mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-03 19:53:19 +03:00
check for advancedcheckout
This commit is contained in:
parent
7c3d166256
commit
6efbf83492
@ -36,6 +36,7 @@ class IntaroCRM extends Module
|
|||||||
$this->registerHook('newOrder') &&
|
$this->registerHook('newOrder') &&
|
||||||
$this->registerHook('actionOrderStatusPostUpdate') &&
|
$this->registerHook('actionOrderStatusPostUpdate') &&
|
||||||
$this->registerHook('actionPaymentConfirmation')
|
$this->registerHook('actionPaymentConfirmation')
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +98,6 @@ class IntaroCRM extends Module
|
|||||||
$this->displayConfirmation($this->l('Settings updated'));
|
$this->displayConfirmation($this->l('Settings updated'));
|
||||||
|
|
||||||
$default_lang = $this->default_lang;
|
$default_lang = $this->default_lang;
|
||||||
|
|
||||||
$intaroCrm = $this->intaroCRM;
|
$intaroCrm = $this->intaroCRM;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -271,6 +271,7 @@ class IntaroCRM extends Module
|
|||||||
$address = Db::getInstance()->ExecuteS($sql);
|
$address = Db::getInstance()->ExecuteS($sql);
|
||||||
$address = $address[0];
|
$address = $address[0];
|
||||||
$delivery = json_decode(Configuration::get('INTAROCRM_API_DELIVERY'));
|
$delivery = json_decode(Configuration::get('INTAROCRM_API_DELIVERY'));
|
||||||
|
$payment = json_decode(Configuration::get('INTAROCRM_API_PAYMENT'));
|
||||||
$inCart = $params['cart']->getProducts();
|
$inCart = $params['cart']->getProducts();
|
||||||
|
|
||||||
if (isset($params['orderStatus'])) {
|
if (isset($params['orderStatus'])) {
|
||||||
@ -315,6 +316,11 @@ class IntaroCRM extends Module
|
|||||||
}
|
}
|
||||||
|
|
||||||
$dTypeKey = $params['cart']->id_carrier;
|
$dTypeKey = $params['cart']->id_carrier;
|
||||||
|
if (Module::getInstanceByName('advancedcheckout') === false) {
|
||||||
|
$pTypeKey = $params['order']->module;
|
||||||
|
} else {
|
||||||
|
$pTypeKey = $params['order']->payment;
|
||||||
|
}
|
||||||
$this->intaroCRM->orderCreate(
|
$this->intaroCRM->orderCreate(
|
||||||
array(
|
array(
|
||||||
'externalId' => $params['order']->id,
|
'externalId' => $params['order']->id,
|
||||||
@ -326,7 +332,7 @@ class IntaroCRM extends Module
|
|||||||
'phone' => $address['phone'],
|
'phone' => $address['phone'],
|
||||||
'email' => $params['customer']->email,
|
'email' => $params['customer']->email,
|
||||||
'paymentStatus' => 'not-paid',
|
'paymentStatus' => 'not-paid',
|
||||||
//'paymentType' => 'cash',
|
'paymentType' => $payment->$pTypeKey,
|
||||||
'deliveryType' => $delivery->$dTypeKey,
|
'deliveryType' => $delivery->$dTypeKey,
|
||||||
'deliveryCost' => $params['order']->total_shipping,
|
'deliveryCost' => $params['order']->total_shipping,
|
||||||
'status' => 'new',
|
'status' => 'new',
|
||||||
@ -522,7 +528,7 @@ class IntaroCRM extends Module
|
|||||||
$paymentTypes[] = array(
|
$paymentTypes[] = array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => $payment['name'],
|
'label' => $payment['name'],
|
||||||
'name' => 'INTAROCRM_API_PAYMENT[' . $payment['id'] . ']',
|
'name' => 'INTAROCRM_API_PAYMENT[' . $payment['code'] . ']',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'options' => array(
|
'options' => array(
|
||||||
'query' => $this->getApiPaymentTypes($intaroCrm),
|
'query' => $this->getApiPaymentTypes($intaroCrm),
|
||||||
@ -543,6 +549,10 @@ class IntaroCRM extends Module
|
|||||||
/* Get all modules then select only payment ones */
|
/* Get all modules then select only payment ones */
|
||||||
$modules = Module::getModulesOnDisk(true);
|
$modules = Module::getModulesOnDisk(true);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hack for knivesland
|
||||||
|
*/
|
||||||
|
if (Module::getInstanceByName('advancedcheckout') === false) {
|
||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
if ($module->tab == 'payments_gateways')
|
if ($module->tab == 'payments_gateways')
|
||||||
{
|
{
|
||||||
@ -588,12 +598,24 @@ class IntaroCRM extends Module
|
|||||||
if ($module->active != 0) {
|
if ($module->active != 0) {
|
||||||
$this->payment_modules[] = array(
|
$this->payment_modules[] = array(
|
||||||
'id' => $module->id,
|
'id' => $module->id,
|
||||||
|
'code' => $module->name,
|
||||||
'name' => $module->displayName
|
'name' => $module->displayName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
require_once(dirname(__FILE__) . '/../advancedcheckout/classes/Payment.php');
|
||||||
|
$modules = Payment::getPaymentMethods();
|
||||||
|
foreach ($modules as $module) {
|
||||||
|
$this->payment_modules[] = array(
|
||||||
|
'id' => $module['id_payment'],
|
||||||
|
'code' => $module['name'],
|
||||||
|
'name' => $module['name']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->payment_modules;
|
return $this->payment_modules;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user