Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Модуль Скидки от суммы заказа [Подгдержка]


Recommended Posts

В 16.03.2014 в 19:28, shoputils сказал:

 

На данный момент нет, акционный товар бугдет улитываться.

@shoputils Здравствуйте. Как сгделать, чтобы не улитывались акционные товары? Может быть, с 2014 года вы уже гделали кому то правку?

Или все ики пригдется самому?

Link to comment
Share on other sites

@efremovxp  Добрый гдень!

Делал для 2.3, на осильные версии еещё нет.

Как только перенесу функционал для других версий движка - обновлю модуль для всех версий вместе.

Link to comment
Share on other sites

В 12.03.2021 в 14:14, shoputils сказал:

@efremovxp  Добрый гдень!

Делал для 2.3, на осильные версии еещё нет.

Как только перенесу функционал для других версий движка - обновлю модуль для всех версий вместе.

Сгделал, чтобы на акционные товары не было скидки (но, чтобы они улитывались в обещёй сумме заказа).

Может кому понадобится:

 

Находим в /catalog/model/extension/total/sum_discounts.php

foreach ($this->discounts as $discount){
                switch ($discount['category_mode']){
                    case 'include':
                        $products_total = 0;
                        foreach ($this->products as $product){
							if (array_intersect($product['categories'], $discount['categories'])){
								$products_total += $product['total'];
							}
                        }
                        break;
                    case 'exclude':
                        $products_total = 0;
                        foreach ($this->products as $product){
							if (!array_intersect($product['categories'], $discount['categories'])){
								$products_total += $product['total'];
							}
                        }
                        break;
                    default:
                        $products_total = $this->cart->getTotal();
                        break;
                }
				
                if ($products_total >= $discount['total']){
                    if (self::MODE_MAX_TOTAL){
                        $sum = round($products_total * ($discount['percent'] / 100), 2);
                        if ($discount['total'] > $max_total){
                            $max_total = $discount['total'];
                            $max_sum = $sum;
                            $max_percent = $discount['percent'];
                        }
                    } else {
                        $sum = round($products_total * ($discount['percent'] / 100), 2);
                        if ($sum > $max_sum){
                            $max_sum = $sum;
                            $max_percent = $discount['percent'];
                        }
                    }
                }
            }

Меняем на:

foreach ($this->discounts as $discount){
                switch ($discount['category_mode']){
                    case 'include':
                        $products_total = 0;
						$minusprods = 0;
                        foreach ($this->products as $product){
							if (array_intersect($product['categories'], $discount['categories'])){
								$prodspecial = $this->model_catalog_product->getProduct($product['product_id']);
								if ((float)$prodspecial['special']){
									$minusprods += $product['total'];
								}
							
								$products_total += $product['total'];
							}
                        }
                        break;
                    case 'exclude':
                        $products_total = 0;
						$minusprods = 0;
                        foreach ($this->products as $product){
							if (!array_intersect($product['categories'], $discount['categories'])){
								$prodspecial = $this->model_catalog_product->getProduct($product['product_id']);
								if ((float)$prodspecial['special']){
									$minusprods += $product['total'];
								}
								$products_total += $product['total'];
							}
                        }
                        break;
                    default:
                        $products_total = $this->cart->getTotal();
                        break;
                }

                if ($products_total >= $discount['total']){
                    if (self::MODE_MAX_TOTAL){
                        $sum = round($products_total * ($discount['percent'] / 100) - $minusprods * ($discount['percent'] / 100), 2);
                        if ($discount['total'] > $max_total){
                            $max_total = $discount['total'];
                            $max_sum = $sum;
                            $max_percent = $discount['percent'];
                        }
                    } else {
                        $sum = round($products_total * ($discount['percent'] / 100) - $minusprods * ($discount['percent'] / 100), 2);
                        if ($sum > $max_sum){
                            $max_sum = $sum;
                            $max_percent = $discount['percent'];
                        }
                    }
                }
            }

 

Link to comment
Share on other sites

  • 1 month later...

@gandhari

Для 3-го опенкари:

 

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.