Bug fix (#14)
This commit is contained in:
parent
77c84ba1f3
commit
3ce1885da0
@ -1 +1,4 @@
|
||||
# woocommerce-module
|
||||
woocommerce-module
|
||||
==================
|
||||
|
||||
Module allows integrate Woocommerce with [retailCRM](http://retailcrm.pro)
|
@ -229,12 +229,12 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
|
||||
|
||||
elseif ($record['field'] == 'delivery_address.street') {
|
||||
$order = new WC_Order($record['order']['externalId']);
|
||||
$order->set_shipping_address1($record['newValue']);
|
||||
$order->set_shipping_address_1($record['newValue']);
|
||||
}
|
||||
|
||||
elseif ($record['field'] == 'delivery_address.building') {
|
||||
$order = new WC_Order($record['order']['externalId']);
|
||||
$order->set_shipping_address2($record['newValue']);
|
||||
$order->set_shipping_address_2($record['newValue']);
|
||||
}
|
||||
|
||||
elseif ($record['field'] == 'payment_type') {
|
||||
@ -366,8 +366,20 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
|
||||
}
|
||||
}
|
||||
|
||||
if (version_compare(get_option('woocommerce_db_version'), '3.0', '<' )) {
|
||||
$shipping_rate = new WC_Shipping_Rate($shipping_method_id, isset($shipping_method_title) ? $shipping_method_title : '', isset($shipping_total) ? floatval($shipping_total) : 0, array(), $shipping_method_id);
|
||||
$order->add_shipping($shipping_rate);
|
||||
} else {
|
||||
$shipping = new WC_Order_Item_Shipping();
|
||||
$shipping->set_props( array(
|
||||
'method_title' => $shipping_method_title,
|
||||
'method_id' => $shipping_method_id,
|
||||
'total' => wc_format_decimal($shipping_total),
|
||||
'order_id' => $order->id
|
||||
) );
|
||||
$shipping->save();
|
||||
$order->add_item( $shipping );
|
||||
}
|
||||
|
||||
$this->update_total($order);
|
||||
|
||||
@ -378,7 +390,6 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
|
||||
|
||||
$this->retailcrm->ordersFixExternalIds($ids);
|
||||
}
|
||||
|
||||
$this->addFuncsHook();
|
||||
}
|
||||
|
||||
@ -441,7 +452,6 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
|
||||
protected function getShippingItemId($items)
|
||||
{
|
||||
if ($items) {
|
||||
|
||||
foreach ($items as $key => $value) {
|
||||
$item_id[] = $key;
|
||||
}
|
||||
|
@ -404,13 +404,18 @@ if ( ! class_exists( 'WC_Retailcrm_Icml' ) ) :
|
||||
$product_data['params'] = $params;
|
||||
}
|
||||
|
||||
if (isset($product_data)) {
|
||||
$full_product_list[] = $product_data;
|
||||
}
|
||||
|
||||
unset($product_data);
|
||||
}
|
||||
endwhile;
|
||||
|
||||
if (isset($full_product_list) && $full_product_list) {
|
||||
$this->writeOffers($full_product_list);
|
||||
unset($full_product_list);
|
||||
}
|
||||
|
||||
$offset += $limit;
|
||||
|
||||
|
@ -42,13 +42,16 @@ if ( ! class_exists( 'WC_Retailcrm_Inventories' ) ) :
|
||||
if (isset($offer['externalId'])) {
|
||||
$product = wc_get_product($offer['externalId']);
|
||||
|
||||
if ($product == false || $product->get_type() == 'variable') continue;
|
||||
|
||||
if ($product != false) {
|
||||
if ($product->get_type() == 'variable') {
|
||||
continue;
|
||||
}
|
||||
update_post_meta($offer['externalId'], '_manage_stock', 'yes');
|
||||
$product->set_stock_quantity($offer['quantity']);
|
||||
$product->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} while ($page <= $totalPageCount);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user