From 9bbe23195c07b91f839f7b4543a96c6761d7d4af Mon Sep 17 00:00:00 2001 From: DmitryZagorulko Date: Fri, 16 Jun 2017 16:13:25 +0300 Subject: [PATCH] correct export and set lang rule (#15) --- retailcrm/job/export.php | 7 ++++++- retailcrm/lib/RetailcrmReferences.php | 10 +++------- retailcrm/retailcrm.php | 4 ++-- retailcrm/translations/ru.php | 3 +++ 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/retailcrm/job/export.php b/retailcrm/job/export.php index dbb23ea..bd349b4 100644 --- a/retailcrm/job/export.php +++ b/retailcrm/job/export.php @@ -113,8 +113,13 @@ foreach ($orderRecords as $record) { $products = $object->getProducts(); foreach($products as $product) { + if(isset($product['product_attribute_id']) && $product['product_attribute_id'] > 0) { + $productId = $product['product_id'] . '#' . $product['product_attribute_id']; + } else { + $productId = $product['product_id']; + } $item = array( - 'productId' => $product['product_id'], + 'offer' => array('externalId' => $productId), 'productName' => $product['product_name'], 'quantity' => $product['product_quantity'], 'initialPrice' => round($product['product_price'], 2), diff --git a/retailcrm/lib/RetailcrmReferences.php b/retailcrm/lib/RetailcrmReferences.php index 9d0efec..4a16459 100644 --- a/retailcrm/lib/RetailcrmReferences.php +++ b/retailcrm/lib/RetailcrmReferences.php @@ -50,10 +50,6 @@ class RetailcrmReferences if (!empty($states)) { foreach ($states as $state) { if ($state['name'] != ' ') { - /*$key = isset($state['id_order_state']) - ? $state['id_order_state'] - : $state['id_order_return_state'] - ;*/ $key = $state['id_order_state']; $statusTypes[] = array( 'type' => 'select', @@ -98,7 +94,7 @@ class RetailcrmReferences return $paymentTypes; } -public function getPaymentAndDeliveryForDefault() +public function getPaymentAndDeliveryForDefault($arParams) { $paymentTypes = array(); $deliveryTypes = array(); @@ -121,7 +117,7 @@ public function getPaymentAndDeliveryForDefault() $paymentDeliveryTypes[] = array( 'type' => 'select', - 'label' => "Доставка", + 'label' => $arParams[0], 'name' => 'RETAILCRM_API_DELIVERY_DEFAULT', 'required' => false, 'options' => array( @@ -148,7 +144,7 @@ public function getPaymentAndDeliveryForDefault() $paymentDeliveryTypes[] = array( 'type' => 'select', - 'label' => "Система оплаты", + 'label' => $arParams[1], 'name' => 'RETAILCRM_API_PAYMENT_DEFAULT', 'required' => false, 'options' => array( diff --git a/retailcrm/retailcrm.php b/retailcrm/retailcrm.php index 7d1497e..b257828 100644 --- a/retailcrm/retailcrm.php +++ b/retailcrm/retailcrm.php @@ -190,8 +190,8 @@ class RetailCRM extends Module * Default */ $fields_form[4]['form'] = array( - 'legend' => array('title' => 'По умолчанию'), - 'input' => $this->reference->getPaymentAndDeliveryForDefault(), + 'legend' => array('title' => $this->l('Default')), + 'input' => $this->reference->getPaymentAndDeliveryForDefault(array($this->l('Delivery method'), $this->l('Payment type'))), ); } diff --git a/retailcrm/translations/ru.php b/retailcrm/translations/ru.php index 901ffc1..cc9019e 100644 --- a/retailcrm/translations/ru.php +++ b/retailcrm/translations/ru.php @@ -18,6 +18,8 @@ $_MODULE['<{retailcrm}prestashop>retailcrm_c9cc8cce247e49bae79f15173ce97354'] = $_MODULE['<{retailcrm}prestashop>retailcrm_065ab3a28ca4f16f55f103adc7d0226f'] = 'Способы доставки'; $_MODULE['<{retailcrm}prestashop>retailcrm_33af8066d3c83110d4bd897f687cedd2'] = 'Статусы заказов'; $_MODULE['<{retailcrm}prestashop>retailcrm_bab959acc06bb03897b294fbb892be6b'] = 'Способы оплаты'; +$_MODULE['<{retailcrm}prestashop>retailcrm_6310f29293c902c64db619c29179d99a'] = 'Способ доставки'; +$_MODULE['<{retailcrm}prestashop>retailcrm_4dbcb38bbbff5d4a402f2575c57a35e6'] = 'Тип оплаты'; $_MODULE['<{retailcrm}prestashop>retailcrm_dd7bf230fde8d4836917806aff6a6b27'] = 'Адрес'; $_MODULE['<{retailcrm}prestashop>retailcrm_630f6dc397fe74e52d5189e2c80f282b'] = 'Вернуться к списку'; $_MODULE['<{retailcrm}prestashop>retailcrm_5c1cf6cfec2dad86c8ca5286a0294516'] = 'Имя'; @@ -47,3 +49,4 @@ $_MODULE['<{retailcrm}prestashop>retailcrm_69aede266809f89b89fe70681f6a129f'] = $_MODULE['<{retailcrm}prestashop>retailcrm_57d056ed0984166336b7879c2af3657f'] = 'Город'; $_MODULE['<{retailcrm}prestashop>retailcrm_bcc254b55c4a1babdf1dcb82c207506b'] = 'Телефон'; $_MODULE['<{retailcrm}prestashop>retailcrm_f0e1fc6f97d36cb80f29196e2662ffde'] = 'Мобильный телефон'; +$_MODULE['<{retailcrm}prestashop>retailcrm_7a1920d61156abc05a60135aefe8bc67'] = 'По умолчанию';