Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

[Решено] Минимальная цена категории в title


Recommended Posts

Подскажите пожалуйста как получить доступ к масиву $products в header tpl. Минимальную цену в категории нахожу так:

echo $products[0]['price'];
Хочу сделать "Название категории" от "xxx грн"

 

Или может есть другой способ получить мин. цену в header?

Надіслати
Поділитися на інших сайтах


...

if ($category_info) {

if ($category_info['seo_title']) {

$this->document->setTitle($category_info['seo_title']);

} else {

$this->document->setTitle($category_info['name']);

}

...

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) {

...

>>
...

if ($category_info) {

...

if ($category_info['seo_title']) {

$this->document->setTitle($category_info['seo_title'].' от '.$products[0]['price']);

} else {

$this->document->setTitle($category_info['name'].' от '.$products[0]['price']);

}

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) {

...

Надіслати
Поділитися на інших сайтах

Но там один недочет $products[0]['price'] - можно получить в category.tpl, а в category.php только формируется этот массив, причем где то под конец файла. Не подскажете как тогда использовать Ваше решение?

$products[0]['price']
>>

$this->data['products'][0]['price']
?
Надіслати
Поділитися на інших сайтах

Да, СПАСИБО, теперь работает. Только еще переместил кусок кода 

			if ($category_info['seo_title']) {
			    if(isset($this->data['products'][0]['price']))
				{
				  $this->document->setTitle($category_info['seo_title'].' от '.$this->data['products'][0]['price']);
				} else $this->document->setTitle($category_info['seo_title']);
			} else {
		  		$this->document->setTitle($category_info['name']);
			};
После

//..........

$stock_status = $result['stock_status'];
$stock_qty = $result['quantity'];

				$product_infoSword = $this->model_catalog_product->getProductSword($result['product_id']);
								
				$this->data['products'][] = array(
					'product_id'  => $result['product_id'],
					'thumb'       => $image,
					'name'        => $result['name'],
					'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 300) . '..',
					'price'       => $price,
					'special'     => $special,
					'special2'    => $this->currency->format($this->tax->calculate($product_infoSword['special'], $product_infoSword['tax_class_id'], $this->config->get('config_tax'))),
					'pricemax'    => $this->currency->format($this->tax->calculate($product_infoSword['price'], $product_infoSword['tax_class_id'], $this->config->get('config_tax'))),
					'tax'         => $tax,
					'rating'      => $result['rating'],
					'reviews'     => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
					'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url),
				
'stock_status'       => $stock_status,
'stock_qty'       => $stock_qty

);

}

//..........            

if ($category_info['seo_title']) {
             if(isset($this->data['products'][0]['price']))
                {
                 $this->document->setTitle($category_info['seo_title'].' от '.$this->data['products'][0]['price']);
                } else $this->document->setTitle($category_info['seo_title']);
            } else {
                 $this->document->setTitle($category_info['name']);
            };

Надіслати
Поділитися на інших сайтах


так я сразу написал, что отправить этот кусок надо в самый конец - прямо перед подключением шаблона категории

...if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) {...
пересмотри первый код :-)
Надіслати
Поділитися на інших сайтах

Гість
Ця тема закрита для публікації повідомлень.
  • Зараз на сторінці   0 користувачів

    • Ні користувачів, які переглядиють цю сторінку

×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.