add loyalty_level when the order is saved
This commit is contained in:
parent
2ec5514886
commit
ebeb378dd1
4 changed files with 9 additions and 8 deletions
|
@ -284,10 +284,6 @@ class RetailCrmOrder
|
|||
if (count($payments) > 0) {
|
||||
$order['payments'] = $payments;
|
||||
}
|
||||
|
||||
if (ConfigProvider::getLoyaltyProgramStatus() === 'Y') {
|
||||
$order['privilegeType'] = 'loyalty_level';
|
||||
}
|
||||
|
||||
//send
|
||||
if (function_exists('retailCrmBeforeOrderSend')) {
|
||||
|
@ -313,7 +309,12 @@ class RetailCrmOrder
|
|||
$order = $normalizer->normalize($order, 'orders');
|
||||
|
||||
Logger::getInstance()->write($order, 'orderSend');
|
||||
|
||||
|
||||
|
||||
if (ConfigProvider::getLoyaltyProgramStatus() === 'Y') {
|
||||
$order['privilegeType'] = 'loyalty_level';
|
||||
}
|
||||
|
||||
if ($send) {
|
||||
if (!RCrmActions::apiMethod($api, $methodApi, __METHOD__, $order, $site)) {
|
||||
return false;
|
||||
|
|
|
@ -13,7 +13,7 @@ Loader::includeModule('intaro.retailcrm');
|
|||
$arResult['LOYALTY_STATUS'] = ConfigProvider::getLoyaltyProgramStatus();
|
||||
|
||||
global $USER;
|
||||
//Активна ПЛ ?
|
||||
|
||||
if ($arResult['LOYALTY_STATUS'] === 'Y' && $USER->IsAuthorized()) {
|
||||
$service = new LoyaltyService();
|
||||
$arResult['LP_REGISTER'] = $service->checkRegInLp();
|
||||
|
|
|
@ -156,7 +156,7 @@ class EventsHandlers
|
|||
|
||||
try {
|
||||
$orderService->saveOrderInCRM($event);
|
||||
|
||||
|
||||
$isNew = $event->getParameter("IS_NEW");
|
||||
|
||||
if (isset($_POST['bonus-input'], $_POST['available-bonuses'])
|
||||
|
|
|
@ -398,7 +398,7 @@ class LoyaltyService
|
|||
* @param array $userFields
|
||||
* @return array
|
||||
*/
|
||||
private function getFields(array $userFields)
|
||||
private function getFields(array $userFields): array
|
||||
{
|
||||
$standartFields = $this->getStandardFields($userFields);
|
||||
$externalFields = $this->getExternalFields();
|
||||
|
|
Loading…
Add table
Reference in a new issue