diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d82f9b..018d528 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2018-03-22 v.2.1.4 +* Исправлена ошибка при активированном модуле без настроек +* Добавлен фильтр при формировании массива заказа +* Исправлена генерация icml с неполной картинкой товара + ## 2018-03-22 v.2.1.3 * Исправлена ошибка на php5.3 diff --git a/woo-retailcrm/include/class-wc-retailcrm-icml.php b/woo-retailcrm/include/class-wc-retailcrm-icml.php index ac6d54f..10431cd 100644 --- a/woo-retailcrm/include/class-wc-retailcrm-icml.php +++ b/woo-retailcrm/include/class-wc-retailcrm-icml.php @@ -416,16 +416,16 @@ if ( ! class_exists( 'WC_Retailcrm_Icml' ) ) : */ private function setOffer(&$full_product_list, $product_attributes, $product, $parent = false) { if ($parent) { - $image = wp_get_attachment_image_src($product->get_image_id()); + $image = wp_get_attachment_image_src($product->get_image_id(), 'full'); if (!$image) { - $image = wp_get_attachment_image_src($parent->get_image_id()); + $image = wp_get_attachment_image_src($parent->get_image_id(), 'full'); } $term_list = $parent->get_category_ids(); $attributes = get_post_meta($parent->get_id(), '_product_attributes'); } else { - $image = wp_get_attachment_image_src($product->get_image_id()); + $image = wp_get_attachment_image_src($product->get_image_id(), 'full'); $term_list = $product->get_category_ids(); $attributes = get_post_meta($product->get_id(), '_product_attributes'); } diff --git a/woo-retailcrm/include/class-wc-retailcrm-orders.php b/woo-retailcrm/include/class-wc-retailcrm-orders.php index 3fe5c76..9f66a60 100644 --- a/woo-retailcrm/include/class-wc-retailcrm-orders.php +++ b/woo-retailcrm/include/class-wc-retailcrm-orders.php @@ -432,7 +432,7 @@ if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) : } } - return $order_data; + return apply_filters('retailcrm_process_order', $order_data); } /** diff --git a/woo-retailcrm/retailcrm.php b/woo-retailcrm/retailcrm.php index 0e09d92..94615ce 100644 --- a/woo-retailcrm/retailcrm.php +++ b/woo-retailcrm/retailcrm.php @@ -1,6 +1,6 @@ - - ', getRetailCrmCookie('_ga')); + ga('send', 'pageview'); + + get_items() as $item) { - $uid = ($item['variation_id'] > 0) ? $item['variation_id'] : $item['product_id'] ; - $_product = wc_get_product($uid); - if ($_product) { - $order_item = array( - 'id' => $uid, - 'name' => $item['name'], - 'price' => (float)$_product->get_price(), - 'quantity' => $item['qty'], - ); + if ($options && is_array($options)) { + $options = array_filter($options); + + if (isset($_GET['key']) && isset($options['ua']) && $options['ua'] == 'yes') { + $orderid = wc_get_order_id_by_order_key($_GET['key']); + $order = new WC_Order($orderid); + foreach ($order->get_items() as $item) { + $uid = ($item['variation_id'] > 0) ? $item['variation_id'] : $item['product_id'] ; + $_product = wc_get_product($uid); + if ($_product) { + $order_item = array( + 'id' => $uid, + 'name' => $item['name'], + 'price' => (float)$_product->get_price(), + 'quantity' => $item['qty'], + ); + + $order_items[] = $order_item; + } } - $order_items[] = $order_item; - } - $url = parse_url(get_site_url()); - $domain = $url['host']; - ?> - - ga('ecommerce:send'); - -