e_plat 1.1.0.pre.rc.4 → 1.1.0.pre.rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/e_plat/mapping/woocommerce/v_3/product/variant.rb +7 -6
- data/lib/e_plat/resource/platform_specific/woocommerce/product/variant.rb +15 -0
- data/lib/e_plat/resource/platform_specific/woocommerce/product.rb +14 -0
- data/lib/e_plat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae49d0be03b307f8982ec8ab83f200cf1a5b22159b7454ae3dee0e50a4fe4dde
|
4
|
+
data.tar.gz: 94acc2fcd262d76ad8ac02dfb355b330297472ec6d4b8355b2ce27bc18758ed3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40de991243c9611dc785ac2336043d211db3b0a35b5d2c87df2b457092d5601e84862e85980b0d2c8b42a21ed6267a57ca5b6c182e89c368817a982adb5ed707
|
7
|
+
data.tar.gz: 3ab713d5bca7758ae7c0c44abc2cea97fcdb85f696b381028d4d358a50bc702acc28e82a638bdd549b4568884e919970b11063784337383033c93e6e5ab70ba7
|
data/README.md
CHANGED
@@ -298,7 +298,7 @@ EPlat is designed to let you mostly use it's universal interface, but then easil
|
|
298
298
|
|----------------------|----------|------------------------------------------|------------------------------------|-----------------------------------|
|
299
299
|
| id | integer | * | id | id |
|
300
300
|
| title | string | * | option_values&.map(&:label)&.join(' ') | attributes.map(&:option).join(' ') |
|
301
|
-
| price | string | * | calculated_price |
|
301
|
+
| price | string | * | calculated_price | gets `price`, sets `regular_price` |
|
302
302
|
| sku | string | * | sku | sku |
|
303
303
|
| position | integer | * | nil | menu_order |
|
304
304
|
| inventory_policy | string | * | nil | backorders |
|
@@ -321,7 +321,7 @@ EPlat is designed to let you mostly use it's universal interface, but then easil
|
|
321
321
|
* Bigcommerce variant.title= and variant.price= setters are not supported. They're a result of the option values instead.
|
322
322
|
* WooCommerce variant.title= setter is not supported. It's result of the option values instead.
|
323
323
|
** WooCommerce calls variants 'variations', EPlat refers to them as variants.
|
324
|
-
*** It's possible for Woo products to have 0 variants, in this situation we generate a virtual one
|
324
|
+
*** It's possible for Woo products to have 0 variants, in this situation we generate a virtual one with an `id` of `0` and `.virtual? == true`.
|
325
325
|
```
|
326
326
|
|
327
327
|
helper methods: <br>
|
@@ -331,7 +331,7 @@ helper methods: <br>
|
|
331
331
|
|
332
332
|
| Alias | Type | Shopify | BigCommerce | WooCommerce |
|
333
333
|
|----------|----------|---------|------------------------------|-----------------------------------|
|
334
|
-
| id | integer | * | id |
|
334
|
+
| id | integer | * | id | name.downcase.hash.abs % 1000000 |
|
335
335
|
| name | string | * | display_name | attributes[i][name] |
|
336
336
|
| position | integer | * | sort_order | attributes[i][position] |
|
337
337
|
| values | array | * | option_values[i][label] | attributes[i][options] |
|
@@ -355,7 +355,7 @@ helper methods: <br>
|
|
355
355
|
|
356
356
|
| Alias | Type | Shopify | BigCommerce | WooCommerce |
|
357
357
|
|-------|----------|------------------------------------------|---------------------|----------------------------------------------|
|
358
|
-
| id | integer | [selected_options][option_value][id] | id |
|
358
|
+
| id | integer | [selected_options][option_value][id] | id | name.downcase.hash.abs % 1000000 |
|
359
359
|
| name | string | [selected_options][name] | option_display_name | attributes[i][name] |
|
360
360
|
| value | string | [selected_options][value] | label | attributes[i][option] |
|
361
361
|
|
@@ -58,9 +58,6 @@ module EPlat
|
|
58
58
|
{
|
59
59
|
existing_entry: {native_key: "id", e_plat_key: "id"}
|
60
60
|
},
|
61
|
-
{
|
62
|
-
existing_entry: {native_key: "price", e_plat_key: "price"}
|
63
|
-
},
|
64
61
|
{
|
65
62
|
existing_entry: {native_key: "sku", e_plat_key: "sku"}
|
66
63
|
},
|
@@ -90,9 +87,13 @@ module EPlat
|
|
90
87
|
}
|
91
88
|
},
|
92
89
|
{
|
93
|
-
|
94
|
-
|
95
|
-
|
90
|
+
existing_entry: {native_key: "price", e_plat_key: "price",
|
91
|
+
custom_e_plat_getter: "-> (value) {
|
92
|
+
value || product&.price
|
93
|
+
}",
|
94
|
+
custom_native_setter: "-> (value) {
|
95
|
+
self.sale_price = value; value
|
96
|
+
}"
|
96
97
|
}
|
97
98
|
},
|
98
99
|
{
|
@@ -16,6 +16,21 @@ module EPlat::Woocommerce
|
|
16
16
|
instance
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
20
|
+
def initialize(attributes = {}, persisted = false)
|
21
|
+
super
|
22
|
+
|
23
|
+
# Ensure option_values have stable IDs based on name
|
24
|
+
if self.option_values.present?
|
25
|
+
self.option_values.each do |option_value|
|
26
|
+
if (option_value.attributes["id"].nil? || option_value.attributes["id"] == 0) && option_value.name.present?
|
27
|
+
# Use the hash of the name (lowercase) as a consistent ID
|
28
|
+
# We're using the name here because it refers to the attribute name (like "Color", "Size")
|
29
|
+
option_value.attributes["id"] = option_value.name.downcase.hash.abs % 1000000
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
19
34
|
|
20
35
|
def save
|
21
36
|
if _is_virtual
|
@@ -2,6 +2,20 @@ module EPlat::Woocommerce
|
|
2
2
|
class Product < EPlat::Product
|
3
3
|
has_many :meta_data, class_name: "EPlat::Woocommerce::Metafield"
|
4
4
|
|
5
|
+
def initialize(attributes = {}, persisted = false)
|
6
|
+
super
|
7
|
+
|
8
|
+
# Ensure options have correct IDs based on name (more stable than position)
|
9
|
+
if self.options.present?
|
10
|
+
self.options.each do |option|
|
11
|
+
if (option.attributes["id"].nil? || option.attributes["id"] == 0) && option.name.present?
|
12
|
+
# Use the hash of the name (lowercase) as a consistent ID
|
13
|
+
option.attributes["id"] = option.name.downcase.hash.abs % 1000000
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
5
19
|
def lazy_load_variants
|
6
20
|
# Woo products natively just return an array of ids under the 'variations' key
|
7
21
|
@variants_collection ||= EPlat::Product::Variant.find(
|
data/lib/e_plat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: e_plat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0.pre.rc.
|
4
|
+
version: 1.1.0.pre.rc.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- oliwoodsuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|