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