mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-21 20:56: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']]['remove'] = false;
|
||||
$priority = $special['priority'];
|
||||
$groupId = $special['customer_group_id'];
|
||||
$priority = $special['priority'];
|
||||
}
|
||||
} else {
|
||||
$productPrice[$special['customer_group_id']]['price'] = $special['price'];
|
||||
$groupId = $special['customer_group_id'];
|
||||
$productPrice[$special['customer_group_id']]['remove'] = false;
|
||||
$groupId = $special['customer_group_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -234,19 +234,29 @@ class RetailcrmOrderConverter {
|
||||
'quantity' => $product['quantity']
|
||||
);
|
||||
|
||||
$date = date('Y-m-d');
|
||||
$always = '0000-00-00';
|
||||
$specials = $this->productsRepository->getProductSpecials($product['product_id']);
|
||||
|
||||
if (!empty($specials)) {
|
||||
$customer = $this->customerRepository->getCustomer($this->order_data['customer_id']);
|
||||
|
||||
foreach ($specials as $special) {
|
||||
if (empty($customer['customer_group_id'])) {
|
||||
continue;
|
||||
}
|
||||
if (($special['date_start'] == $always && $special['date_end'] == $always)
|
||||
|| ($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']);
|
||||
if ($special['customer_group_id'] == $customer['customer_group_id'] && !empty($specialSetting)) {
|
||||
$item['priceType']['code'] = $specialSetting;
|
||||
$specialSetting = $this->settingsManager->getSetting('special_' . $customer['customer_group_id']);
|
||||
if ($special['customer_group_id'] == $customer['customer_group_id'] && !empty($specialSetting)) {
|
||||
$item['priceType']['code'] = $specialSetting;
|
||||
$priority = $special['priority'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user