W
W
wanderbit2016-07-09 17:42:10
Django
wanderbit, 2016-07-09 17:42:10

How to display the category_id value for a product in the featured module?

How to display the category_id value for a product in the featured module?
The main page has a featured module. How to set links for products to different output templates in it, depending on their category_id?
I understand that the category_id value is taken from the address bar if you are on the category page. And how to get the category_id on the main page for products?

$path = '';

      $parts = explode('_', (string)$this->request->get['path']);

      $category_id = (int)array_pop($parts);

Для чего нужно значение
         if($category_id == 59){ 
        $data['products'][] = array(
          'href' => $this->url->link('common/govyadina', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
        );

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2016-02-13
@sim3x

pip install 'requests[security]'
or

sudo apt-get install python-dev libffi-dev libssl-dev

W
web-mechanic, 2016-07-09
@amfetamine

that's right, that's right

$parts = explode('_', (string)$this->request->get['path']);
$category_id = (int)array_pop($parts);

allows you to get the category id, the main thing is that the $this->request->get['path'] variable must be non-empty, i.e. there must be appropriate levels in the url

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question