caboose-cms 0.5.146 → 0.5.147

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDg5NjBiNWNmY2UzNTI3YWY0YzIwYmRkZWNmZjRiNmRjODQ3MjVmNg==
4
+ NzViNDdhOWJiZTg2YTBiZWYyYzAwOWU3NjBlM2ExMDdlYWU3Y2I4Mw==
5
5
  data.tar.gz: !binary |-
6
- Y2I1YTJmMWRhYzE4NmNiZGVlMjllODM0MjZiNDEyZjg4MzNhOTE2Zg==
6
+ YzExNGM3NmM3ZDc1NTQyNDVjNzRkYWI0MDY1NjY3OWM5ZWQxMTU2OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzA4YTM2ZmVhNjQxMDk2M2UyMWFjNGNjNjA0YTY4YTY5ZWZmNTY4NThhODNh
10
- MDQxNGU1MzRjN2VlZDhhNjE0MWI0N2QyNmNiNWI1NzFiMjA2YTI4N2ZmY2Yz
11
- ZDg4ZjBiMzk0MmZhZDY1NzVmOWJjYzM1ZGMzNmFlNmRjMmMwNzk=
9
+ OWM4ZThiNmE1MTc5MGNiZWE3YzI3NGE0MDRiNjU4OTg3ZDFmMWE2OGViMzA4
10
+ NzljYmM3MmFmYzJjOWJkZTY3YTA3ZmQ3YTgwMzZkNTVmMGFhMzdmNmVmMjZh
11
+ MGJlNjk5NTRlMTlmM2I1YzU3ZWEzYmI4YTlkZGYxNzExYjUwZDI=
12
12
  data.tar.gz: !binary |-
13
- MTYxZGU4ZDczZmUwYzEyOGQ0MmVhNWY0ZWZlZmYxZGVjMDE3MjJiYWJiNmEz
14
- MWMzYjZlNWUxNGQ4MmYyMzM5MGEyYTUzMzlhYTE3M2RhYjJlZGNhNjJjMTVk
15
- NDgyYjEwNTVkNDA1NWZjNGI4MzI0MjRiMzcyNDNkOWExOThjYjQ=
13
+ YTA3MzBjZmE5NTA4YWQzNDAyYzY2MjkzNWY4ODRlZDU2Y2RkN2E2Njc1YTYw
14
+ MDc0YmRhZDZkN2VkNzM2ZjJmM2I0MjI0OTkzZTVhZGQ4OTVjNTU0ZGI0YWVh
15
+ OGIzZGIwOWRjYTc5N2Q4MjhhZTU0YWNlN2ViMTYxZDBkODU4MDA=
@@ -297,15 +297,17 @@ module Caboose
297
297
  save = true
298
298
  params.each do |name,value|
299
299
  case name
300
- when 'tax' then order.tax = value
301
- when 'shipping' then order.shipping = value
300
+ when 'tax' then order.tax = value
301
+ when 'shipping' then order.shipping = value
302
302
  when 'handling' then order.handling = value
303
- when 'custom_discount' then order.custom_discount = value
303
+ when 'custom_discount' then
304
+ order.custom_discount = value
305
+ order.discount = order.calculate_discount
304
306
  when 'status' then order.status = value
305
307
  when 'customer_id' then order.customer_id = value
306
308
  end
307
309
  end
308
- order.calculate
310
+ order.calculate_total
309
311
  resp.success = save && order.save
310
312
  render :json => resp
311
313
  end
@@ -63,38 +63,41 @@ module Caboose
63
63
 
64
64
  # Otherwise looking at a category or search parameters
