mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-22 05:06:07 +03:00
Handle the promotional price
This commit is contained in:
parent
cd7f63562d
commit
bb23c4cc40
@ -171,13 +171,13 @@ class ModelExtensionRetailcrmPrices extends Model
|
|||||||
) {
|
) {
|
||||||
$productPrice[$special['customer_group_id']]['price'] = $special['price'];
|
$productPrice[$special['customer_group_id']]['price'] = $special['price'];
|
||||||
$productPrice[$special['customer_group_id']]['remove'] = false;
|
$productPrice[$special['customer_group_id']]['remove'] = false;
|
||||||
$priority = $special['priority'];
|
|
||||||
$groupId = $special['customer_group_id'];
|
$groupId = $special['customer_group_id'];
|
||||||
|
$priority = $special['priority'];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$productPrice[$special['customer_group_id']]['price'] = $special['price'];
|
$productPrice[$special['customer_group_id']]['price'] = $special['price'];
|
||||||
$groupId = $special['customer_group_id'];
|
|
||||||
$productPrice[$special['customer_group_id']]['remove'] = false;
|
$productPrice[$special['customer_group_id']]['remove'] = false;
|
||||||
|
$groupId = $special['customer_group_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,19 +234,29 @@ class RetailcrmOrderConverter {
|
|||||||
'quantity' => $product['quantity']
|
'quantity' => $product['quantity']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$date = date('Y-m-d');
|
||||||
|
$always = '0000-00-00';
|
||||||
$specials = $this->productsRepository->getProductSpecials($product['product_id']);
|
$specials = $this->productsRepository->getProductSpecials($product['product_id']);
|
||||||
|
|
||||||
if (!empty($specials)) {
|
if (!empty($specials)) {
|
||||||
$customer = $this->customerRepository->getCustomer($this->order_data['customer_id']);
|
$customer = $this->customerRepository->getCustomer($this->order_data['customer_id']);
|
||||||
|
|
||||||
foreach ($specials as $special) {
|
foreach ($specials as $special) {
|
||||||
if (empty($customer['customer_group_id'])) {
|
if (($special['date_start'] == $always && $special['date_end'] == $always)
|
||||||
continue;
|
|| ($special['date_start'] <= $date && $special['date_end'] >= $date)
|
||||||
}
|
) {
|
||||||
|
if ((isset($priority) && $priority > $special['priority'])
|
||||||
|
|| !isset($priority)) {
|
||||||
|
if (empty($customer['customer_group_id'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$specialSetting = $this->settingsManager->getSetting('special_' . $customer['customer_group_id']);
|
$specialSetting = $this->settingsManager->getSetting('special_' . $customer['customer_group_id']);
|
||||||
if ($special['customer_group_id'] == $customer['customer_group_id'] && !empty($specialSetting)) {
|
if ($special['customer_group_id'] == $customer['customer_group_id'] && !empty($specialSetting)) {
|
||||||
$item['priceType']['code'] = $specialSetting;
|
$item['priceType']['code'] = $specialSetting;
|
||||||
|
$priority = $special['priority'];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user