Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Скидка для группы покупателей и отображение скидки в карточке товара OpenCart 2


sector78
 Share

Recommended Posts

Задача: Сделать скидку в процентах для группы покупателей opencart 2.0 и вывести ее в карточке товара со стандартной ценой?

1. Был установлен модуль Total Customer Group Discount

Скидка отображается только в корзине, а как вывести цену со скидкой в карточку товара для групп пользователе?

На одном форуме подсказали:

в файле \catalog\controller\product\product.php
находим

$discounts $this->model_catalog_product->getProductDiscounts($this->request->get['product_id']);

и перед ним вставим

            // Скидка для групп
            
if ($this->customer->getGroupId() == 2) {
                
$perc_price $product_info['price'] - ($product_info['price'] / 100) * 10;
                
$data['special'] = $this->currency->format($this->tax->calculate($perc_price$product_info['tax_class_id'], $this->config->get('config_tax')));
            } else {
                
$data['special'] = false;
            }

соответственно цифра 2 это id нужной группы, а 10 это проценты

 

Но поскольку групп будет несколько например - одна группа "id=2" - скидка 3%, а вторая группа "id=3" - скидка 5% и т.д.

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.