mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-02 19:33:14 +03:00
Set payment status and amount only for paid orders. Added properties code for cart items
This commit is contained in:
parent
20c8e83a59
commit
27816dcddf
@ -903,14 +903,16 @@ class RetailcrmOrderBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($payment[$paymentType]) && !empty($payment[$paymentType])) {
|
if (isset($payment[$paymentType]) && !empty($payment[$paymentType])) {
|
||||||
$crmOrder['payments'] = array(
|
$order_payment = array(
|
||||||
array(
|
'externalId' => $order->id . '#' . $order->reference,
|
||||||
'externalId' => $order->id . '#' . $order->reference,
|
'type' => $payment[$paymentType]
|
||||||
'amount' => round($order->total_paid_real, 2),
|
|
||||||
'status' => ((round($order->total_paid_real, 2) > 0) ? 'paid' : null),
|
|
||||||
'type' => $payment[$paymentType]
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (round($order->total_paid_real, 2) > 0) {
|
||||||
|
$order_payment['amount'] = round($order->total_paid_real, 2);
|
||||||
|
$order_payment['status'] = 'paid';
|
||||||
|
}
|
||||||
|
$crmOrder['payments'][] = $order_payment;
|
||||||
} else {
|
} else {
|
||||||
$crmOrder['payments'] = array();
|
$crmOrder['payments'] = array();
|
||||||
}
|
}
|
||||||
@ -1010,6 +1012,14 @@ class RetailcrmOrderBuilder
|
|||||||
$arItem = explode(":", $valAttr);
|
$arItem = explode(":", $valAttr);
|
||||||
|
|
||||||
if ($arItem[0] && $arItem[1]) {
|
if ($arItem[0] && $arItem[1]) {
|
||||||
|
// Product property code should start with a letter, digit or underscore
|
||||||
|
// and only contain letters, digits, underscores, hyphens and colons
|
||||||
|
$propertyCode = preg_replace('/(^[^\w]+)|([^\w\-:])/', '', $arItem[0]);
|
||||||
|
if (empty($propertyCode)) {
|
||||||
|
$propertyCode = 'prop_' . $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
$arProp[$count]['code'] = $propertyCode;
|
||||||
$arProp[$count]['name'] = trim($arItem[0]);
|
$arProp[$count]['name'] = trim($arItem[0]);
|
||||||
$arProp[$count]['value'] = trim($arItem[1]);
|
$arProp[$count]['value'] = trim($arItem[1]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user