spree_frontend 4.0.0.rc3 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a7266f41e2fa6d573a0f4794494010db8a3ca8c63a7aa1b1c2e630bf9cb69d4
4
- data.tar.gz: 8a66adc0c24cf0e480b87263b5b2708d922fc2d6cc092792bde6757d6e585994
3
+ metadata.gz: d24ffaf2244c3ad2ab2000f12ac48d16ef6ee2185a08d78d72ea917e30b5462a
4
+ data.tar.gz: c1c80ceff9541c70f31b3a1fb570e9da89376c9b2c4e5fcb151a8af5dae5319f
5
5
  SHA512:
6
- metadata.gz: 279b4c93d0070a054c15815c95b1734f18dbcf2ede6067dd1058a2e759f2c86b9e91b6b231f7eb443c1820f6ad60de6e6c6df91993158a546fe8cca519b07aa3
7
- data.tar.gz: c087a9e63763783145f05f7adc5d9dc67cda2d50b43da34659e2bb94f273ccec3416bf0ae27eca2f36df1118948981b5e9bdad029dd66a062f9c72c814e5aeec
6
+ metadata.gz: 55afcbf886799fcc0dcb3b992d1c27a6fd215f6f2bef1a84aec2518d9aebbb1db83e680103c442dc908b57668b62abe4cd410798ae467f2b39945673b584dbeb
7
+ data.tar.gz: 28082669c3774436535644bb90f2588707ed0ebc8090d7f9befd3f66167bf15a9dcda3d92b17f9db39e90c3ee71d6b8e9b1bf4a632660fa98dc7659cedc6a847
@@ -42,11 +42,11 @@ module Spree
42
42
  if @order.bill_address_id != @order.ship_address_id && bill_address == ship_address
43
43
  @order.update_column(:bill_address_id, ship_address.id)
44
44
  bill_address.destroy
45
- else
45
+ elsif params[:save_user_address]
46
46
  bill_address.update_attribute(:user_id, try_spree_current_user&.id)
47
47
  end
48
48
 
49
- ship_address.update_attribute(:user_id, try_spree_current_user&.id)
49
+ ship_address.update_attribute(:user_id, try_spree_current_user&.id) if params[:save_user_address]
50
50
  end
51
51
  end
52
52
  end
@@ -13,32 +13,34 @@ module Spree
13
13
  private
14
14
 
15
15
  def structured_product_hash(product)
16
- {
17
- '@context': 'https://schema.org/',
18
- '@type': 'Product',
19
- '@id': "#{spree.root_url}product_#{product.id}",
20
- url: spree.product_url(product),
21
- name: product.name,
22
- image: structured_images(product),
23
- description: product.description,
24
- sku: product.sku,
25
- offers: {
26
- '@type': 'Offer',
27
- price: product.price,
28
- priceCurrency: current_currency,
29
- availability: product.in_stock? ? 'InStock' : 'OutOfStock',
16
+ Rails.cache.fetch("spree/structured-data/#{product.cache_key}") do
17
+ {
18
+ '@context': 'https://schema.org/',
19
+ '@type': 'Product',
20
+ '@id': "#{spree.root_url}product_#{product.id}",
30
21
  url: spree.product_url(product),
31
- availabilityEnds: product.discontinue_on ? product.discontinue_on.strftime('%F') : ''
22
+ name: product.name,
23
+ image: structured_images(product),
24
+ description: product.description,
25
+ sku: product.sku,
26
+ offers: {
27
+ '@type': 'Offer',
28
+ price: product.price,
29
+ priceCurrency: current_currency,
30
+ availability: product.in_stock? ? 'InStock' : 'OutOfStock',
31
+ url: spree.product_url(product),
32
+ availabilityEnds: product.discontinue_on ? product.discontinue_on.strftime('%F') : ''
33
+ }
32
34
  }
33
- }
35
+ end
34
36
  end
35
37
 
36
38
  def structured_images(product)
37
- images = product.has_variants? ? product.variant_images : product.images
39
+ image = product.variant_images.first
38
40
 
39
- return '' unless images.any?
41
+ return '' unless image
40
42
 
41
- main_app.rails_blob_url(images.first.attachment)
43
+ main_app.rails_blob_url(image.attachment)
42
44
  end
43
45
  end
44
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.rc3
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-27 00:00:00.000000000 Z
11
+ date: 2019-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0.rc3
19
+ version: 4.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.0.rc3
26
+ version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spree_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.0.rc3
33
+ version: 4.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.0.0.rc3
40
+ version: 4.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bootstrap
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -262,9 +262,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
262
262
  version: 2.5.0
263
263
  required_rubygems_version: !ruby/object:Gem::Requirement
264
264
  requirements:
265
- - - ">"
265
+ - - ">="
266
266
  - !ruby/object:Gem::Version
267
- version: 1.3.1
267
+ version: '0'
268
268
  requirements:
269
269
  - none
270
270
  rubygems_version: 3.0.2