Version Description
Download this release
Release Info
Developer | wahid0003 |
Plugin | CTX Feed – WooCommerce Product Feed Manager Plugin |
Version | 3.1.0 |
Comparing to | |
See all releases |
Code changes from version 3.0.40 to 3.1.0
- README.txt +3 -1
- includes/class-woo-feed.php +2 -1
- includes/feeds/class-woo-feed-pinterest.php +616 -0
- woo-feed.php +8 -6
README.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://webappick.com
|
|
4 |
Tags:woocommerce,google product feed,facebook product feed,woocommerce product feed,woocommerce,
|
5 |
Requires at least: 3.6
|
6 |
Tested Up To: 5.2
|
7 |
-
Stable tag: 3.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -302,6 +302,8 @@ Using pro version:
|
|
302 |
2. FTP info config
|
303 |
|
304 |
== Changelog ==
|
|
|
|
|
305 |
|
306 |
= 3.0.40(2019-06-21) =
|
307 |
* Fixed: Make Feed view issue fixed
|
4 |
Tags:woocommerce,google product feed,facebook product feed,woocommerce product feed,woocommerce,
|
5 |
Requires at least: 3.6
|
6 |
Tested Up To: 5.2
|
7 |
+
Stable tag: 3.1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
302 |
2. FTP info config
|
303 |
|
304 |
== Changelog ==
|
305 |
+
= 3.1.0(2019-06-24) =
|
306 |
+
* Fixed: Pinterest csv feed issue fixed
|
307 |
|
308 |
= 3.0.40(2019-06-21) =
|
309 |
* Fixed: Make Feed view issue fixed
|
includes/class-woo-feed.php
CHANGED
@@ -70,7 +70,7 @@ class Woo_Feed
|
|
70 |
public function __construct()
|
71 |
{
|
72 |
$this->woo_feed = 'woo-feed';
|
73 |
-
$this->version = '3.0
|
74 |
$this->load_dependencies();
|
75 |
$this->set_locale();
|
76 |
$this->define_admin_hooks();
|
@@ -159,6 +159,7 @@ class Woo_Feed
|
|
159 |
require plugin_dir_path(dirname(__FILE__)) . 'includes/feeds/class-woo-feed-amazon.php';
|
160 |
require plugin_dir_path(dirname(__FILE__)) . 'includes/feeds/class-woo-feed-facebook.php';
|
161 |
require plugin_dir_path(dirname(__FILE__)) . 'includes/feeds/class-woo-feed-nextag.php';
|
|
|
162 |
require plugin_dir_path(dirname(__FILE__)) . 'includes/feeds/class-woo-feed-kelkoo.php';
|
163 |
require plugin_dir_path(dirname(__FILE__)) . 'includes/feeds/class-woo-feed-pricegrabber.php';
|
164 |
require plugin_dir_path(dirname(__FILE__)) . 'includes/feeds/class-woo-feed-shopzilla.php';
|
70 |
public function __construct()
|
71 |
{
|
72 |
$this->woo_feed = 'woo-feed';
|
73 |
+
$this->version = '3.1.0';
|
74 |
$this->load_dependencies();
|
75 |
$this->set_locale();
|
76 |
$this->define_admin_hooks();
|
159 |
require plugin_dir_path(dirname(__FILE__)) . 'includes/feeds/class-woo-feed-amazon.php';
|
160 |
require plugin_dir_path(dirname(__FILE__)) . 'includes/feeds/class-woo-feed-facebook.php';
|
161 |
require plugin_dir_path(dirname(__FILE__)) . 'includes/feeds/class-woo-feed-nextag.php';
|
162 |
+
require plugin_dir_path(dirname(__FILE__)) . 'includes/feeds/class-woo-feed-pinterest.php';
|
163 |
require plugin_dir_path(dirname(__FILE__)) . 'includes/feeds/class-woo-feed-kelkoo.php';
|
164 |
require plugin_dir_path(dirname(__FILE__)) . 'includes/feeds/class-woo-feed-pricegrabber.php';
|
165 |
require plugin_dir_path(dirname(__FILE__)) . 'includes/feeds/class-woo-feed-shopzilla.php';
|
includes/feeds/class-woo-feed-pinterest.php
ADDED
@@ -0,0 +1,616 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Google
|
5 |
+
*
|
6 |
+
* Responsible for processing and generating feed for Google.com
|
7 |
+
*
|
8 |
+
* @since 1.0.0
|
9 |
+
* @package Google
|
10 |
+
*
|
11 |
+
*/
|
12 |
+
class Woo_Feed_Pinterest
|
13 |
+
{
|
14 |
+
|
15 |
+
/**
|
16 |
+
* This variable is responsible for holding all product attributes and their values
|
17 |
+
*
|
18 |
+
* @since 1.0.0
|
19 |
+
* @var array $products Contains all the product attributes to generate feed
|
20 |
+
* @access public
|
21 |
+
*/
|
22 |
+
public $products;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* This variable is responsible for holding feed configuration form values
|
26 |
+
*
|
27 |
+
* @since 1.0.0
|
28 |
+
* @var array $rules Contains feed configuration form values
|
29 |
+
* @access public
|
30 |
+
*/
|
31 |
+
public $rules;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* This variable is responsible for mapping store attributes to merchant attribute
|
35 |
+
*
|
36 |
+
* @since 1.0.0
|
37 |
+
* @var array $mapping Map store attributes to merchant attribute
|
38 |
+
* @access public
|
39 |
+
*/
|
40 |
+
public $mapping;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* This variable is responsible for generate error logs
|
44 |
+
*
|
45 |
+
* @since 1.0.0
|
46 |
+
* @var array $errorLog Generate error logs
|
47 |
+
* @access public
|
48 |
+
*/
|
49 |
+
public $errorLog;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* This variable is responsible for making error number
|
53 |
+
*
|
54 |
+
* @since 1.0.0
|
55 |
+
* @var int $errorCounter Generate error number
|
56 |
+
* @access public
|
57 |
+
*/
|
58 |
+
public $errorCounter;
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Feed Wrapper text for enclosing each product information
|
62 |
+
*
|
63 |
+
* @since 1.0.0
|
64 |
+
* @var string $feedWrapper Feed Wrapper text
|
65 |
+
* @access public
|
66 |
+
*/
|
67 |
+
public $feedWrapper = 'item';
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Store product information
|
71 |
+
*
|
72 |
+
* @since 1.0.0
|
73 |
+
* @var array $storeProducts
|
74 |
+
* @access public
|
75 |
+
*/
|
76 |
+
private $storeProducts;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Define the core functionality to generate feed.
|
80 |
+
*
|
81 |
+
* Set the feed rules. Map products according to the rules and Check required attributes
|
82 |
+
* and their values according to merchant specification.
|
83 |
+
* @var Woo_Generate_Feed $feedRule Contain Feed Configuration
|
84 |
+
* @since 1.0.0
|
85 |
+
*/
|
86 |
+
public function __construct($feedRule)
|
87 |
+
{
|
88 |
+
$products = new Woo_Feed_Products();
|
89 |
+
$limit = isset($feedRule['Limit']) ? esc_html($feedRule['Limit']) : "";
|
90 |
+
$offset = isset($feedRule['Offset']) ? esc_html($feedRule['Offset']) : "";
|
91 |
+
$categories = isset($feedRule['categories']) ? $feedRule['categories']: "";
|
92 |
+
$storeProducts = $products->woo_feed_get_visible_product($limit, $offset,$categories,$feedRule);
|
93 |
+
$feedRule=$products->feedRule;
|
94 |
+
$engine = new WF_Engine($storeProducts, $feedRule);
|
95 |
+
$this->products = $engine->mapProductsByRules();
|
96 |
+
$this->rules = $feedRule;
|
97 |
+
if ($feedRule['feedType'] == 'xml') {
|
98 |
+
$this->mapAttributeForXML();
|
99 |
+
} else {
|
100 |
+
$this->mapAttributeForCSVTXT();
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Return Feed
|
107 |
+
* @return array
|
108 |
+
*/
|
109 |
+
public function returnFinalProduct()
|
110 |
+
{
|
111 |
+
if(!empty($this->products)){
|
112 |
+
$engine = new WF_Engine($this->products, $this->rules);
|
113 |
+
if ($this->rules['feedType'] == 'xml') {
|
114 |
+
//return $this->get_feed($this->products);
|
115 |
+
$feed=array(
|
116 |
+
"header"=>$this->get_xml_feed_header(),
|
117 |
+
"body"=>$this->get_xml_feed($this->products),
|
118 |
+
"footer"=>$this->get_xml_feed_footer(),
|
119 |
+
);
|
120 |
+
return $feed;
|
121 |
+
} elseif ($this->rules['feedType'] == 'txt') {
|
122 |
+
//return $engine->get_txt_feed();
|
123 |
+
$feed=array(
|
124 |
+
"body"=>$engine->get_txt_feed(),
|
125 |
+
"header"=>$engine->txtFeedHeader,
|
126 |
+
"footer"=>"",
|
127 |
+
);
|
128 |
+
return $feed;
|
129 |
+
} elseif ($this->rules['feedType'] == 'csv') {
|
130 |
+
//return $engine->get_csv_feed();
|
131 |
+
$feed=array(
|
132 |
+
"body"=>$engine->get_csv_feed(),
|
133 |
+
"header"=>$engine->csvFeedHeader,
|
134 |
+
"footer"=>"",
|
135 |
+
);
|
136 |
+
return $feed;
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
$feed=array(
|
141 |
+
"body"=>"",
|
142 |
+
"header"=>"",
|
143 |
+
"footer"=>"",
|
144 |
+
);
|
145 |
+
return $feed;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Configure merchant attributes for XML feed
|
150 |
+
*/
|
151 |
+
public function mapAttributeForXML()
|
152 |
+
{
|
153 |
+
|
154 |
+
$googleXMLAttribute = array(
|
155 |
+
"id" => array("g:id", false),
|
156 |
+
"title" => array("title", true),
|
157 |
+
"description" => array("description", true),
|
158 |
+
"link" => array("link", true),
|
159 |
+
"mobile_link" => array("mobile_link", true),
|
160 |
+
"product_type" => array("g:product_type", true),
|
161 |
+
"current_category" => array("g:google_product_category", true),
|
162 |
+
"image" => array("g:image_link", true),
|
163 |
+
"images" => array("g:additional_image_link", false),
|
164 |
+
"images_1" => array("g:additional_image_link_1", true),
|
165 |
+
"images_2" => array("g:additional_image_link_2", true),
|
166 |
+
"images_3" => array("g:additional_image_link_3", true),
|
167 |
+
"images_4" => array("g:additional_image_link_4", true),
|
168 |
+
"images_5" => array("g:additional_image_link_5", true),
|
169 |
+
"images_6" => array("g:additional_image_link_6", true),
|
170 |
+
"images_7" => array("g:additional_image_link_7", true),
|
171 |
+
"images_8" => array("g:additional_image_link_8", true),
|
172 |
+
"images_9" => array("g:additional_image_link_9", true),
|
173 |
+
"images_10" => array("g:additional_image_link_10", true),
|
174 |
+
"condition" => array("g:condition", false),
|
175 |
+
"availability" => array("g:availability", false),
|
176 |
+
"availability_date" => array("g:availability_date", false),
|
177 |
+
"inventory" => array("g:inventory", false),
|
178 |
+
"price" => array("g:price", true),
|
179 |
+
"sale_price" => array("g:sale_price", true),
|
180 |
+
"sale_price_effective_date" => array("g:sale_price_effective_date", true),
|
181 |
+
"brand" => array("g:brand", true),
|
182 |
+
"sku" => array("g:mpn", true),
|
183 |
+
"upc" => array("g:gtin", true),
|
184 |
+
"identifier_exists" => array("g:identifier_exists", true),
|
185 |
+
"item_group_id" => array("g:item_group_id", false),
|
186 |
+
"color" => array("g:color", true),
|
187 |
+
"gender" => array("g:gender", true),
|
188 |
+
"age_group" => array("g:age_group", true),
|
189 |
+
"material" => array("g:material", true),
|
190 |
+
"pattern" => array("g:pattern", true),
|
191 |
+
"size" => array("g:size", true),
|
192 |
+
"size_type" => array("g:size_type", true),
|
193 |
+
"size_system" => array("g:size_system", true),
|
194 |
+
"tax" => array("tax", true),
|
195 |
+
"tax_country" => array("g:tax_country", true),
|
196 |
+
"tax_region" => array("g:tax_region", true),
|
197 |
+
"tax_rate" => array("g:tax_rate", true),
|
198 |
+
"tax_ship" => array("g:tax_ship", true),
|
199 |
+
"tax_category" => array("g:tax_category", true),
|
200 |
+
"weight" => array("g:shipping_weight", false),
|
201 |
+
"length" => array("g:shipping_length", false),
|
202 |
+
"width" => array("g:shipping_width", false),
|
203 |
+
"height" => array("g:shipping_height", false),
|
204 |
+
"shipping_label" => array("g:shipping_label", false),
|
205 |
+
"shipping_country" => array("g:shipping_country", false),
|
206 |
+
"shipping_service" => array("g:shipping_service", false),
|
207 |
+
"shipping_price" => array("g:shipping_price", false),
|
208 |
+
"shipping_region" => array("g:shipping_region", false),
|
209 |
+
"multipack" => array("g:multipack", true),
|
210 |
+
"is_bundle" => array("g:is_bundle", true),
|
211 |
+
"adult" => array("g:adult", true),
|
212 |
+
"adwords_redirect" => array("g:adwords_redirect", true),
|
213 |
+
"custom_label_0" => array("g:custom_label_0", true),
|
214 |
+
"custom_label_1" => array("g:custom_label_1", true),
|
215 |
+
"custom_label_2" => array("g:custom_label_2", true),
|
216 |
+
"custom_label_3" => array("g:custom_label_3", true),
|
217 |
+
"custom_label_4" => array("g:custom_label_4", true),
|
218 |
+
"excluded_destination" => array("g:excluded_destination", true),
|
219 |
+
"included_destination" => array("g:included_destination", true),
|
220 |
+
"expiration_date" => array("g:expiration_date", true),
|
221 |
+
"unit_pricing_measure" => array("g:unit_pricing_measure", true),
|
222 |
+
"unit_pricing_base_measure" => array("g:unit_pricing_base_measure", true),
|
223 |
+
"energy_efficiency_class" => array("g:energy_efficiency_class", true),
|
224 |
+
"loyalty_points" => array("g:loyalty_points", true),
|
225 |
+
"installment" => array("g:installment", true),
|
226 |
+
"promotion_id" => array("g:promotion_id", true),
|
227 |
+
"cost_of_goods_sold" => array("g:cost_of_goods_sold", true),
|
228 |
+
);
|
229 |
+
|
230 |
+
if (count($this->products)) {
|
231 |
+
foreach ($this->products as $no => $product) {
|
232 |
+
//echo "<pre>";
|
233 |
+
//print_r($product);die();
|
234 |
+
$this->identifier_status_add($no);
|
235 |
+
foreach ($product as $key => $value) {
|
236 |
+
$this->mapAttribute($no, $key, $googleXMLAttribute[$key][0], $value, $googleXMLAttribute[$key][0]);
|
237 |
+
}
|
238 |
+
|
239 |
+
$this->process_google_shipping_attribute_for_xml($no);
|
240 |
+
$this->process_google_tax_attribute_for_xml($no);
|
241 |
+
}
|
242 |
+
}
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Configure merchant attributes for XML feed
|
247 |
+
*/
|
248 |
+
public function mapAttributeForCSVTXT()
|
249 |
+
{
|
250 |
+
//Basic product information
|
251 |
+
$googleCSVTXTAttribute = array(
|
252 |
+
"id" => array("id", false),
|
253 |
+
"title" => array("title", true),
|
254 |
+
"description" => array("description", true),
|
255 |
+
"link" => array("link", true),
|
256 |
+
"mobile_link" => array("mobile_link", true),
|
257 |
+
"product_type" => array("product_type", true),
|
258 |
+
"current_category" => array("google_product_category", true),
|
259 |
+
"image" => array("image_link", true),
|
260 |
+
"images" => array("additional_image_link", true),
|
261 |
+
"images_1" => array("additional_image_link_1", true),
|
262 |
+
"images_2" => array("additional_image_link_2", true),
|
263 |
+
"images_3" => array("additional_image_link_3", true),
|
264 |
+
"images_4" => array("additional_image_link_4", true),
|
265 |
+
"images_5" => array("additional_image_link_5", true),
|
266 |
+
"images_6" => array("additional_image_link_6", true),
|
267 |
+
"images_7" => array("additional_image_link_7", true),
|
268 |
+
"images_8" => array("additional_image_link_8", true),
|
269 |
+
"images_9" => array("additional_image_link_9", true),
|
270 |
+
"images_10" => array("additional_image_link_10", true),
|
271 |
+
"condition" => array("condition", false),
|
272 |
+
"availability" => array("availability", false),
|
273 |
+
"availability_date" => array("availability_date", false),
|
274 |
+
"inventory" => array("inventory", false),
|
275 |
+
"price" => array("price", true),
|
276 |
+
"sale_price" => array("sale_price", true),
|
277 |
+
"sale_price_effective_date" => array("sale_price_effective_date", true),
|
278 |
+
"brand" => array("brand", true),
|
279 |
+
"sku" => array("mpn", true),
|
280 |
+
"upc" => array("gtin", true),
|
281 |
+
"identifier_exists" => array("identifier exists", true),
|
282 |
+
"item_group_id" => array("item_group_id", false),
|
283 |
+
"color" => array("color", true),
|
284 |
+
"gender" => array("gender", true),
|
285 |
+
"age_group" => array("age_group", true),
|
286 |
+
"material" => array("material", true),
|
287 |
+
"pattern" => array("pattern", true),
|
288 |
+
"size" => array("size", true),
|
289 |
+
"size_type" => array("size_type", true),
|
290 |
+
"size_system" => array("size_system", true),
|
291 |
+
"tax" => array("tax", true),
|
292 |
+
"tax_country" => array("tax_country", true),
|
293 |
+
"tax_region" => array("tax_region", true),
|
294 |
+
"tax_rate" => array("tax_rate", true),
|
295 |
+
"tax_ship" => array("tax_ship", true),
|
296 |
+
"tax_category" => array("tax_category", true),
|
297 |
+
"weight" => array("shipping_weight", false),
|
298 |
+
"length" => array("shipping_length", false),
|
299 |
+
"width" => array("shipping_width", false),
|
300 |
+
"height" => array("shipping_height", false),
|
301 |
+
"shipping_label" => array("shipping_label", false),
|
302 |
+
"shipping_country" => array("shipping_country", false),
|
303 |
+
"shipping_service" => array("shipping_service", false),
|
304 |
+
"shipping_price" => array("shipping_price", false),
|
305 |
+
"shipping_region" => array("shipping_region", false),
|
306 |
+
"multipack" => array("multipack", true),
|
307 |
+
"is_bundle" => array("is_bundle", true),
|
308 |
+
"adult" => array("adult", true),
|
309 |
+
"adwords_redirect" => array("adwords_redirect", true),
|
310 |
+
"custom_label_0" => array("custom_label_0", true),
|
311 |
+
"custom_label_1" => array("custom_label_1", true),
|
312 |
+
"custom_label_2" => array("custom_label_2", true),
|
313 |
+
"custom_label_3" => array("custom_label_3", true),
|
314 |
+
"custom_label_4" => array("custom_label_4", true),
|
315 |
+
"excluded_destination" => array("excluded_destination", true),
|
316 |
+
"included_destination" => array("included_destination", true),
|
317 |
+
"expiration_date" => array("expiration_date", true),
|
318 |
+
"unit_pricing_measure" => array("unit_pricing_measure", true),
|
319 |
+
"unit_pricing_base_measure" => array("unit_pricing_base_measure", true),
|
320 |
+
"energy_efficiency_class" => array("energy_efficiency_class", true),
|
321 |
+
"loyalty_points" => array("loyalty_points", true),
|
322 |
+
"installment" => array("installment", true),
|
323 |
+
"promotion_id" => array("promotion_id", true),
|
324 |
+
"cost_of_goods_sold" => array("cost_of_goods_sold", true),
|
325 |
+
);
|
326 |
+
|
327 |
+
if (count($this->products)) {
|
328 |
+
foreach ($this->products as $no => $product) {
|
329 |
+
foreach ($product as $key => $value) {
|
330 |
+
$this->mapAttribute($no, $key, $googleCSVTXTAttribute[$key][0], $value, $googleCSVTXTAttribute[$key][0]);
|
331 |
+
}
|
332 |
+
$this->process_google_shipping_attribute_for_CSVTXT($no);
|
333 |
+
$this->process_google_tax_attribute_for_CSVTXT($no);
|
334 |
+
}
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Map to google attribute
|
340 |
+
* @param $no
|
341 |
+
* @param $from
|
342 |
+
* @param $to
|
343 |
+
* @param $value
|
344 |
+
* @param bool $cdata
|
345 |
+
* @return array
|
346 |
+
*/
|
347 |
+
public function mapAttribute($no, $from, $to, $value, $cdata = false)
|
348 |
+
{
|
349 |
+
unset($this->products[$no][$from]);
|
350 |
+
if($to=='g:color'){
|
351 |
+
$value=str_replace(",","/",$value);
|
352 |
+
}
|
353 |
+
if ($this->rules['feedType'] == 'xml') {
|
354 |
+
return $this->products[$no][$to] = $this->formatXMLLine($to, $value, $cdata);
|
355 |
+
} else {
|
356 |
+
return $this->products[$no][$to] = $value;
|
357 |
+
}
|
358 |
+
}
|
359 |
+
|
360 |
+
public function identifier_status_add($no)
|
361 |
+
{
|
362 |
+
$identifier = array('brand', 'upc', 'sku', 'mpn', 'gtin');
|
363 |
+
$product = $this->products[$no];
|
364 |
+
|
365 |
+
if(!array_key_exists('g:identifier_exists',$product)) {
|
366 |
+
if (count(array_intersect_key(array_flip($identifier), $product)) >= 2) {
|
367 |
+
# Any 2 required keys exist!
|
368 |
+
$countIdentifier=0;
|
369 |
+
if(array_key_exists('brand',$product) && !empty($product['brand'])){
|
370 |
+
$countIdentifier++;
|
371 |
+
}
|
372 |
+
if(array_key_exists('upc',$product) && !empty($product['upc'])){
|
373 |
+
$countIdentifier++;
|
374 |
+
}
|
375 |
+
if(array_key_exists('sku',$product) && !empty($product['sku'])){
|
376 |
+
$countIdentifier++;
|
377 |
+
}
|
378 |
+
if(array_key_exists('mpn',$product) && !empty($product['mpn'])){
|
379 |
+
$countIdentifier++;
|
380 |
+
}
|
381 |
+
if(array_key_exists('gtin',$product) && !empty($product['gtin'])){
|
382 |
+
$countIdentifier++;
|
383 |
+
}
|
384 |
+
if($countIdentifier>=2){
|
385 |
+
$this->products[$no]["g:identifier_exists"] = $this->formatXMLLine("g:identifier_exists", "yes", $cdata = true);
|
386 |
+
}else{
|
387 |
+
$this->products[$no]["g:identifier_exists"] = $this->formatXMLLine("g:identifier_exists", "no", $cdata = true);
|
388 |
+
}
|
389 |
+
} else {
|
390 |
+
$this->products[$no]["g:identifier_exists"] = $this->formatXMLLine("g:identifier_exists", "no", $cdata = true);
|
391 |
+
}
|
392 |
+
}
|
393 |
+
}
|
394 |
+
|
395 |
+
|
396 |
+
|
397 |
+
public
|
398 |
+
function process_google_shipping_attribute_for_xml($no)
|
399 |
+
{
|
400 |
+
$shipping = array('g:shipping_country', 'g:shipping_service', 'g:shipping_price', 'g:shipping_region');
|
401 |
+
$shippingAttr = array();
|
402 |
+
$products = $this->products[$no];
|
403 |
+
foreach ($products as $keyAttr => $valueAttr) {
|
404 |
+
if (in_array($keyAttr, $shipping)) {
|
405 |
+
array_push($shippingAttr, array($keyAttr => $valueAttr));
|
406 |
+
unset($this->products[$no][$keyAttr]);
|
407 |
+
}
|
408 |
+
}
|
409 |
+
if (count($shippingAttr)) {
|
410 |
+
$str = "";
|
411 |
+
foreach ($shippingAttr as $key => $attributes) {
|
412 |
+
foreach ($attributes as $keyAttr => $valueAttr) {
|
413 |
+
$str .= str_replace("shipping_", "", $valueAttr);
|
414 |
+
}
|
415 |
+
}
|
416 |
+
return $this->products[$no]['g:shipping'] = $this->formatXMLLine("g:shipping", $str, false);
|
417 |
+
}
|
418 |
+
return false;
|
419 |
+
}
|
420 |
+
|
421 |
+
public
|
422 |
+
function process_google_tax_attribute_for_xml($no)
|
423 |
+
{
|
424 |
+
$tax = array('g:tax_country', 'g:tax_region', 'g:tax_rate', 'g:tax_ship');
|
425 |
+
$taxAttr = array();
|
426 |
+
$products = $this->products[$no];
|
427 |
+
foreach ($products as $keyAttr => $valueAttr) {
|
428 |
+
if (in_array($keyAttr, $tax)) {
|
429 |
+
array_push($taxAttr, array($keyAttr => $valueAttr));
|
430 |
+
unset($this->products[$no][$keyAttr]);
|
431 |
+
}
|
432 |
+
}
|
433 |
+
if (count($taxAttr)) {
|
434 |
+
$str = "";
|
435 |
+
foreach ($taxAttr as $key => $attributes) {
|
436 |
+
foreach ($attributes as $keyAttr => $valueAttr) {
|
437 |
+
// if($keyAttr != "g:tax_ship")
|
438 |
+
// {
|
439 |
+
$str .= str_replace("tax_", "", $valueAttr);
|
440 |
+
$str = str_replace("ship", "tax_ship", $str);
|
441 |
+
// }
|
442 |
+
// else
|
443 |
+
// {
|
444 |
+
// $str .= $valueAttr;
|
445 |
+
// }
|
446 |
+
}
|
447 |
+
}
|
448 |
+
return $this->products[$no]['g:tax'] = $this->formatXMLLine("g:tax", $str, false);
|
449 |
+
}
|
450 |
+
return false;
|
451 |
+
}
|
452 |
+
|
453 |
+
public
|
454 |
+
function process_google_shipping_attribute_for_CSVTXT($no)
|
455 |
+
{
|
456 |
+
$shipping = array('shipping country', 'shipping service', 'shipping price', 'shipping region');
|
457 |
+
$shippingAttr = array();
|
458 |
+
$products = $this->products[$no];
|
459 |
+
foreach ($products as $keyAttr => $valueAttr) {
|
460 |
+
if (in_array($keyAttr, $shipping)) {
|
461 |
+
array_push($shippingAttr, array($keyAttr => $valueAttr));
|
462 |
+
unset($this->products[$no][$keyAttr]);
|
463 |
+
}
|
464 |
+
}
|
465 |
+
if (count($shippingAttr)) {
|
466 |
+
$str = "";
|
467 |
+
foreach ($shippingAttr as $key => $attributes) {
|
468 |
+
foreach ($attributes as $keyAttr => $valueAttr) {
|
469 |
+
$country = ($keyAttr == "shipping country") ? $str .= $valueAttr . ":" : "";
|
470 |
+
$service = ($keyAttr == "shipping service") ? $str .= $valueAttr . ":" : "";
|
471 |
+
$price = ($keyAttr == "shipping price") ? $str .= $valueAttr : "";
|
472 |
+
$region = ($keyAttr == "shipping region") ? $str .= $valueAttr . ":" : "";
|
473 |
+
}
|
474 |
+
}
|
475 |
+
return $this->products[$no]['shipping(country:region:service:price)'] = str_replace(" : ", ":", $str);
|
476 |
+
}
|
477 |
+
return false;
|
478 |
+
}
|
479 |
+
|
480 |
+
public
|
481 |
+
function process_google_tax_attribute_for_CSVTXT($no)
|
482 |
+
{
|
483 |
+
$tax = array('tax country', 'tax region', 'tax rate', 'tax ship');
|
484 |
+
$taxAttr = array();
|
485 |
+
$products = $this->products[$no];
|
486 |
+
foreach ($products as $keyAttr => $valueAttr) {
|
487 |
+
if (in_array($keyAttr, $tax)) {
|
488 |
+
array_push($taxAttr, array($keyAttr => $valueAttr));
|
489 |
+
unset($this->products[$no][$keyAttr]);
|
490 |
+
}
|
491 |
+
}
|
492 |
+
if (count($taxAttr)) {
|
493 |
+
$str = "";
|
494 |
+
foreach ($taxAttr as $key => $attributes) {
|
495 |
+
foreach ($attributes as $keyAttr => $valueAttr) {
|
496 |
+
$country = ($keyAttr == "tax country") ? $str .= $valueAttr . ":" : "";
|
497 |
+
$region = ($keyAttr == "tax region") ? $str .= $valueAttr . ":" : "";
|
498 |
+
$rate = ($keyAttr == "tax rate") ? $str .= $valueAttr . ":": "";
|
499 |
+
$ship = ($keyAttr == "tax ship") ? $str .= $valueAttr . ":" : "";
|
500 |
+
}
|
501 |
+
}
|
502 |
+
return $this->products[$no]['tax(country:region:rate:tax_ship)'] = str_replace(" : ",":", $str);
|
503 |
+
}
|
504 |
+
return false;
|
505 |
+
}
|
506 |
+
|
507 |
+
function formatXMLLine($attribute, $value, $cdata, $space = "")
|
508 |
+
{
|
509 |
+
//Make single XML node
|
510 |
+
if (!empty($value))
|
511 |
+
$value = trim($value);
|
512 |
+
if (gettype($value) == 'array')
|
513 |
+
$value = json_encode($value);
|
514 |
+
if (strpos($value, "<![CDATA[") === false && substr(trim($value), 0, 4) == "http") {
|
515 |
+
$value = "<![CDATA[$value]]>";
|
516 |
+
} elseif (strpos($value, "<![CDATA[") === false && $cdata === true && !empty($value)) {
|
517 |
+
$value = "<![CDATA[$value]]>";
|
518 |
+
} else if ($cdata) {
|
519 |
+
if(!empty($value)){
|
520 |
+
$value = "<![CDATA[$value]]>";
|
521 |
+
}
|
522 |
+
}
|
523 |
+
if (substr($attribute, 0, 23) == 'g:additional_image_link') {
|
524 |
+
$attribute = "g:additional_image_link";
|
525 |
+
}
|
526 |
+
return "
|
527 |
+
$space<$attribute>$value</$attribute>";
|
528 |
+
}
|
529 |
+
|
530 |
+
|
531 |
+
public
|
532 |
+
function get_xml_feed_header()
|
533 |
+
{
|
534 |
+
$output = '<?xml version="1.0" encoding="UTF-8" ?>
|
535 |
+
<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0" xmlns:c="http://base.google.com/cns/1.0">
|
536 |
+
<channel>
|
537 |
+
<title><![CDATA[' . html_entity_decode(get_option('blogname')) . ']]></title>
|
538 |
+
<link><![CDATA[' . site_url() . ']]></link>
|
539 |
+
<description><![CDATA[' . html_entity_decode(get_option('blogdescription')) . ']]></description>';
|
540 |
+
return $output;
|
541 |
+
}
|
542 |
+
|
543 |
+
public
|
544 |
+
function get_xml_feed($items)
|
545 |
+
{
|
546 |
+
$feed = "";
|
547 |
+
//$feed .= $this->get_feed_header();
|
548 |
+
$feed .= "\n";
|
549 |
+
if ($items) {
|
550 |
+
foreach ($items as $item => $products) {
|
551 |
+
$feed .= " <" . $this->feedWrapper . ">";
|
552 |
+
foreach ($products as $key => $value) {
|
553 |
+
if (!empty($value)){
|
554 |
+
$feed .= $value;
|
555 |
+
}
|
556 |
+
}
|
557 |
+
$feed .= "\n </" . $this->feedWrapper . ">\n";
|
558 |
+
}
|
559 |
+
//$feed .= $this->get_feed_footer();
|
560 |
+
|
561 |
+
return $feed;
|
562 |
+
}
|
563 |
+
return false;
|
564 |
+
}
|
565 |
+
|
566 |
+
public
|
567 |
+
function get_xml_feed_footer()
|
568 |
+
{
|
569 |
+
$footer = " </channel>
|
570 |
+
</rss>";
|
571 |
+
return $footer;
|
572 |
+
}
|
573 |
+
|
574 |
+
public
|
575 |
+
function short_products()
|
576 |
+
{
|
577 |
+
if ($this->products) {
|
578 |
+
update_option('wpf_progress', "Shorting Products");
|
579 |
+
sleep(1);
|
580 |
+
$array = array();
|
581 |
+
$ij = 0;
|
582 |
+
foreach ($this->products as $key => $item) {
|
583 |
+
$array[$ij] = $item;
|
584 |
+
unset($this->products[$key]);
|
585 |
+
$ij++;
|
586 |
+
}
|
587 |
+
return $this->products = $array;
|
588 |
+
}
|
589 |
+
return $this->products;
|
590 |
+
}
|
591 |
+
|
592 |
+
/**
|
593 |
+
* Responsible to make CSV feed
|
594 |
+
* @return string
|
595 |
+
*/
|
596 |
+
public
|
597 |
+
function get_csv_feed()
|
598 |
+
{
|
599 |
+
if ($this->products) {
|
600 |
+
$headers = array_keys($this->products[0]);
|
601 |
+
$feed[] = $headers;
|
602 |
+
foreach ($this->products as $no => $product) {
|
603 |
+
$row = array();
|
604 |
+
foreach ($headers as $key => $header) {
|
605 |
+
if (strpos($header, "additional_image_link") !== false) {
|
606 |
+
$header = "additional_image_link";
|
607 |
+
}
|
608 |
+
$row[] = isset($product[$header]) ? $product[$header] : "";;
|
609 |
+
}
|
610 |
+
$feed[] = $row;
|
611 |
+
}
|
612 |
+
return $feed;
|
613 |
+
}
|
614 |
+
return false;
|
615 |
+
}
|
616 |
+
}
|
woo-feed.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
* Plugin Name: WooCommerce Product Feed
|
17 |
* Plugin URI: https://webappick.com/
|
18 |
* Description: This plugin generate WooCommerce product feed for Shopping Engines like Google Shopping,Facebook Product Feed,eBay,Amazon,Idealo and many more..
|
19 |
-
* Version: 3.0
|
20 |
* Author: WebAppick
|
21 |
* Author URI: https://webappick.com/
|
22 |
* License: GPL v2
|
@@ -134,9 +134,10 @@ function woo_feed_add_update($info = "", $name = "")
|
|
134 |
set_time_limit(0);
|
135 |
if (count($info) && isset($info['provider'])) {
|
136 |
# GEt Post data
|
137 |
-
if ($info['provider'] == 'google' || $info['provider'] == 'adroll' || $info['provider'] == '
|
138 |
-
|| $info['provider'] == 'smartly.io') {
|
139 |
$merchant = "Woo_Feed_Google";
|
|
|
|
|
140 |
} elseif ($info['provider'] == 'facebook') {
|
141 |
$merchant = "Woo_Feed_Facebook";
|
142 |
}elseif (strpos($info['provider'],'amazon') !==FALSE) {
|
@@ -341,9 +342,10 @@ function woo_feed_generate_feed_data($info){
|
|
341 |
try{
|
342 |
if (count($info) && isset($info['provider'])) {
|
343 |
# GEt Post data
|
344 |
-
if ($info['provider'] == 'google' || $info['provider'] == 'adroll' || $info['provider'] == '
|
345 |
-
|| $info['provider'] == 'smartly.io') {
|
346 |
$merchant = "Woo_Feed_Google";
|
|
|
|
|
347 |
} elseif ($info['provider'] == 'facebook') {
|
348 |
$merchant = "Woo_Feed_Facebook";
|
349 |
}elseif (strpos($info['provider'],'amazon') !==FALSE) {
|
@@ -776,7 +778,7 @@ function woo_feed_manage_feed()
|
|
776 |
"fruugo.au", "myshopping.com.au",
|
777 |
"smartly.io", "stylight.com",
|
778 |
"nextad", "skinflint.co.uk",
|
779 |
-
"yahoo_nfa",
|
780 |
"comparer.be",
|
781 |
"dooyoo",
|
782 |
"hintaseuranta.fi",
|
16 |
* Plugin Name: WooCommerce Product Feed
|
17 |
* Plugin URI: https://webappick.com/
|
18 |
* Description: This plugin generate WooCommerce product feed for Shopping Engines like Google Shopping,Facebook Product Feed,eBay,Amazon,Idealo and many more..
|
19 |
+
* Version: 3.1.0
|
20 |
* Author: WebAppick
|
21 |
* Author URI: https://webappick.com/
|
22 |
* License: GPL v2
|
134 |
set_time_limit(0);
|
135 |
if (count($info) && isset($info['provider'])) {
|
136 |
# GEt Post data
|
137 |
+
if ($info['provider'] == 'google' || $info['provider'] == 'adroll' || $info['provider'] == 'smartly.io') {
|
|
|
138 |
$merchant = "Woo_Feed_Google";
|
139 |
+
} elseif ($info['provider'] == 'pinterest') {
|
140 |
+
$merchant = "Woo_Feed_Pinterest";
|
141 |
} elseif ($info['provider'] == 'facebook') {
|
142 |
$merchant = "Woo_Feed_Facebook";
|
143 |
}elseif (strpos($info['provider'],'amazon') !==FALSE) {
|
342 |
try{
|
343 |
if (count($info) && isset($info['provider'])) {
|
344 |
# GEt Post data
|
345 |
+
if ($info['provider'] == 'google' || $info['provider'] == 'adroll' || $info['provider'] == 'smartly.io') {
|
|
|
346 |
$merchant = "Woo_Feed_Google";
|
347 |
+
} elseif ($info['provider'] == 'pinterest') {
|
348 |
+
$merchant = "Woo_Feed_Pinterest";
|
349 |
} elseif ($info['provider'] == 'facebook') {
|
350 |
$merchant = "Woo_Feed_Facebook";
|
351 |
}elseif (strpos($info['provider'],'amazon') !==FALSE) {
|
778 |
"fruugo.au", "myshopping.com.au",
|
779 |
"smartly.io", "stylight.com",
|
780 |
"nextad", "skinflint.co.uk",
|
781 |
+
"yahoo_nfa",
|
782 |
"comparer.be",
|
783 |
"dooyoo",
|
784 |
"hintaseuranta.fi",
|