radiant-shop-extension 0.92.3 → 0.92.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.92.3
1
+ 0.92.6
@@ -11,21 +11,22 @@ module Shop
11
11
  end
12
12
 
13
13
  def find_shop_order
14
- begin
15
- ShopOrder.find_by_session(request.session[:shop_order])
16
- rescue
17
- nil
18
- end
14
+ ShopOrder.find_by_session(request.session[:shop_order])
19
15
  end
20
16
 
21
17
  def find_or_create_shop_order
22
- if find_shop_order
23
- return find_shop_order
24
- else
25
- shop_order = ShopOrder.create(:customer_id => (current_user.id rescue nil))
26
- request.session[:shop_order] = shop_order.id
27
- return shop_order
18
+ begin
19
+ @order = find_shop_order
20
+ rescue
21
+ @order = ShopOrder.create
22
+ request.session[:shop_order] = @order.id
23
+ end
24
+
25
+ if current_user
26
+ @order.update_attribute(:customer_id, (current_user.id))
28
27
  end
28
+
29
+ @order
29
30
  end
30
31
  end
31
32
  end
@@ -6,25 +6,23 @@ module Shop
6
6
  base.class_eval do
7
7
  # Uses the page session data to find the current order
8
8
  def find_current_order
9
- @order = ShopOrder.find(@page.request.session[:shop_order])
10
- @order.update_attribute(:customer_id, (current_customer.id rescue nil)) # either assign it to a user, or don't
9
+ ShopOrder.find_by_session(@page.request.session[:shop_order])
11
10
  end
12
-
11
+
13
12
  # Uses the page session data to find or create the current order
14
13
  def find_or_create_current_order
15
14
  begin
16
- find_current_order
15
+ @order = find_current_order
17
16
  rescue
18
17
  @order = ShopOrder.create
19
18
  @result[:session] = { :shop_order => @order.id }
20
- @order.update_attribute(:customer_id, (current_customer.id rescue nil)) # either assign it to a user, or don't
21
19
  end
22
- end
23
-
24
- # Returns the current logged in ShopCustomer (if it exists)
25
- def current_customer
26
- return @shop_customer if @shop_customer.present?
27
- @shop_customer = current_user if current_user.present?
20
+
21
+ if current_user
22
+ @order.update_attribute(:customer_id, (current_user.id))
23
+ end
24
+
25
+ @order
28
26
  end
29
27
  end
30
28
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{radiant-shop-extension}
8
- s.version = "0.92.3"
8
+ s.version = "0.92.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dirk Kelly", "John Barker", "Darcy Laycock"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-shop-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 361
4
+ hash: 355
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 92
9
- - 3
10
- version: 0.92.3
9
+ - 6
10
+ version: 0.92.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dirk Kelly