65
65
  @pager = Caboose::Pager.new(params, {
66
- 'site_id' => @site.id,
67
- 'on_sale' => '',
68
- 'category_id' => '',
69
- 'vendor_id' => '',
70
- 'vendor_name' => '',
71
- 'vendor_status' => 'Active',
72
- 'status' => 'Active',
73
- 'variant_status' => 'Active',
74
- 'price_gte' => '',
75
- 'price_lte' => '',
76
- 'alternate_id' => '',
77
- 'search_like' => ''
66
+ 'site_id' => @site.id,
67
+ 'on_sale' => '',
68
+ 'category_id' => '',
69
+ 'vendor_id' => '',
70
+ 'vendor_name' => '',
71
+ 'vendor_status' => 'Active',
72
+ 'status' => 'Active',
73
+ 'variant_status' => 'Active',
74
+ 'price_gte' => '',
75
+ 'price_lte' => '',
76
+ 'alternate_id' => '',
77
+ 'search_like' => ''
78
+ #'pcs_category_id' => cat.id
78
79
  }, {
79
- 'model' => 'Caboose::Product',
80
- 'sort' => if params[:sort] then params[:sort] else 'store_products.sort_order' end,
81
- 'base_url' => url_without_params,
82
- 'items_per_page' => 15,
83
- 'use_url_params' => false,
80
+ 'model' => 'Caboose::Product',
81
+ 'sort' => if params[:sort] then params[:sort] else 'store_products.sort_order' end,
82
+ #'sort' => if params[:sort] then params[:sort] else 'store_product_category_sorts.sort_order' end,
83
+ 'base_url' => url_without_params,
84
+ 'items_per_page' => 15,
85
+ 'use_url_params' => false,
84
86
 
85
- 'abbreviations' => {
86
- 'search_like' => 'title_concat_store_products.alternate_id_concat_vendor_name_concat_category_name_like',
87
+ 'abbreviations' => {
88
+ 'search_like' => 'title_concat_store_products.alternate_id_concat_vendor_name_concat_category_name_like',
87
89
  },
88
90
 
89
91
  'includes' => {
90
- 'category_id' => [ 'categories' , 'id' ],
91
- 'category_name' => [ 'categories' , 'name' ],
92
- 'vendor_id' => [ 'vendor' , 'id' ],
93
- 'vendor_name' => [ 'vendor' , 'name' ],
94
- 'vendor_status' => [ 'vendor' , 'status' ],
95
- 'price_gte' => [ 'variants' , 'price' ],
96
- 'price_lte' => [ 'variants' , 'price' ],
97
- 'variant_status' => [ 'variants' , 'status' ]
92
+ #'pcs_category_id' => [ 'product_category_sorts', 'category_id' ],
93
+ 'category_id' => [ 'categories' , 'id' ],
94
+ 'category_name' => [ 'categories' , 'name' ],
95
+ 'vendor_id' => [ 'vendor' , 'id' ],
96
+ 'vendor_name' => [ 'vendor' , 'name' ],
97
+ 'vendor_status' => [ 'vendor' , 'status' ],
98
+ 'price_gte' => [ 'variants' , 'price' ],
99
+ 'price_lte' => [ 'variants' , 'price' ],
100
+ 'variant_status' => [ 'variants' , 'status' ]
98
101
  }
99
102
  })
100
103
 
@@ -180,10 +180,11 @@ module Caboose
180
180
  return x
181
181
  end
182
182
 
183
- def calculate_discount
184
- return 0.0 if self.discounts.nil? || self.discounts.count == 0
183
+ def calculate_discount
185
184
  x = 0.0
186
- self.discounts.each{ |d| x = x + d.amount }
185
+ if self.discounts && self.discounts.count > 0
186
+ self.discounts.each{ |d| x = x + d.amount }
187
+ end
187
188
  x = x + self.custom_discount if self.custom_discount
188
189
  return x
189
190
  end
@@ -12,8 +12,9 @@ module Caboose
12
12
  has_many :category_memberships, :class_name => 'Caboose::CategoryMembership'
13
13
  has_many :variants, :class_name => 'Caboose::Variant', :order => 'option1_sort_order, option2_sort_order, option3_sort_order'
14
14
  has_many :product_images, :class_name => 'Caboose::ProductImage'
15
- has_many :proudct_inputs, :class_name => 'Caboose::ProductInput'
15
+ has_many :product_inputs, :class_name => 'Caboose::ProductInput'
16
16
  has_many :reviews, :class_name => 'Caboose::Review'
17
+ has_many :product_category_sorts, :class_name => 'Caboose::ProductCategorySort'
17
18
 
18
19
  #default_scope order('store_products.sort_order')
19
20
 
@@ -0,0 +1,14 @@
1
+ module Caboose
2
+ class ProductCategorySort < ActiveRecord::Base
3
+ self.table_name = 'store_product_category_sorts'
4
+ self.primary_key = 'id'
5
+
6
+ belongs_to :product
7
+ belongs_to :category
8
+ attr_accessible :id,
9
+ :product_id,
10
+ :category_id,
11
+ :sort_order
12
+
13
+ end
14
+ end
@@ -484,6 +484,11 @@ class Caboose::Schema < Caboose::Utilities::Schema
484
484
  [ :allow_gift_wrap , :boolean , { :default => false }],
485
485
  [ :gift_wrap_price , :decimal , { :precision => 8, :scale => 2 }]
486
486
  ],
487
+ Caboose::ProductCategorySort => [
488
+ [ :product_id , :integer ],
489
+ [ :category_id , :integer ],
490
+ [ :sort_order , :integer ]
491
+ ],
487
492
  Caboose::ProductImage => [
488
493
  [ :product_id , :integer ],
489
494
  [ :alternate_id , :string ],
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.5.146'
2
+ VERSION = '0.5.147'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.146
4
+ version: 0.5.147
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
@@ -628,6 +628,7 @@ files:
628
628
  - app/models/caboose/post_category.rb
629
629
  - app/models/caboose/post_category_membership.rb
630
630
  - app/models/caboose/product.rb
631
+ - app/models/caboose/product_category_sort.rb
631
632
  - app/models/caboose/product_image.rb
632
633
  - app/models/caboose/product_image_variant.rb
633
634
  - app/models/caboose/review.rb