Version Description
Download this release
Release Info
Developer | wahid0003 |
Plugin | CTX Feed – WooCommerce Product Feed Manager Plugin |
Version | 2.2.9 |
Comparing to | |
See all releases |
Code changes from version 2.2.8 to 2.2.9
- README.txt +4 -0
- admin/class-woo-feed-manage-list.php +39 -27
- admin/css/woo-feed-admin.css +36 -3
- admin/js/woo-feed-admin.js +17 -0
- admin/partials/woo-feed-admin-display.php +5 -2
- admin/partials/woo-feed-manage-list.php +1 -1
- includes/class-woo-feed.php +1 -1
- includes/classes/class-woo-feed-products.php +1187 -1299
- woo-feed.php +39 -15
README.txt
CHANGED
@@ -270,6 +270,10 @@ Using pro version:
|
|
270 |
|
271 |
== Changelog ==
|
272 |
|
|
|
|
|
|
|
|
|
273 |
= 2.2.8(2018-03-14) =
|
274 |
* Variable product price issue fixed
|
275 |
* Other minor issues about product are fixed
|
270 |
|
271 |
== Changelog ==
|
272 |
|
273 |
+
= 2.2.9(2018-03-23) =
|
274 |
+
* Product missing issue fixed
|
275 |
+
* Auto update active/inactive status added
|
276 |
+
|
277 |
= 2.2.8(2018-03-14) =
|
278 |
* Variable product price issue fixed
|
279 |
* Other minor issues about product are fixed
|
admin/class-woo-feed-manage-list.php
CHANGED
@@ -64,33 +64,44 @@ class Woo_Feed_Manage_list extends Woo_Feed_List_Table
|
|
64 |
* @param array $column_name The name/slug of the column to be processed
|
65 |
* @return string Text or HTML to be placed inside the column <td>
|
66 |
**************************************************************************/
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
|
96 |
/** ************************************************************************
|
@@ -247,6 +258,7 @@ class Woo_Feed_Manage_list extends Woo_Feed_List_Table
|
|
247 |
{
|
248 |
$columns = array(
|
249 |
'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
|
|
|
250 |
'option_name' => __('File Name'),
|
251 |
'provider' => __('Provider'),
|
252 |
'type' => __('Type'),
|
64 |
* @param array $column_name The name/slug of the column to be processed
|
65 |
* @return string Text or HTML to be placed inside the column <td>
|
66 |
**************************************************************************/
|
67 |
+
function column_default($item, $column_name)
|
68 |
+
{
|
69 |
+
$getItem = $item['option_name'];
|
70 |
+
$statusId=$item['option_id'];
|
71 |
+
$itemInfo = unserialize(get_option($getItem));
|
72 |
+
|
73 |
+
|
74 |
+
global $wpdb, $table_prefix;
|
75 |
+
switch ($column_name) {
|
76 |
+
case 'option_name':
|
77 |
+
$name = $item[$column_name];
|
78 |
+
return str_replace("wf_feed_", "", $name);
|
79 |
+
case 'status':
|
80 |
+
if(!isset($itemInfo['status']) || $itemInfo['status'] == 1){
|
81 |
+
return ' <div class="wf_status_wrap"><input style="display: none;" data-index='.$statusId.' id='.$statusId.' checked class="woo_feed_status_input" type="checkbox" value="'.$getItem.'"/>
|
82 |
+
<label for='.$statusId.' class= "woo-feed_active_status"></label></div>';
|
83 |
+
}else{
|
84 |
+
return ' <div class="wf_status_wrap"> <input style="display: none;" data-index='.$statusId.' id='.$statusId.' class="woo_feed_status_input" type="checkbox" value="'.$getItem.'"/>
|
85 |
+
<label for='.$statusId.' class= "woo-feed_active_status"></label> </div>';
|
86 |
+
}
|
87 |
+
case 'provider':
|
88 |
+
$provider = $itemInfo['feedrules']['provider'];
|
89 |
+
return ucwords(str_replace("_", " ", $provider));
|
90 |
+
case 'type':
|
91 |
+
$feedType = $itemInfo['feedrules']['feedType'];
|
92 |
+
return strtoupper(str_replace("_", " ", $feedType));
|
93 |
+
case 'url':
|
94 |
+
return $itemInfo[$column_name];
|
95 |
+
case 'last_updated':
|
96 |
+
return $itemInfo[$column_name];
|
97 |
+
case 'view':
|
98 |
+
$view = $itemInfo['url'];
|
99 |
+
return "<a target='_blank' class='button' href='$view'>" . __('View') . "</a> <input type='button' id='$getItem' value=".__('Regenerate')." class='button wpf_regenerate'> <a target='_blank' class='button' href='$view' download>" . __('Download') . "</a>";
|
100 |
+
default:
|
101 |
+
return false;
|
102 |
+
//return print_r($item, true); //Show the whole array for troubleshooting purposes
|
103 |
+
}
|
104 |
+
}
|
105 |
|
106 |
|
107 |
/** ************************************************************************
|
258 |
{
|
259 |
$columns = array(
|
260 |
'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
|
261 |
+
'status' => __('Status'),
|
262 |
'option_name' => __('File Name'),
|
263 |
'provider' => __('Provider'),
|
264 |
'type' => __('Type'),
|
admin/css/woo-feed-admin.css
CHANGED
@@ -34,8 +34,8 @@
|
|
34 |
background-image: -ms-linear-gradient(top, #3498db, #2980b9);
|
35 |
background-image: -o-linear-gradient(top, #3498db, #2980b9);
|
36 |
background-image: linear-gradient(to bottom, #3498db, #2980b9);
|
37 |
-
-webkit-border-radius:
|
38 |
-
-moz-border-radius:
|
39 |
border-radius: 17px;
|
40 |
-webkit-box-shadow: 0px 1px 3px #666666;
|
41 |
-moz-box-shadow: 0px 1px 3px #666666;
|
@@ -55,7 +55,7 @@
|
|
55 |
border-radius:5px;
|
56 |
padding:10px;
|
57 |
color:#fff;
|
58 |
-
font-size:12px
|
59 |
}
|
60 |
.wfbtn:hover {
|
61 |
background: #3cb0fd;
|
@@ -334,3 +334,36 @@ p {
|
|
334 |
font-size: 14px;
|
335 |
color: #32373c;
|
336 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
background-image: -ms-linear-gradient(top, #3498db, #2980b9);
|
35 |
background-image: -o-linear-gradient(top, #3498db, #2980b9);
|
36 |
background-image: linear-gradient(to bottom, #3498db, #2980b9);
|
37 |
+
-webkit-border-radius: 17px;
|
38 |
+
-moz-border-radius: 17px;
|
39 |
border-radius: 17px;
|
40 |
-webkit-box-shadow: 0px 1px 3px #666666;
|
41 |
-moz-box-shadow: 0px 1px 3px #666666;
|
55 |
border-radius:5px;
|
56 |
padding:10px;
|
57 |
color:#fff;
|
58 |
+
font-size:12px;
|
59 |
}
|
60 |
.wfbtn:hover {
|
61 |
background: #3cb0fd;
|
334 |
font-size: 14px;
|
335 |
color: #32373c;
|
336 |
}
|
337 |
+
|
338 |
+
/* Feed active and inactive button CSS */
|
339 |
+
.wf_status_wrap label{
|
340 |
+
width:50px;
|
341 |
+
height:25px;
|
342 |
+
box-sizing:border-box;
|
343 |
+
border :1px solid;
|
344 |
+
float:left;
|
345 |
+
border-radius:100px;
|
346 |
+
position:relative;
|
347 |
+
cursor:pointer;
|
348 |
+
transition:.3s ease;
|
349 |
+
}
|
350 |
+
input[class=woo_feed_status_input]:checked + label{
|
351 |
+
background:#55e868;
|
352 |
+
}
|
353 |
+
input[class=woo_feed_status_input]:checked + label:before{
|
354 |
+
left:25px;
|
355 |
+
}
|
356 |
+
.wf_status_wrap label:before{
|
357 |
+
transition:.3s ease;
|
358 |
+
content:'';
|
359 |
+
width:20px;
|
360 |
+
height:20px;
|
361 |
+
position:absolute;
|
362 |
+
background:white;
|
363 |
+
left:2px;
|
364 |
+
top:2px;
|
365 |
+
box-sizing:border-box;
|
366 |
+
border:1px solid;
|
367 |
+
color:black;
|
368 |
+
border-radius:100px;
|
369 |
+
}
|
admin/js/woo-feed-admin.js
CHANGED
@@ -249,6 +249,23 @@
|
|
249 |
}
|
250 |
});
|
251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
|
253 |
});
|
254 |
|
249 |
}
|
250 |
});
|
251 |
|
252 |
+
// Feed Active and Inactive status change via ajax
|
253 |
+
$('.woo_feed_status_input').on('change',function(){
|
254 |
+
var counter;
|
255 |
+
var $feedName = $(this).val();
|
256 |
+
if($(this)[0].checked){
|
257 |
+
counter = 1;
|
258 |
+
}else {
|
259 |
+
counter = 0;
|
260 |
+
}
|
261 |
+
$.post(wpf_ajax_obj.wpf_ajax_url, { //POST request
|
262 |
+
_ajax_nonce: wpf_ajax_obj.nonce, //nonce
|
263 |
+
action: "update_feed_status", //action
|
264 |
+
feedName: $feedName,
|
265 |
+
status: counter
|
266 |
+
}, function (data) { //callback
|
267 |
+
});
|
268 |
+
});
|
269 |
|
270 |
});
|
271 |
|
admin/partials/woo-feed-admin-display.php
CHANGED
@@ -10,14 +10,17 @@
|
|
10 |
* @subpackage Woo_Feed/admin/partial
|
11 |
* @author Ohidul Islam <wahid@webappick.com>
|
12 |
*/
|
13 |
-
|
14 |
-
//echo ini_get("max_execution_time");
|
15 |
|
16 |
$dropDown = new Woo_Feed_Dropdown();
|
17 |
$product = new Woo_Feed_Products();
|
18 |
$attributes=new Woo_Feed_Default_Attributes();
|
19 |
$product->load_attributes();
|
20 |
|
|
|
|
|
|
|
|
|
21 |
?>
|
22 |
|
23 |
<div class="wrap" id="Feed">
|
10 |
* @subpackage Woo_Feed/admin/partial
|
11 |
* @author Ohidul Islam <wahid@webappick.com>
|
12 |
*/
|
13 |
+
|
|
|
14 |
|
15 |
$dropDown = new Woo_Feed_Dropdown();
|
16 |
$product = new Woo_Feed_Products();
|
17 |
$attributes=new Woo_Feed_Default_Attributes();
|
18 |
$product->load_attributes();
|
19 |
|
20 |
+
//echo "<pre>";
|
21 |
+
//print_r();
|
22 |
+
//die();
|
23 |
+
|
24 |
?>
|
25 |
|
26 |
<div class="wrap" id="Feed">
|
admin/partials/woo-feed-manage-list.php
CHANGED
@@ -341,7 +341,7 @@ if(isset($_POST)&& isset($_POST['filename'])){
|
|
341 |
feed:fileName
|
342 |
},
|
343 |
success : function(response) {
|
344 |
-
|
345 |
if(response.success) {
|
346 |
width ='100';
|
347 |
showFeedProgress();
|
341 |
feed:fileName
|
342 |
},
|
343 |
success : function(response) {
|
344 |
+
console.log(response);
|
345 |
if(response.success) {
|
346 |
width ='100';
|
347 |
showFeedProgress();
|
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 = '2.2.
|
74 |
|
75 |
$this->load_dependencies();
|
76 |
$this->set_locale();
|
70 |
public function __construct()
|
71 |
{
|
72 |
$this->woo_feed = 'woo-feed';
|
73 |
+
$this->version = '2.2.9';
|
74 |
|
75 |
$this->load_dependencies();
|
76 |
$this->set_locale();
|
includes/classes/class-woo-feed-products.php
CHANGED
@@ -11,61 +11,61 @@
|
|
11 |
class Woo_Feed_Products
|
12 |
{
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
public $pi;
|
70 |
|
71 |
|
@@ -117,7 +117,7 @@ class Woo_Feed_Products
|
|
117 |
$offset = ! empty( $offset ) && is_numeric( $offset ) ? absint( $offset ) : '0';
|
118 |
|
119 |
|
120 |
-
try {
|
121 |
|
122 |
|
123 |
# Query Arguments
|
@@ -142,6 +142,7 @@ class Woo_Feed_Products
|
|
142 |
$products = $query->get_products();
|
143 |
|
144 |
//$products = $this->wooProductQuery($arg);
|
|
|
145 |
|
146 |
$this->pi = 1; # Product Index
|
147 |
foreach ( $products as $key => $productId ) {
|
@@ -154,7 +155,7 @@ class Woo_Feed_Products
|
|
154 |
|
155 |
$simple = new WC_Product_Simple( $id );
|
156 |
|
157 |
-
if(
|
158 |
continue;
|
159 |
}
|
160 |
|
@@ -235,33 +236,12 @@ class Woo_Feed_Products
|
|
235 |
$this->productsList[ $this->pi ][$aKey] = $simple->get_attribute($aKey);
|
236 |
}
|
237 |
}
|
238 |
-
|
239 |
-
|
240 |
-
// # Get all Product Post Meta and Their Values
|
241 |
-
// $metas=get_post_meta($simple->get_id());
|
242 |
-
// if(!empty($metas)){
|
243 |
-
// foreach ($metas as $mKey=>$meta){
|
244 |
-
// if($mKey!="_product_attributes"){
|
245 |
-
// $metaValue=get_post_meta($id,$mKey,true);
|
246 |
-
// $this->productsList[ $this->pi ]["wf_cattr_".$mKey]=(!empty($metaValue))?$metaValue:"";
|
247 |
-
// }
|
248 |
-
// }
|
249 |
-
// }
|
250 |
-
//
|
251 |
-
// # Get all Product Taxonomies and Their values
|
252 |
-
// $taxonomies=get_post_taxonomies($id);
|
253 |
-
// if(!empty($taxonomies)){
|
254 |
-
// foreach ($taxonomies as $tKey=>$taxonomy){
|
255 |
-
// $this->productsList[ $this->pi ]["wf_taxo_".$taxonomy]=strip_tags(get_the_term_list($id,$taxonomy,"",",",""));
|
256 |
-
// }
|
257 |
-
// }
|
258 |
-
|
259 |
}
|
260 |
else if ( $prod->is_type( 'external' ) ) {
|
261 |
|
262 |
$external = new WC_Product_External( $id );
|
263 |
|
264 |
-
if(
|
265 |
continue;
|
266 |
}
|
267 |
|
@@ -343,32 +323,12 @@ class Woo_Feed_Products
|
|
343 |
$this->productsList[ $this->pi ][$aKey] = $external->get_attribute($aKey);
|
344 |
}
|
345 |
}
|
346 |
-
|
347 |
-
|
348 |
-
// # Get all Product Post Meta and Their Values
|
349 |
-
// $metas=get_post_meta($id);
|
350 |
-
// if(!empty($metas)){
|
351 |
-
// foreach ($metas as $mKey=>$meta){
|
352 |
-
// if($mKey!="_product_attributes"){
|
353 |
-
// $metaValue=get_post_meta($id,$mKey,true);
|
354 |
-
// $this->productsList[ $this->pi ]["wf_cattr_".$mKey]=(!empty($metaValue))?$metaValue:"";
|
355 |
-
// }
|
356 |
-
// }
|
357 |
-
// }
|
358 |
-
//
|
359 |
-
// # Get all Product Taxonomies and Their values
|
360 |
-
// $taxonomies=get_post_taxonomies($id);
|
361 |
-
// if(!empty($taxonomies)){
|
362 |
-
// foreach ($taxonomies as $tKey=>$taxonomy){
|
363 |
-
// $this->productsList[ $this->pi ]["wf_taxo_".$taxonomy]=strip_tags(get_the_term_list($id,$taxonomy,"",",",""));
|
364 |
-
// }
|
365 |
-
// }
|
366 |
}
|
367 |
else if ( $prod->is_type( 'grouped' ) ) {
|
368 |
|
369 |
$grouped = new WC_Product_Grouped( $id );
|
370 |
|
371 |
-
if(
|
372 |
continue;
|
373 |
}
|
374 |
|
@@ -450,39 +410,16 @@ class Woo_Feed_Products
|
|
450 |
}
|
451 |
}
|
452 |
|
453 |
-
|
454 |
-
// # Get all Product Post Meta and Their Values
|
455 |
-
// $metas=get_post_meta($id);
|
456 |
-
// if(!empty($metas)){
|
457 |
-
// foreach ($metas as $mKey=>$meta){
|
458 |
-
// if($mKey!="_product_attributes"){
|
459 |
-
// $metaValue=get_post_meta($id,$mKey,true);
|
460 |
-
// $this->productsList[ $this->pi ]["wf_cattr_".$mKey]=(!empty($metaValue))?$metaValue:"";
|
461 |
-
// }
|
462 |
-
// }
|
463 |
-
// }
|
464 |
-
//
|
465 |
-
// # Get all Product Taxonomies and Their values
|
466 |
-
// $taxonomies=get_post_taxonomies($id);
|
467 |
-
// if(!empty($taxonomies)){
|
468 |
-
// foreach ($taxonomies as $tKey=>$taxonomy){
|
469 |
-
// $this->productsList[ $this->pi ]["wf_taxo_".$taxonomy]=strip_tags(get_the_term_list($id,$taxonomy,"",",",""));
|
470 |
-
// }
|
471 |
-
// }
|
472 |
}
|
473 |
else if ( $prod->is_type( 'variable' ) ) {
|
474 |
|
475 |
$variable = new WC_Product_Variable( $id );
|
476 |
|
477 |
-
if(
|
478 |
continue;
|
479 |
}
|
480 |
|
481 |
|
482 |
-
|
483 |
-
$this->productsList[ $this->pi ]["attrs"] = wc_get_attribute_taxonomy_names();
|
484 |
-
$this->productsList[ $this->pi ]["attrs_text"] = wc_get_attribute_taxonomies();
|
485 |
-
|
486 |
$this->productsList[ $this->pi ]["id"] = $variable->get_id();
|
487 |
$this->productsList[ $this->pi ]["title"] = $variable->get_name();
|
488 |
$this->productsList[ $this->pi ]["description"] = $this->remove_short_codes($variable->get_description());
|
@@ -530,13 +467,6 @@ class Woo_Feed_Products
|
|
530 |
$this->productsList[ $this->pi ]['sku'] = $variable->get_sku();
|
531 |
$this->productsList[ $this->pi ]['availability'] = $this->availability( $id );
|
532 |
|
533 |
-
// if ( $this->feedRule['variable_price'] == 'first' ) {
|
534 |
-
// $price = $variable->get_regular_price();
|
535 |
-
// $sPrice = $variable->get_sale_price();
|
536 |
-
// } else {
|
537 |
-
// $price = $variable->get_variation_regular_price( $this->feedRule['variable_price'], $variable->is_taxable() );
|
538 |
-
// $sPrice = $variable->get_variation_sale_price( $this->feedRule['variable_price'], $variable->is_taxable() );
|
539 |
-
// }
|
540 |
|
541 |
$this->productsList[ $this->pi ]['quantity'] = $variable->get_stock_quantity();
|
542 |
$this->productsList[ $this->pi ]['sale_price_sdate'] = $variable->get_date_on_sale_from();
|
@@ -569,42 +499,22 @@ class Woo_Feed_Products
|
|
569 |
$this->productsList[ $this->pi ][$aKey] = $variable->get_attribute($aKey);
|
570 |
}
|
571 |
}
|
572 |
-
|
573 |
-
|
574 |
-
// # Get all Product Post Meta and Their Values
|
575 |
-
// $metas=get_post_meta($id);
|
576 |
-
// if(!empty($metas)){
|
577 |
-
// foreach ($metas as $mKey=>$meta){
|
578 |
-
// if($mKey!="_product_attributes"){
|
579 |
-
// $metaValue=get_post_meta($id,$mKey,true);
|
580 |
-
// $this->productsList[ $this->pi ]["wf_cattr_".$mKey]=(!empty($metaValue))?$metaValue:"";
|
581 |
-
// }
|
582 |
-
// }
|
583 |
-
// }
|
584 |
-
//
|
585 |
-
// # Get all Product Taxonomies and Their values
|
586 |
-
// $taxonomies=get_post_taxonomies($id);
|
587 |
-
// if(!empty($taxonomies)){
|
588 |
-
// foreach ($taxonomies as $tKey=>$taxonomy){
|
589 |
-
// $this->productsList[ $this->pi ]["wf_taxo_".$taxonomy]=strip_tags(get_the_term_list($id,$taxonomy,"",",",""));
|
590 |
-
// }
|
591 |
-
// }
|
592 |
-
|
593 |
-
# Don't Include Variations for Facebook
|
594 |
-
// if ( $this->feedRule['provider'] != 'facebook' ) {
|
595 |
-
// $this->getWC3Variations( $variable->get_available_variations(),$variable);
|
596 |
-
// }
|
597 |
-
|
598 |
}
|
599 |
else if ( $prod->is_type( 'variation' ) && $this->feedRule['provider'] != 'facebook') {
|
600 |
$variation=new WC_Product_Variation($id);
|
601 |
|
602 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
603 |
continue;
|
604 |
}
|
605 |
|
606 |
-
# Parent Info
|
607 |
-
$parent=wc_get_product($variation->get_parent_id());
|
608 |
$parentInfo=$variation->get_parent_data();
|
609 |
$variationTitle= $parentInfo['title'];
|
610 |
|
@@ -701,36 +611,16 @@ class Woo_Feed_Products
|
|
701 |
$this->productsList[ $this->pi ][$aKey] = $variation->get_attribute($aKey);
|
702 |
}
|
703 |
}
|
704 |
-
|
705 |
-
|
706 |
-
// # Get all Product Post Meta and Their Values
|
707 |
-
// $metas=get_post_meta($id);
|
708 |
-
// if(!empty($metas)){
|
709 |
-
// foreach ($metas as $mKey=>$meta){
|
710 |
-
// if($mKey!="_product_attributes"){
|
711 |
-
// $metaValue=get_post_meta($id,$mKey,true);
|
712 |
-
// $this->productsList[ $this->pi ]["wf_cattr_".$mKey]=(!empty($metaValue))?$metaValue:"";
|
713 |
-
// }
|
714 |
-
// }
|
715 |
-
// }
|
716 |
-
//
|
717 |
-
// # Get all Product Taxonomies and Their values
|
718 |
-
// $taxonomies=get_post_taxonomies($id);
|
719 |
-
// if(!empty($taxonomies)){
|
720 |
-
// foreach ($taxonomies as $tKey=>$taxonomy){
|
721 |
-
// $this->productsList[ $this->pi ]["wf_taxo_".$taxonomy]=strip_tags(get_the_term_list($id,$taxonomy,"",",",""));
|
722 |
-
// }
|
723 |
-
// }
|
724 |
}
|
725 |
|
726 |
$this->pi ++;
|
727 |
}
|
728 |
|
729 |
-
|
730 |
return $this->productsList;
|
731 |
-
}catch (Exception $e){
|
732 |
|
733 |
-
}
|
|
|
|
|
734 |
}
|
735 |
|
736 |
/**
|
@@ -882,595 +772,595 @@ class Woo_Feed_Products
|
|
882 |
}
|
883 |
|
884 |
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
|
1475 |
/**
|
1476 |
* Remove ShortCodes from contents
|
@@ -1481,7 +1371,7 @@ class Woo_Feed_Products
|
|
1481 |
public function remove_short_codes($content)
|
1482 |
{
|
1483 |
if(empty($content)){
|
1484 |
-
|
1485 |
}
|
1486 |
|
1487 |
if(class_exists("WPBMap")){
|
@@ -1493,136 +1383,136 @@ class Woo_Feed_Products
|
|
1493 |
|
1494 |
}
|
1495 |
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
|
1627 |
/**
|
1628 |
* Ger Product Attribute
|
@@ -1678,19 +1568,19 @@ class Woo_Feed_Products
|
|
1678 |
}
|
1679 |
}
|
1680 |
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
// if (strpos($name, 'attribute_pa') !== false) {
|
1695 |
// $taxonomy = str_replace("attribute_","",$name);
|
1696 |
// $meta = get_post_meta($id,$name, true);
|
@@ -1699,392 +1589,390 @@ class Woo_Feed_Products
|
|
1699 |
// }else{
|
1700 |
// return get_post_meta($id, $name, true);
|
1701 |
// }
|
|
|
1702 |
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
//Load the main attributes
|
1727 |
-
$sql = '
|
1728 |
SELECT attribute_name as name, attribute_type as type
|
1729 |
FROM ' . $wpdb->prefix . 'woocommerce_attribute_taxonomies';
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
|
|
1751 |
FROM " . $wpdb->prefix . "postmeta" . " group by meta_key";
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
LEFT JOIN $wpdb->terms terms ON (terms.term_id = taxo.term_id) GROUP BY taxo.taxonomy";
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
1836 |
-
|
1837 |
-
|
1838 |
-
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
1950 |
-
|
1951 |
-
|
1952 |
-
|
1953 |
-
|
1954 |
-
|
1955 |
-
|
1956 |
-
|
1957 |
-
|
1958 |
-
|
1959 |
-
|
1960 |
-
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
-
|
1965 |
-
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
|
1971 |
-
|
1972 |
-
|
1973 |
-
|
1974 |
-
|
1975 |
-
|
1976 |
-
|
1977 |
-
|
1978 |
-
|
1979 |
-
|
1980 |
-
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
-
|
2009 |
-
|
2010 |
-
|
2011 |
-
|
2012 |
-
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
2040 |
-
|
2041 |
-
|
2042 |
-
|
2043 |
-
|
2044 |
-
|
2045 |
-
|
2046 |
-
|
2047 |
-
|
2048 |
-
|
2049 |
-
|
2050 |
-
|
2051 |
-
|
2052 |
-
|
2053 |
-
|
2054 |
-
|
2055 |
-
|
2056 |
-
|
2057 |
-
|
2058 |
-
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
-
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
2066 |
-
|
2067 |
-
|
2068 |
-
|
2069 |
-
|
2070 |
-
|
2071 |
-
|
2072 |
-
|
2073 |
-
|
2074 |
-
|
2075 |
-
|
2076 |
-
|
2077 |
-
|
2078 |
-
|
2079 |
-
|
2080 |
-
|
2081 |
-
|
2082 |
-
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
return false;
|
2089 |
-
}
|
2090 |
}
|
11 |
class Woo_Feed_Products
|
12 |
{
|
13 |
|
14 |
+
/**
|
15 |
+
* Contain all parent product information for the plugin.
|
16 |
+
*
|
17 |
+
* @since 1.0.0
|
18 |
+
* @access protected
|
19 |
+
* @var string $parent Contain all parent product information for the plugin.
|
20 |
+
*/
|
21 |
+
public $parent;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Contain all child product information for the plugin.
|
25 |
+
*
|
26 |
+
* @since 1.0.0
|
27 |
+
* @access protected
|
28 |
+
* @var string $parent Contain all child product information for the plugin.
|
29 |
+
*/
|
30 |
+
public $child;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* The parent id of current product.
|
34 |
+
*
|
35 |
+
* @since 1.0.0
|
36 |
+
* @access private
|
37 |
+
* @var string $parentID The current product's Parent ID.
|
38 |
+
*/
|
39 |
+
public $parentID;
|
40 |
+
/**
|
41 |
+
* The child id of current product.
|
42 |
+
*
|
43 |
+
* @since 1.0.0
|
44 |
+
* @access private
|
45 |
+
* @var string $parentID The current product's child ID.
|
46 |
+
*/
|
47 |
+
public $childID;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* The Variable that contain all products.
|
51 |
+
*
|
52 |
+
* @since 1.0.0
|
53 |
+
* @access private
|
54 |
+
* @var array $productsList Products list array.
|
55 |
+
*/
|
56 |
+
public $productsList;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* The Variable that contain all attributes.
|
60 |
+
*
|
61 |
+
* @since 1.0.0
|
62 |
+
* @access private
|
63 |
+
* @var array $attributeList attributes list array.
|
64 |
+
*/
|
65 |
+
public $attributeList;
|
66 |
+
|
67 |
+
public $feedRule;
|
68 |
+
public $idExist=array();
|
69 |
public $pi;
|
70 |
|
71 |
|
117 |
$offset = ! empty( $offset ) && is_numeric( $offset ) ? absint( $offset ) : '0';
|
118 |
|
119 |
|
120 |
+
// try {
|
121 |
|
122 |
|
123 |
# Query Arguments
|
142 |
$products = $query->get_products();
|
143 |
|
144 |
//$products = $this->wooProductQuery($arg);
|
145 |
+
//return $products;
|
146 |
|
147 |
$this->pi = 1; # Product Index
|
148 |
foreach ( $products as $key => $productId ) {
|
155 |
|
156 |
$simple = new WC_Product_Simple( $id );
|
157 |
|
158 |
+
if($simple->get_status()!="publish"){
|
159 |
continue;
|
160 |
}
|
161 |
|
236 |
$this->productsList[ $this->pi ][$aKey] = $simple->get_attribute($aKey);
|
237 |
}
|
238 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
}
|
240 |
else if ( $prod->is_type( 'external' ) ) {
|
241 |
|
242 |
$external = new WC_Product_External( $id );
|
243 |
|
244 |
+
if($external->get_status()!="publish"){
|
245 |
continue;
|
246 |
}
|
247 |
|
323 |
$this->productsList[ $this->pi ][$aKey] = $external->get_attribute($aKey);
|
324 |
}
|
325 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
}
|
327 |
else if ( $prod->is_type( 'grouped' ) ) {
|
328 |
|
329 |
$grouped = new WC_Product_Grouped( $id );
|
330 |
|
331 |
+
if($grouped->get_status()!="publish"){
|
332 |
continue;
|
333 |
}
|
334 |
|
410 |
}
|
411 |
}
|
412 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
}
|
414 |
else if ( $prod->is_type( 'variable' ) ) {
|
415 |
|
416 |
$variable = new WC_Product_Variable( $id );
|
417 |
|
418 |
+
if($variable->get_status()!="publish"){
|
419 |
continue;
|
420 |
}
|
421 |
|
422 |
|
|
|
|
|
|
|
|
|
423 |
$this->productsList[ $this->pi ]["id"] = $variable->get_id();
|
424 |
$this->productsList[ $this->pi ]["title"] = $variable->get_name();
|
425 |
$this->productsList[ $this->pi ]["description"] = $this->remove_short_codes($variable->get_description());
|
467 |
$this->productsList[ $this->pi ]['sku'] = $variable->get_sku();
|
468 |
$this->productsList[ $this->pi ]['availability'] = $this->availability( $id );
|
469 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
470 |
|
471 |
$this->productsList[ $this->pi ]['quantity'] = $variable->get_stock_quantity();
|
472 |
$this->productsList[ $this->pi ]['sale_price_sdate'] = $variable->get_date_on_sale_from();
|
499 |
$this->productsList[ $this->pi ][$aKey] = $variable->get_attribute($aKey);
|
500 |
}
|
501 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
502 |
}
|
503 |
else if ( $prod->is_type( 'variation' ) && $this->feedRule['provider'] != 'facebook') {
|
504 |
$variation=new WC_Product_Variation($id);
|
505 |
|
506 |
+
# Parent Info
|
507 |
+
$parent=new WC_Product_Variable($variation->get_parent_id());
|
508 |
+
|
509 |
+
# Skip if not a valid product
|
510 |
+
if(!$variation->variation_is_visible()){
|
511 |
+
continue;
|
512 |
+
}
|
513 |
+
|
514 |
+
if($parent->get_status()!="publish"){
|
515 |
continue;
|
516 |
}
|
517 |
|
|
|
|
|
518 |
$parentInfo=$variation->get_parent_data();
|
519 |
$variationTitle= $parentInfo['title'];
|
520 |
|
611 |
$this->productsList[ $this->pi ][$aKey] = $variation->get_attribute($aKey);
|
612 |
}
|
613 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
614 |
}
|
615 |
|
616 |
$this->pi ++;
|
617 |
}
|
618 |
|
|
|
619 |
return $this->productsList;
|
|
|
620 |
|
621 |
+
// }catch (Exception $e){
|
622 |
+
// return $this->productsList;
|
623 |
+
// }
|
624 |
}
|
625 |
|
626 |
/**
|
772 |
}
|
773 |
|
774 |
|
775 |
+
/**
|
776 |
+
* Get WooCommerce Product
|
777 |
+
* @param string $feedRule
|
778 |
+
* @return array
|
779 |
+
*/
|
780 |
+
public function woo_feed_get_visible_product($feedRule="")
|
781 |
+
{
|
782 |
+
$this->feedRule = $feedRule;
|
783 |
+
$limit = ! empty( $feedRule['Limit'] ) && is_numeric( $feedRule['Limit'] ) ? absint( $feedRule['Limit'] ) : '2000';
|
784 |
+
$offset = ! empty( $feedRule['Offset'] ) && is_numeric( $feedRule['Offset'] ) ? absint( $feedRule['Offset'] ) : '0';
|
785 |
+
# WC 3.1+ Compatibility
|
786 |
+
|
787 |
+
if ( woo_feed_wc_version_check(3.1) ) {
|
788 |
+
|
789 |
+
return $this->getWC3Products( $limit, $offset);
|
790 |
+
|
791 |
+
} else {
|
792 |
+
try {
|
793 |
+
|
794 |
+
if ( ! empty( $feedRule ) ) {
|
795 |
+
$this->feedRule = $feedRule;
|
796 |
+
}
|
797 |
+
|
798 |
+
|
799 |
+
if ( $offset == '0' ) {
|
800 |
+
delete_option( "wf_check_duplicate" );
|
801 |
+
}
|
802 |
+
$getIDs = get_option( "wf_check_duplicate" );
|
803 |
+
$arg = array(
|
804 |
+
'post_type' => array( 'product', 'product_variation' ),
|
805 |
+
'post_status' => 'publish',
|
806 |
+
'posts_per_page' => $limit,
|
807 |
+
'orderby' => 'date',
|
808 |
+
'order' => 'desc',
|
809 |
+
'fields' => 'ids',
|
810 |
+
'offset' => $offset,
|
811 |
+
'cache_results' => false,
|
812 |
+
'update_post_term_cache' => false,
|
813 |
+
'update_post_meta_cache' => false,
|
814 |
+
);
|
815 |
+
|
816 |
+
|
817 |
+
# Query Database for products
|
818 |
+
$loop = new WP_Query( $arg );
|
819 |
+
|
820 |
+
$i = 0;
|
821 |
+
|
822 |
+
while ( $loop->have_posts() ) : $loop->the_post();
|
823 |
+
|
824 |
+
$this->childID = get_the_ID();
|
825 |
+
$this->parentID = ( wp_get_post_parent_id( $this->childID ) ) ? wp_get_post_parent_id( $this->childID ) : $this->childID;
|
826 |
+
|
827 |
+
global $product;
|
828 |
+
if ( ! is_object( $product ) || ! $product->is_visible() ) {
|
829 |
+
continue;
|
830 |
+
}
|
831 |
+
|
832 |
+
$type1 = "";
|
833 |
+
if ( is_object( $product ) && $product->is_type( 'simple' ) ) {
|
834 |
+
# No variations to product
|
835 |
+
$type1 = "simple";
|
836 |
+
} elseif ( is_object( $product ) && $product->is_type( 'variable' ) ) {
|
837 |
+
# Product has variations
|
838 |
+
$type1 = "variable";
|
839 |
+
} elseif ( is_object( $product ) && $product->is_type( 'grouped' ) ) {
|
840 |
+
$type1 = "grouped";
|
841 |
+
} elseif ( is_object( $product ) && $product->is_type( 'external' ) ) {
|
842 |
+
$type1 = "external";
|
843 |
+
} elseif ( is_object( $product ) && $product->is_downloadable() ) {
|
844 |
+
$type1 = "downloadable";
|
845 |
+
} elseif ( is_object( $product ) && $product->is_virtual() ) {
|
846 |
+
$type1 = "virtual";
|
847 |
+
}
|
848 |
+
|
849 |
+
|
850 |
+
$post = get_post( $this->parentID );
|
851 |
+
|
852 |
+
if ( ! is_object( $post ) ) {
|
853 |
+
continue;
|
854 |
+
}
|
855 |
+
|
856 |
+
if ( $post->post_status == 'trash' ) {
|
857 |
+
continue;
|
858 |
+
}
|
859 |
+
|
860 |
+
|
861 |
+
if ( get_post_type() == 'product_variation' && $this->feedRule['provider'] != 'facebook' ) {
|
862 |
+
if ( $this->parentID != 0 ) {
|
863 |
+
|
864 |
+
$status = get_post( $this->childID );
|
865 |
+
if ( ! $status || ! is_object( $status ) ) {
|
866 |
+
continue;
|
867 |
+
}
|
868 |
+
|
869 |
+
if ( $status->post_status == "trash" ) {
|
870 |
+
continue;
|
871 |
+
}
|
872 |
+
|
873 |
+
$parentStatus = get_post( $this->parentID );
|
874 |
+
if ( $parentStatus && is_object( $parentStatus ) && $parentStatus->post_status != 'publish' ) {
|
875 |
+
continue;
|
876 |
+
}
|
877 |
+
|
878 |
+
# Check Valid URL
|
879 |
+
$mainImage = wp_get_attachment_url( $product->get_image_id() );
|
880 |
+
$link = $product->get_permalink( $this->childID );
|
881 |
+
|
882 |
+
if ( $this->feedRule['provider'] != 'custom' ) {
|
883 |
+
if ( substr( trim( $link ), 0, 4 ) !== "http" && substr( trim( $mainImage ), 0, 4 ) !== "http" ) {
|
884 |
+
continue;
|
885 |
+
}
|
886 |
+
}
|
887 |
+
|
888 |
+
if ( $getIDs ) {
|
889 |
+
if ( in_array( $this->childID, $getIDs ) ) {
|
890 |
+
continue;
|
891 |
+
} else {
|
892 |
+
array_push( $this->idExist, $this->childID );
|
893 |
+
}
|
894 |
+
} else {
|
895 |
+
array_push( $this->idExist, $this->childID );
|
896 |
+
}
|
897 |
+
|
898 |
+
|
899 |
+
$this->productsList[ $i ]['id'] = $this->childID;
|
900 |
+
$this->productsList[ $i ]['variation_type'] = "child";
|
901 |
+
$this->productsList[ $i ]['item_group_id'] = $this->parentID;
|
902 |
+
$this->productsList[ $i ]['sku'] = $this->getAttributeValue( $this->childID, "_sku" );
|
903 |
+
$this->productsList[ $i ]['parent_sku'] = $this->getAttributeValue( $this->parentID, "_sku" );
|
904 |
+
$this->productsList[ $i ]['title'] = $post->post_title;
|
905 |
+
$this->productsList[ $i ]['description'] = $post->post_content;
|
906 |
+
|
907 |
+
# Short Description to variable description
|
908 |
+
$vDesc = $this->getAttributeValue( $this->childID, "_variation_description" );
|
909 |
+
if ( ! empty( $vDesc ) ) {
|
910 |
+
$this->productsList[ $i ]['short_description'] = $vDesc;
|
911 |
+
} else {
|
912 |
+
$this->productsList[ $i ]['short_description'] = $post->post_excerpt;
|
913 |
+
}
|
914 |
+
|
915 |
+
$this->productsList[ $i ]['product_type'] = $this->get_product_term_list( $post->ID, 'product_cat', "", ">" );
|
916 |
+
$this->productsList[ $i ]['link'] = $link;
|
917 |
+
$this->productsList[ $i ]['ex_link'] = "";
|
918 |
+
$this->productsList[ $i ]['image'] = $this->get_formatted_url( $mainImage );
|
919 |
+
|
920 |
+
# Featured Image
|
921 |
+
if ( has_post_thumbnail( $post->ID ) ):
|
922 |
+
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
|
923 |
+
$this->productsList[ $i ]['feature_image'] = $this->get_formatted_url( $image[0] );
|
924 |
+
else:
|
925 |
+
$this->productsList[ $i ]['feature_image'] = $this->get_formatted_url( $mainImage );
|
926 |
+
endif;
|
927 |
+
|
928 |
+
# Additional Images
|
929 |
+
$imageLinks = array();
|
930 |
+
$images = $this->additionalImages( $this->childID );
|
931 |
+
if ( $images && is_array( $images ) ) {
|
932 |
+
$mKey = 1;
|
933 |
+
foreach ( $images as $key => $value ) {
|
934 |
+
if ( $value != $this->productsList[ $i ]['image'] ) {
|
935 |
+
$imgLink = $this->get_formatted_url( $value );
|
936 |
+
$this->productsList[ $i ]["image_$mKey"] = $imgLink;
|
937 |
+
if ( ! empty( $imgLink ) ) {
|
938 |
+
array_push( $imageLinks, $imgLink );
|
939 |
+
}
|
940 |
+
}
|
941 |
+
$mKey ++;
|
942 |
+
}
|
943 |
+
}
|
944 |
+
$this->productsList[ $i ]['images'] = implode( ",", $imageLinks );
|
945 |
+
$this->productsList[ $i ]['condition'] = "New";
|
946 |
+
$this->productsList[ $i ]['type'] = $product->get_type();
|
947 |
+
$this->productsList[ $i ]['visibility'] = $this->getAttributeValue( $this->childID, "_visibility" );
|
948 |
+
$this->productsList[ $i ]['rating_total'] = $product->get_rating_count();
|
949 |
+
$this->productsList[ $i ]['rating_average'] = $product->get_average_rating();
|
950 |
+
$this->productsList[ $i ]['tags'] = $this->get_product_term_list( $post->ID, 'product_tag' );
|
951 |
+
$this->productsList[ $i ]['shipping'] = $product->get_shipping_class();
|
952 |
+
|
953 |
+
$this->productsList[ $i ]['availability'] = $this->availability( $this->childID );
|
954 |
+
$this->productsList[ $i ]['quantity'] = $this->get_quantity( $this->childID, "_stock" );
|
955 |
+
$this->productsList[ $i ]['sale_price_sdate'] = $this->get_date( $this->childID, "_sale_price_dates_from" );
|
956 |
+
$this->productsList[ $i ]['sale_price_edate'] = $this->get_date( $this->childID, "_sale_price_dates_to" );
|
957 |
+
$this->productsList[ $i ]['price'] = ( $product->get_regular_price() ) ? $product->get_regular_price() : $product->get_price();
|
958 |
+
$this->productsList[ $i ]['sale_price'] = ( $product->get_sale_price() ) ? $product->get_sale_price() : "";
|
959 |
+
$this->productsList[ $i ]['weight'] = ( $product->get_weight() ) ? $product->get_weight() : "";
|
960 |
+
$this->productsList[ $i ]['width'] = ( $product->get_width() ) ? $product->get_width() : "";
|
961 |
+
$this->productsList[ $i ]['height'] = ( $product->get_height() ) ? $product->get_height() : "";
|
962 |
+
$this->productsList[ $i ]['length'] = ( $product->get_length() ) ? $product->get_length() : "";
|
963 |
+
|
964 |
+
# Sale price effective date
|
965 |
+
$from = $this->sale_price_effective_date( $this->childID, '_sale_price_dates_from' );
|
966 |
+
$to = $this->sale_price_effective_date( $this->childID, '_sale_price_dates_to' );
|
967 |
+
if ( ! empty( $from ) && ! empty( $to ) ) {
|
968 |
+
$from = date( "c", strtotime( $from ) );
|
969 |
+
$to = date( "c", strtotime( $to ) );
|
970 |
+
$this->productsList[ $i ]['sale_price_effective_date'] = "$from" . "/" . "$to";
|
971 |
+
} else {
|
972 |
+
$this->productsList[ $i ]['sale_price_effective_date'] = "";
|
973 |
+
}
|
974 |
+
|
975 |
+
}
|
976 |
+
} elseif ( get_post_type() == 'product' ) {
|
977 |
+
if ( $type1 == 'simple' ) {
|
978 |
+
|
979 |
+
$mainImage = wp_get_attachment_url( $product->get_image_id() );
|
980 |
+
$link = get_permalink( $post->ID );
|
981 |
+
|
982 |
+
if ( $this->feedRule['provider'] != 'custom' ) {
|
983 |
+
if ( substr( trim( $link ), 0, 4 ) !== "http" && substr( trim( $mainImage ), 0, 4 ) !== "http" ) {
|
984 |
+
continue;
|
985 |
+
}
|
986 |
+
}
|
987 |
+
|
988 |
+
if ( $getIDs ) {
|
989 |
+
if ( in_array( $post->ID, $getIDs ) ) {
|
990 |
+
continue;
|
991 |
+
} else {
|
992 |
+
array_push( $this->idExist, $post->ID );
|
993 |
+
}
|
994 |
+
} else {
|
995 |
+
array_push( $this->idExist, $post->ID );
|
996 |
+
}
|
997 |
+
|
998 |
+
$this->productsList[ $i ]['id'] = $post->ID;
|
999 |
+
$this->productsList[ $i ]['variation_type'] = "simple";
|
1000 |
+
$this->productsList[ $i ]['title'] = $post->post_title;
|
1001 |
+
$this->productsList[ $i ]['description'] = $post->post_content;
|
1002 |
+
|
1003 |
+
$this->productsList[ $i ]['short_description'] = $post->post_excerpt;
|
1004 |
+
$this->productsList[ $i ]['product_type'] = $this->get_product_term_list( $post->ID, 'product_cat', "", ">" );
|
1005 |
+
$this->productsList[ $i ]['link'] = $link;
|
1006 |
+
$this->productsList[ $i ]['ex_link'] = "";
|
1007 |
+
$this->productsList[ $i ]['image'] = $this->get_formatted_url( $mainImage );
|
1008 |
+
|
1009 |
+
# Featured Image
|
1010 |
+
if ( has_post_thumbnail( $post->ID ) ):
|
1011 |
+
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
|
1012 |
+
$this->productsList[ $i ]['feature_image'] = $this->get_formatted_url( $image[0] );
|
1013 |
+
else:
|
1014 |
+
$this->productsList[ $i ]['feature_image'] = $this->get_formatted_url( $mainImage );
|
1015 |
+
endif;
|
1016 |
+
|
1017 |
+
# Additional Images
|
1018 |
+
$imageLinks = array();
|
1019 |
+
$images = $this->additionalImages( $post->ID );
|
1020 |
+
if ( $images && is_array( $images ) ) {
|
1021 |
+
$mKey = 1;
|
1022 |
+
foreach ( $images as $key => $value ) {
|
1023 |
+
if ( $value != $this->productsList[ $i ]['image'] ) {
|
1024 |
+
$imgLink = $this->get_formatted_url( $value );
|
1025 |
+
$this->productsList[ $i ]["image_$mKey"] = $imgLink;
|
1026 |
+
if ( ! empty( $imgLink ) ) {
|
1027 |
+
array_push( $imageLinks, $imgLink );
|
1028 |
+
}
|
1029 |
+
}
|
1030 |
+
$mKey ++;
|
1031 |
+
}
|
1032 |
+
}
|
1033 |
+
$this->productsList[ $i ]['images'] = implode( ",", $imageLinks );
|
1034 |
+
|
1035 |
+
$this->productsList[ $i ]['condition'] = "New";
|
1036 |
+
$this->productsList[ $i ]['type'] = $product->get_type();
|
1037 |
+
$this->productsList[ $i ]['visibility'] = $this->getAttributeValue( $post->ID, "_visibility" );
|
1038 |
+
$this->productsList[ $i ]['rating_total'] = $product->get_rating_count();
|
1039 |
+
$this->productsList[ $i ]['rating_average'] = $product->get_average_rating();
|
1040 |
+
$this->productsList[ $i ]['tags'] = $this->get_product_term_list( $post->ID, 'product_tag' );
|
1041 |
+
|
1042 |
+
$this->productsList[ $i ]['item_group_id'] = $post->ID;
|
1043 |
+
$this->productsList[ $i ]['sku'] = $this->getAttributeValue( $post->ID, "_sku" );
|
1044 |
+
|
1045 |
+
$this->productsList[ $i ]['availability'] = $this->availability( $post->ID );
|
1046 |
+
$this->productsList[ $i ]['quantity'] = $this->get_quantity( $post->ID, "_stock" );
|
1047 |
+
$this->productsList[ $i ]['sale_price_sdate'] = $this->get_date( $post->ID, "_sale_price_dates_from" );
|
1048 |
+
$this->productsList[ $i ]['sale_price_edate'] = $this->get_date( $post->ID, "_sale_price_dates_to" );
|
1049 |
+
$this->productsList[ $i ]['price'] = ( $product->get_regular_price() ) ? $product->get_regular_price() : $product->get_price();
|
1050 |
+
$this->productsList[ $i ]['sale_price'] = ( $product->get_sale_price() ) ? $product->get_sale_price() : "";
|
1051 |
+
$this->productsList[ $i ]['weight'] = ( $product->get_weight() ) ? $product->get_weight() : "";
|
1052 |
+
$this->productsList[ $i ]['width'] = ( $product->get_width() ) ? $product->get_width() : "";
|
1053 |
+
$this->productsList[ $i ]['height'] = ( $product->get_height() ) ? $product->get_height() : "";
|
1054 |
+
$this->productsList[ $i ]['length'] = ( $product->get_length() ) ? $product->get_length() : "";
|
1055 |
+
|
1056 |
+
# Sale price effective date
|
1057 |
+
$from = $this->sale_price_effective_date( $post->ID, '_sale_price_dates_from' );
|
1058 |
+
$to = $this->sale_price_effective_date( $post->ID, '_sale_price_dates_to' );
|
1059 |
+
if ( ! empty( $from ) && ! empty( $to ) ) {
|
1060 |
+
$from = date( "c", strtotime( $from ) );
|
1061 |
+
$to = date( "c", strtotime( $to ) );
|
1062 |
+
$this->productsList[ $i ]['sale_price_effective_date'] = "$from" . "/" . "$to";
|
1063 |
+
} else {
|
1064 |
+
$this->productsList[ $i ]['sale_price_effective_date'] = "";
|
1065 |
+
}
|
1066 |
+
|
1067 |
+
}
|
1068 |
+
else if ( $type1 == 'external' ) {
|
1069 |
+
|
1070 |
+
$mainImage = wp_get_attachment_url( $product->get_image_id() );
|
1071 |
+
|
1072 |
+
$getLink = new WC_Product_External( $post->ID );
|
1073 |
+
$EX_link = $getLink->get_product_url();
|
1074 |
+
$link = get_permalink( $post->ID );
|
1075 |
+
if ( $this->feedRule['provider'] != 'custom' ) {
|
1076 |
+
if ( substr( trim( $link ), 0, 4 ) !== "http" && substr( trim( $mainImage ), 0, 4 ) !== "http" ) {
|
1077 |
+
continue;
|
1078 |
+
}
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
$this->productsList[ $i ]['id'] = $post->ID;
|
1082 |
+
$this->productsList[ $i ]['variation_type'] = "external";
|
1083 |
+
$this->productsList[ $i ]['title'] =$post->post_title;
|
1084 |
+
$this->productsList[ $i ]['description'] = do_shortcode( $post->post_content );
|
1085 |
+
|
1086 |
+
$this->productsList[ $i ]['short_description'] = $post->post_excerpt;
|
1087 |
+
$this->productsList[ $i ]['product_type'] = $this->get_product_term_list( $post->ID, 'product_cat', "", ">" );
|
1088 |
+
$this->productsList[ $i ]['link'] = $link;
|
1089 |
+
$this->productsList[ $i ]['ex_link'] = $EX_link;
|
1090 |
+
$this->productsList[ $i ]['image'] = $this->get_formatted_url( $mainImage );
|
1091 |
+
|
1092 |
+
# Featured Image
|
1093 |
+
if ( has_post_thumbnail( $post->ID ) ):
|
1094 |
+
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
|
1095 |
+
$this->productsList[ $i ]['feature_image'] = $this->get_formatted_url( $image[0] );
|
1096 |
+
else:
|
1097 |
+
$this->productsList[ $i ]['feature_image'] = $this->get_formatted_url( $mainImage );
|
1098 |
+
endif;
|
1099 |
+
|
1100 |
+
# Additional Images
|
1101 |
+
$imageLinks = array();
|
1102 |
+
$images = $this->additionalImages( $post->ID );
|
1103 |
+
if ( $images && is_array( $images ) ) {
|
1104 |
+
$mKey = 1;
|
1105 |
+
foreach ( $images as $key => $value ) {
|
1106 |
+
if ( $value != $this->productsList[ $i ]['image'] ) {
|
1107 |
+
$imgLink = $this->get_formatted_url( $value );
|
1108 |
+
$this->productsList[ $i ]["image_$mKey"] = $imgLink;
|
1109 |
+
if ( ! empty( $imgLink ) ) {
|
1110 |
+
array_push( $imageLinks, $imgLink );
|
1111 |
+
}
|
1112 |
+
}
|
1113 |
+
$mKey ++;
|
1114 |
+
}
|
1115 |
+
}
|
1116 |
+
$this->productsList[ $i ]['images'] = implode( ",", $imageLinks );
|
1117 |
+
|
1118 |
+
$this->productsList[ $i ]['condition'] = "New";
|
1119 |
+
$this->productsList[ $i ]['type'] = $product->get_type();
|
1120 |
+
$this->productsList[ $i ]['visibility'] = $this->getAttributeValue( $post->ID, "_visibility" );
|
1121 |
+
$this->productsList[ $i ]['rating_total'] = $product->get_rating_count();
|
1122 |
+
$this->productsList[ $i ]['rating_average'] = $product->get_average_rating();
|
1123 |
+
$this->productsList[ $i ]['tags'] = $this->get_product_term_list( $post->ID, 'product_tag' );
|
1124 |
+
|
1125 |
+
$this->productsList[ $i ]['item_group_id'] = $post->ID;
|
1126 |
+
$this->productsList[ $i ]['sku'] = $this->getAttributeValue( $post->ID, "_sku" );
|
1127 |
+
|
1128 |
+
$this->productsList[ $i ]['availability'] = $this->availability( $post->ID );
|
1129 |
+
|
1130 |
+
$this->productsList[ $i ]['quantity'] = $this->get_quantity( $post->ID, "_stock" );
|
1131 |
+
$this->productsList[ $i ]['sale_price_sdate'] = $this->get_date( $post->ID, "_sale_price_dates_from" );
|
1132 |
+
$this->productsList[ $i ]['sale_price_edate'] = $this->get_date( $post->ID, "_sale_price_dates_to" );
|
1133 |
+
$this->productsList[ $i ]['price'] = ( $product->get_regular_price() ) ? $product->get_regular_price() : $product->get_price();
|
1134 |
+
$this->productsList[ $i ]['sale_price'] = ( $product->get_sale_price() ) ? $product->get_sale_price() : "";
|
1135 |
+
$this->productsList[ $i ]['weight'] = ( $product->get_weight() ) ? $product->get_weight() : "";
|
1136 |
+
$this->productsList[ $i ]['width'] = ( $product->get_width() ) ? $product->get_width() : "";
|
1137 |
+
$this->productsList[ $i ]['height'] = ( $product->get_height() ) ? $product->get_height() : "";
|
1138 |
+
$this->productsList[ $i ]['length'] = ( $product->get_length() ) ? $product->get_length() : "";
|
1139 |
+
|
1140 |
+
# Sale price effective date
|
1141 |
+
$from = $this->sale_price_effective_date( $post->ID, '_sale_price_dates_from' );
|
1142 |
+
$to = $this->sale_price_effective_date( $post->ID, '_sale_price_dates_to' );
|
1143 |
+
if ( ! empty( $from ) && ! empty( $to ) ) {
|
1144 |
+
$from = date( "c", strtotime( $from ) );
|
1145 |
+
$to = date( "c", strtotime( $to ) );
|
1146 |
+
$this->productsList[ $i ]['sale_price_effective_date'] = "$from" . "/" . "$to";
|
1147 |
+
} else {
|
1148 |
+
$this->productsList[ $i ]['sale_price_effective_date'] = "";
|
1149 |
+
}
|
1150 |
+
|
1151 |
+
}
|
1152 |
+
elseif ( $type1 == 'grouped' ) {
|
1153 |
+
|
1154 |
+
$grouped = new WC_Product_Grouped( $post->ID );
|
1155 |
+
$children = $grouped->get_children();
|
1156 |
+
$this->parentID = $post->ID;
|
1157 |
+
if ( $children ) {
|
1158 |
+
foreach ( $children as $cKey => $child ) {
|
1159 |
+
|
1160 |
+
$product = new WC_Product( $child );
|
1161 |
+
$this->childID = $child;
|
1162 |
+
$post = get_post( $this->childID );
|
1163 |
+
|
1164 |
+
if ( $post->post_status == 'trash' ) {
|
1165 |
+
continue;
|
1166 |
+
}
|
1167 |
+
|
1168 |
+
if ( ! empty( $this->ids_in ) && ! in_array( $post->ID, $this->ids_in ) ) {
|
1169 |
+
continue;
|
1170 |
+
}
|
1171 |
+
|
1172 |
+
if ( ! empty( $this->ids_not_in ) && in_array( $post->ID, $this->ids_in ) ) {
|
1173 |
+
continue;
|
1174 |
+
}
|
1175 |
+
|
1176 |
+
if ( ! $product->is_visible() ) {
|
1177 |
+
continue;
|
1178 |
+
}
|
1179 |
+
|
1180 |
+
$i ++;
|
1181 |
+
|
1182 |
+
$mainImage = wp_get_attachment_url( $product->get_image_id() );
|
1183 |
+
$link = get_permalink( $post->ID );
|
1184 |
+
if ( $this->feedRule['provider'] != 'custom' ) {
|
1185 |
+
if ( substr( trim( $link ), 0, 4 ) !== "http" && substr( trim( $mainImage ), 0, 4 ) !== "http" ) {
|
1186 |
+
continue;
|
1187 |
+
}
|
1188 |
+
}
|
1189 |
+
|
1190 |
+
$this->productsList[ $i ]['id'] = $post->ID;
|
1191 |
+
$this->productsList[ $i ]['variation_type'] = "grouped";
|
1192 |
+
$this->productsList[ $i ]['title'] = $post->post_title;
|
1193 |
+
$this->productsList[ $i ]['description'] = do_shortcode( $post->post_content );
|
1194 |
+
|
1195 |
+
$this->productsList[ $i ]['short_description'] = $post->post_excerpt;
|
1196 |
+
$this->productsList[ $i ]['product_type'] = $this->get_product_term_list( $post->ID, 'product_cat', "", ">" );
|
1197 |
+
$this->productsList[ $i ]['link'] = $link;
|
1198 |
+
$this->productsList[ $i ]['ex_link'] = "";
|
1199 |
+
$this->productsList[ $i ]['image'] = $this->get_formatted_url( $mainImage );
|
1200 |
+
|
1201 |
+
# Featured Image
|
1202 |
+
if ( has_post_thumbnail( $post->ID ) ):
|
1203 |
+
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
|
1204 |
+
$this->productsList[ $i ]['feature_image'] = $this->get_formatted_url( $image[0] );
|
1205 |
+
else:
|
1206 |
+
$this->productsList[ $i ]['feature_image'] = $this->get_formatted_url( $mainImage );
|
1207 |
+
endif;
|
1208 |
+
|
1209 |
+
# Additional Images
|
1210 |
+
$imageLinks = array();
|
1211 |
+
$images = $this->additionalImages( $this->childID );
|
1212 |
+
if ( $images and is_array( $images ) ) {
|
1213 |
+
$mKey = 1;
|
1214 |
+
foreach ( $images as $key => $value ) {
|
1215 |
+
if ( $value != $this->productsList[ $i ]['image'] ) {
|
1216 |
+
$imgLink = $this->get_formatted_url( $value );
|
1217 |
+
$this->productsList[ $i ]["image_$mKey"] = $imgLink;
|
1218 |
+
if ( ! empty( $imgLink ) ) {
|
1219 |
+
array_push( $imageLinks, $imgLink );
|
1220 |
+
}
|
1221 |
+
}
|
1222 |
+
$mKey ++;
|
1223 |
+
}
|
1224 |
+
}
|
1225 |
+
$this->productsList[ $i ]['images'] = implode( ",", $imageLinks );
|
1226 |
+
$this->productsList[ $i ]['condition'] = "New";
|
1227 |
+
$this->productsList[ $i ]['type'] = $product->get_type();
|
1228 |
+
$this->productsList[ $i ]['visibility'] = $this->getAttributeValue( $post->ID, "_visibility" );
|
1229 |
+
$this->productsList[ $i ]['rating_total'] = $product->get_rating_count();
|
1230 |
+
$this->productsList[ $i ]['rating_average'] = $product->get_average_rating();
|
1231 |
+
$this->productsList[ $i ]['tags'] = $this->get_product_term_list( $post->ID, 'product_tag' );
|
1232 |
+
|
1233 |
+
$this->productsList[ $i ]['item_group_id'] = $this->parentID;
|
1234 |
+
$this->productsList[ $i ]['sku'] = $this->getAttributeValue( $post->ID, "_sku" );
|
1235 |
+
|
1236 |
+
$this->productsList[ $i ]['availability'] = $this->availability( $post->ID );
|
1237 |
+
|
1238 |
+
$this->productsList[ $i ]['quantity'] = $this->get_quantity( $post->ID, "_stock" );
|
1239 |
+
$this->productsList[ $i ]['sale_price_sdate'] = $this->get_date( $post->ID, "_sale_price_dates_from" );
|
1240 |
+
$this->productsList[ $i ]['sale_price_edate'] = $this->get_date( $post->ID, "_sale_price_dates_to" );
|
1241 |
+
$this->productsList[ $i ]['price'] = ( $product->get_regular_price() ) ? $product->get_regular_price() : $product->get_price();
|
1242 |
+
$this->productsList[ $i ]['sale_price'] = ( $product->get_sale_price() ) ? $product->get_sale_price() : "";
|
1243 |
+
$this->productsList[ $i ]['weight'] = ( $product->get_weight() ) ? $product->get_weight() : "";
|
1244 |
+
$this->productsList[ $i ]['width'] = ( $product->get_width() ) ? $product->get_width() : "";
|
1245 |
+
$this->productsList[ $i ]['height'] = ( $product->get_height() ) ? $product->get_height() : "";
|
1246 |
+
$this->productsList[ $i ]['length'] = ( $product->get_length() ) ? $product->get_length() : "";
|
1247 |
+
|
1248 |
+
# Sale price effective date
|
1249 |
+
$from = $this->sale_price_effective_date( $post->ID, '_sale_price_dates_from' );
|
1250 |
+
$to = $this->sale_price_effective_date( $post->ID, '_sale_price_dates_to' );
|
1251 |
+
if ( ! empty( $from ) && ! empty( $to ) ) {
|
1252 |
+
$from = date( "c", strtotime( $from ) );
|
1253 |
+
$to = date( "c", strtotime( $to ) );
|
1254 |
+
$this->productsList[ $i ]['sale_price_effective_date'] = "$from" . "/" . "$to";
|
1255 |
+
} else {
|
1256 |
+
$this->productsList[ $i ]['sale_price_effective_date'] = "";
|
1257 |
+
}
|
1258 |
+
}
|
1259 |
+
}
|
1260 |
+
}
|
1261 |
+
else if ( $type1 == 'variable' && $product->has_child() ) {
|
1262 |
+
|
1263 |
+
# Check Valid URL
|
1264 |
+
$mainImage = wp_get_attachment_url( $product->get_image_id() );
|
1265 |
+
$link = get_permalink( $post->ID );
|
1266 |
+
|
1267 |
+
if ( $this->feedRule['provider'] != 'custom' ) {
|
1268 |
+
if ( substr( trim( $link ), 0, 4 ) !== "http" && substr( trim( $mainImage ), 0, 4 ) !== "http" ) {
|
1269 |
+
continue;
|
1270 |
+
}
|
1271 |
+
}
|
1272 |
+
|
1273 |
+
|
1274 |
+
$this->productsList[ $i ]['id'] = $post->ID;
|
1275 |
+
$this->productsList[ $i ]['variation_type'] = "parent";
|
1276 |
+
$this->productsList[ $i ]['title'] = $post->post_title;
|
1277 |
+
$this->productsList[ $i ]['description'] = $post->post_content;
|
1278 |
+
|
1279 |
+
$this->productsList[ $i ]['short_description'] = $post->post_excerpt;
|
1280 |
+
$this->productsList[ $i ]['product_type'] = $this->get_product_term_list( $post->ID, 'product_cat', "", ">" );
|
1281 |
+
$this->productsList[ $i ]['link'] = $link;
|
1282 |
+
$this->productsList[ $i ]['ex_link'] = "";
|
1283 |
+
$this->productsList[ $i ]['image'] = $this->get_formatted_url( $mainImage );
|
1284 |
+
|
1285 |
+
# Featured Image
|
1286 |
+
if ( has_post_thumbnail( $post->ID ) ):
|
1287 |
+
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
|
1288 |
+
$this->productsList[ $i ]['feature_image'] = $this->get_formatted_url( $image[0] );
|
1289 |
+
else:
|
1290 |
+
$this->productsList[ $i ]['feature_image'] = $this->get_formatted_url( $mainImage );
|
1291 |
+
endif;
|
1292 |
+
|
1293 |
+
# Additional Images
|
1294 |
+
$imageLinks = array();
|
1295 |
+
$images = $this->additionalImages( $post->ID );
|
1296 |
+
if ( $images and is_array( $images ) ) {
|
1297 |
+
$mKey = 1;
|
1298 |
+
foreach ( $images as $key => $value ) {
|
1299 |
+
if ( $value != $this->productsList[ $i ]['image'] ) {
|
1300 |
+
$imgLink = $this->get_formatted_url( $value );
|
1301 |
+
$this->productsList[ $i ]["image_$mKey"] = $imgLink;
|
1302 |
+
if ( ! empty( $imgLink ) ) {
|
1303 |
+
array_push( $imageLinks, $imgLink );
|
1304 |
+
}
|
1305 |
+
}
|
1306 |
+
$mKey ++;
|
1307 |
+
}
|
1308 |
+
}
|
1309 |
+
$this->productsList[ $i ]['images'] = implode( ",", $imageLinks );
|
1310 |
+
|
1311 |
+
$this->productsList[ $i ]['condition'] = "New";
|
1312 |
+
$this->productsList[ $i ]['type'] = $product->get_type();
|
1313 |
+
$this->productsList[ $i ]['visibility'] = $this->getAttributeValue( $post->ID, "_visibility" );
|
1314 |
+
$this->productsList[ $i ]['rating_total'] = $product->get_rating_count();
|
1315 |
+
$this->productsList[ $i ]['rating_average'] = $product->get_average_rating();
|
1316 |
+
$this->productsList[ $i ]['tags'] = $this->get_product_term_list( $post->ID, 'product_tag' );
|
1317 |
+
|
1318 |
+
$this->productsList[ $i ]['item_group_id'] = $post->ID;
|
1319 |
+
$this->productsList[ $i ]['sku'] = $this->getAttributeValue( $post->ID, "_sku" );
|
1320 |
+
|
1321 |
+
$this->productsList[ $i ]['availability'] = $this->availability( $post->ID );
|
1322 |
+
$this->productsList[ $i ]['quantity'] = $this->get_quantity( $post->ID, "_stock" );
|
1323 |
+
$this->productsList[ $i ]['sale_price_sdate'] = $this->get_date( $post->ID, "_sale_price_dates_from" );
|
1324 |
+
$this->productsList[ $i ]['sale_price_edate'] = $this->get_date( $post->ID, "_sale_price_dates_to" );
|
1325 |
+
|
1326 |
+
$price = ( $product->get_price() ) ? $product->get_price() : false;
|
1327 |
+
|
1328 |
+
$this->productsList[ $i ]['price'] = ( $product->get_regular_price() ) ? $product->get_regular_price() : $price;
|
1329 |
+
$this->productsList[ $i ]['sale_price'] = ( $product->get_sale_price() ) ? $product->get_sale_price() : "";
|
1330 |
+
$this->productsList[ $i ]['weight'] = ( $product->get_weight() ) ? $product->get_weight() : "";
|
1331 |
+
$this->productsList[ $i ]['width'] = ( $product->get_width() ) ? $product->get_width() : "";
|
1332 |
+
$this->productsList[ $i ]['height'] = ( $product->get_height() ) ? $product->get_height() : "";
|
1333 |
+
$this->productsList[ $i ]['length'] = ( $product->get_length() ) ? $product->get_length() : "";
|
1334 |
+
|
1335 |
+
# Sale price effective date
|
1336 |
+
$from = $this->sale_price_effective_date( $post->ID, '_sale_price_dates_from' );
|
1337 |
+
$to = $this->sale_price_effective_date( $post->ID, '_sale_price_dates_to' );
|
1338 |
+
if ( ! empty( $from ) && ! empty( $to ) ) {
|
1339 |
+
$from = date( "c", strtotime( $from ) );
|
1340 |
+
$to = date( "c", strtotime( $to ) );
|
1341 |
+
$this->productsList[ $i ]['sale_price_effective_date'] = "$from" . "/" . "$to";
|
1342 |
+
} else {
|
1343 |
+
$this->productsList[ $i ]['sale_price_effective_date'] = "";
|
1344 |
+
}
|
1345 |
+
}
|
1346 |
+
}
|
1347 |
+
$i ++;
|
1348 |
+
endwhile;
|
1349 |
+
wp_reset_query();
|
1350 |
+
|
1351 |
+
if ( $getIDs ) {
|
1352 |
+
$mergedIds = array_merge( $getIDs, $this->idExist );
|
1353 |
+
update_option( "wf_check_duplicate", $mergedIds );
|
1354 |
+
} else {
|
1355 |
+
update_option( "wf_check_duplicate", $this->idExist );
|
1356 |
+
}
|
1357 |
+
|
1358 |
+
return $this->productsList;
|
1359 |
+
} catch ( Exception $e ) {
|
1360 |
+
return $this->productsList;
|
1361 |
+
}
|
1362 |
+
}
|
1363 |
+
}
|
1364 |
|
1365 |
/**
|
1366 |
* Remove ShortCodes from contents
|
1371 |
public function remove_short_codes($content)
|
1372 |
{
|
1373 |
if(empty($content)){
|
1374 |
+
return "";
|
1375 |
}
|
1376 |
|
1377 |
if(class_exists("WPBMap")){
|
1383 |
|
1384 |
}
|
1385 |
|
1386 |
+
/**
|
1387 |
+
* Get formatted image url
|
1388 |
+
*
|
1389 |
+
* @param $url
|
1390 |
+
* @return bool|string
|
1391 |
+
*/
|
1392 |
+
public function get_formatted_url($url = "")
|
1393 |
+
{
|
1394 |
+
if (!empty($url)) {
|
1395 |
+
if (substr(trim($url), 0, 4) === "http" || substr(trim($url), 0, 3) === "ftp" || substr(trim($url), 0, 4) === "sftp") {
|
1396 |
+
return rtrim($url, "/");
|
1397 |
+
} else {
|
1398 |
+
$base = get_site_url();
|
1399 |
+
$url = $base . $url;
|
1400 |
+
return rtrim($url, "/");
|
1401 |
+
}
|
1402 |
+
}
|
1403 |
+
return $url;
|
1404 |
+
}
|
1405 |
+
|
1406 |
+
|
1407 |
+
/**
|
1408 |
+
* Get formatted product date
|
1409 |
+
*
|
1410 |
+
* @param $id
|
1411 |
+
* @param $name
|
1412 |
+
* @return bool|string
|
1413 |
+
*/
|
1414 |
+
public function get_date($id, $name)
|
1415 |
+
{
|
1416 |
+
$date = $this->getAttributeValue($id, $name);
|
1417 |
+
if ($date) {
|
1418 |
+
return date("Y-m-d", $date);
|
1419 |
+
}
|
1420 |
+
return false;
|
1421 |
+
}
|
1422 |
+
|
1423 |
+
/**
|
1424 |
+
* Get formatted product quantity
|
1425 |
+
*
|
1426 |
+
* @param $id
|
1427 |
+
* @param $name
|
1428 |
+
* @return bool|mixed
|
1429 |
+
*/
|
1430 |
+
public function get_quantity($id, $name)
|
1431 |
+
{
|
1432 |
+
$qty = $this->getAttributeValue($id, $name);
|
1433 |
+
if ($qty) {
|
1434 |
+
return $qty + 0;
|
1435 |
+
}
|
1436 |
+
return "0";
|
1437 |
+
}
|
1438 |
+
|
1439 |
+
/**
|
1440 |
+
* Retrieve a post's terms as a list with specified format.
|
1441 |
+
*
|
1442 |
+
* @since 2.5.0
|
1443 |
+
*
|
1444 |
+
* @param int $id Post ID.
|
1445 |
+
* @param string $taxonomy Taxonomy name.
|
1446 |
+
* @param string $before Optional. Before list.
|
1447 |
+
* @param string $sep Optional. Separate items using this.
|
1448 |
+
* @param string $after Optional. After list.
|
1449 |
+
*
|
1450 |
+
* @return string|false|WP_Error A list of terms on success, false if there are no terms, WP_Error on failure.
|
1451 |
+
*/
|
1452 |
+
function get_product_term_list($id, $taxonomy, $before = '', $sep = ',', $after = '')
|
1453 |
+
{
|
1454 |
+
$terms = get_the_terms($id, $taxonomy);
|
1455 |
+
|
1456 |
+
if (is_wp_error($terms)) {
|
1457 |
+
return $terms;
|
1458 |
+
}
|
1459 |
+
|
1460 |
+
if (empty($terms)) {
|
1461 |
+
return false;
|
1462 |
+
}
|
1463 |
+
|
1464 |
+
$links = array();
|
1465 |
+
|
1466 |
+
foreach ($terms as $term) {
|
1467 |
+
$links[] = $term->name;
|
1468 |
+
}
|
1469 |
+
ksort($links);
|
1470 |
+
return $before . join($sep, $links) . $after;
|
1471 |
+
}
|
1472 |
+
|
1473 |
+
/** Return additional image URLs
|
1474 |
+
*
|
1475 |
+
* @param int $Id
|
1476 |
+
*
|
1477 |
+
* @return bool|array
|
1478 |
+
*/
|
1479 |
+
|
1480 |
+
public function additionalImages($Id)
|
1481 |
+
{
|
1482 |
+
$ids=$this->getAttributeValue($Id,"_product_image_gallery");
|
1483 |
+
$imgIds=!empty($ids)?explode(",",$ids):"";
|
1484 |
+
|
1485 |
+
$images = array();
|
1486 |
+
if (!empty($imgIds)) {
|
1487 |
+
foreach ($imgIds as $key => $value) {
|
1488 |
+
if ($key < 10) {
|
1489 |
+
$images[$key] = wp_get_attachment_url($value);
|
1490 |
+
}
|
1491 |
+
}
|
1492 |
+
return $images;
|
1493 |
+
}
|
1494 |
+
return false;
|
1495 |
+
}
|
1496 |
+
|
1497 |
+
/**
|
1498 |
+
* Give space to availability text
|
1499 |
+
*
|
1500 |
+
* @param integer $id
|
1501 |
+
*
|
1502 |
+
* @return string
|
1503 |
+
*/
|
1504 |
+
public function availability($id)
|
1505 |
+
{
|
1506 |
+
$status=$this->getAttributeValue($id,"_stock_status");
|
1507 |
+
if ($status) {
|
1508 |
+
if ($status == 'instock') {
|
1509 |
+
return "in stock";
|
1510 |
+
} elseif ($status == 'outofstock') {
|
1511 |
+
return "out of stock";
|
1512 |
+
}
|
1513 |
+
}
|
1514 |
+
return "out of stock";
|
1515 |
+
}
|
1516 |
|
1517 |
/**
|
1518 |
* Ger Product Attribute
|
1568 |
}
|
1569 |
}
|
1570 |
|
1571 |
+
/**
|
1572 |
+
* Get Product Attribute Value
|
1573 |
+
*
|
1574 |
+
* @deprecated 2.2.5
|
1575 |
+
* @param $id
|
1576 |
+
* @param $name
|
1577 |
+
*
|
1578 |
+
* @return mixed
|
1579 |
+
*/
|
1580 |
+
public function getAttributeValue($id, $name)
|
1581 |
+
{
|
1582 |
+
|
1583 |
+
return $this->getProductMeta($id,$name);
|
1584 |
// if (strpos($name, 'attribute_pa') !== false) {
|
1585 |
// $taxonomy = str_replace("attribute_","",$name);
|
1586 |
// $meta = get_post_meta($id,$name, true);
|
1589 |
// }else{
|
1590 |
// return get_post_meta($id, $name, true);
|
1591 |
// }
|
1592 |
+
}
|
1593 |
|
1594 |
+
/**
|
1595 |
+
* Get Sale price effective date for google
|
1596 |
+
*
|
1597 |
+
* @param $id
|
1598 |
+
* @param $name
|
1599 |
+
* @return string
|
1600 |
+
*/
|
1601 |
+
public function sale_price_effective_date($id, $name)
|
1602 |
+
{
|
1603 |
+
return ($date = $this->getAttributeValue($id, $name)) ? date_i18n('Y-m-d', $date) : "";
|
1604 |
+
}
|
1605 |
+
|
1606 |
+
|
1607 |
+
/**
|
1608 |
+
* Get All Default WooCommerce Attributes
|
1609 |
+
* @return bool|array
|
1610 |
+
*/
|
1611 |
+
public function getAllAttributes()
|
1612 |
+
{
|
1613 |
+
global $wpdb;
|
1614 |
+
|
1615 |
+
//Load the main attributes
|
1616 |
+
$sql = '
|
|
|
|
|
1617 |
SELECT attribute_name as name, attribute_type as type
|
1618 |
FROM ' . $wpdb->prefix . 'woocommerce_attribute_taxonomies';
|
1619 |
+
$data = $wpdb->get_results($sql);
|
1620 |
+
if (count($data)) {
|
1621 |
+
foreach ($data as $key => $value) {
|
1622 |
+
$info["wf_attr_pa_" . $value->name] = $value->name;
|
1623 |
+
}
|
1624 |
+
return $info;
|
1625 |
+
}
|
1626 |
+
return false;
|
1627 |
+
}
|
1628 |
+
|
1629 |
+
|
1630 |
+
/**
|
1631 |
+
* Get All Custom Attributes
|
1632 |
+
* @return array|bool
|
1633 |
+
*/
|
1634 |
+
|
1635 |
+
public function getAllCustomAttributes()
|
1636 |
+
{
|
1637 |
+
global $wpdb;
|
1638 |
+
$info = array();
|
1639 |
+
//Load the main attributes
|
1640 |
+
$sql = "SELECT meta_key as name, meta_value as type
|
1641 |
FROM " . $wpdb->prefix . "postmeta" . " group by meta_key";
|
1642 |
+
$data = $wpdb->get_results($sql);
|
1643 |
+
if ($data) {
|
1644 |
+
foreach ($data as $key => $value) {
|
1645 |
+
if (substr($value->name, 0, 1) !== "_") { //&& substr($value->name, 0, 13) !== "attribute_pa_"
|
1646 |
+
$info["wf_cattr_" . $value->name] = $value->name;
|
1647 |
+
}
|
1648 |
+
}
|
1649 |
+
return $info;
|
1650 |
+
}
|
1651 |
+
return false;
|
1652 |
+
}
|
1653 |
+
|
1654 |
+
/**
|
1655 |
+
* Get All Taxonomy
|
1656 |
+
*
|
1657 |
+
* @param string $name
|
1658 |
+
*
|
1659 |
+
* @return mixed
|
1660 |
+
*/
|
1661 |
+
public function getAllTaxonomy($name = "color")
|
1662 |
+
{
|
1663 |
+
global $wpdb;
|
1664 |
+
//Load the taxonomies
|
1665 |
+
$info = false;
|
1666 |
+
|
1667 |
+
$sql = "SELECT taxo.taxonomy, terms.name, terms.slug FROM $wpdb->term_taxonomy taxo
|
1668 |
LEFT JOIN $wpdb->terms terms ON (terms.term_id = taxo.term_id) GROUP BY taxo.taxonomy";
|
1669 |
+
$data = $wpdb->get_results($sql);
|
1670 |
+
if (count($data)) {
|
1671 |
+
foreach ($data as $key => $value) {
|
1672 |
+
$info["wf_taxo_" . $value->taxonomy] = $value->taxonomy;
|
1673 |
+
}
|
1674 |
+
}
|
1675 |
+
return $info;
|
1676 |
+
}
|
1677 |
+
|
1678 |
+
/**
|
1679 |
+
* Get Category Mappings
|
1680 |
+
* @return bool|array
|
1681 |
+
*/
|
1682 |
+
public function getCustomCategoryMappedAttributes()
|
1683 |
+
{
|
1684 |
+
global $wpdb;
|
1685 |
+
|
1686 |
+
//Load Custom Category Mapped Attributes
|
1687 |
+
$var = "wf_cmapping_";
|
1688 |
+
$sql = $wpdb->prepare("SELECT * FROM $wpdb->options WHERE option_name LIKE %s;", $var . "%");
|
1689 |
+
$data = $wpdb->get_results($sql);
|
1690 |
+
if (count($data)) {
|
1691 |
+
foreach ($data as $key => $value) {
|
1692 |
+
$info[$key] = $value->option_name;
|
1693 |
+
}
|
1694 |
+
return $info;
|
1695 |
+
}
|
1696 |
+
return false;
|
1697 |
+
}
|
1698 |
+
|
1699 |
+
/**
|
1700 |
+
* Get Dynamic Attribute List
|
1701 |
+
* @return bool|array
|
1702 |
+
*/
|
1703 |
+
public function dynamicAttributes()
|
1704 |
+
{
|
1705 |
+
global $wpdb;
|
1706 |
+
|
1707 |
+
# Load Custom Category Mapped Attributes
|
1708 |
+
$var = "wf_dattribute_";
|
1709 |
+
$sql = $wpdb->prepare("SELECT * FROM $wpdb->options WHERE option_name LIKE %s;", $var . "%");
|
1710 |
+
$data = $wpdb->get_results($sql);
|
1711 |
+
if (count($data)) {
|
1712 |
+
foreach ($data as $key => $value) {
|
1713 |
+
$info[$key] = $value->option_name;
|
1714 |
+
}
|
1715 |
+
return $info;
|
1716 |
+
}
|
1717 |
+
return false;
|
1718 |
+
}
|
1719 |
+
|
1720 |
+
/**
|
1721 |
+
* Local Attribute List to map product value with merchant attributes
|
1722 |
+
*
|
1723 |
+
* @param string $selected
|
1724 |
+
*
|
1725 |
+
* @return string
|
1726 |
+
*/
|
1727 |
+
public function attributeDropdown($selected = "")
|
1728 |
+
{
|
1729 |
+
$attributes = array(
|
1730 |
+
"id" => "Product Id",
|
1731 |
+
"title" => "Product Title",
|
1732 |
+
"description" => "Product Description",
|
1733 |
+
"short_description" => "Product Short Description",
|
1734 |
+
"product_type" => "Product Local Category",
|
1735 |
+
"link" => "Product URL",
|
1736 |
+
"ex_link" => "External Product URL",
|
1737 |
+
"condition" => "Condition",
|
1738 |
+
"item_group_id" => "Parent Id [Group Id]",
|
1739 |
+
"sku" => "SKU",
|
1740 |
+
"parent_sku" => "Parent SKU",
|
1741 |
+
"availability" => "Availability",
|
1742 |
+
"quantity" => "Quantity",
|
1743 |
+
"price" => "Regular Price",
|
1744 |
+
"sale_price" => "Sale Price",
|
1745 |
+
"sale_price_sdate" => "Sale Start Date",
|
1746 |
+
"sale_price_edate" => "Sale End Date",
|
1747 |
+
"weight" => "Weight",
|
1748 |
+
"width" => "Width",
|
1749 |
+
"height" => "Height",
|
1750 |
+
"length" => "Length",
|
1751 |
+
"shipping_class" => "Shipping Class",
|
1752 |
+
"type" => "Product Type",
|
1753 |
+
"variation_type" => "Variation Type",
|
1754 |
+
"visibility" => "Visibility",
|
1755 |
+
"rating_total" => "Total Rating",
|
1756 |
+
"rating_average" => "Average Rating",
|
1757 |
+
"tags" => "Tags",
|
1758 |
+
"sale_price_effective_date" => "Sale Price Effective Date",
|
1759 |
+
"is_bundle" => "Is Bundle",
|
1760 |
+
);
|
1761 |
+
|
1762 |
+
$images = array(
|
1763 |
+
"image" => "Main Image",
|
1764 |
+
"feature_image" => "Featured Image",
|
1765 |
+
"images" => "Images [Comma Separated]",
|
1766 |
+
"image_1" => "Additional Image 1",
|
1767 |
+
"image_2" => "Additional Image 2",
|
1768 |
+
"image_3" => "Additional Image 3",
|
1769 |
+
"image_4" => "Additional Image 4",
|
1770 |
+
"image_5" => "Additional Image 5",
|
1771 |
+
"image_6" => "Additional Image 6",
|
1772 |
+
"image_7" => "Additional Image 7",
|
1773 |
+
"image_8" => "Additional Image 8",
|
1774 |
+
"image_9" => "Additional Image 9",
|
1775 |
+
"image_10" => "Additional Image 10",
|
1776 |
+
);
|
1777 |
+
|
1778 |
+
# Primary Attributes
|
1779 |
+
$str = "<option></option>";
|
1780 |
+
$sltd = "";
|
1781 |
+
$str .= "<optgroup label='Primary Attributes'>";
|
1782 |
+
foreach ($attributes as $key => $value) {
|
1783 |
+
$sltd = "";
|
1784 |
+
if ($selected == $key) {
|
1785 |
+
$sltd = 'selected="selected"';
|
1786 |
+
}
|
1787 |
+
$str .= "<option $sltd value='$key'>" . $value . "</option>";
|
1788 |
+
}
|
1789 |
+
$str .= "</optgroup>";
|
1790 |
+
|
1791 |
+
# Additional Images
|
1792 |
+
if ($images) {
|
1793 |
+
$str .= "<optgroup label='Image Attributes'>";
|
1794 |
+
foreach ($images as $key => $value) {
|
1795 |
+
$sltd = "";
|
1796 |
+
if ($selected == $key) {
|
1797 |
+
$sltd = 'selected="selected"';
|
1798 |
+
}
|
1799 |
+
$str .= "<option $sltd value='$key'>" . $value . "</option>";
|
1800 |
+
}
|
1801 |
+
$str .= "</optgroup>";
|
1802 |
+
}
|
1803 |
+
|
1804 |
+
# Get All WooCommerce Attributes
|
1805 |
+
$vAttributes = $this->getAllAttributes();
|
1806 |
+
if ($vAttributes) {
|
1807 |
+
$str .= "<optgroup label='Product Attributes'>";
|
1808 |
+
foreach ($vAttributes as $key => $value) {
|
1809 |
+
$sltd = "";
|
1810 |
+
if ($selected == $key) {
|
1811 |
+
$sltd = 'selected="selected"';
|
1812 |
+
}
|
1813 |
+
$str .= "<option $sltd value='$key'>" . $value . "</option>";
|
1814 |
+
}
|
1815 |
+
$str .= "</optgroup>";
|
1816 |
+
}
|
1817 |
+
|
1818 |
+
# Get All Custom Attributes
|
1819 |
+
$customAttributes = $this->getAllCustomAttributes();
|
1820 |
+
if ($customAttributes) {
|
1821 |
+
$str .= "<optgroup label='Variation & Custom Attributes'>";
|
1822 |
+
foreach ($customAttributes as $key => $value) {
|
1823 |
+
if (strpos($value, 0, 1) != "_") {
|
1824 |
+
$sltd = "";
|
1825 |
+
if ($selected == $key) {
|
1826 |
+
$sltd = 'selected="selected"';
|
1827 |
+
}
|
1828 |
+
$str .= "<option $sltd value='$key'>" . $value . "</option>";
|
1829 |
+
}
|
1830 |
+
}
|
1831 |
+
$str .= "</optgroup>";
|
1832 |
+
}
|
1833 |
+
return $str;
|
1834 |
+
}
|
1835 |
+
|
1836 |
+
/**
|
1837 |
+
* Load all WooCommerce attributes into an option
|
1838 |
+
*/
|
1839 |
+
public function load_attributes()
|
1840 |
+
{
|
1841 |
+
# Get All WooCommerce Attributes
|
1842 |
+
$vAttributes = $this->getAllAttributes();
|
1843 |
+
update_option("wpfw_vAttributes", $vAttributes);
|
1844 |
+
|
1845 |
+
# Get All Custom Attributes
|
1846 |
+
$customAttributes = $this->getAllCustomAttributes();
|
1847 |
+
update_option("wpfw_customAttributes", $customAttributes);
|
1848 |
+
}
|
1849 |
+
|
1850 |
+
/**
|
1851 |
+
* Local Attribute List to map product value with merchant attributes
|
1852 |
+
*
|
1853 |
+
* @param string $selected
|
1854 |
+
*
|
1855 |
+
* @return string
|
1856 |
+
*/
|
1857 |
+
public function loadAttributeDropdown($selected = "")
|
1858 |
+
{
|
1859 |
+
$attributes = array(
|
1860 |
+
"id" => "Product Id",
|
1861 |
+
"title" => "Product Title",
|
1862 |
+
"description" => "Product Description",
|
1863 |
+
"short_description" => "Product Short Description",
|
1864 |
+
"product_type" => "Product Local Category",
|
1865 |
+
"link" => "Product URL",
|
1866 |
+
"ex_link" => "External Product URL",
|
1867 |
+
"condition" => "Condition",
|
1868 |
+
"item_group_id" => "Parent Id [Group Id]",
|
1869 |
+
"sku" => "SKU",
|
1870 |
+
"parent_sku" => "Parent SKU",
|
1871 |
+
"availability" => "Availability",
|
1872 |
+
"quantity" => "Quantity",
|
1873 |
+
"price" => "Regular Price",
|
1874 |
+
"sale_price" => "Sale Price",
|
1875 |
+
"sale_price_sdate" => "Sale Start Date",
|
1876 |
+
"sale_price_edate" => "Sale End Date",
|
1877 |
+
"weight" => "Weight",
|
1878 |
+
"width" => "Width",
|
1879 |
+
"height" => "Height",
|
1880 |
+
"length" => "Length",
|
1881 |
+
"shipping_class" => "Shipping Class",
|
1882 |
+
"type" => "Product Type",
|
1883 |
+
"variation_type" => "Variation Type",
|
1884 |
+
"visibility" => "Visibility",
|
1885 |
+
"rating_total" => "Total Rating",
|
1886 |
+
"rating_average" => "Average Rating",
|
1887 |
+
"tags" => "Tags",
|
1888 |
+
"sale_price_effective_date" => "Sale Price Effective Date",
|
1889 |
+
"is_bundle" => "Is Bundle",
|
1890 |
+
);
|
1891 |
+
|
1892 |
+
$images = array(
|
1893 |
+
"image" => "Main Image",
|
1894 |
+
"feature_image" => "Featured Image",
|
1895 |
+
"images" => "Images [Comma Separated]",
|
1896 |
+
"image_1" => "Additional Image 1",
|
1897 |
+
"image_2" => "Additional Image 2",
|
1898 |
+
"image_3" => "Additional Image 3",
|
1899 |
+
"image_4" => "Additional Image 4",
|
1900 |
+
"image_5" => "Additional Image 5",
|
1901 |
+
"image_6" => "Additional Image 6",
|
1902 |
+
"image_7" => "Additional Image 7",
|
1903 |
+
"image_8" => "Additional Image 8",
|
1904 |
+
"image_9" => "Additional Image 9",
|
1905 |
+
"image_10" => "Additional Image 10",
|
1906 |
+
);
|
1907 |
+
|
1908 |
+
# Primary Attributes
|
1909 |
+
$str = "<option></option>";
|
1910 |
+
$sltd = "";
|
1911 |
+
$str .= "<optgroup label='Primary Attributes'>";
|
1912 |
+
foreach ($attributes as $key => $value) {
|
1913 |
+
$sltd = "";
|
1914 |
+
if ($selected == $key) {
|
1915 |
+
$sltd = 'selected="selected"';
|
1916 |
+
}
|
1917 |
+
$str .= "<option $sltd value='$key'>" . $value . "</option>";
|
1918 |
+
}
|
1919 |
+
$str .= "</optgroup>";
|
1920 |
+
|
1921 |
+
# Additional Images
|
1922 |
+
if ($images) {
|
1923 |
+
$str .= "<optgroup label='Image Attributes'>";
|
1924 |
+
foreach ($images as $key => $value) {
|
1925 |
+
$sltd = "";
|
1926 |
+
if ($selected == $key) {
|
1927 |
+
$sltd = 'selected="selected"';
|
1928 |
+
}
|
1929 |
+
$str .= "<option $sltd value='$key'>" . $value . "</option>";
|
1930 |
+
}
|
1931 |
+
$str .= "</optgroup>";
|
1932 |
+
}
|
1933 |
+
|
1934 |
+
# Get All WooCommerce Attributes
|
1935 |
+
$vAttributes = get_option("wpfw_vAttributes");
|
1936 |
+
if ($vAttributes) {
|
1937 |
+
$str .= "<optgroup label='Product Attributes'>";
|
1938 |
+
foreach ($vAttributes as $key => $value) {
|
1939 |
+
$sltd = "";
|
1940 |
+
if ($selected == $key) {
|
1941 |
+
$sltd = 'selected="selected"';
|
1942 |
+
}
|
1943 |
+
$str .= "<option $sltd value='$key'>" . $value . "</option>";
|
1944 |
+
}
|
1945 |
+
$str .= "</optgroup>";
|
1946 |
+
}
|
1947 |
+
|
1948 |
+
# Get All Custom Attributes
|
1949 |
+
$customAttributes = get_option("wpfw_customAttributes");
|
1950 |
+
if ($customAttributes) {
|
1951 |
+
$str .= "<optgroup label='Variation & Custom Attributes'>";
|
1952 |
+
foreach ($customAttributes as $key => $value) {
|
1953 |
+
$sltd = "";
|
1954 |
+
if ($selected == $key) {
|
1955 |
+
$sltd = 'selected="selected"';
|
1956 |
+
}
|
1957 |
+
$str .= "<option $sltd value='$key'>" . $value . "</option>";
|
1958 |
+
}
|
1959 |
+
$str .= "</optgroup>";
|
1960 |
+
}
|
1961 |
+
return $str;
|
1962 |
+
}
|
1963 |
+
|
1964 |
+
/**
|
1965 |
+
* Check WooCommerce Version
|
1966 |
+
* @param string $version
|
1967 |
+
* @return bool
|
1968 |
+
*/
|
1969 |
+
public static function version_check( $version = '3.0' ) {
|
1970 |
+
if ( class_exists( 'WooCommerce' ) ) {
|
1971 |
+
global $woocommerce;
|
1972 |
+
if ( version_compare( $woocommerce->version, $version, ">=" ) ) {
|
1973 |
+
return true;
|
1974 |
+
}
|
1975 |
+
}
|
1976 |
+
return false;
|
1977 |
+
}
|
|
|
|
|
1978 |
}
|
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: 2.2.
|
20 |
* Author: WebAppick
|
21 |
* Author URI: https://webappick.com/
|
22 |
* License: GPL v2
|
@@ -206,7 +206,8 @@ function woo_feed_add_update($info = "", $name = "")
|
|
206 |
$feedInfo = array(
|
207 |
'feedrules' => $feedRules,
|
208 |
'url' => $url,
|
209 |
-
'last_updated' => date("Y-m-d H:i:s")
|
|
|
210 |
);
|
211 |
|
212 |
if (!empty($name) && $name != "wf_feed_" . $fileName) {
|
@@ -289,16 +290,6 @@ function woo_feed_get_product_information(){
|
|
289 |
$totalProducts=$products->publish + $variations->publish;
|
290 |
}
|
291 |
|
292 |
-
// global $wpdb;
|
293 |
-
// $query = "SELECT DISTINCT {$wpdb->prefix}posts.ID
|
294 |
-
// FROM {$wpdb->prefix}posts
|
295 |
-
// LEFT JOIN {$wpdb->prefix}term_relationships ON ({$wpdb->prefix}posts.ID = {$wpdb->prefix}term_relationships.object_id)
|
296 |
-
// LEFT JOIN {$wpdb->prefix}term_taxonomy ON ({$wpdb->prefix}term_relationships.term_taxonomy_id = {$wpdb->prefix}term_taxonomy.term_taxonomy_id)
|
297 |
-
// WHERE {$wpdb->prefix}posts.post_type IN ('product','product_variation') AND {$wpdb->prefix}posts.post_status = 'publish'
|
298 |
-
// ORDER BY ID";
|
299 |
-
// $products = $wpdb->get_results($query, OBJECT );
|
300 |
-
//
|
301 |
-
// $totalProducts=count($products);
|
302 |
|
303 |
$data=array('product'=>$totalProducts);
|
304 |
|
@@ -512,11 +503,16 @@ function woo_feed_save_feed_file(){
|
|
512 |
|
513 |
check_ajax_referer('wpf_feed_nonce');
|
514 |
$feed=str_replace("wf_feed_", "",$_POST['feed']);
|
|
|
|
|
515 |
$info=get_option($feed);
|
|
|
516 |
if(!$info){
|
517 |
$getInfo=unserialize(get_option($_POST['feed']));
|
518 |
$info=$getInfo['feedrules'];
|
519 |
}
|
|
|
|
|
520 |
$feedService = $info['provider'];
|
521 |
$fileName = str_replace(" ", "",$info['filename']);
|
522 |
$type = $info['feedType'];
|
@@ -568,6 +564,13 @@ function woo_feed_save_feed_file(){
|
|
568 |
'last_updated' => date("Y-m-d H:i:s"),
|
569 |
);
|
570 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
571 |
if (!empty($name) && $name != "wf_feed_" . $fileName) {
|
572 |
delete_option($name);
|
573 |
}
|
@@ -677,10 +680,10 @@ function woo_feed_manage_feed()
|
|
677 |
// if ($process) {
|
678 |
// $message = "<b>Feed Updated Successfully. Feed URL: <a style='font-weight: bold;color:green;' target='_blank' href=$process>$process</a></b>";
|
679 |
// update_option('wpf_message', $message);
|
680 |
-
// wp_redirect(admin_url("admin.php?page=woo_feed_manage_feed&wpf_message=success"));
|
681 |
// } else {
|
682 |
// update_option('wpf_message', 'Failed To Update Feed');
|
683 |
-
//
|
684 |
// }
|
685 |
|
686 |
$fileName = "wf_config".str_replace(" ", "", sanitize_text_field($_POST['filename']));
|
@@ -763,6 +766,25 @@ function woo_feed_getFeedInfoForCronUpdate(){
|
|
763 |
}
|
764 |
|
765 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
766 |
/*
|
767 |
* Scheduled Action Hook
|
768 |
*/
|
@@ -774,6 +796,8 @@ function woo_feed_cron_update_feed()
|
|
774 |
$result = $wpdb->get_results($query, 'ARRAY_A');
|
775 |
foreach ($result as $key => $value) {
|
776 |
$feedInfo = unserialize(get_option($value['option_name']));
|
777 |
-
|
|
|
|
|
778 |
}
|
779 |
}
|
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: 2.2.9
|
20 |
* Author: WebAppick
|
21 |
* Author URI: https://webappick.com/
|
22 |
* License: GPL v2
|
206 |
$feedInfo = array(
|
207 |
'feedrules' => $feedRules,
|
208 |
'url' => $url,
|
209 |
+
'last_updated' => date("Y-m-d H:i:s"),
|
210 |
+
'status'=>1
|
211 |
);
|
212 |
|
213 |
if (!empty($name) && $name != "wf_feed_" . $fileName) {
|
290 |
$totalProducts=$products->publish + $variations->publish;
|
291 |
}
|
292 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
|
294 |
$data=array('product'=>$totalProducts);
|
295 |
|
503 |
|
504 |
check_ajax_referer('wpf_feed_nonce');
|
505 |
$feed=str_replace("wf_feed_", "",$_POST['feed']);
|
506 |
+
|
507 |
+
|
508 |
$info=get_option($feed);
|
509 |
+
|
510 |
if(!$info){
|
511 |
$getInfo=unserialize(get_option($_POST['feed']));
|
512 |
$info=$getInfo['feedrules'];
|
513 |
}
|
514 |
+
|
515 |
+
|
516 |
$feedService = $info['provider'];
|
517 |
$fileName = str_replace(" ", "",$info['filename']);
|
518 |
$type = $info['feedType'];
|
564 |
'last_updated' => date("Y-m-d H:i:s"),
|
565 |
);
|
566 |
|
567 |
+
$feedOldInfo=unserialize(get_option("wf_feed_".$fileName));
|
568 |
+
if(isset($feedOldInfo['status'])){
|
569 |
+
$feedInfo['status']=$feedOldInfo['status'];
|
570 |
+
}else{
|
571 |
+
$feedInfo['status']=1;
|
572 |
+
}
|
573 |
+
|
574 |
if (!empty($name) && $name != "wf_feed_" . $fileName) {
|
575 |
delete_option($name);
|
576 |
}
|
680 |
// if ($process) {
|
681 |
// $message = "<b>Feed Updated Successfully. Feed URL: <a style='font-weight: bold;color:green;' target='_blank' href=$process>$process</a></b>";
|
682 |
// update_option('wpf_message', $message);
|
683 |
+
// //wp_redirect(admin_url("admin.php?page=woo_feed_manage_feed&wpf_message=success"));
|
684 |
// } else {
|
685 |
// update_option('wpf_message', 'Failed To Update Feed');
|
686 |
+
// // wp_redirect(admin_url("admin.php?page=woo_feed_manage_feed&wpf_message=error"));
|
687 |
// }
|
688 |
|
689 |
$fileName = "wf_config".str_replace(" ", "", sanitize_text_field($_POST['filename']));
|
766 |
}
|
767 |
|
768 |
|
769 |
+
/**
|
770 |
+
* Update feed status
|
771 |
+
*/
|
772 |
+
add_action('wp_ajax_update_feed_status', 'woo_feed_update_feed_status');
|
773 |
+
function woo_feed_update_feed_status(){
|
774 |
+
if(!empty($_POST['feedName'])){
|
775 |
+
$feedInfo = unserialize(get_option($_POST['feedName']));
|
776 |
+
$feedInfo['status'] = $_POST['status'];
|
777 |
+
$data = array('status' => true);
|
778 |
+
update_option($_POST['feedName'],serialize($feedInfo));
|
779 |
+
return wp_send_json_success($data);
|
780 |
+
}else{
|
781 |
+
$data = array('status' => false);
|
782 |
+
return wp_send_json_error($data);
|
783 |
+
}
|
784 |
+
wp_die();
|
785 |
+
}
|
786 |
+
|
787 |
+
|
788 |
/*
|
789 |
* Scheduled Action Hook
|
790 |
*/
|
796 |
$result = $wpdb->get_results($query, 'ARRAY_A');
|
797 |
foreach ($result as $key => $value) {
|
798 |
$feedInfo = unserialize(get_option($value['option_name']));
|
799 |
+
if(!isset($feedInfo['status']) || $feedInfo['status'] != "0") {
|
800 |
+
woo_feed_add_update( $feedInfo['feedrules'] );
|
801 |
+
}
|
802 |
}
|
803 |
}
|