Jump to content
Sign in to follow this  
TamDe

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

Recommended Posts

Подскажите подалуйста как вывести старую цену(перечеркнутую) в корзине?

Share this post


Link to post
Share on other sites

В каком месте? покажите схематично на рисунке.

Share this post


Link to post
Share on other sites

пробовал и добавлять элемент в массив special ни чего не помогло

post-17333-0-76845600-1398159242_thumb.jpg

Share this post


Link to post
Share on other sites

 

пробывал и добавлять элемент в массив special ни чего не помогло

Показывайте, как и где вы это делали.

Share this post


Link to post
Share on other sites

в cart.php добавлял

		if ((float)$product['special']) {
				$this->data['special'] = $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id'], $this->config->get('config_tax')));
			} else {
				$this->data['special'] = false;
			}
			
			if ($this->config->get('config_tax')) {
				$this->data['tax'] = $this->currency->format((float)$product_info['special'] ? $product['special'] : $product['price']);
			} else {
				$this->data['tax'] = false;
			}
			
			$discounts = $this->model_catalog_product->getProductDiscounts($this->request->get['product_id']);
			
			$this->data['discounts'] = array(); 
			
			foreach ($discounts as $discount) {
				$this->data['discounts'][] = array(
					'quantity' => $discount['quantity'],
					'price'    => $this->currency->format($this->tax->calculate($discount['price'], $product_info['tax_class_id'], $this->config->get('config_tax')))
				);
			}

и еще добавил тут несколько строк

$this->data['products'][] = array(
          			'key'      => $product['key'],
          			'thumb'    => $image,
					'name'     => $product['name'],
          			'model'    => $product['model'],
          			'option'   => $option_data,
          			'quantity' => $product['quantity'],
          			'stock'    => $product['stock'] ? true : !(!$this->config->get('config_stock_checkout') || $this->config->get('config_stock_warning')),
					'reward'   => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''),
					'price'    => $price,
					'special'     => $special,
					'tax'         => $tax,
					'total'    => $total,
					'href'     => $this->url->link('product/product', 'product_id=' . $product['product_id']),
					'remove'   => $this->url->link('checkout/cart', 'remove=' . $product['key'])
				);

Share this post


Link to post
Share on other sites

Дело в том, что

 

Посмотрите

 

 

$products = $this->cart->getProducts();

 

Есть ли в корзине special?

 

Скорей всего нет, потому что там лежит уже реальная цена - смотрите в system/cart.php

 

Если хотите получить старую цену

 

приблизительно так.

     $product_price_query = $this->db->query("SELECT price FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . " LIMIT 1");

Share this post


Link to post
Share on other sites

Спасибо огромное за наводку. Вообщем сделал так, может пригодится.

 В /system/library/cart.php добавил:

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

после строки:

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

В файле /catalog/controller/checkout/cart.php добавил

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

после

// Display prices
				if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
					$total = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')) * $product['quantity']);
				} else {
					$total = false;
				}

и чуть ниже добавил еще одну строку

'price2'    => $price2,

В файле /catalog/view/theme/default/template/checkout/cart.tpl добавил вывод в нужном месте:

 <?php echo $product['price2']; ?>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

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.