huginn_bigcommerce_product_agent 1.4.3 → 1.5.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 728526f71b899d714ffeaf9cca25b150326ba889dc17c732ace2c41b7b92782e
|
4
|
+
data.tar.gz: d237a9f1a6eb179f76679a7a870b56a7844239ee45f4fd32f56ba8a296201ca9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54e4aa00c7216da7c8d66ba4ea45cbcd1ec51339982686719505f2806761a91e601d807165c194975777e9b7ae0ee8327cde0d9ee966ccee264659d70b083ee1
|
7
|
+
data.tar.gz: 9e9ff91a64dbab6ac8e0a1b599a5415ce2744d39cf00e3ca12d697fddde434dcf9aa174ecd89b0e67333838bd03cfe8585797c6d9e50c73cd57b936eb3ed8b9a
|
@@ -124,6 +124,16 @@ module Agents
|
|
124
124
|
wrapper_skus.map {|k,v| v},
|
125
125
|
%w[custom_fields options]
|
126
126
|
)
|
127
|
+
#save skus
|
128
|
+
digital_skus = []
|
129
|
+
physical_skus = []
|
130
|
+
if split[:digital] and split[:physical]
|
131
|
+
digital_skus.concat([wrapper_skus[:digital]])
|
132
|
+
digital_skus.concat(get_mapper(:ProductMapper).get_product_skus(split[:digital])).join(",")
|
133
|
+
physical_skus.concat([wrapper_skus[:physical]])
|
134
|
+
physical_skus.concat(get_mapper(:ProductMapper).get_product_skus(split[:physical])).join(",")
|
135
|
+
end
|
136
|
+
|
127
137
|
# upsert wrapper products
|
128
138
|
split.each do |type, product|
|
129
139
|
is_digital = type == :digital ? true : false
|
@@ -138,10 +148,11 @@ module Agents
|
|
138
148
|
variant_option_name = get_mapper(:OptionMapper).variant_option_name
|
139
149
|
bc_option = !bc_product.nil? ? bc_product['options'].select {|opt| opt['display_name'] === variant_option_name}.first : nil
|
140
150
|
|
151
|
+
search_skus = is_digital ? physical_skus : digital_skus
|
141
152
|
# ##############################
|
142
153
|
# 1. update wrapper product
|
143
154
|
# ##############################
|
144
|
-
upsert_result = upsert_product(wrapper_sku, product, bc_product, is_digital)
|
155
|
+
upsert_result = upsert_product(wrapper_sku, product, bc_product, is_digital, search_skus)
|
145
156
|
bc_product = upsert_result[:product]
|
146
157
|
|
147
158
|
# clean up custom/meta fields. there are not batch operations so we might as well do them here.
|
@@ -337,7 +348,7 @@ module Agents
|
|
337
348
|
return ::BigcommerceProductAgent::Mapper.const_get(class_name.to_sym)
|
338
349
|
end
|
339
350
|
|
340
|
-
def upsert_product(sku, product, bc_product = nil, is_digital=false)
|
351
|
+
def upsert_product(sku, product, bc_product = nil, is_digital=false, search_skus=[])
|
341
352
|
custom_fields_updates = get_mapper(:CustomFieldMapper).map(
|
342
353
|
interpolated['custom_fields_map'],
|
343
354
|
product,
|
@@ -350,7 +361,10 @@ module Agents
|
|
350
361
|
sku,
|
351
362
|
product,
|
352
363
|
product_id,
|
353
|
-
{
|
364
|
+
{
|
365
|
+
additional_search_terms: search_skus,
|
366
|
+
custom_fields: custom_fields_updates[:upsert]
|
367
|
+
},
|
354
368
|
is_digital,
|
355
369
|
)
|
356
370
|
|
@@ -38,7 +38,7 @@ module BigcommerceProductAgent
|
|
38
38
|
height: product['height'] ? product['height']['value'] : '0',
|
39
39
|
meta_keywords: self.meta_keywords(product),
|
40
40
|
meta_description: self.meta_description(product) || '',
|
41
|
-
search_keywords: self.
|
41
|
+
search_keywords: self.get_search_keywords(additional_data.delete(:additional_search_terms), product),
|
42
42
|
is_visible: variant ? false : true,
|
43
43
|
}
|
44
44
|
result[:upc] = product['gtin12'] if product['gtin12']
|
@@ -182,6 +182,11 @@ module BigcommerceProductAgent
|
|
182
182
|
end
|
183
183
|
end
|
184
184
|
end
|
185
|
+
|
186
|
+
# get a list of search keywords for the products
|
187
|
+
def self.get_search_keywords(additional_search_terms, product)
|
188
|
+
return (self.meta_keywords(product) + additional_search_terms.split(",")).join(",")
|
189
|
+
end
|
185
190
|
end
|
186
191
|
end
|
187
192
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: huginn_bigcommerce_product_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Spizziri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|