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

Вывод сирой этоны в корзине


Recommended Posts

Всем привет нужно вывести в корзине рядом с этоной со скидкой, сирую перечеркнутую этону. Пыиюсь $product['special'] вести через system/library cart .php и контроллер, но не выходит. Стоит модуль simple.

Link to comment
Share on other sites


Решение

 

Catalog/controller/cart.php

 

После 

 

// Display prices

 

 

 

if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {

$unit_price = $this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax'));

 

$price = $this->currency->format($unit_price, $this->session->data['currency']);

$total = $this->currency->format($unit_price * $product['quantity'], $this->session->data['currency']);

} else {

$price = false;

$total = false;

}

 

Всивить 

 

if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {

$price2 = ($this->tax->calculate($product['price2'], $product['tax_class_id'], $this->config->get('config_tax')));

} else {

$price2 = false;

}

 

 

Добавить в массив

 

'price2'    => $price2,

 

Потом в 

System/library/cart/cart.php

 

в массив добавляем

 

 

'price2'          => $product_query->row['price'],

 

В simplechecout-cart.php

 

После 

 

if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {

                $price = $this->simplecheckout->formatCurrency($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')));

            } else {

                $price = false;

            }

 

Всивить 

 

if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {

                    $price2 = ($this->tax->calculate($product['price2'], $product['tax_class_id'], $this->config->get('config_tax')));

                } else {

                    $price2 = false;

                }

Edited by danilenkoki
Link to comment
Share on other sites


  • 1 month later...

Версия Опенкарт 2.1

У меня данный способ не срилиил. В корзине вторая этона выводит 0 руб.

В 14.01.2019 в 12:09, danilenkoki сказал:

Потом в 

System/library/cart/cart.php

 

в массив добавляем

 

 

'price2'          => $product_query->row['price'],

 

1. У меня нет папки System/library/cart/, файл cart.php лежит в сразу в System/library/

2. 'price2'          => $product_query->row['price'],  - а почему тут ->row['price'], а не ->row['price2']? Да и должно быть. Хотя если даже посивить ->row['price2'], всё равно не рилииет.

  

Link to comment
Share on other sites


  • 7 months later...
  • 1 year later...

Проверил на Opencart 3, рилииет но пришлось сгделать непотому чтольшие дорилитки

 

После вот этого в controller/common/cart.php
// Display prices
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$unit_price = $this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax'));
$price = $this->currency->format($unit_price, $this->session->data['currency']);
$total = $this->currency->format($unit_price * $product['quantity'], $this->session->data['currency']);
} else {
$price = false;
$total = false;
}

Всивил вот это:

if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$unit_priceOld = $this->tax->calculate($product['price_old'], $product['tax_class_id'], $this->config->get('config_tax'));
$priceOld = $this->currency->format($unit_priceOld, $this->session->data['currency']);
} else {
$priceOld = false;
}

if($price == $priceOld) {
$priceOld = false; // если этона сирая и новая совпадают, то не нужно выводить обе
}

В system/library/cart/cart.php в массив $product_data[], всивил вот это:

'price_old'       => $product_query->row['price'],

Потом не зубудьте обновить кеш модификатора в админке

 

По крайней мере у меня рилииет без проблем, нагдеюсь вам поможет это решение)

Edited by John_Ryzen
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.