Version Description
Added support for PHP 8.0
Download this release
Release Info
Developer | jorisverwater |
Plugin | Product Feed PRO for WooCommerce |
Version | 9.6.6 |
Comparing to | |
See all releases |
Code changes from version 9.3.7 to 9.6.6
- TODO.txt +2 -2
- classes/channels/class-google_local_products.php +2 -2
- classes/channels/class-google_shopping.php +5 -0
- classes/class-activate.php +7 -0
- classes/class-attributes.php +17 -8
- classes/class-get-products.php +1101 -1000
- js/woosea_key.js +1 -1
- js/woosea_manage.js +20 -0
- pages/admin/woosea-manage-feed.php +13 -0
- pages/admin/woosea-manage-settings.php +41 -5
- readme.txt +187 -2
- woocommerce-sea.php +42 -17
TODO.txt
CHANGED
@@ -5,18 +5,18 @@ Tutorial / Blog posts:
|
|
5 |
- Explain all the different fields/attributes that can be selected from the drop-downs
|
6 |
|
7 |
Priority issues:
|
|
|
8 |
- License key input field needs to be a password field (asterixes)
|
|
|
9 |
- Add a preview option so only 5-10 products are being generated
|
10 |
- Own hosted plugin updating: https://rudrastyh.com/wordpress/self-hosted-plugin-update.html
|
11 |
- Google local product feed inventory in XML format (not just TXT like it is now)
|
12 |
- Add support for Multisites
|
13 |
- Add a filter on review score (and amount of reviews)
|
14 |
- Make extra woosea fields available for front-end usage
|
15 |
-
- Only update feed when changes to products have been made
|
16 |
- Add header to extra fields on product edit pages
|
17 |
- Add possibility to create OR rules
|
18 |
- Add support for Google My Business product feeds
|
19 |
-
- Build a better WP Cron check, current one is not good enough
|
20 |
- AMAZON integration:
|
21 |
- requires a professional seller account, 39 dollar a month, before being able to create a developer account
|
22 |
- only than we can use their MWS service needed to connect our plugin
|
5 |
- Explain all the different fields/attributes that can be selected from the drop-downs
|
6 |
|
7 |
Priority issues:
|
8 |
+
- Add Pinterest Tag; https://help.pinterest.com/nl/business/article/install-the-pinterest-tag
|
9 |
- License key input field needs to be a password field (asterixes)
|
10 |
+
- A seperate FB pixel per WPML website / language
|
11 |
- Add a preview option so only 5-10 products are being generated
|
12 |
- Own hosted plugin updating: https://rudrastyh.com/wordpress/self-hosted-plugin-update.html
|
13 |
- Google local product feed inventory in XML format (not just TXT like it is now)
|
14 |
- Add support for Multisites
|
15 |
- Add a filter on review score (and amount of reviews)
|
16 |
- Make extra woosea fields available for front-end usage
|
|
|
17 |
- Add header to extra fields on product edit pages
|
18 |
- Add possibility to create OR rules
|
19 |
- Add support for Google My Business product feeds
|
|
|
20 |
- AMAZON integration:
|
21 |
- requires a professional seller account, 39 dollar a month, before being able to create a developer account
|
22 |
- only than we can use their MWS service needed to connect our plugin
|
classes/channels/class-google_local_products.php
CHANGED
@@ -12,8 +12,8 @@ class WooSEA_google_local_products {
|
|
12 |
$google_local_products = array(
|
13 |
"Local products fields" => array(
|
14 |
"Itemid" => array(
|
15 |
-
"name" => "
|
16 |
-
"feed_name" => "g:
|
17 |
"format" => "required",
|
18 |
"woo_suggest" => "id",
|
19 |
),
|
12 |
$google_local_products = array(
|
13 |
"Local products fields" => array(
|
14 |
"Itemid" => array(
|
15 |
+
"name" => "Id",
|
16 |
+
"feed_name" => "g:id",
|
17 |
"format" => "required",
|
18 |
"woo_suggest" => "id",
|
19 |
),
|
classes/channels/class-google_shopping.php
CHANGED
@@ -356,6 +356,11 @@ class WooSEA_google_shopping {
|
|
356 |
"feed_name" => "g:max_handling_time",
|
357 |
"format" => "optional",
|
358 |
),
|
|
|
|
|
|
|
|
|
|
|
359 |
),
|
360 |
"Tax" => array(
|
361 |
"Tax" => array(
|
356 |
"feed_name" => "g:max_handling_time",
|
357 |
"format" => "optional",
|
358 |
),
|
359 |
+
"Ships from country" => array(
|
360 |
+
"name" => "ships_from_country",
|
361 |
+
"feed_name" => "g:ships_from_country",
|
362 |
+
"format" => "optional",
|
363 |
+
),
|
364 |
),
|
365 |
"Tax" => array(
|
366 |
"Tax" => array(
|
classes/class-activate.php
CHANGED
@@ -1112,6 +1112,13 @@ class WooSEA_Activation {
|
|
1112 |
"taxonomy" => "none",
|
1113 |
"utm_source" => "Tweakers.nl",
|
1114 |
"type" => "Comparison shopping engine" ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1115 |
"Fashionchick.nl" => array (
|
1116 |
"channel_hash" => md5("Fashionchick.nl"),
|
1117 |
"name" => "Fashionchick.nl",
|
1112 |
"taxonomy" => "none",
|
1113 |
"utm_source" => "Tweakers.nl",
|
1114 |
"type" => "Comparison shopping engine" ),
|
1115 |
+
"Boetiek.nl" => array (
|
1116 |
+
"channel_hash" => md5("Boetiek.nl"),
|
1117 |
+
"name" => "Boetiek.nl",
|
1118 |
+
"fields" => "boetiek",
|
1119 |
+
"taxonomy" => "none",
|
1120 |
+
"utm_source" => "Boetiek.nl",
|
1121 |
+
"type" => "Comparison shopping engine" ),
|
1122 |
"Fashionchick.nl" => array (
|
1123 |
"channel_hash" => md5("Fashionchick.nl"),
|
1124 |
"name" => "Fashionchick.nl",
|
classes/class-attributes.php
CHANGED
@@ -48,7 +48,7 @@ private function get_dynamic_attributes(){
|
|
48 |
global $wpdb;
|
49 |
$list = array();
|
50 |
|
51 |
-
$no_taxonomies = array("portfolio_category","portfolio_skills","portfolio_tags","nav_menu","post_format","slide-page","element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","
|
52 |
$taxonomies = get_taxonomies();
|
53 |
$diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
|
54 |
|
@@ -208,10 +208,13 @@ public function get_mapping_attributes_dropdown() {
|
|
208 |
"mother_title" => "Product name parent product",
|
209 |
"title_hyphen" => "Product name hyphen",
|
210 |
"title_lc" => "Product name lowercase",
|
|
|
211 |
"description" => "Product description",
|
212 |
"short_description" => "Product short description",
|
213 |
"raw_description" => "Unfiltered product description",
|
214 |
"raw_short_description" => "Unfiltered product short description",
|
|
|
|
|
215 |
"price" => "Price",
|
216 |
"regular_price" => "Regular price",
|
217 |
"sale_price" => "Sale price",
|
@@ -247,7 +250,7 @@ public function get_mapping_attributes_dropdown() {
|
|
247 |
"category_path" => "Category path",
|
248 |
"category_path_short" => "Category path short",
|
249 |
"category_path_skroutz" => "Category path Skroutz",
|
250 |
-
"one_category" => "
|
251 |
"condition" => "Condition",
|
252 |
"availability" => "Availability",
|
253 |
"quantity" => "Quantity [Stock]",
|
@@ -267,7 +270,8 @@ public function get_mapping_attributes_dropdown() {
|
|
267 |
"length" => "Length",
|
268 |
"shipping" => "Shipping",
|
269 |
"shipping_price" => "Shipping cost",
|
270 |
-
"shipping_label" => "Shipping
|
|
|
271 |
"visibility" => "Visibility",
|
272 |
"rating_total" => "Total rating",
|
273 |
"rating_average" => "Average rating",
|
@@ -350,9 +354,10 @@ public function get_mapping_attributes_dropdown() {
|
|
350 |
|
351 |
foreach ($custom_attributes as $key => $value) {
|
352 |
if (!preg_match("/pyre|sbg|fusion/i",$value)){
|
353 |
-
|
|
|
354 |
$dropdown .= "<option value='$key'>" . ucfirst($value) . "</option>";
|
355 |
-
|
356 |
}
|
357 |
}
|
358 |
|
@@ -402,11 +407,14 @@ public function get_mapping_attributes_dropdown() {
|
|
402 |
"mother_title" => "Product name parent product",
|
403 |
"title_hyphen" => "Product name hyphen",
|
404 |
"title_lc" => "Product name lowercase",
|
|
|
405 |
"description" => "Product description",
|
406 |
"short_description" => "Product short description",
|
407 |
"raw_description" => "Unfiltered product description",
|
408 |
"raw_short_description" => "Unfiltered product short description",
|
409 |
-
|
|
|
|
|
410 |
"variable_link" => "Product variable link",
|
411 |
"add_to_cart_link" => "Add to cart link",
|
412 |
"image" => "Main image",
|
@@ -429,7 +437,7 @@ public function get_mapping_attributes_dropdown() {
|
|
429 |
"category_path" => "Category path",
|
430 |
"category_path_short" => "Category path short",
|
431 |
"category_path_skroutz" => "Category path Skroutz",
|
432 |
-
"one_category" => "
|
433 |
"condition" => "Condition",
|
434 |
"availability" => "Availability",
|
435 |
"quantity" => "Quantity [Stock]",
|
@@ -464,7 +472,8 @@ public function get_mapping_attributes_dropdown() {
|
|
464 |
"length" => "Length",
|
465 |
"shipping" => "Shipping",
|
466 |
"shipping_price" => "Shipping cost",
|
467 |
-
|
|
|
468 |
"visibility" => "Visibility",
|
469 |
"rating_total" => "Total rating",
|
470 |
"rating_average" => "Average rating",
|
48 |
global $wpdb;
|
49 |
$list = array();
|
50 |
|
51 |
+
$no_taxonomies = array("portfolio_category","portfolio_skills","portfolio_tags","nav_menu","post_format","slide-page","element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","category","post_tag","nav_menu","link_category","post_format","product_type","product_visibility","product_cat","product_shipping_class","product_tag");
|
52 |
$taxonomies = get_taxonomies();
|
53 |
$diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
|
54 |
|
208 |
"mother_title" => "Product name parent product",
|
209 |
"title_hyphen" => "Product name hyphen",
|
210 |
"title_lc" => "Product name lowercase",
|
211 |
+
"title_lcw" => "Product name uppercase first characters",
|
212 |
"description" => "Product description",
|
213 |
"short_description" => "Product short description",
|
214 |
"raw_description" => "Unfiltered product description",
|
215 |
"raw_short_description" => "Unfiltered product short description",
|
216 |
+
"mother_description" => "Product description parent product",
|
217 |
+
"mother_short_description" => "Product short description parent product",
|
218 |
"price" => "Price",
|
219 |
"regular_price" => "Regular price",
|
220 |
"sale_price" => "Sale price",
|
250 |
"category_path" => "Category path",
|
251 |
"category_path_short" => "Category path short",
|
252 |
"category_path_skroutz" => "Category path Skroutz",
|
253 |
+
"one_category" => "Yoast primary category",
|
254 |
"condition" => "Condition",
|
255 |
"availability" => "Availability",
|
256 |
"quantity" => "Quantity [Stock]",
|
270 |
"length" => "Length",
|
271 |
"shipping" => "Shipping",
|
272 |
"shipping_price" => "Shipping cost",
|
273 |
+
"shipping_label" => "Shipping class slug",
|
274 |
+
"shipping_label_name" => "Shipping class name",
|
275 |
"visibility" => "Visibility",
|
276 |
"rating_total" => "Total rating",
|
277 |
"rating_average" => "Average rating",
|
354 |
|
355 |
foreach ($custom_attributes as $key => $value) {
|
356 |
if (!preg_match("/pyre|sbg|fusion/i",$value)){
|
357 |
+
$value = ltrim($value);
|
358 |
+
if (!empty($value)){
|
359 |
$dropdown .= "<option value='$key'>" . ucfirst($value) . "</option>";
|
360 |
+
}
|
361 |
}
|
362 |
}
|
363 |
|
407 |
"mother_title" => "Product name parent product",
|
408 |
"title_hyphen" => "Product name hyphen",
|
409 |
"title_lc" => "Product name lowercase",
|
410 |
+
"title_lcw" => "Product name uppercase first characters",
|
411 |
"description" => "Product description",
|
412 |
"short_description" => "Product short description",
|
413 |
"raw_description" => "Unfiltered product description",
|
414 |
"raw_short_description" => "Unfiltered product short description",
|
415 |
+
"mother_description" => "Product description parent product",
|
416 |
+
"mother_short_description" => "Product short description parent product",
|
417 |
+
"link" => "Link",
|
418 |
"variable_link" => "Product variable link",
|
419 |
"add_to_cart_link" => "Add to cart link",
|
420 |
"image" => "Main image",
|
437 |
"category_path" => "Category path",
|
438 |
"category_path_short" => "Category path short",
|
439 |
"category_path_skroutz" => "Category path Skroutz",
|
440 |
+
"one_category" => "Yoast primary category",
|
441 |
"condition" => "Condition",
|
442 |
"availability" => "Availability",
|
443 |
"quantity" => "Quantity [Stock]",
|
472 |
"length" => "Length",
|
473 |
"shipping" => "Shipping",
|
474 |
"shipping_price" => "Shipping cost",
|
475 |
+
"shipping_label" => "Shipping class slug",
|
476 |
+
"shipping_label_name" => "Shipping class name",
|
477 |
"visibility" => "Visibility",
|
478 |
"rating_total" => "Total rating",
|
479 |
"rating_average" => "Average rating",
|
classes/class-get-products.php
CHANGED
@@ -26,7 +26,6 @@ class WooSEA_Get_Products {
|
|
26 |
return "<![CDATA[ $string ]]>";
|
27 |
}
|
28 |
|
29 |
-
|
30 |
/**
|
31 |
* Check if a plugin is active
|
32 |
*/
|
@@ -57,6 +56,11 @@ class WooSEA_Get_Products {
|
|
57 |
* Get all approved product review comments for Google's Product Review Feeds
|
58 |
*/
|
59 |
public function woosea_get_reviews ( $product_data, $product ) {
|
|
|
|
|
|
|
|
|
|
|
60 |
$approved_reviews = array();
|
61 |
$prod_id = $product_data['id'];
|
62 |
|
@@ -84,8 +88,10 @@ class WooSEA_Get_Products {
|
|
84 |
$cnt = 0;
|
85 |
$name = "";
|
86 |
foreach($name_pieces as $n_piece){
|
|
|
|
|
87 |
if($cnt > 0){
|
88 |
-
$n_piece = substr($n_piece, 0, 1);
|
89 |
}
|
90 |
$name .= $n_piece." ";
|
91 |
$cnt++;
|
@@ -96,7 +102,7 @@ class WooSEA_Get_Products {
|
|
96 |
$review['reviewer_name'] = html_entity_decode((str_replace("\r", "", $review['reviewer_name'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
|
97 |
$review['reviewer_name'] = preg_replace( '/\[(.*?)\]/', ' ', $review['reviewer_name'] );
|
98 |
$review['reviewer_name'] = str_replace(" ", "", $review['reviewer_name']);
|
99 |
-
|
100 |
|
101 |
$review['reviewer_id'] = $review_raw->user_id;
|
102 |
$review['review_timestamp'] = $review_raw->comment_date;
|
@@ -324,7 +330,7 @@ class WooSEA_Get_Products {
|
|
324 |
/**
|
325 |
* Get category path (needed for Prisjakt)
|
326 |
*/
|
327 |
-
public function woosea_get_term_parents( $id, $taxonomy, $link =
|
328 |
// Only add Home to the beginning of the chain when we start buildin the chain
|
329 |
if(empty($visited)){
|
330 |
$chain = 'Home';
|
@@ -931,6 +937,16 @@ class WooSEA_Get_Products {
|
|
931 |
unset($shipping_cost);
|
932 |
}
|
933 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
934 |
}
|
935 |
|
936 |
if(isset($zone_details)){
|
@@ -957,12 +973,9 @@ class WooSEA_Get_Products {
|
|
957 |
$zone_details['price'] = trim($shipping_cost);
|
958 |
}
|
959 |
} else {
|
960 |
-
// $shipping_cost = 0;
|
961 |
if(isset($shipping_cost)){
|
962 |
$zone_details['price'] = trim($currency." ".$shipping_cost);
|
963 |
}
|
964 |
-
//unset($zone_details);
|
965 |
-
//unset($shipping_cost);
|
966 |
}
|
967 |
}
|
968 |
}
|
@@ -992,12 +1005,19 @@ class WooSEA_Get_Products {
|
|
992 |
|
993 |
// Remove other shipping classes when free shipping is relevant
|
994 |
$free_check = "yes";
|
995 |
-
//$free_check = get_option ('free_shipping');
|
996 |
|
997 |
if(in_array($free_check, array_column($shipping_arr, 'free'))) { // search value in the array
|
998 |
foreach($shipping_arr as $k => $v) {
|
999 |
if(!in_array($free_check, $v)){
|
1000 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1001 |
}
|
1002 |
}
|
1003 |
}
|
@@ -1005,8 +1025,6 @@ class WooSEA_Get_Products {
|
|
1005 |
// Fix empty services
|
1006 |
foreach($shipping_arr as $k => $v){
|
1007 |
if(empty($v['service'])){
|
1008 |
-
// $lalala = get_option( 'woocommerce_default_country' );
|
1009 |
-
// $shipping_arr[$k]['country'] = get_option( 'woocommerce_default_country' );
|
1010 |
unset($shipping_arr[$k]);
|
1011 |
}
|
1012 |
}
|
@@ -1145,16 +1163,19 @@ class WooSEA_Get_Products {
|
|
1145 |
} elseif (preg_match("/g:product_detail/i",$k)){
|
1146 |
if(!empty($v)){
|
1147 |
$product_detail_split = explode("#", $v);
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
|
|
|
|
|
|
1158 |
}
|
1159 |
} elseif ($k == "g:installment"){
|
1160 |
if(!empty($v)){
|
@@ -1993,7 +2014,7 @@ class WooSEA_Get_Products {
|
|
1993 |
$xml_piece = "";
|
1994 |
|
1995 |
// Get taxonomies
|
1996 |
-
$no_taxonomies = array("element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","
|
1997 |
$taxonomies = get_taxonomies();
|
1998 |
$diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
|
1999 |
|
@@ -2325,6 +2346,10 @@ class WooSEA_Get_Products {
|
|
2325 |
$product_data['raw_description'] = substr($product_data['raw_description'], 0, 5000);
|
2326 |
$product_data['raw_short_description'] = substr($product_data['raw_short_description'], 0, 5000);
|
2327 |
|
|
|
|
|
|
|
|
|
2328 |
/**
|
2329 |
* Check of we need to add Google Analytics UTM parameters
|
2330 |
*/
|
@@ -2439,6 +2464,10 @@ class WooSEA_Get_Products {
|
|
2439 |
}
|
2440 |
|
2441 |
$product_data['shipping_label'] = $product->get_shipping_class();
|
|
|
|
|
|
|
|
|
2442 |
|
2443 |
// Get product prices
|
2444 |
$product_data['price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
|
@@ -2451,7 +2480,8 @@ class WooSEA_Get_Products {
|
|
2451 |
// Untouched raw system pricing - DO NOT CHANGE THESE
|
2452 |
$product_data['system_net_price'] = round(wc_get_price_excluding_tax( $product ), 2);
|
2453 |
$product_data['system_net_price'] = wc_format_decimal($product_data['system_net_price'],2);
|
2454 |
-
|
|
|
2455 |
$product_data['system_regular_price'] = wc_format_decimal($product_data['system_regular_price'],2);
|
2456 |
|
2457 |
$product_data['system_price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
|
@@ -2485,6 +2515,7 @@ class WooSEA_Get_Products {
|
|
2485 |
if($product->get_type() == "bundle"){
|
2486 |
if ($this->woosea_is_plugin_active('woocommerce-product-bundles/woocommerce-product-bundles.php')){
|
2487 |
$product_data['price'] = get_post_meta($product_data['id'], '_price', true);
|
|
|
2488 |
if(is_numeric($tax_rates[1]['rate'])){
|
2489 |
$product_data['price_forced'] = round(get_post_meta($product_data['id'], '_price', true) * (100+$tax_rates[1]['rate'])/100,2);
|
2490 |
$product_data['regular_price'] = round(get_post_meta($product_data['id'], '_regular_price', true) * (100+$tax_rates[1]['rate'])/100,2);
|
@@ -2582,6 +2613,7 @@ class WooSEA_Get_Products {
|
|
2582 |
$discount = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', false, $product, 1, $product_data['sale_price'], 'discounted_price', true, true);
|
2583 |
if($discount !== false){
|
2584 |
$product_data['sale_price'] = $discount;
|
|
|
2585 |
$price_incl_tax = get_option( 'woocommerce_prices_include_tax' );
|
2586 |
if($price_incl_tax == "yes"){
|
2587 |
$product_data['price_forced'] = $product_data['price']*($fullrate/100);
|
@@ -2722,9 +2754,12 @@ class WooSEA_Get_Products {
|
|
2722 |
$product_data['system_sale_price'] = wc_format_localized_price($product_data['system_sale_price']);
|
2723 |
|
2724 |
// Add rounded price options
|
2725 |
-
$
|
2726 |
-
$
|
2727 |
-
$
|
|
|
|
|
|
|
2728 |
|
2729 |
// Calculate discount percentage
|
2730 |
if($product_data['sale_price'] > 0){
|
@@ -2742,7 +2777,7 @@ class WooSEA_Get_Products {
|
|
2742 |
}
|
2743 |
}
|
2744 |
|
2745 |
-
if ((array_key_exists('shipping', $project_config['attributes'])) OR (array_key_exists('shipping_price', $project_config['attributes'])) OR ($project_config['fields'] == "trovaprezzi")){
|
2746 |
$product_data['shipping'] = $this->woosea_get_shipping_cost($class_cost_id, $project_config, $product_data['price'], $tax_rates, $shipping_zones, $product_data['id'], $product_data['item_group_id']);
|
2747 |
$shipping_str = $product_data['shipping'];
|
2748 |
}
|
@@ -2838,7 +2873,7 @@ class WooSEA_Get_Products {
|
|
2838 |
|
2839 |
foreach($diff_taxonomies as $taxo){
|
2840 |
$term_value = get_the_terms($product_data['id'], $taxo);
|
2841 |
-
$product_data[$taxo] = "";
|
2842 |
|
2843 |
if(is_array($term_value)){
|
2844 |
// Do not add variation values to the feed when they are out of stock
|
@@ -2848,7 +2883,7 @@ class WooSEA_Get_Products {
|
|
2848 |
$variations = $product_skroutz->get_available_variations();
|
2849 |
$variations_id = wp_list_pluck( $variations, 'variation_id' );
|
2850 |
$skroutz_att_array = array();
|
2851 |
-
|
2852 |
foreach($variations_id as $var_id){
|
2853 |
$stock_value = get_post_meta( $var_id, "_stock_status", true );
|
2854 |
if($stock_value == "instock"){
|
@@ -2862,7 +2897,6 @@ class WooSEA_Get_Products {
|
|
2862 |
$product_data[$taxo] = rtrim($product_data[$taxo],',');
|
2863 |
}
|
2864 |
}
|
2865 |
-
|
2866 |
foreach($skroutz_att_array as $skrtz_value){
|
2867 |
$product_data[$taxo] .= ",". $skrtz_value;
|
2868 |
}
|
@@ -2977,7 +3011,7 @@ class WooSEA_Get_Products {
|
|
2977 |
$data = $wpdb->get_results($sql);
|
2978 |
if (count($data)) {
|
2979 |
foreach ($data as $key => $value) {
|
2980 |
-
|
2981 |
if (preg_match("/_product_attributes/i",$value->name)){
|
2982 |
$product_attr = unserialize($value->type);
|
2983 |
if(!empty($product_attr)){
|
@@ -2995,14 +3029,14 @@ class WooSEA_Get_Products {
|
|
2995 |
|
2996 |
/**
|
2997 |
* Get Product Attributes for Single products
|
|
|
2998 |
*/
|
2999 |
-
if (($product->is_type('simple')) OR ($product->is_type('external')) OR ($product->is_type('mix-and-match')) OR ($product->is_type('bundle')) OR ($product->is_type('composite')) OR ($product->is_type('auction') OR ($product->is_type('subscription')))){
|
3000 |
$single_attributes = $product->get_attributes();
|
3001 |
-
|
3002 |
foreach ($single_attributes as $attribute){
|
3003 |
-
|
3004 |
-
|
3005 |
-
|
3006 |
}
|
3007 |
}
|
3008 |
|
@@ -3028,9 +3062,9 @@ class WooSEA_Get_Products {
|
|
3028 |
$product_variations = new WC_Product_Variation( $product_data['id'] );
|
3029 |
$variations = $product_variations->get_variation_attributes();
|
3030 |
|
3031 |
-
// For Skroutz apparal products we can only append colours to the product name
|
3032 |
// When a product has both a size and color attribute we assume its an apparal product
|
3033 |
-
if($project_config['fields'] == "skroutz"){
|
3034 |
$size_found = "no";
|
3035 |
$color_found = "no";
|
3036 |
|
@@ -3106,8 +3140,6 @@ class WooSEA_Get_Products {
|
|
3106 |
}
|
3107 |
}
|
3108 |
|
3109 |
-
|
3110 |
-
|
3111 |
if((isset($project_config['lowest_price_variations'])) OR (isset($project_config['default_variations']))){
|
3112 |
|
3113 |
// Determine the default variation product
|
@@ -3260,19 +3292,21 @@ class WooSEA_Get_Products {
|
|
3260 |
/**
|
3261 |
* Although this is a product variation we also need to grap the Dynamic attributes belonging to the simple mother prodict
|
3262 |
*/
|
|
|
|
|
3263 |
foreach($diff_taxonomies as $taxo){
|
3264 |
$term_value = get_the_terms($product_data['item_group_id'], $taxo);
|
3265 |
unset($product_data[$taxo]);
|
3266 |
if(is_array($term_value)){
|
3267 |
foreach($term_value as $term){
|
3268 |
if(empty($product_data[$taxo])){
|
3269 |
-
|
3270 |
} else {
|
3271 |
-
|
3272 |
}
|
3273 |
}
|
3274 |
}
|
3275 |
-
|
3276 |
|
3277 |
/**
|
3278 |
* Add product tags to the product data array
|
@@ -3440,6 +3474,8 @@ class WooSEA_Get_Products {
|
|
3440 |
* we will add CDATA brackets to the title and description attributes
|
3441 |
*/
|
3442 |
$product_data['title_lc'] = ucfirst(strtolower($product_data['title']));
|
|
|
|
|
3443 |
//$product_data['description'] = $this->woosea_append_cdata ( $product_data['description'] );
|
3444 |
//$product_data['short_description'] = $this->woosea_append_cdata ( $product_data['short_description'] );
|
3445 |
|
@@ -3448,6 +3484,17 @@ class WooSEA_Get_Products {
|
|
3448 |
*/
|
3449 |
$product_data['reviews'] = $this->woosea_get_reviews( $product_data, $product );
|
3450 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3451 |
/**
|
3452 |
* Check if individual products need to be excluded
|
3453 |
*/
|
@@ -3513,16 +3560,19 @@ class WooSEA_Get_Products {
|
|
3513 |
// For these channels parent products are allowed
|
3514 |
$allowed_channel_parents = array(
|
3515 |
"skroutz",
|
|
|
3516 |
"google_dsa",
|
3517 |
"google_product_review",
|
3518 |
);
|
3519 |
|
3520 |
-
if
|
3521 |
-
if(($
|
3522 |
-
$product_data
|
3523 |
-
|
3524 |
-
|
3525 |
-
|
|
|
|
|
3526 |
|
3527 |
/**
|
3528 |
* Remove variation products that are not THE default variation product
|
@@ -3549,6 +3599,49 @@ class WooSEA_Get_Products {
|
|
3549 |
}
|
3550 |
}
|
3551 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3552 |
/**
|
3553 |
* When product has passed the filter rules it can continue with the rest
|
3554 |
*/
|
@@ -4404,479 +4497,482 @@ class WooSEA_Get_Products {
|
|
4404 |
return $product_data;
|
4405 |
}
|
4406 |
|
4407 |
-
|
4408 |
-
|
4409 |
-
|
4410 |
private function woocommerce_sea_rules( $project_rules2, $product_data ){
|
4411 |
-
|
4412 |
-
|
4413 |
|
4414 |
-
|
4415 |
|
4416 |
-
|
4417 |
|
4418 |
-
|
4419 |
-
|
4420 |
|
4421 |
-
|
4422 |
-
|
4423 |
-
|
4424 |
-
|
4425 |
|
4426 |
// Check if a rule has been set for Google categories
|
4427 |
if (!empty($product_data['categories']) AND ($pr_array['than_attribute'] == "google_category") AND ($product_data[$pr_array['attribute']] == $pr_array['criteria'])){
|
4428 |
-
|
4429 |
-
|
4430 |
$category_id = explode("-", $pr_array['newvalue']);
|
4431 |
$pr_array['newvalue'] = $category_id[0];
|
4432 |
-
|
4433 |
-
|
4434 |
|
4435 |
-
|
4436 |
-
|
4437 |
-
|
4438 |
-
|
4439 |
|
4440 |
|
4441 |
-
|
4442 |
-
|
4443 |
-
|
4444 |
-
|
4445 |
|
4446 |
-
|
4447 |
|
4448 |
-
|
4449 |
-
|
4450 |
-
|
4451 |
-
|
4452 |
-
|
4453 |
-
|
4454 |
-
|
4455 |
-
|
4456 |
-
|
4457 |
-
|
4458 |
-
|
4459 |
-
|
4460 |
-
|
4461 |
-
|
4462 |
-
|
4463 |
-
|
4464 |
-
|
4465 |
-
|
4466 |
-
|
4467 |
-
|
4468 |
-
|
4469 |
-
|
4470 |
-
|
4471 |
-
|
4472 |
-
|
4473 |
-
|
4474 |
-
|
4475 |
-
|
4476 |
-
|
4477 |
-
|
4478 |
-
|
4479 |
-
|
4480 |
-
|
4481 |
-
|
4482 |
-
|
4483 |
-
|
4484 |
-
|
4485 |
-
|
4486 |
-
|
4487 |
-
|
4488 |
-
|
4489 |
-
|
4490 |
-
|
4491 |
-
|
4492 |
-
|
4493 |
-
|
4494 |
-
|
4495 |
-
|
4496 |
-
|
4497 |
-
|
4498 |
-
|
4499 |
-
|
4500 |
-
|
4501 |
-
|
4502 |
-
|
4503 |
-
|
4504 |
-
|
4505 |
-
|
4506 |
-
|
4507 |
-
|
4508 |
-
|
4509 |
-
|
4510 |
-
|
4511 |
-
|
4512 |
-
|
4513 |
-
|
4514 |
-
|
4515 |
-
|
4516 |
-
|
4517 |
-
|
4518 |
-
|
4519 |
-
|
4520 |
-
|
4521 |
-
|
4522 |
-
|
4523 |
-
|
4524 |
-
|
4525 |
-
|
4526 |
-
|
4527 |
-
|
4528 |
-
|
4529 |
-
|
4530 |
// Make sure that a new value has been set
|
4531 |
-
|
4532 |
-
|
4533 |
if($pr_array['attribute'] == $pr_array['than_attribute']){
|
4534 |
$newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
|
4535 |
$product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
|
4536 |
}
|
4537 |
-
|
4538 |
-
|
4539 |
-
|
4540 |
-
|
4541 |
-
|
4542 |
-
|
4543 |
-
|
4544 |
-
|
4545 |
-
|
4546 |
-
|
4547 |
-
|
4548 |
-
|
4549 |
-
|
4550 |
-
|
4551 |
-
|
4552 |
-
|
4553 |
-
|
4554 |
-
|
4555 |
-
|
4556 |
-
|
4557 |
-
|
4558 |
-
|
4559 |
-
|
4560 |
-
|
4561 |
-
|
4562 |
-
|
4563 |
-
|
4564 |
-
|
4565 |
-
|
4566 |
-
|
4567 |
-
|
4568 |
-
|
4569 |
-
|
4570 |
-
|
4571 |
-
|
4572 |
-
|
4573 |
-
|
4574 |
-
|
4575 |
-
|
4576 |
-
|
4577 |
-
|
4578 |
-
|
4579 |
-
|
4580 |
-
|
4581 |
-
|
4582 |
-
|
4583 |
-
|
4584 |
-
|
4585 |
-
|
4586 |
-
|
4587 |
-
|
4588 |
-
|
4589 |
-
|
4590 |
-
|
4591 |
-
|
4592 |
-
|
4593 |
-
|
4594 |
-
|
4595 |
-
|
4596 |
-
|
4597 |
-
|
4598 |
-
|
4599 |
-
|
4600 |
-
|
4601 |
-
|
4602 |
-
|
4603 |
-
|
4604 |
-
|
4605 |
-
|
4606 |
-
|
4607 |
-
|
4608 |
-
|
4609 |
-
|
4610 |
-
|
4611 |
-
|
4612 |
-
|
4613 |
-
|
4614 |
-
|
4615 |
-
|
4616 |
-
|
4617 |
-
|
4618 |
-
|
4619 |
-
|
4620 |
-
|
4621 |
-
|
4622 |
-
|
4623 |
-
|
4624 |
-
|
4625 |
-
|
4626 |
-
|
4627 |
-
|
4628 |
-
|
4629 |
-
|
4630 |
-
|
4631 |
-
|
4632 |
-
|
4633 |
-
|
4634 |
-
|
4635 |
-
|
4636 |
-
|
4637 |
-
|
4638 |
-
|
4639 |
-
|
4640 |
-
|
4641 |
-
|
4642 |
-
|
4643 |
-
|
4644 |
-
|
4645 |
-
|
4646 |
-
|
4647 |
-
|
4648 |
-
|
4649 |
-
|
4650 |
-
|
4651 |
-
|
4652 |
-
|
4653 |
-
|
4654 |
-
|
4655 |
-
|
4656 |
-
|
4657 |
-
|
4658 |
-
|
4659 |
-
|
4660 |
-
|
4661 |
-
|
4662 |
-
|
4663 |
-
|
4664 |
-
|
4665 |
-
|
4666 |
-
|
4667 |
-
|
4668 |
-
|
4669 |
-
|
4670 |
-
|
4671 |
-
|
4672 |
-
|
4673 |
-
|
4674 |
-
|
4675 |
-
|
4676 |
-
|
4677 |
-
|
4678 |
-
|
4679 |
-
|
4680 |
-
|
4681 |
-
|
4682 |
-
|
4683 |
-
|
4684 |
-
|
4685 |
-
|
4686 |
-
|
4687 |
-
|
4688 |
-
|
4689 |
-
|
4690 |
-
|
4691 |
-
|
4692 |
-
|
4693 |
-
|
4694 |
-
|
4695 |
-
|
4696 |
-
|
4697 |
-
|
4698 |
-
|
4699 |
-
|
4700 |
-
|
4701 |
-
|
4702 |
-
|
4703 |
-
|
4704 |
-
|
4705 |
-
|
4706 |
-
|
4707 |
-
|
4708 |
-
|
4709 |
-
|
4710 |
-
|
4711 |
-
|
4712 |
-
|
4713 |
if (!array_key_exists('cs', $pr_array)){
|
4714 |
-
$
|
4715 |
-
|
4716 |
-
|
4717 |
-
|
4718 |
-
|
4719 |
-
case($pr_array['condition'] = "contains"):
|
4720 |
-
if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
|
4721 |
-
// Specifically for shipping price rules
|
4722 |
-
if(!empty($product_data[$pr_array['than_attribute']])){
|
4723 |
-
if(is_array($product_data[$pr_array['than_attribute']])){
|
4724 |
-
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4725 |
-
for ($x = 0; $x <= $arr_size; $x++) {
|
4726 |
-
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4727 |
-
}
|
4728 |
-
} else {
|
4729 |
-
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4730 |
-
}
|
4731 |
-
} else {
|
4732 |
-
// This attribute value is empty for this product
|
4733 |
-
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4734 |
-
}
|
4735 |
-
}
|
4736 |
-
break;
|
4737 |
-
case($pr_array['condition'] = "containsnot"):
|
4738 |
-
if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
|
4739 |
-
// Specifically for shipping price rules
|
4740 |
-
if(is_array($product_data[$pr_array['than_attribute']])){
|
4741 |
-
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4742 |
-
for ($x = 0; $x <= $arr_size; $x++) {
|
4743 |
-
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4744 |
-
}
|
4745 |
-
} else {
|
4746 |
-
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4747 |
-
}
|
4748 |
-
}
|
4749 |
-
break;
|
4750 |
-
case($pr_array['condition'] = "="):
|
4751 |
-
if (($pr_array['criteria'] == "$pd_value")){
|
4752 |
-
// Specifically for shipping price rules
|
4753 |
-
if(is_array($product_data[$pr_array['than_attribute']])){
|
4754 |
-
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4755 |
-
for ($x = 0; $x <= $arr_size; $x++) {
|
4756 |
-
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4757 |
-
}
|
4758 |
-
} else {
|
4759 |
-
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4760 |
-
}
|
4761 |
-
}
|
4762 |
-
$ship = $product_data['shipping'];
|
4763 |
-
break;
|
4764 |
-
case($pr_array['condition'] = "!="):
|
4765 |
-
if (($pr_array['criteria'] != "$pd_value")){
|
4766 |
-
// Specifically for shipping price rules
|
4767 |
-
if(is_array($product_data[$pr_array['than_attribute']])){
|
4768 |
-
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4769 |
-
for ($x = 0; $x <= $arr_size; $x++) {
|
4770 |
-
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4771 |
-
}
|
4772 |
-
} else {
|
4773 |
-
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4774 |
-
}
|
4775 |
-
}
|
4776 |
-
break;
|
4777 |
-
case($pr_array['condition'] = ">"):
|
4778 |
-
// Use a lexical order on relational string operators
|
4779 |
-
if (($pd_value > $pr_array['criteria'])){
|
4780 |
-
// Specifically for shipping price rules
|
4781 |
-
if(is_array($product_data[$pr_array['than_attribute']])){
|
4782 |
-
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4783 |
-
for ($x = 0; $x <= $arr_size; $x++) {
|
4784 |
-
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4785 |
-
}
|
4786 |
-
} else {
|
4787 |
-
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4788 |
-
}
|
4789 |
-
}
|
4790 |
-
break;
|
4791 |
-
case($pr_array['condition'] = ">="):
|
4792 |
-
// Use a lexical order on relational string operators
|
4793 |
-
if (($pd_value >= $pr_array['criteria'])){
|
4794 |
-
// Specifically for shipping price rules
|
4795 |
-
if(is_array($product_data[$pr_array['than_attribute']])){
|
4796 |
-
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4797 |
-
for ($x = 0; $x <= $arr_size; $x++) {
|
4798 |
-
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4799 |
-
}
|
4800 |
-
} else {
|
4801 |
-
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4802 |
-
}
|
4803 |
-
}
|
4804 |
-
break;
|
4805 |
-
case($pr_array['condition'] = "<"):
|
4806 |
-
// Use a lexical order on relational string operators
|
4807 |
-
if (($pd_value < $pr_array['criteria'])){
|
4808 |
-
// Specifically for shipping price rules
|
4809 |
-
if(isset($product_data[$pr_array['than_attribute']]) AND (is_array($product_data[$pr_array['than_attribute']]))){
|
4810 |
-
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4811 |
-
for ($x = 0; $x <= $arr_size; $x++) {
|
4812 |
-
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4813 |
-
}
|
4814 |
-
} else {
|
4815 |
-
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4816 |
-
}
|
4817 |
-
}
|
4818 |
-
break;
|
4819 |
-
case($pr_array['condition'] = "=<"):
|
4820 |
-
// Use a lexical order on relational string operators
|
4821 |
-
if (($pd_value <= $pr_array['criteria'])){
|
4822 |
-
// Specifically for shipping price rules
|
4823 |
-
if(is_array($product_data[$pr_array['than_attribute']])){
|
4824 |
-
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4825 |
-
for ($x = 0; $x <= $arr_size; $x++) {
|
4826 |
-
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4827 |
-
}
|
4828 |
-
} else {
|
4829 |
-
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4830 |
-
}
|
4831 |
-
}
|
4832 |
-
break;
|
4833 |
|
4834 |
-
|
4835 |
-
|
4836 |
-
|
4837 |
-
|
4838 |
-
|
4839 |
-
|
4840 |
-
|
4841 |
-
|
4842 |
-
|
4843 |
-
|
4844 |
-
|
4845 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4846 |
case($pr_array['condition'] = "findreplace"):
|
4847 |
if (strpos($pd_value, $pr_array['criteria']) !== false){
|
4848 |
-
|
4849 |
-
|
4850 |
-
|
4851 |
if($pr_array['attribute'] == $pr_array['than_attribute']){
|
4852 |
-
|
4853 |
-
|
4854 |
-
|
4855 |
-
|
4856 |
-
|
|
|
4857 |
break;
|
4858 |
-
|
4859 |
-
|
4860 |
-
|
4861 |
-
|
4862 |
-
|
4863 |
-
|
4864 |
-
|
4865 |
-
|
4866 |
-
|
4867 |
-
|
4868 |
-
|
4869 |
-
|
4870 |
-
|
4871 |
-
|
4872 |
-
|
4873 |
-
|
4874 |
-
|
4875 |
-
|
4876 |
-
|
4877 |
-
|
4878 |
-
|
4879 |
-
|
4880 |
|
4881 |
/**
|
4882 |
* Function to exclude products based on individual product exclusions
|
@@ -4899,525 +4995,530 @@ class WooSEA_Get_Products {
|
|
4899 |
}
|
4900 |
}
|
4901 |
|
4902 |
-
|
4903 |
-
|
4904 |
-
|
|
|
4905 |
private function woocommerce_sea_filters( $project_rules, $product_data ){
|
4906 |
-
|
4907 |
|
4908 |
-
|
4909 |
-
|
4910 |
|
4911 |
-
|
4912 |
-
|
4913 |
-
|
4914 |
|
4915 |
-
|
4916 |
|
4917 |
-
|
4918 |
-
|
4919 |
-
|
4920 |
|
4921 |
-
|
4922 |
|
4923 |
-
|
4924 |
-
|
4925 |
-
|
4926 |
|
4927 |
-
|
4928 |
-
|
|
|
4929 |
|
4930 |
-
|
|
|
|
|
|
|
4931 |
|
4932 |
-
|
4933 |
-
|
4934 |
-
|
4935 |
-
|
4936 |
-
|
4937 |
-
|
4938 |
-
|
4939 |
-
|
4940 |
-
|
4941 |
-
|
4942 |
-
|
4943 |
-
|
4944 |
-
|
4945 |
-
|
4946 |
-
|
4947 |
-
|
4948 |
-
|
4949 |
-
|
4950 |
-
|
4951 |
-
|
4952 |
-
|
4953 |
-
|
4954 |
-
$allowed = 0;
|
4955 |
-
} elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
|
4956 |
-
$allowed = 0;
|
4957 |
-
}
|
4958 |
-
break;
|
4959 |
case($pr_array['condition'] = "="):
|
4960 |
-
|
4961 |
-
|
4962 |
-
|
4963 |
-
|
4964 |
-
}
|
4965 |
-
break;
|
4966 |
-
case($pr_array['condition'] = "!="):
|
4967 |
-
if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
4968 |
-
if($allowed <> 0){
|
4969 |
-
$allowed = 1;
|
4970 |
-
}
|
4971 |
-
} elseif (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
4972 |
-
$allowed = 0;
|
4973 |
-
}
|
4974 |
-
break;
|
4975 |
-
case($pr_array['condition'] = ">"):
|
4976 |
-
if (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
4977 |
-
$allowed = 0;
|
4978 |
-
} elseif (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
4979 |
-
$allowed = 0;
|
4980 |
-
}
|
4981 |
-
break;
|
4982 |
-
case($pr_array['condition'] = ">="):
|
4983 |
-
if (($old_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
4984 |
-
$allowed = 0;
|
4985 |
-
} elseif (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
4986 |
-
$allowed = 0;
|
4987 |
-
}
|
4988 |
-
break;
|
4989 |
-
case($pr_array['condition'] = "<"):
|
4990 |
-
if (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
4991 |
-
$allowed = 0;
|
4992 |
-
} elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
4993 |
-
$allowed = 0;
|
4994 |
-
}
|
4995 |
-
break;
|
4996 |
-
case($pr_array['condition'] = "=<"):
|
4997 |
-
if (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
4998 |
-
$allowed = 0;
|
4999 |
-
} elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
5000 |
-
$allowed = 0;
|
5001 |
-
}
|
5002 |
-
break;
|
5003 |
-
case($pr_array['condition'] = "empty"):
|
5004 |
-
if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
|
5005 |
-
$allowed = 0;
|
5006 |
-
} elseif ((strlen($pd_value > 0)) && ($pr_array['than'] == "include_only")){
|
5007 |
-
$allowed = 0;
|
5008 |
-
}
|
5009 |
-
break;
|
5010 |
-
default:
|
5011 |
-
break;
|
5012 |
-
}
|
5013 |
-
} elseif (is_array($pd_value)){
|
5014 |
-
// Tis can either be a shipping or product_tag array
|
5015 |
-
if($pr_array['attribute'] == "product_tag"){
|
5016 |
-
$in_tag_array = "not";
|
5017 |
-
|
5018 |
-
foreach($pd_value as $pt_key => $pt_value){
|
5019 |
-
// Rules for string values
|
5020 |
-
if (!array_key_exists('cs', $pr_array)){
|
5021 |
-
$pt_value = strtolower($pt_value);
|
5022 |
-
$pr_array['criteria'] = strtolower($pr_array['criteria']);
|
5023 |
-
}
|
5024 |
-
|
5025 |
-
if(preg_match('/'.$pr_array['criteria'].'/', $pt_value)){
|
5026 |
-
$in_tag_array = "yes";
|
5027 |
}
|
5028 |
-
|
5029 |
-
|
5030 |
-
|
5031 |
-
|
5032 |
-
|
5033 |
-
|
5034 |
-
|
5035 |
-
|
5036 |
-
|
5037 |
-
|
5038 |
-
|
5039 |
-
|
5040 |
-
|
5041 |
-
|
5042 |
-
|
5043 |
-
|
5044 |
-
|
5045 |
-
|
5046 |
-
|
5047 |
-
|
5048 |
-
|
5049 |
-
|
5050 |
-
|
5051 |
-
|
5052 |
-
|
5053 |
-
|
5054 |
-
|
5055 |
-
|
5056 |
-
|
5057 |
-
|
5058 |
-
|
5059 |
-
|
5060 |
-
|
5061 |
-
|
5062 |
-
|
5063 |
-
|
5064 |
-
|
5065 |
-
|
5066 |
-
|
5067 |
-
|
5068 |
-
|
5069 |
-
|
5070 |
-
|
5071 |
-
|
5072 |
-
|
5073 |
-
|
5074 |
-
|
5075 |
-
|
5076 |
-
|
5077 |
-
|
5078 |
-
|
5079 |
-
|
5080 |
-
|
5081 |
-
|
5082 |
-
|
5083 |
-
|
5084 |
-
|
5085 |
-
|
5086 |
-
|
5087 |
-
if($pr_array['than'] == "include_only"){
|
5088 |
-
if($allowed <> 0){
|
5089 |
-
$allowed = 1;
|
5090 |
-
}
|
5091 |
-
} else {
|
5092 |
-
$allowed = 0;
|
5093 |
-
}
|
5094 |
-
}
|
5095 |
-
break;
|
5096 |
-
case($pr_array['condition'] = ">="):
|
5097 |
-
if (($v >= $pr_array['criteria'])){
|
5098 |
-
if($pr_array['than'] == "include_only"){
|
5099 |
-
if($allowed <> 0){
|
5100 |
-
$allowed = 1;
|
5101 |
-
}
|
5102 |
-
} else {
|
5103 |
-
$allowed = 0;
|
5104 |
-
}
|
5105 |
-
}
|
5106 |
-
break;
|
5107 |
-
case($pr_array['condition'] = "<"):
|
5108 |
-
if (($v < $pr_array['criteria'])){
|
5109 |
-
if($pr_array['than'] == "include_only"){
|
5110 |
-
if($allowed <> 0){
|
5111 |
-
$allowed = 1;
|
5112 |
-
}
|
5113 |
-
} else {
|
5114 |
-
$allowed = 0;
|
5115 |
-
}
|
5116 |
-
}
|
5117 |
-
break;
|
5118 |
-
case($pr_array['condition'] = "=<"):
|
5119 |
-
if (($v <= $pr_array['criteria'])){
|
5120 |
-
if($pr_array['than'] == "include_only"){
|
5121 |
-
if($allowed <> 0){
|
5122 |
-
$allowed = 1;
|
5123 |
-
}
|
5124 |
-
} else {
|
5125 |
-
$allowed = 0;
|
5126 |
-
}
|
5127 |
-
}
|
5128 |
-
break;
|
5129 |
-
case($pr_array['condition'] = "empty"):
|
5130 |
-
if (strlen($v) < 1){
|
5131 |
-
if($pr_array['than'] == "include_only"){
|
5132 |
-
if($allowed <> 0){
|
5133 |
-
$allowed = 1;
|
5134 |
-
}
|
5135 |
-
} else {
|
5136 |
-
$allowed = 0;
|
5137 |
-
}
|
5138 |
-
}
|
5139 |
-
break;
|
5140 |
-
default:
|
5141 |
-
break;
|
5142 |
-
}
|
5143 |
-
} else {
|
5144 |
-
switch ($pr_array['condition']) {
|
5145 |
-
case($pr_array['condition'] = "contains"):
|
5146 |
-
if($pr_array['than'] == "include_only"){
|
5147 |
-
$allowed = 0;
|
5148 |
-
} else {
|
5149 |
-
if($allowed <> 0){
|
5150 |
-
$allowed = 1;
|
5151 |
-
}
|
5152 |
-
}
|
5153 |
-
break;
|
5154 |
-
case($pr_array['condition'] = "containsnot"):
|
5155 |
-
if($pr_array['than'] == "include_only"){
|
5156 |
-
if($allowed <> 0){
|
5157 |
-
$allowed = 1;
|
5158 |
-
}
|
5159 |
-
} else {
|
5160 |
-
$allowed = 0;
|
5161 |
-
}
|
5162 |
-
break;
|
5163 |
-
case($pr_array['condition'] = "="):
|
5164 |
-
if($pr_array['than'] == "include_only"){
|
5165 |
-
$allowed = 0;
|
5166 |
-
} else {
|
5167 |
-
if($allowed <> 0){
|
5168 |
-
$allowed = 1;
|
5169 |
-
}
|
5170 |
-
}
|
5171 |
-
break;
|
5172 |
-
case($pr_array['condition'] = "!="):
|
5173 |
-
if($pr_array['than'] == "include_only"){
|
5174 |
-
if($allowed <> 0){
|
5175 |
-
$allowed = 1;
|
5176 |
-
}
|
5177 |
-
} else {
|
5178 |
-
$allowed = 0;
|
5179 |
-
}
|
5180 |
-
break;
|
5181 |
-
case($pr_array['condition'] = ">"):
|
5182 |
-
if($pr_array['than'] == "include_only"){
|
5183 |
-
$allowed = 0;
|
5184 |
-
} else {
|
5185 |
-
$allowed = 0;
|
5186 |
-
}
|
5187 |
-
break;
|
5188 |
-
case($pr_array['condition'] = ">="):
|
5189 |
-
if($pr_array['than'] == "include_only"){
|
5190 |
-
$allowed = 0;
|
5191 |
-
} else {
|
5192 |
-
$allowed = 0;
|
5193 |
-
}
|
5194 |
-
break;
|
5195 |
-
case($pr_array['condition'] = "<"):
|
5196 |
-
if($pr_array['than'] == "include_only"){
|
5197 |
-
$allowed = 0;
|
5198 |
-
} else {
|
5199 |
-
$allowed = 0;
|
5200 |
-
}
|
5201 |
-
break;
|
5202 |
-
case($pr_array['condition'] = "=<"):
|
5203 |
-
if($pr_array['than'] == "include_only"){
|
5204 |
-
$allowed = 0;
|
5205 |
-
} else {
|
5206 |
-
$allowed = 0;
|
5207 |
-
}
|
5208 |
-
break;
|
5209 |
-
case($pr_array['condition'] = "empty"):
|
5210 |
-
if($pr_array['than'] == "include_only"){
|
5211 |
-
if($allowed <> 0){
|
5212 |
-
$allowed = 1;
|
5213 |
-
}
|
5214 |
-
} else {
|
5215 |
-
$allowed = 0;
|
5216 |
-
}
|
5217 |
-
break;
|
5218 |
-
default:
|
5219 |
-
break;
|
5220 |
-
}
|
5221 |
-
}
|
5222 |
-
} else {
|
5223 |
-
// For now only shipping details are in an array
|
5224 |
-
foreach ($pd_value as $k => $v){
|
5225 |
-
foreach ($v as $kk => $vv){
|
5226 |
-
// Only shipping detail rule can be on price for now
|
5227 |
-
if($kk == "price"){
|
5228 |
-
switch ($pr_array['condition']) {
|
5229 |
-
case($pr_array['condition'] = "contains"):
|
5230 |
-
if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
|
5231 |
-
$allowed = 0;
|
5232 |
-
}
|
5233 |
-
break;
|
5234 |
-
case($pr_array['condition'] = "containsnot"):
|
5235 |
-
if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
|
5236 |
-
$allowed = 0;
|
5237 |
-
}
|
5238 |
-
break;
|
5239 |
-
case($pr_array['condition'] = "="):
|
5240 |
-
if (($vv == $pr_array['criteria'])){
|
5241 |
-
$allowed = 0;
|
5242 |
-
}
|
5243 |
-
break;
|
5244 |
-
case($pr_array['condition'] = "!="):
|
5245 |
-
if (($vv != $pr_array['criteria'])){
|
5246 |
-
$allowed = 0;
|
5247 |
-
}
|
5248 |
-
break;
|
5249 |
-
case($pr_array['condition'] = ">"):
|
5250 |
-
if (($vv > $pr_array['criteria'])){
|
5251 |
-
$allowed = 0;
|
5252 |
-
}
|
5253 |
-
break;
|
5254 |
-
case($pr_array['condition'] = ">="):
|
5255 |
-
if (($vv >= $pr_array['criteria'])){
|
5256 |
-
$allowed = 0;
|
5257 |
-
}
|
5258 |
-
break;
|
5259 |
-
case($pr_array['condition'] = "<"):
|
5260 |
-
if (($vv < $pr_array['criteria'])){
|
5261 |
-
$allowed = 0;
|
5262 |
-
}
|
5263 |
-
break;
|
5264 |
-
case($pr_array['condition'] = "=<"):
|
5265 |
-
if (($vv <= $pr_array['criteria'])){
|
5266 |
-
$allowed = 0;
|
5267 |
-
}
|
5268 |
-
break;
|
5269 |
-
case($pr_array['condition'] = "empty"):
|
5270 |
-
if (strlen($vv) < 1){
|
5271 |
-
$allowed = 0;
|
5272 |
-
}
|
5273 |
-
break;
|
5274 |
-
default:
|
5275 |
-
break;
|
5276 |
-
}
|
5277 |
-
}
|
5278 |
-
}
|
5279 |
-
}
|
5280 |
-
}
|
5281 |
-
} else {
|
5282 |
-
// Filters for string values
|
5283 |
-
// If case-sensitve is off than lowercase both the criteria and attribute value
|
5284 |
-
if (array_key_exists('cs', $pr_array)){
|
5285 |
-
if ($pr_array['cs'] != "on"){
|
5286 |
-
$pd_value = strtolower($pd_value);
|
5287 |
-
$pr_array['criteria'] = strtolower($pr_array['criteria']);
|
5288 |
-
}
|
5289 |
-
}
|
5290 |
-
$pos = strpos($pd_value, '&');
|
5291 |
-
$pos_slash = strpos($pr_array['criteria'], '\\');
|
5292 |
-
if($pos !== false){
|
5293 |
-
$pd_value = str_replace("&","&",$pd_value);
|
5294 |
-
}
|
5295 |
-
if($pos_slash !== false){
|
5296 |
-
$pr_array['criteria'] = str_replace("\\","",$pr_array['criteria']);
|
5297 |
-
}
|
5298 |
|
5299 |
-
|
5300 |
-
|
5301 |
-
|
5302 |
-
|
5303 |
-
|
5304 |
-
|
5305 |
-
|
5306 |
-
|
5307 |
-
|
5308 |
-
|
5309 |
-
|
5310 |
-
|
5311 |
-
|
5312 |
-
|
5313 |
-
|
5314 |
-
|
5315 |
-
|
5316 |
-
|
5317 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5318 |
case($pr_array['condition'] = "="):
|
5319 |
-
|
5320 |
-
$allowed = 0;
|
5321 |
-
} elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "include_only")){
|
5322 |
-
$found = strpos($pd_value,$pr_array['criteria']);
|
5323 |
-
if ($found !== false) {
|
5324 |
-
//for category mapping check if its an array
|
5325 |
-
if($pr_array['attribute'] == "raw_categories"){
|
5326 |
-
$raw_cats_arr = explode("||",$pd_value);
|
5327 |
-
if(is_array($raw_cats_arr)){
|
5328 |
-
if(in_array($pr_array['criteria'],$raw_cats_arr, TRUE)){
|
5329 |
-
if($allowed <> 0){
|
5330 |
-
$allowed = 1;
|
5331 |
-
}
|
5332 |
-
} else {
|
5333 |
-
$allowed = 0;
|
5334 |
-
}
|
5335 |
-
}
|
5336 |
-
} else {
|
5337 |
-
if($allowed <> 0){
|
5338 |
-
$allowed = 1;
|
5339 |
-
}
|
5340 |
-
}
|
5341 |
-
} else {
|
5342 |
-
$allowed = 0;
|
5343 |
-
}
|
5344 |
-
} elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
|
5345 |
-
if($allowed <> 0){
|
5346 |
-
$allowed = 1;
|
5347 |
-
}
|
5348 |
-
} elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
|
5349 |
-
$allowed = 0;
|
5350 |
-
} elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
|
5351 |
-
$allowed = 1;
|
5352 |
-
}
|
5353 |
-
break;
|
5354 |
-
case($pr_array['condition'] = "!="):
|
5355 |
-
if (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "exclude")){
|
5356 |
-
if($allowed <> 0){
|
5357 |
-
$allowed = 1;
|
5358 |
-
}
|
5359 |
-
} elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
|
5360 |
-
$allowed = 0;
|
5361 |
-
} elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "exclude")){
|
5362 |
-
$allowed = 0;
|
5363 |
-
}
|
5364 |
-
break;
|
5365 |
-
case($pr_array['condition'] = ">"):
|
5366 |
-
// Use a lexical order on relational string operators
|
5367 |
-
if (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
5368 |
-
$allowed = 0;
|
5369 |
-
} elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
5370 |
-
$allowed = 0;
|
5371 |
-
}
|
5372 |
-
break;
|
5373 |
-
case($pr_array['condition'] = ">="):
|
5374 |
-
// Use a lexical order on relational string operators
|
5375 |
-
if (($pd_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
5376 |
-
$allowed = 0;
|
5377 |
-
} elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
5378 |
$allowed = 0;
|
5379 |
-
|
5380 |
-
|
5381 |
-
|
5382 |
-
|
5383 |
-
|
5384 |
-
|
5385 |
-
|
5386 |
-
|
5387 |
-
|
5388 |
-
|
5389 |
-
|
5390 |
-
|
5391 |
-
|
5392 |
-
|
5393 |
-
|
5394 |
-
|
5395 |
-
|
5396 |
-
|
5397 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5398 |
if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
|
5399 |
-
|
5400 |
-
|
5401 |
-
|
5402 |
-
|
5403 |
-
|
5404 |
-
|
5405 |
-
|
5406 |
-
|
5407 |
-
|
5408 |
-
|
5409 |
-
|
5410 |
-
|
5411 |
-
|
5412 |
-
|
5413 |
-
|
5414 |
-
|
5415 |
|
5416 |
-
|
5417 |
-
|
5418 |
-
|
5419 |
-
|
5420 |
-
|
5421 |
-
|
5422 |
-
|
5423 |
}
|
26 |
return "<![CDATA[ $string ]]>";
|
27 |
}
|
28 |
|
|
|
29 |
/**
|
30 |
* Check if a plugin is active
|
31 |
*/
|
56 |
* Get all approved product review comments for Google's Product Review Feeds
|
57 |
*/
|
58 |
public function woosea_get_reviews ( $product_data, $product ) {
|
59 |
+
// Rwviews for the parent variable product itself can be skipped, the review is added for the variation
|
60 |
+
if($product_data['product_type'] == "variable"){
|
61 |
+
return;
|
62 |
+
}
|
63 |
+
|
64 |
$approved_reviews = array();
|
65 |
$prod_id = $product_data['id'];
|
66 |
|
88 |
$cnt = 0;
|
89 |
$name = "";
|
90 |
foreach($name_pieces as $n_piece){
|
91 |
+
$n_piece = str_replace("&", "", $n_piece);
|
92 |
+
|
93 |
if($cnt > 0){
|
94 |
+
$n_piece = ucfirst(substr($n_piece, 0, 1));
|
95 |
}
|
96 |
$name .= $n_piece." ";
|
97 |
$cnt++;
|
102 |
$review['reviewer_name'] = html_entity_decode((str_replace("\r", "", $review['reviewer_name'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
|
103 |
$review['reviewer_name'] = preg_replace( '/\[(.*?)\]/', ' ', $review['reviewer_name'] );
|
104 |
$review['reviewer_name'] = str_replace(" ", "", $review['reviewer_name']);
|
105 |
+
$review['reviewer_name'] = $this->woosea_utf8_for_xml( $review['reviewer_name'] );
|
106 |
|
107 |
$review['reviewer_id'] = $review_raw->user_id;
|
108 |
$review['review_timestamp'] = $review_raw->comment_date;
|
330 |
/**
|
331 |
* Get category path (needed for Prisjakt)
|
332 |
*/
|
333 |
+
public function woosea_get_term_parents( $id, $taxonomy, string $link = null, $project_taxonomy, $nicename = false, $visited = array() ) {
|
334 |
// Only add Home to the beginning of the chain when we start buildin the chain
|
335 |
if(empty($visited)){
|
336 |
$chain = 'Home';
|
937 |
unset($shipping_cost);
|
938 |
}
|
939 |
}
|
940 |
+
|
941 |
+
// User do not want to have free shipping in their feed
|
942 |
+
$remove_free_shipping = "no";
|
943 |
+
$remove_free_shipping = get_option ('remove_free_shipping');
|
944 |
+
|
945 |
+
if($remove_free_shipping == "yes"){
|
946 |
+
unset($zone_details['service']);
|
947 |
+
unset($zone_details['price']);
|
948 |
+
unset($shipping_cost);
|
949 |
+
}
|
950 |
}
|
951 |
|
952 |
if(isset($zone_details)){
|
973 |
$zone_details['price'] = trim($shipping_cost);
|
974 |
}
|
975 |
} else {
|
|
|
976 |
if(isset($shipping_cost)){
|
977 |
$zone_details['price'] = trim($currency." ".$shipping_cost);
|
978 |
}
|
|
|
|
|
979 |
}
|
980 |
}
|
981 |
}
|
1005 |
|
1006 |
// Remove other shipping classes when free shipping is relevant
|
1007 |
$free_check = "yes";
|
|
|
1008 |
|
1009 |
if(in_array($free_check, array_column($shipping_arr, 'free'))) { // search value in the array
|
1010 |
foreach($shipping_arr as $k => $v) {
|
1011 |
if(!in_array($free_check, $v)){
|
1012 |
+
|
1013 |
+
// User do not want to have free shipping in their feed
|
1014 |
+
// Only remove the other shipping classes when free shipping is not being removed
|
1015 |
+
$remove_free_shipping = "no";
|
1016 |
+
$remove_free_shipping = get_option ('remove_free_shipping');
|
1017 |
+
|
1018 |
+
if($remove_free_shipping == "no"){
|
1019 |
+
unset($shipping_arr[$k]);
|
1020 |
+
}
|
1021 |
}
|
1022 |
}
|
1023 |
}
|
1025 |
// Fix empty services
|
1026 |
foreach($shipping_arr as $k => $v){
|
1027 |
if(empty($v['service'])){
|
|
|
|
|
1028 |
unset($shipping_arr[$k]);
|
1029 |
}
|
1030 |
}
|
1163 |
} elseif (preg_match("/g:product_detail/i",$k)){
|
1164 |
if(!empty($v)){
|
1165 |
$product_detail_split = explode("#", $v);
|
1166 |
+
$detail_complete = count($product_detail_split);
|
1167 |
+
if($detail_complete == 2){
|
1168 |
+
$product_detail = $product->addChild('g:product_detail', '', $namespace['g']);
|
1169 |
+
$name = str_replace("_", " ", $product_detail_split[0]);
|
1170 |
+
|
1171 |
+
$section_name = explode(":", $name);
|
1172 |
+
$section_name_start = ucfirst($section_name[0]);
|
1173 |
+
$name = ucfirst(trim($section_name[1]));
|
1174 |
+
|
1175 |
+
$section_name = $product_detail->addChild('g:section_name', "General", $namespace['g']);
|
1176 |
+
$product_detail_name = $product_detail->addChild('g:attribute_name', $section_name_start, $namespace['g']);
|
1177 |
+
$product_detail_value = $product_detail->addChild('g:attribute_value', $product_detail_split[1], $namespace['g']);
|
1178 |
+
}
|
1179 |
}
|
1180 |
} elseif ($k == "g:installment"){
|
1181 |
if(!empty($v)){
|
2014 |
$xml_piece = "";
|
2015 |
|
2016 |
// Get taxonomies
|
2017 |
+
$no_taxonomies = array("element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","category","post_tag","nav_menu","link_category","post_format","product_type","product_visibility","product_cat","product_shipping_class","product_tag");
|
2018 |
$taxonomies = get_taxonomies();
|
2019 |
$diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
|
2020 |
|
2346 |
$product_data['raw_description'] = substr($product_data['raw_description'], 0, 5000);
|
2347 |
$product_data['raw_short_description'] = substr($product_data['raw_short_description'], 0, 5000);
|
2348 |
|
2349 |
+
// Parent variable description
|
2350 |
+
$product_data['mother_description'] = $product_data['description'];
|
2351 |
+
$product_data['mother_short_description'] = $product_data['short_description'];
|
2352 |
+
|
2353 |
/**
|
2354 |
* Check of we need to add Google Analytics UTM parameters
|
2355 |
*/
|
2464 |
}
|
2465 |
|
2466 |
$product_data['shipping_label'] = $product->get_shipping_class();
|
2467 |
+
$term = get_term_by( 'slug', $product->get_shipping_class(), 'product_shipping_class' );
|
2468 |
+
if(is_object($term)){
|
2469 |
+
$product_data['shipping_label_name'] = $term->name;
|
2470 |
+
}
|
2471 |
|
2472 |
// Get product prices
|
2473 |
$product_data['price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
|
2480 |
// Untouched raw system pricing - DO NOT CHANGE THESE
|
2481 |
$product_data['system_net_price'] = round(wc_get_price_excluding_tax( $product ), 2);
|
2482 |
$product_data['system_net_price'] = wc_format_decimal($product_data['system_net_price'],2);
|
2483 |
+
$float_system_regular_price = floatval($product->get_regular_price());
|
2484 |
+
$product_data['system_regular_price'] = round($float_system_regular_price,2);
|
2485 |
$product_data['system_regular_price'] = wc_format_decimal($product_data['system_regular_price'],2);
|
2486 |
|
2487 |
$product_data['system_price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
|
2515 |
if($product->get_type() == "bundle"){
|
2516 |
if ($this->woosea_is_plugin_active('woocommerce-product-bundles/woocommerce-product-bundles.php')){
|
2517 |
$product_data['price'] = get_post_meta($product_data['id'], '_price', true);
|
2518 |
+
$product_data['sale_price'] = get_post_meta($product_data['id'], '_sale_price', true);
|
2519 |
if(is_numeric($tax_rates[1]['rate'])){
|
2520 |
$product_data['price_forced'] = round(get_post_meta($product_data['id'], '_price', true) * (100+$tax_rates[1]['rate'])/100,2);
|
2521 |
$product_data['regular_price'] = round(get_post_meta($product_data['id'], '_regular_price', true) * (100+$tax_rates[1]['rate'])/100,2);
|
2613 |
$discount = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', false, $product, 1, $product_data['sale_price'], 'discounted_price', true, true);
|
2614 |
if($discount !== false){
|
2615 |
$product_data['sale_price'] = $discount;
|
2616 |
+
$product_data['price'] = $discount;
|
2617 |
$price_incl_tax = get_option( 'woocommerce_prices_include_tax' );
|
2618 |
if($price_incl_tax == "yes"){
|
2619 |
$product_data['price_forced'] = $product_data['price']*($fullrate/100);
|
2754 |
$product_data['system_sale_price'] = wc_format_localized_price($product_data['system_sale_price']);
|
2755 |
|
2756 |
// Add rounded price options
|
2757 |
+
$float_price = floatval($product_data['price']);
|
2758 |
+
$float_regular_price = floatval($product_data['regular_price']);
|
2759 |
+
$float_sale_price = floatval($product_data['sale_price']);
|
2760 |
+
$product_data['rounded_price'] = round($float_price,0);
|
2761 |
+
$product_data['rounded_regular_price'] = round($float_regular_price,0);
|
2762 |
+
$product_data['rounded_sale_price'] = round($float_sale_price,0);
|
2763 |
|
2764 |
// Calculate discount percentage
|
2765 |
if($product_data['sale_price'] > 0){
|
2777 |
}
|
2778 |
}
|
2779 |
|
2780 |
+
if ((array_key_exists('shipping', $project_config['attributes'])) OR (array_key_exists('shipping_price', $project_config['attributes'])) OR ($project_config['fields'] == "trovaprezzi") OR ($project_config['fields'] == "customfeed")){
|
2781 |
$product_data['shipping'] = $this->woosea_get_shipping_cost($class_cost_id, $project_config, $product_data['price'], $tax_rates, $shipping_zones, $product_data['id'], $product_data['item_group_id']);
|
2782 |
$shipping_str = $product_data['shipping'];
|
2783 |
}
|
2873 |
|
2874 |
foreach($diff_taxonomies as $taxo){
|
2875 |
$term_value = get_the_terms($product_data['id'], $taxo);
|
2876 |
+
$product_data["$taxo"] = "";
|
2877 |
|
2878 |
if(is_array($term_value)){
|
2879 |
// Do not add variation values to the feed when they are out of stock
|
2883 |
$variations = $product_skroutz->get_available_variations();
|
2884 |
$variations_id = wp_list_pluck( $variations, 'variation_id' );
|
2885 |
$skroutz_att_array = array();
|
2886 |
+
|
2887 |
foreach($variations_id as $var_id){
|
2888 |
$stock_value = get_post_meta( $var_id, "_stock_status", true );
|
2889 |
if($stock_value == "instock"){
|
2897 |
$product_data[$taxo] = rtrim($product_data[$taxo],',');
|
2898 |
}
|
2899 |
}
|
|
|
2900 |
foreach($skroutz_att_array as $skrtz_value){
|
2901 |
$product_data[$taxo] .= ",". $skrtz_value;
|
2902 |
}
|
3011 |
$data = $wpdb->get_results($sql);
|
3012 |
if (count($data)) {
|
3013 |
foreach ($data as $key => $value) {
|
3014 |
+
$value_display = str_replace("_", " ",$value->name);
|
3015 |
if (preg_match("/_product_attributes/i",$value->name)){
|
3016 |
$product_attr = unserialize($value->type);
|
3017 |
if(!empty($product_attr)){
|
3029 |
|
3030 |
/**
|
3031 |
* Get Product Attributes for Single products
|
3032 |
+
* These are the attributes users create themselves in WooCommerce
|
3033 |
*/
|
3034 |
+
if (($product->is_type('simple')) OR ($product->is_type('external')) OR ($product->is_type('mix-and-match')) OR ($product->is_type('bundle')) OR ($product->is_type('composite')) OR ($product->is_type('auction') OR ($product->is_type('subscription')) OR ($product->is_type('variable')))){
|
3035 |
$single_attributes = $product->get_attributes();
|
|
|
3036 |
foreach ($single_attributes as $attribute){
|
3037 |
+
$attr_name = strtolower($attribute->get_name());
|
3038 |
+
$attr_value = $product->get_attribute($attr_name);
|
3039 |
+
$product_data[$attr_name] = $attr_value;
|
3040 |
}
|
3041 |
}
|
3042 |
|
3062 |
$product_variations = new WC_Product_Variation( $product_data['id'] );
|
3063 |
$variations = $product_variations->get_variation_attributes();
|
3064 |
|
3065 |
+
// For Skroutz and Bestprice apparal products we can only append colours to the product name
|
3066 |
// When a product has both a size and color attribute we assume its an apparal product
|
3067 |
+
if(($project_config['fields'] == "skroutz") OR ($project_config['fields'] == "bestprice")){
|
3068 |
$size_found = "no";
|
3069 |
$color_found = "no";
|
3070 |
|
3140 |
}
|
3141 |
}
|
3142 |
|
|
|
|
|
3143 |
if((isset($project_config['lowest_price_variations'])) OR (isset($project_config['default_variations']))){
|
3144 |
|
3145 |
// Determine the default variation product
|
3292 |
/**
|
3293 |
* Although this is a product variation we also need to grap the Dynamic attributes belonging to the simple mother prodict
|
3294 |
*/
|
3295 |
+
$stock_value = get_post_meta( $product_data['id'], "_stock_status", true );
|
3296 |
+
//if($stock_value == "instock"){
|
3297 |
foreach($diff_taxonomies as $taxo){
|
3298 |
$term_value = get_the_terms($product_data['item_group_id'], $taxo);
|
3299 |
unset($product_data[$taxo]);
|
3300 |
if(is_array($term_value)){
|
3301 |
foreach($term_value as $term){
|
3302 |
if(empty($product_data[$taxo])){
|
3303 |
+
$product_data[$taxo] = $term->name;
|
3304 |
} else {
|
3305 |
+
$product_data[$taxo] .= " ".$term->name;
|
3306 |
}
|
3307 |
}
|
3308 |
}
|
3309 |
+
}
|
3310 |
|
3311 |
/**
|
3312 |
* Add product tags to the product data array
|
3474 |
* we will add CDATA brackets to the title and description attributes
|
3475 |
*/
|
3476 |
$product_data['title_lc'] = ucfirst(strtolower($product_data['title']));
|
3477 |
+
$product_data['title_lcw'] = ucwords(strtolower($product_data['title']));
|
3478 |
+
|
3479 |
//$product_data['description'] = $this->woosea_append_cdata ( $product_data['description'] );
|
3480 |
//$product_data['short_description'] = $this->woosea_append_cdata ( $product_data['short_description'] );
|
3481 |
|
3484 |
*/
|
3485 |
$product_data['reviews'] = $this->woosea_get_reviews( $product_data, $product );
|
3486 |
|
3487 |
+
/**
|
3488 |
+
* Filter out reviews that do not have text
|
3489 |
+
*/
|
3490 |
+
if(!empty($product_data['reviews'])){
|
3491 |
+
foreach($product_data['reviews'] as $review_id => $review_details){
|
3492 |
+
if(empty($review_details['content'])){
|
3493 |
+
unset($product_data['reviews'][$review_id]);
|
3494 |
+
}
|
3495 |
+
}
|
3496 |
+
}
|
3497 |
+
|
3498 |
/**
|
3499 |
* Check if individual products need to be excluded
|
3500 |
*/
|
3560 |
// For these channels parent products are allowed
|
3561 |
$allowed_channel_parents = array(
|
3562 |
"skroutz",
|
3563 |
+
"bestprice",
|
3564 |
"google_dsa",
|
3565 |
"google_product_review",
|
3566 |
);
|
3567 |
|
3568 |
+
if(array_key_exists('fields', $project_config)){
|
3569 |
+
if (!in_array($project_config['fields'], $allowed_channel_parents)){
|
3570 |
+
if(($product->is_type('variable')) AND ($product_data['item_group_id'] == 0)){
|
3571 |
+
$product_data = array();
|
3572 |
+
$product_data = null;
|
3573 |
+
}
|
3574 |
+
}
|
3575 |
+
}
|
3576 |
|
3577 |
/**
|
3578 |
* Remove variation products that are not THE default variation product
|
3599 |
}
|
3600 |
}
|
3601 |
|
3602 |
+
/**
|
3603 |
+
* Do final check on Skroutz out of stock sizes
|
3604 |
+
* When a size is not on stock remove it
|
3605 |
+
*/
|
3606 |
+
if($project_config['fields'] == "skroutz"){
|
3607 |
+
if(isset($product_data['id'])){
|
3608 |
+
foreach($project_config['attributes'] as $ky => $vy){
|
3609 |
+
if(isset($vy['attribute'])){
|
3610 |
+
if($vy['attribute'] == "size"){
|
3611 |
+
$size_found = "yes";
|
3612 |
+
$sz_attribute = $vy['mapfrom'];
|
3613 |
+
}
|
3614 |
+
if($vy['attribute'] == "color"){
|
3615 |
+
$color_found = "yes";
|
3616 |
+
$clr_attribute = $vy['mapfrom'];
|
3617 |
+
}
|
3618 |
+
}
|
3619 |
+
}
|
3620 |
+
|
3621 |
+
$stock_value = get_post_meta( $product_data['id'], "_stock_status", true );
|
3622 |
+
$sz_attr_value = get_post_meta( $product_data['id'], $sz_attribute, true );
|
3623 |
+
$clr_attr_value = get_post_meta( $product_data['id'], "attribute_".$clr_attribute, true );
|
3624 |
+
if(isset($product_data['item_group_id']) AND ($product_data['item_group_id'] > 0)){
|
3625 |
+
$product_skroutz = wc_get_product($product_data['item_group_id']);
|
3626 |
+
$variations = $product_skroutz->get_available_variations();
|
3627 |
+
$variations_id = wp_list_pluck( $variations, 'variation_id' );
|
3628 |
+
|
3629 |
+
foreach($variations_id as $var_id){
|
3630 |
+
$clr_variation = get_post_meta( $var_id, "attribute_".$clr_attribute, true );
|
3631 |
+
$size_variation = get_post_meta( $var_id, "attribute_".$sz_attribute, true );
|
3632 |
+
$stock_variation = get_post_meta( $var_id, "_stock_status", true );
|
3633 |
+
|
3634 |
+
if($clr_variation == $clr_attr_value){
|
3635 |
+
if($stock_variation == "outofstock"){
|
3636 |
+
// Remove this size as it is not on stock
|
3637 |
+
$product_data[$sz_attribute] = str_replace(ucfirst($size_variation),"",$product_data[$sz_attribute]);
|
3638 |
+
}
|
3639 |
+
}
|
3640 |
+
}
|
3641 |
+
}
|
3642 |
+
}
|
3643 |
+
}
|
3644 |
+
|
3645 |
/**
|
3646 |
* When product has passed the filter rules it can continue with the rest
|
3647 |
*/
|
4497 |
return $product_data;
|
4498 |
}
|
4499 |
|
4500 |
+
/**
|
4501 |
+
* Execute project rules
|
4502 |
+
*/
|
4503 |
private function woocommerce_sea_rules( $project_rules2, $product_data ){
|
4504 |
+
$aantal_prods = count($product_data);
|
4505 |
+
if($aantal_prods > 0){
|
4506 |
|
4507 |
+
foreach ($project_rules2 as $pr_key => $pr_array){
|
4508 |
|
4509 |
+
foreach ($product_data as $pd_key => $pd_value){
|
4510 |
|
4511 |
+
// Check is there is a rule on specific attributes
|
4512 |
+
if($pd_key == $pr_array['attribute']){
|
4513 |
|
4514 |
+
// This is because for data manipulation the than attribute is empty
|
4515 |
+
if(!array_key_exists('than_attribute', $pr_array)){
|
4516 |
+
$pr_array['than_attribute'] = $pd_key;
|
4517 |
+
}
|
4518 |
|
4519 |
// Check if a rule has been set for Google categories
|
4520 |
if (!empty($product_data['categories']) AND ($pr_array['than_attribute'] == "google_category") AND ($product_data[$pr_array['attribute']] == $pr_array['criteria'])){
|
4521 |
+
|
4522 |
+
$pr_array['than_attribute'] = "categories";
|
4523 |
$category_id = explode("-", $pr_array['newvalue']);
|
4524 |
$pr_array['newvalue'] = $category_id[0];
|
4525 |
+
$product_data['categories'] = $pr_array['newvalue'];
|
4526 |
+
}
|
4527 |
|
4528 |
+
// Make sure that rules on numerics are on true numerics
|
4529 |
+
if (!is_array($pd_value) AND (!preg_match('/[A-Za-z]/', $pd_value))){
|
4530 |
+
$pd_value = strtr($pd_value, ',', '.');
|
4531 |
+
}
|
4532 |
|
4533 |
|
4534 |
+
// Make sure the price or sale price is numeric
|
4535 |
+
if(($pr_array['attribute'] == "sale_price") OR ($pr_array['attribute'] == "price")){
|
4536 |
+
settype($pd_value, "double");
|
4537 |
+
}
|
4538 |
|
4539 |
+
if (((is_numeric($pd_value)) AND ($pr_array['than_attribute'] != "shipping"))){
|
4540 |
|
4541 |
+
// Rules for numeric values
|
4542 |
+
switch ($pr_array['condition']) {
|
4543 |
+
case($pr_array['condition'] = "contains"):
|
4544 |
+
if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
|
4545 |
+
$product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $pd_value);
|
4546 |
+
}
|
4547 |
+
break;
|
4548 |
+
case($pr_array['condition'] = "containsnot"):
|
4549 |
+
if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
|
4550 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4551 |
+
}
|
4552 |
+
break;
|
4553 |
+
case($pr_array['condition'] = "="):
|
4554 |
+
if (($pd_value == $pr_array['criteria'])){
|
4555 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4556 |
+
}
|
4557 |
+
break;
|
4558 |
+
case($pr_array['condition'] = "!="):
|
4559 |
+
if (($pd_value != $pr_array['criteria'])){
|
4560 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4561 |
+
}
|
4562 |
+
break;
|
4563 |
+
case($pr_array['condition'] = ">"):
|
4564 |
+
if (($pd_value > $pr_array['criteria'])){
|
4565 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4566 |
+
}
|
4567 |
+
break;
|
4568 |
+
case($pr_array['condition'] = ">="):
|
4569 |
+
if (($pd_value >= $pr_array['criteria'])){
|
4570 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4571 |
+
}
|
4572 |
+
break;
|
4573 |
+
case($pr_array['condition'] = "<"):
|
4574 |
+
if (($pd_value < $pr_array['criteria'])){
|
4575 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4576 |
+
}
|
4577 |
+
break;
|
4578 |
+
case($pr_array['condition'] = "=<"):
|
4579 |
+
if (($pd_value <= $pr_array['criteria'])){
|
4580 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4581 |
+
}
|
4582 |
+
break;
|
4583 |
+
case($pr_array['condition'] = "empty"):
|
4584 |
+
if(empty($product_data[$pr_array['attribute']])){
|
4585 |
+
if ((strlen($pd_value) < 1)){
|
4586 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4587 |
+
} else {
|
4588 |
+
$product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
|
4589 |
+
}
|
4590 |
+
}
|
4591 |
+
break;
|
4592 |
+
case($pr_array['condition'] = "multiply"):
|
4593 |
+
$pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
|
4594 |
+
$convert_back = "false";
|
4595 |
+
$pos = strpos($pd_value, ',');
|
4596 |
+
if($pos !== false){
|
4597 |
+
$convert_back = "true";
|
4598 |
+
}
|
4599 |
+
$pd_value = strtr($pd_value, ',', '.');
|
4600 |
+
$newvalue = $pd_value*$pr_array['criteria'];
|
4601 |
+
$newvalue = round($newvalue, 2);
|
4602 |
+
if($convert_back == "true"){
|
4603 |
+
$newvalue = strtr($newvalue, '.',',');
|
4604 |
+
}
|
4605 |
+
$product_data[$pr_array['attribute']] = $newvalue;
|
4606 |
+
break;
|
4607 |
+
case($pr_array['condition'] = "divide"):
|
4608 |
+
$newvalue = ($pd_value / $pr_array['criteria']);
|
4609 |
+
$newvalue = round($newvalue, 2);
|
4610 |
+
$newvalue = strtr($newvalue, '.',',');
|
4611 |
+
$product_data[$pr_array['attribute']] = $newvalue;
|
4612 |
+
break;
|
4613 |
+
case($pr_array['condition'] = "plus"):
|
4614 |
+
$newvalue = ($pd_value + $pr_array['criteria']);
|
4615 |
+
$product_data[$pr_array['attribute']] = $newvalue;
|
4616 |
+
break;
|
4617 |
+
case($pr_array['condition'] = "minus"):
|
4618 |
+
$newvalue = ($pd_value - $pr_array['criteria']);
|
4619 |
+
$product_data[$pr_array['attribute']] = $newvalue;
|
4620 |
+
break;
|
4621 |
+
case($pr_array['condition'] = "findreplace"):
|
4622 |
+
if (strpos($pd_value, $pr_array['criteria']) !== false){
|
4623 |
// Make sure that a new value has been set
|
4624 |
+
if(!empty($pr_array['newvalue'])){
|
4625 |
+
// Find and replace only work on same attribute field, otherwise create a contains rule
|
4626 |
if($pr_array['attribute'] == $pr_array['than_attribute']){
|
4627 |
$newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
|
4628 |
$product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
|
4629 |
}
|
4630 |
+
}
|
4631 |
+
}
|
4632 |
+
break;
|
4633 |
+
default:
|
4634 |
+
break;
|
4635 |
+
}
|
4636 |
+
} elseif (is_array($pd_value)) {
|
4637 |
+
|
4638 |
+
// For now only shipping details are in an array
|
4639 |
+
foreach ($pd_value as $k => $v){
|
4640 |
+
if(is_array($v)){
|
4641 |
+
foreach ($v as $kk => $vv){
|
4642 |
+
// Only shipping detail rule can be on price for now
|
4643 |
+
if($kk == "price"){
|
4644 |
+
switch ($pr_array['condition']) {
|
4645 |
+
case($pr_array['condition'] = "contains"):
|
4646 |
+
if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
|
4647 |
+
$pd_value[$k]['price'] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $vv);
|
4648 |
+
$product_data[$pr_array['than_attribute']] = $pd_value;
|
4649 |
+
}
|
4650 |
+
break;
|
4651 |
+
case($pr_array['condition'] = "containsnot"):
|
4652 |
+
if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
|
4653 |
+
$pd_value[$k]['price'] = $pr_array['newvalue'];
|
4654 |
+
$product_data[$pr_array['than_attribute']] = $pd_value;
|
4655 |
+
}
|
4656 |
+
break;
|
4657 |
+
case($pr_array['condition'] = "="):
|
4658 |
+
if (($vv == $pr_array['criteria'])){
|
4659 |
+
$pd_value[$k]['price'] = $pr_array['newvalue'];
|
4660 |
+
$product_data[$pr_array['than_attribute']] = $pd_value;
|
4661 |
+
}
|
4662 |
+
break;
|
4663 |
+
case($pr_array['condition'] = "!="):
|
4664 |
+
if (($vv != $pr_array['criteria'])){
|
4665 |
+
$pd_value[$k]['price'] = $pr_array['newvalue'];
|
4666 |
+
$product_data[$pr_array['than_attribute']] = $pd_value;
|
4667 |
+
}
|
4668 |
+
break;
|
4669 |
+
case($pr_array['condition'] = ">"):
|
4670 |
+
if (($vv > $pr_array['criteria'])){
|
4671 |
+
$pd_value[$k]['price'] = $pr_array['newvalue'];
|
4672 |
+
$product_data[$pr_array['than_attribute']] = $pd_value;
|
4673 |
+
}
|
4674 |
+
break;
|
4675 |
+
case($pr_array['condition'] = ">="):
|
4676 |
+
if (($vv >= $pr_array['criteria'])){
|
4677 |
+
$pd_value[$k]['price'] = $pr_array['newvalue'];
|
4678 |
+
$product_data[$pr_array['than_attribute']] = $pd_value;
|
4679 |
+
}
|
4680 |
+
break;
|
4681 |
+
case($pr_array['condition'] = "<"):
|
4682 |
+
if (($vv < $pr_array['criteria'])){
|
4683 |
+
$pd_value[$k]['price'] = $pr_array['newvalue'];
|
4684 |
+
$product_data[$pr_array['than_attribute']] = $pd_value;
|
4685 |
+
}
|
4686 |
+
break;
|
4687 |
+
case($pr_array['condition'] = "=<"):
|
4688 |
+
if (($vv <= $pr_array['criteria'])){
|
4689 |
+
$pd_value[$k]['price'] = $pr_array['newvalue'];
|
4690 |
+
$product_data[$pr_array['than_attribute']] = $pd_value;
|
4691 |
+
}
|
4692 |
+
break;
|
4693 |
+
case($pr_array['condition'] = "empty"):
|
4694 |
+
if ((strlen($vv) < 1)){
|
4695 |
+
$pd_value[$k]['price'] = $pr_array['newvalue'];
|
4696 |
+
$product_data[$pr_array['than_attribute']] = $pd_value;
|
4697 |
+
}
|
4698 |
+
break;
|
4699 |
+
case($pr_array['condition'] = "multiply"):
|
4700 |
+
// Only shipping array
|
4701 |
+
if(is_array($pd_value)){
|
4702 |
+
$pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
|
4703 |
+
foreach ($pd_value as $ship_a_key => $shipping_arr){
|
4704 |
+
foreach($shipping_arr as $ship_key => $ship_value){
|
4705 |
+
if($ship_key == "price"){
|
4706 |
+
$ship_pieces = explode(" ", $ship_value);
|
4707 |
+
$pd_value = strtr($ship_pieces[1], ',', '.');
|
4708 |
+
$newvalue = $pd_value*$pr_array['criteria'];
|
4709 |
+
$newvalue = round($newvalue, 2);
|
4710 |
+
$newvalue = strtr($newvalue, '.',',');
|
4711 |
+
$newvalue = $ship_pieces[0]." ".$newvalue;
|
4712 |
+
$product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
|
4713 |
+
}
|
4714 |
+
}
|
4715 |
+
}
|
4716 |
+
}
|
4717 |
+
break;
|
4718 |
+
default:
|
4719 |
+
break;
|
4720 |
+
}
|
4721 |
+
}
|
4722 |
+
}
|
4723 |
+
} else {
|
4724 |
+
// Rules on product tags
|
4725 |
+
foreach ($pd_value as $k => $v){
|
4726 |
+
|
4727 |
+
// Rules for string values
|
4728 |
+
if (!array_key_exists('cs', $pr_array)){
|
4729 |
+
$v = strtolower($v);
|
4730 |
+
$pr_array['criteria'] = strtolower($pr_array['criteria']);
|
4731 |
+
}
|
4732 |
+
|
4733 |
+
switch ($pr_array['condition']) {
|
4734 |
+
case($pr_array['condition'] = "contains"):
|
4735 |
+
if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
|
4736 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4737 |
+
}
|
4738 |
+
break;
|
4739 |
+
case($pr_array['condition'] = "containsnot"):
|
4740 |
+
if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
|
4741 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4742 |
+
}
|
4743 |
+
break;
|
4744 |
+
case($pr_array['condition'] = "="):
|
4745 |
+
if (($v == $pr_array['criteria'])){
|
4746 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4747 |
+
}
|
4748 |
+
break;
|
4749 |
+
case($pr_array['condition'] = "!="):
|
4750 |
+
if (($v != $pr_array['criteria'])){
|
4751 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4752 |
+
}
|
4753 |
+
break;
|
4754 |
+
case($pr_array['condition'] = ">"):
|
4755 |
+
if (($v > $pr_array['criteria'])){
|
4756 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4757 |
+
}
|
4758 |
+
break;
|
4759 |
+
case($pr_array['condition'] = ">="):
|
4760 |
+
if (($v >= $pr_array['criteria'])){
|
4761 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4762 |
+
}
|
4763 |
+
break;
|
4764 |
+
case($pr_array['condition'] = "<"):
|
4765 |
+
if (($v < $pr_array['criteria'])){
|
4766 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4767 |
+
}
|
4768 |
+
break;
|
4769 |
+
case($pr_array['condition'] = "=<"):
|
4770 |
+
if (($v <= $pr_array['criteria'])){
|
4771 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4772 |
+
}
|
4773 |
+
break;
|
4774 |
+
case($pr_array['condition'] = "empty"):
|
4775 |
+
if ((strlen($v) < 1)){
|
4776 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4777 |
+
}
|
4778 |
+
break;
|
4779 |
+
case($pr_array['condition'] = "multiply"):
|
4780 |
+
// Only shipping array
|
4781 |
+
if(is_array($v)){
|
4782 |
+
$pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
|
4783 |
+
foreach ($v as $ship_a_key => $shipping_arr){
|
4784 |
+
foreach($shipping_arr as $ship_key => $ship_value){
|
4785 |
+
if($ship_key == "price"){
|
4786 |
+
$ship_pieces = explode(" ", $ship_value);
|
4787 |
+
$pd_value = strtr($ship_pieces[1], ',', '.');
|
4788 |
+
$newvalue = $pd_value*$pr_array['criteria'];
|
4789 |
+
$newvalue = round($newvalue, 2);
|
4790 |
+
$newvalue = strtr($newvalue, '.',',');
|
4791 |
+
$newvalue = $ship_pieces[0]." ".$newvalue;
|
4792 |
+
$product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
|
4793 |
+
}
|
4794 |
+
}
|
4795 |
+
}
|
4796 |
+
}
|
4797 |
+
break;
|
4798 |
+
default:
|
4799 |
+
break;
|
4800 |
+
}
|
4801 |
+
}
|
4802 |
+
}
|
4803 |
+
}
|
4804 |
+
} else {
|
4805 |
+
// Rules for string values
|
4806 |
if (!array_key_exists('cs', $pr_array)){
|
4807 |
+
if($pr_array['attribute'] != "image"){
|
4808 |
+
$pd_value = strtolower($pd_value);
|
4809 |
+
$pr_array['criteria'] = strtolower($pr_array['criteria']);
|
4810 |
+
}
|
4811 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4812 |
|
4813 |
+
switch ($pr_array['condition']) {
|
4814 |
+
case($pr_array['condition'] = "contains"):
|
4815 |
+
if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
|
4816 |
+
// Specifically for shipping price rules
|
4817 |
+
if(!empty($product_data[$pr_array['than_attribute']])){
|
4818 |
+
if(is_array($product_data[$pr_array['than_attribute']])){
|
4819 |
+
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4820 |
+
for ($x = 0; $x <= $arr_size; $x++) {
|
4821 |
+
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4822 |
+
}
|
4823 |
+
} else {
|
4824 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4825 |
+
}
|
4826 |
+
} else {
|
4827 |
+
// This attribute value is empty for this product
|
4828 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4829 |
+
}
|
4830 |
+
}
|
4831 |
+
break;
|
4832 |
+
case($pr_array['condition'] = "containsnot"):
|
4833 |
+
if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
|
4834 |
+
// Specifically for shipping price rules
|
4835 |
+
if(is_array($product_data[$pr_array['than_attribute']])){
|
4836 |
+
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4837 |
+
for ($x = 0; $x <= $arr_size; $x++) {
|
4838 |
+
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4839 |
+
}
|
4840 |
+
} else {
|
4841 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4842 |
+
}
|
4843 |
+
}
|
4844 |
+
break;
|
4845 |
+
case($pr_array['condition'] = "="):
|
4846 |
+
if (($pr_array['criteria'] == "$pd_value")){
|
4847 |
+
// Specifically for shipping price rules
|
4848 |
+
if(is_array($product_data[$pr_array['than_attribute']])){
|
4849 |
+
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4850 |
+
for ($x = 0; $x <= $arr_size; $x++) {
|
4851 |
+
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4852 |
+
}
|
4853 |
+
} else {
|
4854 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4855 |
+
}
|
4856 |
+
}
|
4857 |
+
$ship = $product_data['shipping'];
|
4858 |
+
break;
|
4859 |
+
case($pr_array['condition'] = "!="):
|
4860 |
+
if (($pr_array['criteria'] != "$pd_value")){
|
4861 |
+
// Specifically for shipping price rules
|
4862 |
+
if(is_array($product_data[$pr_array['than_attribute']])){
|
4863 |
+
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4864 |
+
for ($x = 0; $x <= $arr_size; $x++) {
|
4865 |
+
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4866 |
+
}
|
4867 |
+
} else {
|
4868 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4869 |
+
}
|
4870 |
+
}
|
4871 |
+
break;
|
4872 |
+
case($pr_array['condition'] = ">"):
|
4873 |
+
// Use a lexical order on relational string operators
|
4874 |
+
if (($pd_value > $pr_array['criteria'])){
|
4875 |
+
// Specifically for shipping price rules
|
4876 |
+
if(is_array($product_data[$pr_array['than_attribute']])){
|
4877 |
+
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4878 |
+
for ($x = 0; $x <= $arr_size; $x++) {
|
4879 |
+
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4880 |
+
}
|
4881 |
+
} else {
|
4882 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4883 |
+
}
|
4884 |
+
}
|
4885 |
+
break;
|
4886 |
+
case($pr_array['condition'] = ">="):
|
4887 |
+
// Use a lexical order on relational string operators
|
4888 |
+
if (($pd_value >= $pr_array['criteria'])){
|
4889 |
+
// Specifically for shipping price rules
|
4890 |
+
if(is_array($product_data[$pr_array['than_attribute']])){
|
4891 |
+
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4892 |
+
for ($x = 0; $x <= $arr_size; $x++) {
|
4893 |
+
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4894 |
+
}
|
4895 |
+
} else {
|
4896 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4897 |
+
}
|
4898 |
+
}
|
4899 |
+
break;
|
4900 |
+
case($pr_array['condition'] = "<"):
|
4901 |
+
// Use a lexical order on relational string operators
|
4902 |
+
if (($pd_value < $pr_array['criteria'])){
|
4903 |
+
// Specifically for shipping price rules
|
4904 |
+
if(isset($product_data[$pr_array['than_attribute']]) AND (is_array($product_data[$pr_array['than_attribute']]))){
|
4905 |
+
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4906 |
+
for ($x = 0; $x <= $arr_size; $x++) {
|
4907 |
+
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4908 |
+
}
|
4909 |
+
} else {
|
4910 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4911 |
+
}
|
4912 |
+
}
|
4913 |
+
break;
|
4914 |
+
case($pr_array['condition'] = "=<"):
|
4915 |
+
// Use a lexical order on relational string operators
|
4916 |
+
if (($pd_value <= $pr_array['criteria'])){
|
4917 |
+
// Specifically for shipping price rules
|
4918 |
+
if(is_array($product_data[$pr_array['than_attribute']])){
|
4919 |
+
$arr_size = (count($product_data[$pr_array['than_attribute']])-1);
|
4920 |
+
for ($x = 0; $x <= $arr_size; $x++) {
|
4921 |
+
$product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
|
4922 |
+
}
|
4923 |
+
} else {
|
4924 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4925 |
+
}
|
4926 |
+
}
|
4927 |
+
break;
|
4928 |
+
|
4929 |
+
case($pr_array['condition'] = "empty"):
|
4930 |
+
if(empty($product_data[$pr_array['attribute']])){
|
4931 |
+
if(empty($product_data[$pr_array['than_attribute']])){
|
4932 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4933 |
+
} else {
|
4934 |
+
$product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
|
4935 |
+
}
|
4936 |
+
}
|
4937 |
+
break;
|
4938 |
+
case($pr_array['condition'] = "replace"):
|
4939 |
+
$product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $product_data[$pr_array['than_attribute']]);
|
4940 |
+
break;
|
4941 |
case($pr_array['condition'] = "findreplace"):
|
4942 |
if (strpos($pd_value, $pr_array['criteria']) !== false){
|
4943 |
+
// Make sure that a new value has been set
|
4944 |
+
if(!empty($pr_array['newvalue'])){
|
4945 |
+
// Find and replace only work on same attribute field, otherwise create a contains rule
|
4946 |
if($pr_array['attribute'] == $pr_array['than_attribute']){
|
4947 |
+
$newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
|
4948 |
+
//$product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
|
4949 |
+
$product_data[$pr_array['than_attribute']] = $newvalue;
|
4950 |
+
}
|
4951 |
+
}
|
4952 |
+
}
|
4953 |
break;
|
4954 |
+
default:
|
4955 |
+
break;
|
4956 |
+
}
|
4957 |
+
}
|
4958 |
+
} else {
|
4959 |
+
// When a rule has been set on an attribute that is not in product_data
|
4960 |
+
// Add the newvalue to product_data
|
4961 |
+
if (!array_key_exists($pr_array['attribute'], $product_data)){
|
4962 |
+
if(!empty($pr_array['newvalue'])){
|
4963 |
+
$product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
|
4964 |
+
} else {
|
4965 |
+
if(array_key_exists($pr_array['than_attribute'], $product_data)){
|
4966 |
+
$product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
|
4967 |
+
}
|
4968 |
+
}
|
4969 |
+
}
|
4970 |
+
}
|
4971 |
+
}
|
4972 |
+
}
|
4973 |
+
}
|
4974 |
+
return $product_data;
|
4975 |
+
}
|
4976 |
|
4977 |
/**
|
4978 |
* Function to exclude products based on individual product exclusions
|
4995 |
}
|
4996 |
}
|
4997 |
|
4998 |
+
|
4999 |
+
/**
|
5000 |
+
* Execute project filters (include / exclude)
|
5001 |
+
*/
|
5002 |
private function woocommerce_sea_filters( $project_rules, $product_data ){
|
5003 |
+
$allowed = 1;
|
5004 |
|
5005 |
+
// Check if product was already excluded from the feed
|
5006 |
+
$product_excluded = ucfirst( get_post_meta( $product_data['id'], '_woosea_exclude_product', true ) );
|
5007 |
|
5008 |
+
if( $product_excluded == "Yes"){
|
5009 |
+
$allowed = 0;
|
5010 |
+
}
|
5011 |
|
5012 |
+
foreach ($project_rules as $pr_key => $pr_array){
|
5013 |
|
5014 |
+
if($pr_array['attribute'] == "categories"){
|
5015 |
+
$pr_array['attribute'] = "raw_categories";
|
5016 |
+
}
|
5017 |
|
5018 |
+
//if(array_key_exists($pr_array['attribute'], $product_data)){
|
5019 |
|
5020 |
+
if(!array_key_exists($pr_array['attribute'], $product_data)) {
|
5021 |
+
$product_data[$pr_array['attribute']] = ""; // Sets an empty postmeta value in place of a missing one.
|
5022 |
+
}
|
5023 |
|
5024 |
+
foreach ($product_data as $pd_key => $pd_value){
|
5025 |
+
// Check is there is a rule on specific attributes
|
5026 |
+
if(in_array($pd_key, $pr_array, TRUE)){
|
5027 |
|
5028 |
+
if($pd_key == "price"){
|
5029 |
+
//$pd_value = @number_format($pd_value,2);
|
5030 |
+
$pd_value = wc_format_decimal($pd_value);
|
5031 |
+
}
|
5032 |
|
5033 |
+
if (is_numeric($pd_value)){
|
5034 |
+
$old_value = $pd_value;
|
5035 |
+
if($pd_key == "price"){
|
5036 |
+
$pd_value = @number_format($pd_value,2);
|
5037 |
+
}
|
5038 |
+
|
5039 |
+
// Rules for numeric values
|
5040 |
+
switch ($pr_array['condition']) {
|
5041 |
+
case($pr_array['condition'] = "contains"):
|
5042 |
+
if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
|
5043 |
+
$allowed = 0;
|
5044 |
+
} elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
|
5045 |
+
$allowed = 0;
|
5046 |
+
}
|
5047 |
+
break;
|
5048 |
+
case($pr_array['condition'] = "containsnot"):
|
5049 |
+
if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
|
5050 |
+
$allowed = 0;
|
5051 |
+
} elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
|
5052 |
+
$allowed = 0;
|
5053 |
+
}
|
5054 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
5055 |
case($pr_array['condition'] = "="):
|
5056 |
+
if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
5057 |
+
$allowed = 0;
|
5058 |
+
} elseif (($old_value != $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
5059 |
+
$allowed = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5060 |
}
|
5061 |
+
break;
|
5062 |
+
case($pr_array['condition'] = "!="):
|
5063 |
+
if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
5064 |
+
if($allowed <> 0){
|
5065 |
+
$allowed = 1;
|
5066 |
+
}
|
5067 |
+
} elseif (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
5068 |
+
$allowed = 0;
|
5069 |
+
}
|
5070 |
+
break;
|
5071 |
+
case($pr_array['condition'] = ">"):
|
5072 |
+
if (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
5073 |
+
$allowed = 0;
|
5074 |
+
} elseif (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
5075 |
+
$allowed = 0;
|
5076 |
+
}
|
5077 |
+
break;
|
5078 |
+
case($pr_array['condition'] = ">="):
|
5079 |
+
if (($old_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
5080 |
+
$allowed = 0;
|
5081 |
+
} elseif (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
5082 |
+
$allowed = 0;
|
5083 |
+
}
|
5084 |
+
break;
|
5085 |
+
case($pr_array['condition'] = "<"):
|
5086 |
+
if (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
5087 |
+
$allowed = 0;
|
5088 |
+
} elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
5089 |
+
$allowed = 0;
|
5090 |
+
}
|
5091 |
+
break;
|
5092 |
+
case($pr_array['condition'] = "=<"):
|
5093 |
+
if (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
5094 |
+
$allowed = 0;
|
5095 |
+
} elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
5096 |
+
$allowed = 0;
|
5097 |
+
}
|
5098 |
+
break;
|
5099 |
+
case($pr_array['condition'] = "empty"):
|
5100 |
+
if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
|
5101 |
+
$allowed = 0;
|
5102 |
+
} elseif ((strlen($pd_value > 0)) && ($pr_array['than'] == "include_only")){
|
5103 |
+
$allowed = 0;
|
5104 |
+
}
|
5105 |
+
break;
|
5106 |
+
default:
|
5107 |
+
break;
|
5108 |
+
}
|
5109 |
+
} elseif (is_array($pd_value)){
|
5110 |
+
// Tis can either be a shipping or product_tag array
|
5111 |
+
if($pr_array['attribute'] == "product_tag"){
|
5112 |
+
$in_tag_array = "not";
|
5113 |
+
|
5114 |
+
foreach($pd_value as $pt_key => $pt_value){
|
5115 |
+
// Rules for string values
|
5116 |
+
if (!array_key_exists('cs', $pr_array)){
|
5117 |
+
$pt_value = strtolower($pt_value);
|
5118 |
+
$pr_array['criteria'] = strtolower($pr_array['criteria']);
|
5119 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5120 |
|
5121 |
+
if(preg_match('/'.$pr_array['criteria'].'/', $pt_value)){
|
5122 |
+
$in_tag_array = "yes";
|
5123 |
+
}
|
5124 |
+
}
|
5125 |
+
|
5126 |
+
if($in_tag_array == "yes"){
|
5127 |
+
//if(in_array($pr_array['criteria'], $pd_value, TRUE)) {
|
5128 |
+
$v = $pr_array['criteria'];
|
5129 |
+
switch ($pr_array['condition']) {
|
5130 |
+
case($pr_array['condition'] = "contains"):
|
5131 |
+
if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
|
5132 |
+
if($pr_array['than'] == "include_only"){
|
5133 |
+
if($allowed <> 0){
|
5134 |
+
$allowed = 1;
|
5135 |
+
}
|
5136 |
+
} else {
|
5137 |
+
$allowed = 0;
|
5138 |
+
}
|
5139 |
+
} else {
|
5140 |
+
$allowed = 0;
|
5141 |
+
}
|
5142 |
+
break;
|
5143 |
+
case($pr_array['condition'] = "containsnot"):
|
5144 |
+
if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
|
5145 |
+
if($pr_array['than'] == "include_only"){
|
5146 |
+
if($allowed <> 0){
|
5147 |
+
$allowed = 1;
|
5148 |
+
}
|
5149 |
+
} else {
|
5150 |
+
$allowed = 0;
|
5151 |
+
}
|
5152 |
+
} else {
|
5153 |
+
$allowed = 0;
|
5154 |
+
}
|
5155 |
+
break;
|
5156 |
+
case($pr_array['condition'] = "="):
|
5157 |
+
if (($v == $pr_array['criteria'])){
|
5158 |
+
if($pr_array['than'] == "include_only"){
|
5159 |
+
if($allowed <> 0){
|
5160 |
+
$allowed = 1;
|
5161 |
+
}
|
5162 |
+
} else {
|
5163 |
+
$allowed = 0;
|
5164 |
+
}
|
5165 |
+
} else {
|
5166 |
+
$allowed = 0;
|
5167 |
+
}
|
5168 |
+
break;
|
5169 |
+
case($pr_array['condition'] = "!="):
|
5170 |
+
if (($v != $pr_array['criteria'])){
|
5171 |
+
if($pr_array['than'] == "include_only"){
|
5172 |
+
if($allowed <> 0){
|
5173 |
+
$allowed = 1;
|
5174 |
+
}
|
5175 |
+
} else {
|
5176 |
+
$allowed = 0;
|
5177 |
+
}
|
5178 |
+
}
|
5179 |
+
break;
|
5180 |
+
case($pr_array['condition'] = ">"):
|
5181 |
+
if (($v > $pr_array['criteria'])){
|
5182 |
+
if($pr_array['than'] == "include_only"){
|
5183 |
+
if($allowed <> 0){
|
5184 |
+
$allowed = 1;
|
5185 |
+
}
|
5186 |
+
} else {
|
5187 |
+
$allowed = 0;
|
5188 |
+
}
|
5189 |
+
}
|
5190 |
+
break;
|
5191 |
+
case($pr_array['condition'] = ">="):
|
5192 |
+
if (($v >= $pr_array['criteria'])){
|
5193 |
+
if($pr_array['than'] == "include_only"){
|
5194 |
+
if($allowed <> 0){
|
5195 |
+
$allowed = 1;
|
5196 |
+
}
|
5197 |
+
} else {
|
5198 |
+
$allowed = 0;
|
5199 |
+
}
|
5200 |
+
}
|
5201 |
+
break;
|
5202 |
+
case($pr_array['condition'] = "<"):
|
5203 |
+
if (($v < $pr_array['criteria'])){
|
5204 |
+
if($pr_array['than'] == "include_only"){
|
5205 |
+
if($allowed <> 0){
|
5206 |
+
$allowed = 1;
|
5207 |
+
}
|
5208 |
+
} else {
|
5209 |
+
$allowed = 0;
|
5210 |
+
}
|
5211 |
+
}
|
5212 |
+
break;
|
5213 |
+
case($pr_array['condition'] = "=<"):
|
5214 |
+
if (($v <= $pr_array['criteria'])){
|
5215 |
+
if($pr_array['than'] == "include_only"){
|
5216 |
+
if($allowed <> 0){
|
5217 |
+
$allowed = 1;
|
5218 |
+
}
|
5219 |
+
} else {
|
5220 |
+
$allowed = 0;
|
5221 |
+
}
|
5222 |
+
}
|
5223 |
+
break;
|
5224 |
+
case($pr_array['condition'] = "empty"):
|
5225 |
+
if (strlen($v) < 1){
|
5226 |
+
if($pr_array['than'] == "include_only"){
|
5227 |
+
if($allowed <> 0){
|
5228 |
+
$allowed = 1;
|
5229 |
+
}
|
5230 |
+
} else {
|
5231 |
+
if(!empty($pt_value)){
|
5232 |
+
$allowed = 1;
|
5233 |
+
} else {
|
5234 |
+
$allowed = 0;
|
5235 |
+
}
|
5236 |
+
}
|
5237 |
+
}
|
5238 |
+
break;
|
5239 |
+
default:
|
5240 |
+
break;
|
5241 |
+
}
|
5242 |
+
} else {
|
5243 |
+
switch ($pr_array['condition']) {
|
5244 |
+
case($pr_array['condition'] = "contains"):
|
5245 |
+
if($pr_array['than'] == "include_only"){
|
5246 |
+
$allowed = 0;
|
5247 |
+
} else {
|
5248 |
+
if($allowed <> 0){
|
5249 |
+
$allowed = 1;
|
5250 |
+
}
|
5251 |
+
}
|
5252 |
+
break;
|
5253 |
+
case($pr_array['condition'] = "containsnot"):
|
5254 |
+
if($pr_array['than'] == "include_only"){
|
5255 |
+
if($allowed <> 0){
|
5256 |
+
$allowed = 1;
|
5257 |
+
}
|
5258 |
+
} else {
|
5259 |
+
$allowed = 0;
|
5260 |
+
}
|
5261 |
+
break;
|
5262 |
+
case($pr_array['condition'] = "="):
|
5263 |
+
if($pr_array['than'] == "include_only"){
|
5264 |
+
$allowed = 0;
|
5265 |
+
} else {
|
5266 |
+
if($allowed <> 0){
|
5267 |
+
$allowed = 1;
|
5268 |
+
}
|
5269 |
+
}
|
5270 |
+
break;
|
5271 |
+
case($pr_array['condition'] = "!="):
|
5272 |
+
if($pr_array['than'] == "include_only"){
|
5273 |
+
if($allowed <> 0){
|
5274 |
+
$allowed = 1;
|
5275 |
+
}
|
5276 |
+
} else {
|
5277 |
+
$allowed = 0;
|
5278 |
+
}
|
5279 |
+
break;
|
5280 |
+
case($pr_array['condition'] = ">"):
|
5281 |
+
if($pr_array['than'] == "include_only"){
|
5282 |
+
$allowed = 0;
|
5283 |
+
} else {
|
5284 |
+
$allowed = 0;
|
5285 |
+
}
|
5286 |
+
break;
|
5287 |
+
case($pr_array['condition'] = ">="):
|
5288 |
+
if($pr_array['than'] == "include_only"){
|
5289 |
+
$allowed = 0;
|
5290 |
+
} else {
|
5291 |
+
$allowed = 0;
|
5292 |
+
}
|
5293 |
+
break;
|
5294 |
+
case($pr_array['condition'] = "<"):
|
5295 |
+
if($pr_array['than'] == "include_only"){
|
5296 |
+
$allowed = 0;
|
5297 |
+
} else {
|
5298 |
+
$allowed = 0;
|
5299 |
+
}
|
5300 |
+
break;
|
5301 |
+
case($pr_array['condition'] = "=<"):
|
5302 |
+
if($pr_array['than'] == "include_only"){
|
5303 |
+
$allowed = 0;
|
5304 |
+
} else {
|
5305 |
+
$allowed = 0;
|
5306 |
+
}
|
5307 |
+
break;
|
5308 |
+
case($pr_array['condition'] = "empty"):
|
5309 |
+
if($pr_array['than'] == "include_only"){
|
5310 |
+
if($allowed <> 0){
|
5311 |
+
$allowed = 1;
|
5312 |
+
}
|
5313 |
+
} else {
|
5314 |
+
$allowed = 0;
|
5315 |
+
}
|
5316 |
+
break;
|
5317 |
+
default:
|
5318 |
+
break;
|
5319 |
+
}
|
5320 |
+
}
|
5321 |
+
} else {
|
5322 |
+
// For now only shipping details are in an array
|
5323 |
+
foreach ($pd_value as $k => $v){
|
5324 |
+
foreach ($v as $kk => $vv){
|
5325 |
+
// Only shipping detail rule can be on price for now
|
5326 |
+
if($kk == "price"){
|
5327 |
+
switch ($pr_array['condition']) {
|
5328 |
+
case($pr_array['condition'] = "contains"):
|
5329 |
+
if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
|
5330 |
+
$allowed = 0;
|
5331 |
+
}
|
5332 |
+
break;
|
5333 |
+
case($pr_array['condition'] = "containsnot"):
|
5334 |
+
if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
|
5335 |
+
$allowed = 0;
|
5336 |
+
}
|
5337 |
+
break;
|
5338 |
+
case($pr_array['condition'] = "="):
|
5339 |
+
if (($vv == $pr_array['criteria'])){
|
5340 |
+
$allowed = 0;
|
5341 |
+
}
|
5342 |
+
break;
|
5343 |
+
case($pr_array['condition'] = "!="):
|
5344 |
+
if (($vv != $pr_array['criteria'])){
|
5345 |
+
$allowed = 0;
|
5346 |
+
}
|
5347 |
+
break;
|
5348 |
+
case($pr_array['condition'] = ">"):
|
5349 |
+
if (($vv > $pr_array['criteria'])){
|
5350 |
+
$allowed = 0;
|
5351 |
+
}
|
5352 |
+
break;
|
5353 |
+
case($pr_array['condition'] = ">="):
|
5354 |
+
if (($vv >= $pr_array['criteria'])){
|
5355 |
+
$allowed = 0;
|
5356 |
+
}
|
5357 |
+
break;
|
5358 |
+
case($pr_array['condition'] = "<"):
|
5359 |
+
if (($vv < $pr_array['criteria'])){
|
5360 |
+
$allowed = 0;
|
5361 |
+
}
|
5362 |
+
break;
|
5363 |
+
case($pr_array['condition'] = "=<"):
|
5364 |
+
if (($vv <= $pr_array['criteria'])){
|
5365 |
+
$allowed = 0;
|
5366 |
+
}
|
5367 |
+
break;
|
5368 |
+
case($pr_array['condition'] = "empty"):
|
5369 |
+
if (strlen($vv) < 1){
|
5370 |
+
$allowed = 0;
|
5371 |
+
}
|
5372 |
+
break;
|
5373 |
+
default:
|
5374 |
+
break;
|
5375 |
+
}
|
5376 |
+
}
|
5377 |
+
}
|
5378 |
+
}
|
5379 |
+
}
|
5380 |
+
} else {
|
5381 |
+
// Filters for string values
|
5382 |
+
// If case-sensitve is off than lowercase both the criteria and attribute value
|
5383 |
+
if (array_key_exists('cs', $pr_array)){
|
5384 |
+
if ($pr_array['cs'] != "on"){
|
5385 |
+
$pd_value = strtolower($pd_value);
|
5386 |
+
$pr_array['criteria'] = strtolower($pr_array['criteria']);
|
5387 |
+
}
|
5388 |
+
}
|
5389 |
+
$pos = strpos($pd_value, '&');
|
5390 |
+
$pos_slash = strpos($pr_array['criteria'], '\\');
|
5391 |
+
if($pos !== false){
|
5392 |
+
$pd_value = str_replace("&","&",$pd_value);
|
5393 |
+
}
|
5394 |
+
if($pos_slash !== false){
|
5395 |
+
$pr_array['criteria'] = str_replace("\\","",$pr_array['criteria']);
|
5396 |
+
}
|
5397 |
+
|
5398 |
+
switch ($pr_array['condition']) {
|
5399 |
+
case($pr_array['condition'] = "contains"):
|
5400 |
+
if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
|
5401 |
+
$allowed = 0;
|
5402 |
+
} elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
|
5403 |
+
$allowed = 0;
|
5404 |
+
} elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
|
5405 |
+
if($allowed <> 0){
|
5406 |
+
$allowed = 1;
|
5407 |
+
}
|
5408 |
+
}
|
5409 |
+
break;
|
5410 |
+
case($pr_array['condition'] = "containsnot"):
|
5411 |
+
if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
|
5412 |
+
$allowed = 0;
|
5413 |
+
} elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
|
5414 |
+
$allowed = 0;
|
5415 |
+
}
|
5416 |
+
break;
|
5417 |
case($pr_array['condition'] = "="):
|
5418 |
+
if (($pr_array['criteria'] == "$pd_value") AND ($pr_array['than'] == "exclude")){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5419 |
$allowed = 0;
|
5420 |
+
} elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "include_only")){
|
5421 |
+
$found = strpos($pd_value,$pr_array['criteria']);
|
5422 |
+
if ($found !== false) {
|
5423 |
+
//for category mapping check if its an array
|
5424 |
+
if($pr_array['attribute'] == "raw_categories"){
|
5425 |
+
$raw_cats_arr = explode("||",$pd_value);
|
5426 |
+
if(is_array($raw_cats_arr)){
|
5427 |
+
if(in_array($pr_array['criteria'],$raw_cats_arr, TRUE)){
|
5428 |
+
if($allowed <> 0){
|
5429 |
+
$allowed = 1;
|
5430 |
+
}
|
5431 |
+
} else {
|
5432 |
+
$allowed = 0;
|
5433 |
+
}
|
5434 |
+
}
|
5435 |
+
} else {
|
5436 |
+
if($allowed <> 0){
|
5437 |
+
$allowed = 1;
|
5438 |
+
}
|
5439 |
+
}
|
5440 |
+
} else {
|
5441 |
+
$allowed = 0;
|
5442 |
+
}
|
5443 |
+
} elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
|
5444 |
+
if($allowed <> 0){
|
5445 |
+
$allowed = 1;
|
5446 |
+
}
|
5447 |
+
} elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
|
5448 |
+
// $allowed = 0;
|
5449 |
+
} elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
|
5450 |
+
$allowed = 1;
|
5451 |
+
} else {
|
5452 |
+
// $allowed = 1; // Change made on February 24th 2021
|
5453 |
+
}
|
5454 |
+
break;
|
5455 |
+
case($pr_array['condition'] = "!="):
|
5456 |
+
if (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "exclude")){
|
5457 |
+
if($allowed <> 0){
|
5458 |
+
$allowed = 1;
|
5459 |
+
}
|
5460 |
+
} elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
|
5461 |
+
$allowed = 0;
|
5462 |
+
} elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "exclude")){
|
5463 |
+
$allowed = 0;
|
5464 |
+
}
|
5465 |
+
break;
|
5466 |
+
case($pr_array['condition'] = ">"):
|
5467 |
+
// Use a lexical order on relational string operators
|
5468 |
+
if (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
5469 |
+
$allowed = 0;
|
5470 |
+
} elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
5471 |
+
$allowed = 0;
|
5472 |
+
}
|
5473 |
+
break;
|
5474 |
+
case($pr_array['condition'] = ">="):
|
5475 |
+
// Use a lexical order on relational string operators
|
5476 |
+
if (($pd_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
5477 |
+
$allowed = 0;
|
5478 |
+
} elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
5479 |
+
$allowed = 0;
|
5480 |
+
}
|
5481 |
+
break;
|
5482 |
+
case($pr_array['condition'] = "<"):
|
5483 |
+
// Use a lexical order on relational string operators
|
5484 |
+
if (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
5485 |
+
$allowed = 0;
|
5486 |
+
} elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
5487 |
+
$allowed = 0;
|
5488 |
+
}
|
5489 |
+
break;
|
5490 |
+
case($pr_array['condition'] = "=<"):
|
5491 |
+
// Use a lexical order on relational string operators
|
5492 |
+
if (($pd_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
|
5493 |
+
$allowed = 0;
|
5494 |
+
} elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
|
5495 |
+
$allowed = 0;
|
5496 |
+
}
|
5497 |
+
break;
|
5498 |
+
case($pr_array['condition'] = "empty"):
|
5499 |
if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
|
5500 |
+
$allowed = 0;
|
5501 |
+
} elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "exclude")){
|
5502 |
+
if($allowed <> 0){
|
5503 |
+
$allowed = 1;
|
5504 |
+
}
|
5505 |
+
} elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "include_only")){
|
5506 |
+
$allowed = 0;
|
5507 |
+
}
|
5508 |
+
break;
|
5509 |
+
default:
|
5510 |
+
break;
|
5511 |
+
}
|
5512 |
+
}
|
5513 |
+
}
|
5514 |
+
}
|
5515 |
+
}
|
5516 |
|
5517 |
+
if ($allowed < 1){
|
5518 |
+
$product_data = array();
|
5519 |
+
$product_data = null;
|
5520 |
+
} else {
|
5521 |
+
return $product_data;
|
5522 |
+
}
|
5523 |
+
}
|
5524 |
}
|
js/woosea_key.js
CHANGED
@@ -27,7 +27,7 @@ jQuery(document).ready(function($) {
|
|
27 |
var license_key = $('#license-key').val();
|
28 |
|
29 |
jQuery.ajax({
|
30 |
-
url: 'https://www.adtribes.io/check/license.php?key=' + license_key + '&email=' + license_email + '&domain=' + root_domain + '&version=9.
|
31 |
jsonp: 'callback',
|
32 |
dataType: 'jsonp',
|
33 |
type: 'GET',
|
27 |
var license_key = $('#license-key').val();
|
28 |
|
29 |
jQuery.ajax({
|
30 |
+
url: 'https://www.adtribes.io/check/license.php?key=' + license_key + '&email=' + license_email + '&domain=' + root_domain + '&version=9.6.6',
|
31 |
jsonp: 'callback',
|
32 |
dataType: 'jsonp',
|
33 |
type: 'GET',
|
js/woosea_manage.js
CHANGED
@@ -256,6 +256,26 @@ jQuery(function($) {
|
|
256 |
}
|
257 |
})
|
258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
// Check if user would like to enable debug logging
|
260 |
$('#add_woosea_logging').on('change', function(){ // on change of state
|
261 |
if(this.checked){
|
256 |
}
|
257 |
})
|
258 |
|
259 |
+
// Check if user would like the plugin to remove the free shipping class
|
260 |
+
$('#remove_free_shipping').on('change', function(){ // on change of state
|
261 |
+
if(this.checked){
|
262 |
+
|
263 |
+
// Checkbox is on
|
264 |
+
jQuery.ajax({
|
265 |
+
method: "POST",
|
266 |
+
url: ajaxurl,
|
267 |
+
data: { 'action': 'woosea_remove_free_shipping', 'status': "on" }
|
268 |
+
})
|
269 |
+
} else {
|
270 |
+
// Checkbox is off
|
271 |
+
jQuery.ajax({
|
272 |
+
method: "POST",
|
273 |
+
url: ajaxurl,
|
274 |
+
data: { 'action': 'woosea_remove_free_shipping', 'status': "off" }
|
275 |
+
})
|
276 |
+
}
|
277 |
+
})
|
278 |
+
|
279 |
// Check if user would like to enable debug logging
|
280 |
$('#add_woosea_logging').on('change', function(){ // on change of state
|
281 |
if(this.checked){
|
pages/admin/woosea-manage-feed.php
CHANGED
@@ -67,6 +67,7 @@ if(!empty($license_information)){
|
|
67 |
if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
|
68 |
$notifications_box = $notifications_obj->get_admin_notifications ( '12', 'false' );
|
69 |
}
|
|
|
70 |
?>
|
71 |
<div class="wrap">
|
72 |
<div class="woo-product-feed-pro-form-style-2">
|
@@ -124,6 +125,18 @@ if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
|
|
124 |
<?php
|
125 |
}
|
126 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
?>
|
128 |
|
129 |
<div class="woo-product-feed-pro-form-style-2-heading"><?php _e( 'Manage feeds','woo-product-feed-pro' );?></div>
|
67 |
if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
|
68 |
$notifications_box = $notifications_obj->get_admin_notifications ( '12', 'false' );
|
69 |
}
|
70 |
+
|
71 |
?>
|
72 |
<div class="wrap">
|
73 |
<div class="woo-product-feed-pro-form-style-2">
|
125 |
<?php
|
126 |
}
|
127 |
}
|
128 |
+
|
129 |
+
|
130 |
+
if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
|
131 |
+
?>
|
132 |
+
<div class="notice notice-error is-dismissible">
|
133 |
+
<p>
|
134 |
+
<strong><?php _e( 'WARNING: Your WP-Cron is disabled', 'woo-product-feed-pro' );?></strong><br/></br/>
|
135 |
+
We detected that your WP-cron has been disabled in your wp-config.php file. Our plugin heavily depends on the WP-cron being active otherwise it cannot update and generate your product feeds. <a href="https://adtribes.io/help-my-feed-processing-is-stuck/?utm_source=<?php print"$host";?>&utm_medium=manage-feed&utm_campaign=cron-warning&utm_content=notification" target="_blank"><strong>Please enable your WP-cron first</strong></a>.
|
136 |
+
</p>
|
137 |
+
</div>
|
138 |
+
<?php
|
139 |
+
}
|
140 |
?>
|
141 |
|
142 |
<div class="woo-product-feed-pro-form-style-2-heading"><?php _e( 'Manage feeds','woo-product-feed-pro' );?></div>
|
pages/admin/woosea-manage-settings.php
CHANGED
@@ -101,6 +101,20 @@ if(isset($_GET["tab"])) {
|
|
101 |
?>
|
102 |
</span>
|
103 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
<!-- wordpress provides the styling for tabs. -->
|
106 |
<h2 class="nav-tab-wrapper">
|
@@ -290,6 +304,24 @@ if(isset($_GET["tab"])) {
|
|
290 |
</label>
|
291 |
</td>
|
292 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
<tr>
|
294 |
<td>
|
295 |
<span><?php _e( 'Remove the local pickup shipping zone from feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
|
@@ -440,11 +472,11 @@ if(isset($_GET["tab"])) {
|
|
440 |
$external_path_tsv = $external_base . "/woo-product-feed-pro/";
|
441 |
$external_path_logs = $external_base . "/woo-product-feed-pro/";
|
442 |
$test_file = $external_path . "/tesfile.txt";
|
443 |
-
$test_file_xml = $external_path . "
|
444 |
-
$test_file_csv = $external_path . "
|
445 |
-
$test_file_txt = $external_path . "
|
446 |
-
$test_file_tsv = $external_path . "
|
447 |
-
$test_file_logs = $external_path . "
|
448 |
|
449 |
if (is_writable($external_path)) {
|
450 |
// Normal root category
|
@@ -515,6 +547,10 @@ if(isset($_GET["tab"])) {
|
|
515 |
$cron_enabled = "True";
|
516 |
}
|
517 |
|
|
|
|
|
|
|
|
|
518 |
print "<table class=\"woo-product-feed-pro-table\">";
|
519 |
print "<tr><td><strong>System check</strong></td><td><strong>Status</strong></td></tr>";
|
520 |
print "<tr><td>WP-Cron enabled</td><td>$cron_enabled</td></tr>";
|
101 |
?>
|
102 |
</span>
|
103 |
</div>
|
104 |
+
|
105 |
+
<?php
|
106 |
+
if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
|
107 |
+
?>
|
108 |
+
<div class="notice notice-error is-dismissible">
|
109 |
+
<p>
|
110 |
+
<strong><?php _e( 'WARNING: Your WP-Cron is disabled', 'woo-product-feed-pro' );?></strong><br/></br/>
|
111 |
+
We detected that your WP-cron has been disabled in your wp-config.php file. Our plugin heavily depends on the WP-cron being active for it to be able to update and generate your product feeds. More information on the inner workings of our plugin and instructions on how to enable your WP-Cron can be found here: <a href="https://adtribes.io/help-my-feed-processing-is-stuck/?utm_source=<?php print"$host";?>&utm_medium=manage-feed&utm_campaign=cron-warning&utm_content=notification" target="_blank"><strong>My feed won't update or is stuck processing</strong></a>.
|
112 |
+
</p>
|
113 |
+
</div>
|
114 |
+
<?php
|
115 |
+
}
|
116 |
+
?>
|
117 |
+
|
118 |
|
119 |
<!-- wordpress provides the styling for tabs. -->
|
120 |
<h2 class="nav-tab-wrapper">
|
304 |
</label>
|
305 |
</td>
|
306 |
</tr>
|
307 |
+
<tr>
|
308 |
+
<td>
|
309 |
+
<span><?php _e( 'Remove the free shipping zone from feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
|
310 |
+
</td>
|
311 |
+
<td>
|
312 |
+
<label class="woo-product-feed-pro-switch">
|
313 |
+
<?php
|
314 |
+
$remove_free_shipping = get_option ('remove_free_shipping');
|
315 |
+
if($remove_free_shipping == "yes"){
|
316 |
+
print "<input type=\"checkbox\" id=\"remove_free_shipping\" name=\"remove_free_shipping\" class=\"checkbox-field\" checked>";
|
317 |
+
} else {
|
318 |
+
print "<input type=\"checkbox\" id=\"remove_free_shipping\" name=\"remove_free_shipping\" class=\"checkbox-field\">";
|
319 |
+
}
|
320 |
+
?>
|
321 |
+
<div class="woo-product-feed-pro-slider round"></div>
|
322 |
+
</label>
|
323 |
+
</td>
|
324 |
+
</tr>
|
325 |
<tr>
|
326 |
<td>
|
327 |
<span><?php _e( 'Remove the local pickup shipping zone from feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
|
472 |
$external_path_tsv = $external_base . "/woo-product-feed-pro/";
|
473 |
$external_path_logs = $external_base . "/woo-product-feed-pro/";
|
474 |
$test_file = $external_path . "/tesfile.txt";
|
475 |
+
$test_file_xml = $external_path . "xml/tesfile.txt";
|
476 |
+
$test_file_csv = $external_path . "csv/tesfile.txt";
|
477 |
+
$test_file_txt = $external_path . "txt/tesfile.txt";
|
478 |
+
$test_file_tsv = $external_path . "tsv/tesfile.txt";
|
479 |
+
$test_file_logs = $external_path . "logs/tesfile.txt";
|
480 |
|
481 |
if (is_writable($external_path)) {
|
482 |
// Normal root category
|
547 |
$cron_enabled = "True";
|
548 |
}
|
549 |
|
550 |
+
if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
|
551 |
+
$cron_enabled = "<strong>False</strong>";
|
552 |
+
}
|
553 |
+
|
554 |
print "<table class=\"woo-product-feed-pro-table\">";
|
555 |
print "<tr><td><strong>System check</strong></td><td><strong>Status</strong></td></tr>";
|
556 |
print "<tr><td>WP-Cron enabled</td><td>$cron_enabled</td></tr>";
|
readme.txt
CHANGED
@@ -5,11 +5,11 @@ License URI: http://www.gnu.org/licenses/gpl.html
|
|
5 |
Tags: Product Feed, Google Shopping, Google Shopping Feed, WooCommerce Product Feed, WooCommerce Product Feed PRO, Bing Shopping, Bing product feed, Bing remarking, Google Merchant Feed, Google DRM Feed, Google Dynamic Remarketing Feed, Facebook feed, Google feed, Bing feed, Facebook Product Feed, Facebook Dynamic remarketing, Data Feed, WooCommerce Feed, XML product feed, CSV product feed, TSV, TXT product feed, comparison shopping engines, comparison shopping websites, vergelijk.nl, vergelijk.be, vertaa.fi, beslist.nl, kieskeurig.nl, bol.com, raketten, pricerunner, pricegrabber, Buy, leGuide, Kelkoo, Twenga, Yandex, Etsy, Dealtime, Shopzilla, Billiger, Google Product Review feed
|
6 |
Requires at least: 4.5
|
7 |
Tested up to: 5.6
|
8 |
-
Stable tag: 9.
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
-
Generate WooCommerce product feeds for all your marketing channels, such as Google Shopping (merchant center), Facebook Remarketing, Bing Ads, Billiger.de, Pricerunner,
|
13 |
|
14 |
= Why choose this plugin? =
|
15 |
Simply because this is the most complete plugin offering support for an unlimited number of products and feeds, including features such as category- & field-mapping and advanced, rule-based, filtering and product variables support.
|
@@ -175,6 +175,7 @@ Some of the above mentioned feature can only be used by users who upgraded to th
|
|
175 |
* <a href="https://www.beslist.nl" target="_blank" rel="nofollow">Beslist.nl</a>
|
176 |
* <a href="https://www.beslist.be" target="_blank" rel="nofollow">Beslist.be</a>
|
177 |
* <a href="https://www.fashionchick.nl" target="_blank">Fashionchick.nl</a>
|
|
|
178 |
* Bol.com
|
179 |
* Stylight
|
180 |
* Incurvy
|
@@ -322,6 +323,98 @@ Questions left or unanswered? Please do not hesitate to contact us at support@ad
|
|
322 |
|
323 |
=== Changelog ===
|
324 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
= 9.3.7 (2021-01-12) =
|
326 |
* Added the Bestprice.gr template
|
327 |
|
@@ -2988,6 +3081,98 @@ Questions left or unanswered? Please do not hesitate to contact us at support@ad
|
|
2988 |
|
2989 |
== Upgrade Notice ==
|
2990 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2991 |
= 9.3.7 =
|
2992 |
Added the Bestprice.gr template
|
2993 |
|
5 |
Tags: Product Feed, Google Shopping, Google Shopping Feed, WooCommerce Product Feed, WooCommerce Product Feed PRO, Bing Shopping, Bing product feed, Bing remarking, Google Merchant Feed, Google DRM Feed, Google Dynamic Remarketing Feed, Facebook feed, Google feed, Bing feed, Facebook Product Feed, Facebook Dynamic remarketing, Data Feed, WooCommerce Feed, XML product feed, CSV product feed, TSV, TXT product feed, comparison shopping engines, comparison shopping websites, vergelijk.nl, vergelijk.be, vertaa.fi, beslist.nl, kieskeurig.nl, bol.com, raketten, pricerunner, pricegrabber, Buy, leGuide, Kelkoo, Twenga, Yandex, Etsy, Dealtime, Shopzilla, Billiger, Google Product Review feed
|
6 |
Requires at least: 4.5
|
7 |
Tested up to: 5.6
|
8 |
+
Stable tag: 9.6.6
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
+
Generate WooCommerce product feeds for all your marketing channels, such as Google Shopping (merchant center), Facebook Remarketing, Bing Ads, Billiger.de, Pricerunner, Skroutz and many more. Next to custom feeds there are over 100 pre-defined templates included for marketplaces, comparison shopping engines and search engines. This plugin provides high-quality product feed for Google Shopping and many many more.
|
13 |
|
14 |
= Why choose this plugin? =
|
15 |
Simply because this is the most complete plugin offering support for an unlimited number of products and feeds, including features such as category- & field-mapping and advanced, rule-based, filtering and product variables support.
|
175 |
* <a href="https://www.beslist.nl" target="_blank" rel="nofollow">Beslist.nl</a>
|
176 |
* <a href="https://www.beslist.be" target="_blank" rel="nofollow">Beslist.be</a>
|
177 |
* <a href="https://www.fashionchick.nl" target="_blank">Fashionchick.nl</a>
|
178 |
+
* <a href="https://www.boetiek.nl" target="_blank">Boetiek.nl</a>
|
179 |
* Bol.com
|
180 |
* Stylight
|
181 |
* Incurvy
|
323 |
|
324 |
=== Changelog ===
|
325 |
|
326 |
+
= 9.6.6 (2021-02-24) =
|
327 |
+
* Added support for PHP 8.0
|
328 |
+
|
329 |
+
= 9.6.5 (2021-02-24) =
|
330 |
+
* Do not add Skroutz variable products to the feed when they do not have item_group_id's
|
331 |
+
|
332 |
+
= 9.6.4 (2021-02-24) =
|
333 |
+
* Fixed an issue with rules and filters
|
334 |
+
* When a rule was set on an image link, no longer lowercase the image link
|
335 |
+
|
336 |
+
= 9.6.3 (2021-02-23) =
|
337 |
+
* Fixed a bug, the Facebook pixel is now also measuing revenue for multiple items in Cart, InititiateCheckout and Purchase events
|
338 |
+
* Reverted back some changes in filters and rules
|
339 |
+
|
340 |
+
= 9.6.2 (2021-02-22) =
|
341 |
+
* For Skroutz feed removing sizes from feeds when they are out-of-stock
|
342 |
+
|
343 |
+
= 9.6.1 (2021-02-19) =
|
344 |
+
* Added attribute that will allow you to uppercase every first character of a string in product names
|
345 |
+
|
346 |
+
= 9.6.0 (2021-02-19) =
|
347 |
+
* Changed g:itemid to g:id for the Google Local Product Feeds
|
348 |
+
|
349 |
+
= 9.5.9 (2021-02-19) =
|
350 |
+
* Added a fail-safe when users do not select a marketing channel which let to PHP notices in logs
|
351 |
+
|
352 |
+
= 9.5.8 (2021-02-18) =
|
353 |
+
* Added shipping class name attribute
|
354 |
+
|
355 |
+
= 9.5.7 (2021-02-17) =
|
356 |
+
* Dynamic attribute values are now also added to parent variable products for Skroutz feeds
|
357 |
+
|
358 |
+
= 9.5.6 (2021-02-17) =
|
359 |
+
* Changed attribute name primary category to Yoast primary category as it caused lots of confussion
|
360 |
+
|
361 |
+
= 9.5.5 (2021-02-11) =
|
362 |
+
* Fixed a PHP notice that showed when creating a new rule
|
363 |
+
* Tested for compatibility with WooCommerce 5.0
|
364 |
+
|
365 |
+
= 9.5.4 (2021-02-09) =
|
366 |
+
* When free shipping zones are removed do not remove the other shipping zones
|
367 |
+
|
368 |
+
= 9.5.3 (2021-02-08) =
|
369 |
+
* Added a feature to remove free shipping zones from Google and Facebook feeds
|
370 |
+
|
371 |
+
= 9.5.2 (2021-02-08) =
|
372 |
+
* Fixed a minor issue in exclude rules for WooCommerce category names
|
373 |
+
|
374 |
+
= 9.5.1 (2021-02-02) =
|
375 |
+
* Dynamic attributes without values that are used for product details should be skipped which not always happened. This is fixed now.
|
376 |
+
|
377 |
+
= 9.5.0 (2021-02-01) =
|
378 |
+
* Discount rules created with the FlyCart plugin did not make it to Skroutz feeds. This has been solved now
|
379 |
+
|
380 |
+
= 9.4.9 (2021-01-31) =
|
381 |
+
* Added a seperate sale price attribute for bundled products
|
382 |
+
* Reviews for parent variable products are removed, the reviews are attached to its variations
|
383 |
+
|
384 |
+
= 9.4.8 (2021-01-30) =
|
385 |
+
* Fixed an issue with the ecomm_prodid on the cart page
|
386 |
+
|
387 |
+
= 9.4.7 (2021-01-29) =
|
388 |
+
* Solved an issue that shipping costs to the first product in a custom feed where empty
|
389 |
+
|
390 |
+
= 9.4.6 (2021-01-28) =
|
391 |
+
* Added a new attribute: product description parent product
|
392 |
+
|
393 |
+
= 9.4.5 (2021-01-28) =
|
394 |
+
* Added a Google Shopping field to their template: g:ship_from_country
|
395 |
+
* Stripping & characters from review names as it breaks the review feeds
|
396 |
+
|
397 |
+
= 9.4.4 (2021-01-27) =
|
398 |
+
* Fixed an issue where reviews without review text caused the feed to be disapproved by Google. We now remove reviews from feeds that have no review texts.
|
399 |
+
|
400 |
+
= 9.4.3 (2021-01-27) =
|
401 |
+
* Fixed an issue with an undefined ecomm_price variable on product variable pages
|
402 |
+
|
403 |
+
= 9.4.2 (2021-01-26) =
|
404 |
+
* Added the Dutch Boetiek.nl template
|
405 |
+
|
406 |
+
= 9.4.1 (2021-01-19) =
|
407 |
+
* Fixed a bug: exclude filters on empty product tags were broken. This is fixed now.
|
408 |
+
|
409 |
+
= 9.4.0 (2021-01-14) =
|
410 |
+
* Added a WP-cron check and notifications
|
411 |
+
|
412 |
+
= 9.3.9 (2021-01-14) =
|
413 |
+
* Bestprice.gr apparel products are now grouped by color
|
414 |
+
|
415 |
+
= 9.3.8 (2021-01-13) =
|
416 |
+
* Tested for compatibility with WooCommerce 4.9
|
417 |
+
|
418 |
= 9.3.7 (2021-01-12) =
|
419 |
* Added the Bestprice.gr template
|
420 |
|
3081 |
|
3082 |
== Upgrade Notice ==
|
3083 |
|
3084 |
+
= 9.6.6 =
|
3085 |
+
Added support for PHP 8.0
|
3086 |
+
|
3087 |
+
= 9.6.5 =
|
3088 |
+
Do not add Skroutz variable products to the feed when they do not have item_group_id's
|
3089 |
+
|
3090 |
+
= 9.6.4 =
|
3091 |
+
Fixed an issue with rules and filters
|
3092 |
+
When a rule was set on an image link, no longer lowercase the image link
|
3093 |
+
|
3094 |
+
= 9.6.3 =
|
3095 |
+
Fixed a bug, the Facebook pixel is now also measuing revenue for multiple items in Cart, InititiateCheckout and Purchase events
|
3096 |
+
Reverted back some changes in filters and rules
|
3097 |
+
|
3098 |
+
= 9.6.2 =
|
3099 |
+
For Skroutz feed removing sizes from feeds when they are out-of-stock
|
3100 |
+
|
3101 |
+
= 9.6.1 =
|
3102 |
+
Added attribute that will allow you to uppercase every first character of a string in product names
|
3103 |
+
|
3104 |
+
= 9.6.0 =
|
3105 |
+
Changed g:itemid to g:id for the Google Local Product Feeds
|
3106 |
+
|
3107 |
+
= 9.5.9 =
|
3108 |
+
* Added a fail-safe when users do not select a marketing channel which let to PHP notices in logs
|
3109 |
+
|
3110 |
+
= 9.5.8 =
|
3111 |
+
Added shipping class name attribute
|
3112 |
+
|
3113 |
+
= 9.5.7 =
|
3114 |
+
Dynamic attribute values are now also added to parent variable products for Skroutz feeds
|
3115 |
+
|
3116 |
+
= 9.5.6 =
|
3117 |
+
Changed attribute name primary category to Yoast primary category as it caused lots of confussion
|
3118 |
+
|
3119 |
+
= 9.5.5 =
|
3120 |
+
Fixed a PHP notice that showed when creating a new rule
|
3121 |
+
Tested for compatibility with WooCommerce 5.0
|
3122 |
+
|
3123 |
+
= 9.5.4 =
|
3124 |
+
When free shipping zones are removed do not remove the other shipping zones
|
3125 |
+
|
3126 |
+
= 9.5.3 =
|
3127 |
+
Added a feature to remove free shipping zones from Google and Facebook feeds
|
3128 |
+
|
3129 |
+
= 9.5.2 =
|
3130 |
+
Fixed a minor issue in exclude rules for WooCommerce category names
|
3131 |
+
|
3132 |
+
= 9.5.1 =
|
3133 |
+
Dynamic attributes without values that are used for product details should be skipped which not always happened. This is fixed now.
|
3134 |
+
|
3135 |
+
= 9.5.0 =
|
3136 |
+
Discount rules created with the FlyCart plugin did not make it to Skroutz feeds. This has been solved now
|
3137 |
+
|
3138 |
+
= 9.4.9 =
|
3139 |
+
Added a seperate sale price attribute for bundled products
|
3140 |
+
Reviews for parent variable products are removed, the reviews are attached to its variations
|
3141 |
+
|
3142 |
+
= 9.4.8 =
|
3143 |
+
Fixed an issue with the ecomm_prodid on the cart page
|
3144 |
+
|
3145 |
+
= 9.4.7 =
|
3146 |
+
Solved an issue that shipping costs to the first product in a custom feed where empty
|
3147 |
+
|
3148 |
+
= 9.4.6 =
|
3149 |
+
Added a new attribute: product description parent product
|
3150 |
+
|
3151 |
+
= 9.4.5 =
|
3152 |
+
Added a Google Shopping field to their template: g:ship_from_country
|
3153 |
+
Stripping & characters from review names as it breaks the review feeds
|
3154 |
+
|
3155 |
+
= 9.4.4 =
|
3156 |
+
Fixed an issue where reviews without review text caused the feed to be disapproved by Google. We now remove reviews from feeds that have no review texts.
|
3157 |
+
|
3158 |
+
= 9.4.3 =
|
3159 |
+
Fixed an issue with an undefined ecomm_price variable on product variable pages
|
3160 |
+
|
3161 |
+
= 9.4.2 =
|
3162 |
+
Added the Dutch Boetiek.nl template
|
3163 |
+
|
3164 |
+
= 9.4.1 =
|
3165 |
+
Fixed a bug: exclude filters on empty product tags were broken. This is fixed now.
|
3166 |
+
|
3167 |
+
= 9.4.0 =
|
3168 |
+
Added a WP-cron check and notifications
|
3169 |
+
|
3170 |
+
= 9.3.9 =
|
3171 |
+
Bestprice.gr apparel products are now grouped by color
|
3172 |
+
|
3173 |
+
= 9.3.8 =
|
3174 |
+
Tested for compatibility with WooCommerce 4.9
|
3175 |
+
|
3176 |
= 9.3.7 =
|
3177 |
Added the Bestprice.gr template
|
3178 |
|
woocommerce-sea.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Product Feed PRO for WooCommerce
|
4 |
-
* Version: 9.
|
5 |
* Plugin URI: https://www.adtribes.io/support/?utm_source=wpadmin&utm_medium=plugin&utm_campaign=woosea_product_feed_pro
|
6 |
* Description: Configure and maintain your WooCommerce product feeds for Google Shopping, Facebook, Remarketing, Bing, Yandex, Comparison shopping websites and over a 100 channels more.
|
7 |
* Author: AdTribes.io
|
@@ -17,7 +17,7 @@
|
|
17 |
* Domain Path: /languages
|
18 |
*
|
19 |
* WC requires at least: 4.4
|
20 |
-
* WC tested up to:
|
21 |
*
|
22 |
* Product Feed PRO for WooCommerce is free software: you can redistribute it and/or modify
|
23 |
* it under the terms of the GNU General Public License as published by
|
@@ -48,7 +48,7 @@ if (!defined('ABSPATH')) {
|
|
48 |
* Plugin versionnumber, please do not override.
|
49 |
* Define some constants
|
50 |
*/
|
51 |
-
define( 'WOOCOMMERCESEA_PLUGIN_VERSION', '9.
|
52 |
define( 'WOOCOMMERCESEA_PLUGIN_NAME', 'woocommerce-product-feed-pro' );
|
53 |
define( 'WOOCOMMERCESEA_PLUGIN_NAME_SHORT', 'woo-product-feed-pro' );
|
54 |
|
@@ -347,7 +347,6 @@ function woosea_add_facebook_pixel( $product = null ){
|
|
347 |
$cats = str_replace("&","&", $cats);
|
348 |
|
349 |
if(!empty($fb_prodid)){
|
350 |
-
|
351 |
if(!$product) {
|
352 |
return -1;
|
353 |
}
|
@@ -436,6 +435,8 @@ function woosea_add_facebook_pixel( $product = null ){
|
|
436 |
$order_real = 0;
|
437 |
$contents = "";
|
438 |
|
|
|
|
|
439 |
if ( !is_wp_error( $order_items )) {
|
440 |
foreach( $order_items as $item_id => $order_item) {
|
441 |
$prod_id = $order_item->get_product_id();
|
@@ -454,7 +455,7 @@ function woosea_add_facebook_pixel( $product = null ){
|
|
454 |
}
|
455 |
}
|
456 |
$contents = rtrim($contents, ",");
|
457 |
-
$viewContent = "fbq('track','Purchase',{currency:'$currency', value:'$
|
458 |
}
|
459 |
} else {
|
460 |
// This is on the cart page itself
|
@@ -463,6 +464,8 @@ function woosea_add_facebook_pixel( $product = null ){
|
|
463 |
$cart_real = 0;
|
464 |
$contents = "";
|
465 |
|
|
|
|
|
466 |
$checkoutpage = wc_get_checkout_url();
|
467 |
$current_url = get_permalink(get_the_ID());
|
468 |
|
@@ -477,20 +480,15 @@ function woosea_add_facebook_pixel( $product = null ){
|
|
477 |
//$contents .= "$prod_id,";
|
478 |
|
479 |
$cart_real = wc_format_localized_price( $cart_item['line_total'] );
|
480 |
-
|
481 |
-
// $line_total = number_format(($cart_item['line_total']),2, '.','');
|
482 |
-
// $line_tax = number_format(($cart_item['line_tax']),2, '.','');
|
483 |
-
// $cart_real = number_format($cart_real,2, '.','');
|
484 |
-
// $cart_real = number_format(($line_total+$line_tax+$cart_real),2,',','');
|
485 |
}
|
486 |
$contents = rtrim($contents, ",");
|
487 |
|
488 |
// User is on the billing pages
|
489 |
if($checkoutpage == $current_url){
|
490 |
-
$viewContent = "fbq(\"track\",\"InitiateCheckout\",{currency:\"$currency\", value:\"$
|
491 |
} else {
|
492 |
// User is on the basket page
|
493 |
-
$viewContent = "fbq(\"track\",\"AddToCart\",{currency:\"$currency\", value:\"$
|
494 |
}
|
495 |
}
|
496 |
}
|
@@ -622,7 +620,7 @@ function woosea_add_remarketing_tags( $product = null ){
|
|
622 |
// In that case we need to put in the AggregateOffer structured data
|
623 |
$variation_id = woosea_find_matching_product_variation( $product, $_GET );
|
624 |
$nr_get = count($_GET);
|
625 |
-
|
626 |
if($nr_get > 0){
|
627 |
$variable_product = wc_get_product($variation_id);
|
628 |
|
@@ -659,7 +657,9 @@ function woosea_add_remarketing_tags( $product = null ){
|
|
659 |
$ecomm_price = wc_format_decimal( $lowest, wc_get_price_decimals());
|
660 |
} else {
|
661 |
$ecomm_lowprice = wc_format_decimal( $lowest, wc_get_price_decimals() );
|
662 |
-
|
|
|
|
|
663 |
}
|
664 |
}
|
665 |
} else {
|
@@ -671,14 +671,18 @@ function woosea_add_remarketing_tags( $product = null ){
|
|
671 |
var google_tag_params = {
|
672 |
ecomm_prodid: <?php print "$ecomm_prodid";?>,
|
673 |
ecomm_pagetype: '<?php print "$ecomm_pagetype";?>',
|
674 |
-
ecomm_totalvalue:
|
675 |
};
|
676 |
</script>
|
677 |
|
678 |
<?php
|
679 |
}
|
680 |
} elseif ($ecomm_pagetype == "cart"){
|
681 |
-
|
|
|
|
|
|
|
|
|
682 |
?>
|
683 |
<script type="text/javascript">
|
684 |
var google_tag_params = {
|
@@ -804,6 +808,7 @@ function woosea_request_review(){
|
|
804 |
}
|
805 |
add_action('admin_notices', 'woosea_request_review');
|
806 |
|
|
|
807 |
/**
|
808 |
* Create a seperate MySql table for saving conversion information
|
809 |
*/
|
@@ -2285,6 +2290,21 @@ function woosea_local_pickup_shipping (){
|
|
2285 |
}
|
2286 |
add_action( 'wp_ajax_woosea_local_pickup_shipping', 'woosea_local_pickup_shipping' );
|
2287 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2288 |
/**
|
2289 |
* This function enables the setting to use
|
2290 |
* logging
|
@@ -4623,8 +4643,11 @@ add_action('wp_dashboard_setup', 'woosea_blog_widgets');
|
|
4623 |
/**
|
4624 |
* Creates the RSS metabox
|
4625 |
*/
|
|
|
|
|
|
|
|
|
4626 |
function woosea_my_rss_box() {
|
4627 |
-
|
4628 |
// Get RSS Feed(s)
|
4629 |
include_once(ABSPATH . WPINC . '/feed.php');
|
4630 |
$domain = $_SERVER['HTTP_HOST'];
|
@@ -4633,6 +4656,8 @@ function woosea_my_rss_box() {
|
|
4633 |
$my_feeds = array(
|
4634 |
'https://www.adtribes.io/feed/'
|
4635 |
);
|
|
|
|
|
4636 |
|
4637 |
// Loop through Feeds
|
4638 |
foreach ( $my_feeds as $feed) :
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Product Feed PRO for WooCommerce
|
4 |
+
* Version: 9.6.6
|
5 |
* Plugin URI: https://www.adtribes.io/support/?utm_source=wpadmin&utm_medium=plugin&utm_campaign=woosea_product_feed_pro
|
6 |
* Description: Configure and maintain your WooCommerce product feeds for Google Shopping, Facebook, Remarketing, Bing, Yandex, Comparison shopping websites and over a 100 channels more.
|
7 |
* Author: AdTribes.io
|
17 |
* Domain Path: /languages
|
18 |
*
|
19 |
* WC requires at least: 4.4
|
20 |
+
* WC tested up to: 5.0
|
21 |
*
|
22 |
* Product Feed PRO for WooCommerce is free software: you can redistribute it and/or modify
|
23 |
* it under the terms of the GNU General Public License as published by
|
48 |
* Plugin versionnumber, please do not override.
|
49 |
* Define some constants
|
50 |
*/
|
51 |
+
define( 'WOOCOMMERCESEA_PLUGIN_VERSION', '9.6.6' );
|
52 |
define( 'WOOCOMMERCESEA_PLUGIN_NAME', 'woocommerce-product-feed-pro' );
|
53 |
define( 'WOOCOMMERCESEA_PLUGIN_NAME_SHORT', 'woo-product-feed-pro' );
|
54 |
|
347 |
$cats = str_replace("&","&", $cats);
|
348 |
|
349 |
if(!empty($fb_prodid)){
|
|
|
350 |
if(!$product) {
|
351 |
return -1;
|
352 |
}
|
435 |
$order_real = 0;
|
436 |
$contents = "";
|
437 |
|
438 |
+
$cart_total_amount = wc_format_localized_price(WC()->cart->get_cart_contents_total());
|
439 |
+
|
440 |
if ( !is_wp_error( $order_items )) {
|
441 |
foreach( $order_items as $item_id => $order_item) {
|
442 |
$prod_id = $order_item->get_product_id();
|
455 |
}
|
456 |
}
|
457 |
$contents = rtrim($contents, ",");
|
458 |
+
$viewContent = "fbq('track','Purchase',{currency:'$currency', value:'$cart_total_amount', content_type:'product', contents:[$contents]});";
|
459 |
}
|
460 |
} else {
|
461 |
// This is on the cart page itself
|
464 |
$cart_real = 0;
|
465 |
$contents = "";
|
466 |
|
467 |
+
$cart_total_amount = wc_format_localized_price(WC()->cart->get_cart_contents_total());
|
468 |
+
|
469 |
$checkoutpage = wc_get_checkout_url();
|
470 |
$current_url = get_permalink(get_the_ID());
|
471 |
|
480 |
//$contents .= "$prod_id,";
|
481 |
|
482 |
$cart_real = wc_format_localized_price( $cart_item['line_total'] );
|
|
|
|
|
|
|
|
|
|
|
483 |
}
|
484 |
$contents = rtrim($contents, ",");
|
485 |
|
486 |
// User is on the billing pages
|
487 |
if($checkoutpage == $current_url){
|
488 |
+
$viewContent = "fbq(\"track\",\"InitiateCheckout\",{currency:\"$currency\", value:\"$cart_total_amount\", content_type:\"product\", content_ids:[$contents]});";
|
489 |
} else {
|
490 |
// User is on the basket page
|
491 |
+
$viewContent = "fbq(\"track\",\"AddToCart\",{currency:\"$currency\", value:\"$cart_total_amount\", content_type:\"product\", content_ids:[$contents]});";
|
492 |
}
|
493 |
}
|
494 |
}
|
620 |
// In that case we need to put in the AggregateOffer structured data
|
621 |
$variation_id = woosea_find_matching_product_variation( $product, $_GET );
|
622 |
$nr_get = count($_GET);
|
623 |
+
|
624 |
if($nr_get > 0){
|
625 |
$variable_product = wc_get_product($variation_id);
|
626 |
|
657 |
$ecomm_price = wc_format_decimal( $lowest, wc_get_price_decimals());
|
658 |
} else {
|
659 |
$ecomm_lowprice = wc_format_decimal( $lowest, wc_get_price_decimals() );
|
660 |
+
$ecomm_highprice = wc_format_decimal( $highest, wc_get_price_decimals() );
|
661 |
+
$ecomm_price = $ecomm_lowprice;
|
662 |
+
|
663 |
}
|
664 |
}
|
665 |
} else {
|
671 |
var google_tag_params = {
|
672 |
ecomm_prodid: <?php print "$ecomm_prodid";?>,
|
673 |
ecomm_pagetype: '<?php print "$ecomm_pagetype";?>',
|
674 |
+
ecomm_totalvalue: <?php print "$ecomm_price";?>,
|
675 |
};
|
676 |
</script>
|
677 |
|
678 |
<?php
|
679 |
}
|
680 |
} elseif ($ecomm_pagetype == "cart"){
|
681 |
+
// Get the first product from cart and use that product ID
|
682 |
+
foreach( WC()->cart->get_cart() as $cart_item ){
|
683 |
+
$ecomm_prodid = $cart_item['product_id'];
|
684 |
+
break;
|
685 |
+
}
|
686 |
?>
|
687 |
<script type="text/javascript">
|
688 |
var google_tag_params = {
|
808 |
}
|
809 |
add_action('admin_notices', 'woosea_request_review');
|
810 |
|
811 |
+
|
812 |
/**
|
813 |
* Create a seperate MySql table for saving conversion information
|
814 |
*/
|
2290 |
}
|
2291 |
add_action( 'wp_ajax_woosea_local_pickup_shipping', 'woosea_local_pickup_shipping' );
|
2292 |
|
2293 |
+
/**
|
2294 |
+
* This function enables the setting to remove
|
2295 |
+
* free shipping zones
|
2296 |
+
*/
|
2297 |
+
function woosea_remove_free_shipping (){
|
2298 |
+
$status = sanitize_text_field($_POST['status']);
|
2299 |
+
|
2300 |
+
if ($status == "off"){
|
2301 |
+
update_option( 'remove_free_shipping', 'no', 'yes');
|
2302 |
+
} else {
|
2303 |
+
update_option( 'remove_free_shipping', 'yes', 'yes');
|
2304 |
+
}
|
2305 |
+
}
|
2306 |
+
add_action( 'wp_ajax_woosea_remove_free_shipping', 'woosea_remove_free_shipping' );
|
2307 |
+
|
2308 |
/**
|
2309 |
* This function enables the setting to use
|
2310 |
* logging
|
4643 |
/**
|
4644 |
* Creates the RSS metabox
|
4645 |
*/
|
4646 |
+
function woosea_feed_interval( $seconds ) {
|
4647 |
+
return 172800; // Cache the feed for 2 days
|
4648 |
+
}
|
4649 |
+
|
4650 |
function woosea_my_rss_box() {
|
|
|
4651 |
// Get RSS Feed(s)
|
4652 |
include_once(ABSPATH . WPINC . '/feed.php');
|
4653 |
$domain = $_SERVER['HTTP_HOST'];
|
4656 |
$my_feeds = array(
|
4657 |
'https://www.adtribes.io/feed/'
|
4658 |
);
|
4659 |
+
|
4660 |
+
add_filter( 'wp_feed_cache_transient_lifetime' , 'woosea_feed_interval' );
|
4661 |
|
4662 |
// Loop through Feeds
|
4663 |
foreach ( $my_feeds as $feed) :
|