Skip to content

Commit

Permalink
Fix customers edit
Browse files Browse the repository at this point in the history
  • Loading branch information
iyzoer committed Mar 12, 2018
1 parent b4693c3 commit c16decd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 43 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2018-03-12 v.2.1.1
* Исправлена ошибка редактирования информации о клиенте

## 2018-02-26 v.2.1.0
* Переработана механика генерации icml каталога товаров
* В icml каталог добавлена выгрузка налоговой ставки
Expand Down
50 changes: 8 additions & 42 deletions woo-retailcrm/retailcrm.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Version: 2.1.0
* Version: 2.1.1
* Plugin Name: WooCommerce RetailCRM
* Plugin URI: https://wordpress.org/plugins/woo-retailcrm/
* Description: Integration plugin for WooCommerce & RetailCRM
Expand Down Expand Up @@ -212,40 +212,6 @@ function retailcrm_update_order_payment($order_id)
$order_class->orderUpdatePayment($order_id);
}

/**
* Update order
*
* @param $meta_id, $order_id, $meta_key, $_meta_value
*/
function retailcrm_update_order($meta_id, $order_id, $meta_key, $_meta_value)
{
if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) {
include_once( check_custom_orders() );
}
$order_class = new WC_Retailcrm_Orders();

if ($meta_key == '_payment_method') {
$order_class->orderUpdatePaymentType($order_id, $_meta_value);
}

$address = array();

if ($meta_key == '_shipping_first_name') $address['firstName'] = $_meta_value;
if ($meta_key == '_shipping_last_name') $address['lastName'] = $_meta_value;
if ($meta_key == '_billing_phone') $address['phone'] = $_meta_value;
if ($meta_key == '_billing_email') $address['email'] = $_meta_value;
if ($meta_key == '_shipping_city') $address['delivery']['address']['city'] = $_meta_value;
if ($meta_key == '_shipping_state') $address['delivery']['address']['region'] = $_meta_value;
if ($meta_key == '_shipping_postcode') $address['delivery']['address']['index'] = $_meta_value;
if ($meta_key == '_shipping_country') $address['delivery']['address']['countryIso'] = $_meta_value;
if ($meta_key == '_shipping_address_1') $address['delivery']['address']['text'] = $_meta_value;
if ($meta_key == '_shipping_address_2') $address['delivery']['address']['text'] .= $_meta_value;

if (!empty($address)) {
$order_class->orderUpdateShippingAddress($order_id, $address);
}
}

/**
* Update order items
*
Expand Down Expand Up @@ -404,14 +370,14 @@ function update_order($order_id) {
add_action('retailcrm_history', 'retailcrm_history_get');
add_action('retailcrm_icml', 'generate_icml');
add_action('retailcrm_inventories', 'load_stocks');
add_action( 'init', 'check_inventories');
add_action( 'init', 'register_icml_generation');
add_action( 'init', 'register_retailcrm_history');
add_action( 'wp_ajax_do_upload', 'upload_to_crm' );
add_action( 'wp_ajax_generate_icml', 'generate_icml' );
add_action('init', 'check_inventories');
add_action('init', 'register_icml_generation');
add_action('init', 'register_retailcrm_history');
add_action('wp_ajax_do_upload', 'upload_to_crm');
add_action('wp_ajax_generate_icml', 'generate_icml');
add_action('admin_print_footer_scripts', 'ajax_upload', 99);
add_action('admin_print_footer_scripts', 'ajax_generate_icml', 99);
add_action( 'woocommerce_created_customer', 'create_customer', 10, 1 );
add_action( 'woocommerce_checkout_update_user_meta', 10, 2 );
add_action('woocommerce_created_customer', 'create_customer', 10, 1);
add_action('woocommerce_update_customer', 'update_customer', 10, 1);
add_action('woocommerce_update_order', 'update_order', 11, 1);
}
2 changes: 1 addition & 1 deletion woo-retailcrm/uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*
* @link https://wordpress.org/plugins/woo-retailcrm/
* @since 2.1.0
* @since 2.1.1
*
* @package RetailCRM
*/
Expand Down

0 comments on commit c16decd

Please sign in to comment.