spree_froomerce_fconnect 0.70.3 → 0.70.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -123,7 +123,7 @@ class Admin::FroomercesController < Admin::BaseController
123
123
  flash[:error] = I18n.t(".error.e#{result['error']['code']}")
124
124
  end
125
125
  else
126
- flash[:error] = I18n.t('.error.HTTPfaliur')
126
+ flash[:error] = I18n.t('.error.HTTPfaliure')
127
127
  end
128
128
  end
129
129
  end
@@ -165,7 +165,7 @@ class Admin::FroomercesController < Admin::BaseController
165
165
  flash[:error] = I18n.t(".error.e#{result['error']['code']}")
166
166
  end
167
167
  else
168
- flash[:error] = I18n.t('.error.HTTPfaliur')
168
+ flash[:error] = I18n.t('.error.HTTPfaliure')
169
169
  end
170
170
  redirect_to(:action => "export_facebook_widgets")
171
171
  end
@@ -193,7 +193,7 @@ class Admin::FroomercesController < Admin::BaseController
193
193
  redirect_to :action => "index"
194
194
  end
195
195
  else
196
- flash[:error] = I18n.t('.error.HTTPfaliur')
196
+ flash[:error] = I18n.t('.error.HTTPfaliure')
197
197
  redirect_to :action => "index"
198
198
  end
199
199
  end
@@ -7,9 +7,9 @@ class FroomerceProductsController < ApplicationController
7
7
  @products = searcher.retrieve_products
8
8
  @taxon = nil
9
9
  if Taxonomy.exists?
10
- @taxon = Taxon.find(:all)
10
+ @taxon = Taxon.order('lft ASC')
11
11
  end
12
- if @products.count < FroomerceConfig::FEED_CONFIG[:temp_limit]
12
+ if @products.size < FroomerceConfig::FEED_CONFIG[:temp_limit]
13
13
  config = FroomerceConfig.first
14
14
  user = FroomerceUser.first
15
15
  call = {'secret_token' => FroomerceConfig::VERIFICATION[:token],'user_id'=> user.froomerce_user_id, 'shop_id' => config.froomerce_shop_id, 'action_type' => 'update_feed_status' }
@@ -24,15 +24,16 @@ class FroomerceProductsController < ApplicationController
24
24
  end
25
25
 
26
26
  def feed_url
27
+ @flag = false
27
28
  @page_no = params[:page].to_i
28
29
  searcher = Spree::Config.searcher_class.new(params)
29
30
  @products = searcher.retrieve_products
30
- if @products.count < FroomerceConfig::FEED_CONFIG[:feed_per_page]
31
- @page_no = nil
31
+ if @products.size < FroomerceConfig::FEED_CONFIG[:feed_per_page]
32
+ @flag = true
32
33
  end
33
34
  @taxon = nil
34
35
  if Taxonomy.exists?
35
- @taxon = Taxon.find(:all)
36
+ @taxon = Taxon.order('lft ASC')
36
37
  end
37
38
  render :template => 'froomerce_products/feed_url.xml.builder', :layout => false
38
39
  end
@@ -59,7 +59,7 @@ xml.data do
59
59
  end
60
60
  end
61
61
  end
62
- if @taxon && @page_no == 1
62
+ if @taxon and @page_no == 1
63
63
  xml.categories do
64
64
  @taxon.each do |tax|
65
65
  if tax.parent_id.blank?
@@ -68,6 +68,7 @@ xml.data do
68
68
  xml.parent_id{xml.cdata!("0")}
69
69
  xml.category_id{xml.cdata!("#{tax.id}")}
70
70
  xml.category_name{xml.cdata!(tax.name)}
71
+ xml.position{xml.cdata!("#{tax.lft}")}
71
72
  end
72
73
  end
73
74
  else
@@ -75,12 +76,13 @@ xml.data do
75
76
  xml.parent_id{xml.cdata!("#{tax.parent_id}")}
76
77
  xml.category_id{xml.cdata!("#{tax.id}")}
77
78
  xml.category_name{xml.cdata!(tax.name)}
79
+ xml.position{xml.cdata!("#{tax.lft}")}
78
80
  end
79
81
  end
80
82
  end
81
83
  end
82
84
  end
