e_plat 1.1.0.pre.rc.5 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2206781bbf8868908c0e96fe7c14598796565160e8dda1552dcb039f15dc42de
4
- data.tar.gz: '08d8237e1f2117e6b2d732b22450f770ff19525701b150e734021119332adeea'
3
+ metadata.gz: ae49d0be03b307f8982ec8ab83f200cf1a5b22159b7454ae3dee0e50a4fe4dde
4
+ data.tar.gz: 94acc2fcd262d76ad8ac02dfb355b330297472ec6d4b8355b2ce27bc18758ed3
5
5
  SHA512:
6
- metadata.gz: 16d8aef337c863094e137d709a9180fb313570de1df5b8a80083b448a98846bac6afe0b762fdf7a7f79e4c05dc3666eaf91bc7cafd26db4991eb5fccd2a3b265
7
- data.tar.gz: 898f2f7cbd29a897dce7d790800a20523d13579955f548471e1482ec78588c002b373b52b90606ccbde113a85aca792ac7e76d238d8e8d49510488feb1e6cebd
6
+ metadata.gz: 40de991243c9611dc785ac2336043d211db3b0a35b5d2c87df2b457092d5601e84862e85980b0d2c8b42a21ed6267a57ca5b6c182e89c368817a982adb5ed707
7
+ data.tar.gz: 3ab713d5bca7758ae7c0c44abc2cea97fcdb85f696b381028d4d358a50bc702acc28e82a638bdd549b4568884e919970b11063784337383033c93e6e5ab70ba7
data/README.md CHANGED
@@ -331,7 +331,7 @@ helper methods: <br>
331
331
 
332
332
  | Alias | Type | Shopify | BigCommerce | WooCommerce |
333
333
  |----------|----------|---------|------------------------------|-----------------------------------|
334
- | id | integer | * | id | attributes[i][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 | attributes[i][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
 
@@ -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(
@@ -1,3 +1,3 @@
1
1
  module EPlat
2
- VERSION = "1.1.0-rc.5"
2
+ VERSION = "1.1.0-rc.6"
3
3
  end
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.5
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-21 00:00:00.000000000 Z
11
+ date: 2025-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler