mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-02 19:33:14 +03:00
Bug fixes in customer search (#27)
* multi module for api v4, v5 * bug fix empty payment in history * add module key for marketplace * fix for validation on marketplace, edit validation form for saving settings * Bug fix * Bug fixes in customer search
This commit is contained in:
parent
87a6c6ee34
commit
3d3d55a9d1
@ -3,7 +3,7 @@
|
||||
* @author Retail Driver LCC
|
||||
* @copyright RetailCRM
|
||||
* @license GPL
|
||||
* @version 2.1.1
|
||||
* @version 2.1.3
|
||||
* @link https://retailcrm.ru
|
||||
*
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @author Retail Driver LCC
|
||||
* @copyright RetailCRM
|
||||
* @license GPL
|
||||
* @version 2.1.1
|
||||
* @version 2.1.3
|
||||
* @link https://retailcrm.ru
|
||||
*
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @author Retail Driver LCC
|
||||
* @copyright RetailCRM
|
||||
* @license GPL
|
||||
* @version 2.1.1
|
||||
* @version 2.1.3
|
||||
* @link https://retailcrm.ru
|
||||
*
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @author Retail Driver LCC
|
||||
* @copyright RetailCRM
|
||||
* @license GPL
|
||||
* @version 2.1.1
|
||||
* @version 2.1.3
|
||||
* @link https://retailcrm.ru
|
||||
*
|
||||
*/
|
||||
@ -103,6 +103,7 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
||||
if (!isset($paymentId) || !$paymentId) {
|
||||
$paymentId = $paymentDefault;
|
||||
}
|
||||
|
||||
if (!$paymentType) {
|
||||
if ($paymentDefault) {
|
||||
if (Module::getInstanceByName($paymentDefault)) {
|
||||
@ -116,6 +117,7 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
||||
3,
|
||||
_PS_ROOT_DIR_ . '/retailcrm.log'
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -135,7 +137,7 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
||||
|
||||
$customer = new Customer();
|
||||
if (!empty($order['customer']['email'])) {
|
||||
$customer->getByEmail($order['customer']['email']);
|
||||
$customer->getByEmail($order['customer']['email'], null, false);
|
||||
}
|
||||
|
||||
if (!array_key_exists('externalId', $order['customer'])) {
|
||||
@ -408,6 +410,7 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
||||
/*
|
||||
* check payment type
|
||||
*/
|
||||
|
||||
if (!empty($order['paymentType']) && $apiVersion != 5) {
|
||||
$ptype = $order['paymentType'];
|
||||
|
||||
@ -445,6 +448,36 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
||||
WHERE
|
||||
`id_order` = ' . (int)$order['externalId']);
|
||||
|
||||
Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'order_payment`
|
||||
(`payment_method`, `order_reference` , `amount`, `date_add`)
|
||||
VALUES
|
||||
(\'' . $payType . '\',
|
||||
\'' . $orderToUpdate->reference . '\',
|
||||
\'' . $payment['amount'] . '\',
|
||||
\'' . $payment['paidAt'] . '\')');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif (!empty($order['payments']) && $apiVersion == 5) {
|
||||
if ($order['payments']) {
|
||||
foreach ($order['payments'] as $payment) {
|
||||
if (!isset($payment['externalId']) && $payment['status'] == 'paid') {
|
||||
$ptype = $payment['type'];
|
||||
$ptypes = $references->getSystemPaymentModules();
|
||||
if ($payments[$ptype] != null) {
|
||||
foreach ($ptypes as $pay) {
|
||||
if ($pay['code'] == $payments[$ptype]) {
|
||||
$payType = $pay['name'];
|
||||
}
|
||||
}
|
||||
$paymentType = Module::getModuleName($payments[$ptype]);
|
||||
Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'orders`
|
||||
SET
|
||||
`payment` = \'' . ($paymentType != null ? $paymentType : $payments[$ptype]). '\'
|
||||
WHERE
|
||||
`id_order` = ' . (int)$order['externalId']);
|
||||
|
||||
Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'order_payment`
|
||||
(`payment_method`, `order_reference` , `amount`, `date_add`)
|
||||
VALUES
|
||||
@ -503,6 +536,7 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
||||
if (isset($item['discount']) ||
|
||||
isset($item['discountPercent']) ||
|
||||
isset($item['discountTotal'])) {
|
||||
|
||||
$product = new Product((int) $product_id, false, $default_lang);
|
||||
$tax = new TaxCore($product->id_tax_rules_group);
|
||||
|
||||
|
@ -25,7 +25,7 @@ class RetailCRM extends Module
|
||||
{
|
||||
$this->name = 'retailcrm';
|
||||
$this->tab = 'export';
|
||||
$this->version = '2.1.2';
|
||||
$this->version = '2.1.3';
|
||||
$this->author = 'Retail Driver LCC';
|
||||
$this->displayName = $this->l('RetailCRM');
|
||||
$this->description = $this->l('Integration module for RetailCRM');
|
||||
@ -40,7 +40,7 @@ class RetailCRM extends Module
|
||||
$this->psVersion = Tools::substr(_PS_VERSION_, 0, 3);
|
||||
$this->log = _PS_ROOT_DIR_ . '/retailcrm.log';
|
||||
$this->module_key = '149c765c6cddcf35e1f13ea6c71e9fa5';
|
||||
|
||||
|
||||
if ($this->psVersion == '1.6') {
|
||||
$this->bootstrap = true;
|
||||
$this->use_new_hooks = false;
|
||||
@ -129,7 +129,7 @@ class RetailCRM extends Module
|
||||
$this->api = new RetailcrmProxy($address, $token, $this->log, $version);
|
||||
$this->reference = new RetailcrmReferences($this->api);
|
||||
}
|
||||
|
||||
|
||||
$output .= $this->displayConfirmation(
|
||||
$this->l('Timezone settings must be identical to both of your crm and shop') .
|
||||
" <a target=\"_blank\" href=\"$address/admin/settings#t-main\">$address/admin/settings#t-main</a>"
|
||||
@ -156,7 +156,9 @@ class RetailCRM extends Module
|
||||
'name' => 'v5'
|
||||
)
|
||||
);
|
||||
|
||||
$fields_form = array();
|
||||
|
||||
/*
|
||||
* Network connection form
|
||||
*/
|
||||
@ -290,7 +292,7 @@ class RetailCRM extends Module
|
||||
$helper->fields_value['RETAILCRM_API_TOKEN'] = Configuration::get('RETAILCRM_API_TOKEN');
|
||||
$helper->fields_value['RETAILCRM_API_VERSION'] = Configuration::get('RETAILCRM_API_VERSION');
|
||||
$helper->fields_value['RETAILCRM_STATUS_EXPORT'] = Configuration::get('RETAILCRM_STATUS_EXPORT');
|
||||
|
||||
|
||||
$deliverySettings = Configuration::get('RETAILCRM_API_DELIVERY');
|
||||
if (isset($deliverySettings) && $deliverySettings != '') {
|
||||
$deliveryTypes = json_decode($deliverySettings);
|
||||
@ -503,6 +505,7 @@ class RetailCRM extends Module
|
||||
$arProp = array();
|
||||
$count = 0;
|
||||
$arAttr = explode(",", $item['attributes']);
|
||||
|
||||
foreach ($arAttr as $valAttr) {
|
||||
$arItem = explode(":", $valAttr);
|
||||
$arProp[$count]['name'] = trim($arItem[0]);
|
||||
@ -645,6 +648,7 @@ class RetailCRM extends Module
|
||||
private function validateCrmAddress($address)
|
||||
{
|
||||
if (preg_match("/https:\/\/(.*).retailcrm.ru/", $address) === 1) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -52,4 +52,4 @@ $_MODULE['<{retailcrm}prestashop>retailcrm_f0e1fc6f97d36cb80f29196e2662ffde'] =
|
||||
$_MODULE['<{retailcrm}prestashop>retailcrm_7a1920d61156abc05a60135aefe8bc67'] = 'По умолчанию';
|
||||
$_MODULE['<{retailcrm}prestashop>retailcrm_cc18dd262eff97c4dd4b56f750896adb'] = 'Статус по умолчанию';
|
||||
$_MODULE['<{retailcrm}prestashop>retailcrm_a33b96f0ce0f1227132f1cb3cf1c9e88'] = 'Статус заказа при пакетной выгрузке ';
|
||||
$_MODULE['<{retailcrm}prestashop>retailcrm_1bd340aeb42a5ee0318784c2cffed8a9'] = 'Выбранная версия API недоступна';
|
||||
$_MODULE['<{retailcrm}prestashop>retailcrm_1bd340aeb42a5ee0318784c2cffed8a9'] = 'Выбранная версия API недоступна';
|
||||
|
Loading…
x
Reference in New Issue
Block a user