83
- if @page_no
85
+ unless @flag
84
86
  xml.next_page{xml.cdata!(root_url+"froomerce_feed?page=#{@page_no+1}&per_page=#{FroomerceConfig::FEED_CONFIG[:feed_per_page]}")}
85
87
  end
86
88
  end
@@ -68,6 +68,7 @@ xml.data do
68
68
  xml.parent_id{xml.cdata!("0")}
69
69
  xml.category_id{xml.cdata!("#{tax.id}")}
70
70
  xml.category_name{xml.cdata!(tax.name)}
71
+ xml.position{xml.cdata!("#{tax.lft}")}
71
72
  end
72
73
  end
73
74
  else
@@ -75,6 +76,7 @@ xml.data do
75
76
  xml.parent_id{xml.cdata!("#{tax.parent_id}")}
76
77
  xml.category_id{xml.cdata!("#{tax.id}")}
77
78
  xml.category_name{xml.cdata!(tax.name)}
79
+ xml.position{xml.cdata!("#{tax.lft}")}
78
80
  end
79
81
  end
80
82
  end
data/lib/call_backs.rb CHANGED
@@ -12,32 +12,30 @@ class CallBacks
12
12
  return nil unless options.count > 1
13
13
  types = []
14
14
  types = options.collect {|opt| opt.option_type }
15
- variants = Variant.find_all_by_product_id(id)
15
+ variants = product.variants
16
16
  prod_images = product.images.collect {|img| root_url.chop + img.attachment.url}
17
17
  product_images = prod_images.join('^')
18
18
  i = 0; j=0
19
19
  variants.each do |variant|
20
- unless variant.is_master
21
- values = variant.option_values.order('option_type_id ASC')
22
- images = variant.images.collect {|img| root_url.chop + img.attachment.url}
23
- additional_images = images.join('^')
24
- if additional_images.blank?
25
- additionl_images_url = product_images
26
- else
27
- additionl_images_url = product_images + '^' + additional_images
28
- end
29
- if additional_images.blank?
30
- hash[i] = {'product_id' => variant.id, 'price' => variant.price}
31
- else
32
- hash[i] = {'product_id' => variant.id, 'price' => variant.price, 'additional_imgs' => additionl_images_url, 'cart_img' => root_url.chop + variant.images.first.attachment.url}
33
- end
34
- types.each do |type|
35
- hash[i][type.presentation] = values[j].presentation
36
- j = j.succ
37
- end
38
- i = i.succ
39
- j = 0
20
+ values = variant.option_values.order('option_type_id ASC')
21
+ images = variant.images.collect {|img| root_url.chop + img.attachment.url}
22
+ additional_images = images.join('^')
23
+ if additional_images.blank?
24
+ additionl_images_url = product_images
25
+ else
26
+ additionl_images_url = product_images + '^' + additional_images
27
+ end
28
+ if additional_images.blank?
29
+ hash[i] = {'product_id' => variant.id, 'price' => variant.price}
30
+ else
31
+ hash[i] = {'product_id' => variant.id, 'price' => variant.price, 'additional_imgs' => additionl_images_url, 'cart_img' => root_url.chop + variant.images.first.attachment.url}
32
+ end
33
+ types.each do |type|
34
+ hash[i][type.presentation] = values[j].presentation
35
+ j = j.succ
40
36
  end
37
+ i = i.succ
38
+ j = 0
41
39
  additional_images = ''
42
40
  additionl_images_url = ''
43
41
  end
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  s.platform = Gem::Platform::RUBY
4
4
  s.name = 'spree_froomerce_fconnect'
5
- s.version = '0.70.3'
5
+ s.version = '0.70.4'
6
6
  s.summary = 'Create your store to Facebook and create product widgets for your Fan Page'
7
7
  s.description = 'Create your store to Facebook and create product widgets for your Fan Page'
8
8
  s.required_ruby_version = '>= 1.8.7'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_froomerce_fconnect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.70.3
4
+ version: 0.70.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-19 00:00:00.000000000Z
12
+ date: 2012-04-19 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core
16
- requirement: &78167060 !ruby/object:Gem::Requirement
16
+ requirement: &81699450 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 0.70.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *78167060
24
+ version_requirements: *81699450
25
25
  description: Create your store to Facebook and create product widgets for your Fan
26
26
  Page
27
27
  email: ali.naqi@coeus-solutions.de