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

Filter button


Izrajk
 Share

Recommended Posts

Добрый день,

 

У меня на сайте есть кнопка рядом с названием, она переходить в последнюю категорию товара из хлебных крошек, я хочу улучшить её, а вот как не понимаю, я хочу добавить условие, если в товаре есть атрибут "Доставка"  то после нажатия будет выводиться категория, где все товары с этими атрибутами, без разницы с какой сортировкой. 

 

1.jpg.12b6bfbc6c7f63b2d3f6b2a1752317d1.jpg

 

Т.е, к примеру, атрибут "Доставка" имеет id 453.

Мне нужно как то получить this->date['attribute'] get (product_id) и после как-то сравнивать с id_атрибутом и в зависимости от результата менять href.

Может кто помочь, вроде не сложно, но в голове крутятся все эти фильтры, и не понятно как формировать href, мне в model'е нужно что-то менять?

Link to comment
Share on other sites


Не знаю насколько правильно, я реализовал, но думаю, должно получиться, что-то вроде этого

		$date['attrr'] = array();
		$attribute_groups = $this->model_catalog_product->getProductAttributes($product_id);
		
		foreach ($attribute_groups as $attrr) {
		$attribute_info = $this->model_catalog_category->getProductAttributes($attrr['attribute_id']);
		if ($attribute_info) {
		$data['attrr'][] = array(
		'name'     => 'name',
		'href'     => $this->url->link('product/attribute', 'path=' . $attribute_info['attribute_id'])
		);
		}
} 

 

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