Jump to content

Recommended Posts

Шаблон: Journal 2. Ссылка на сайт: http://tie.com.ua/babochki/
В блоке фильтр товаров, а именно "Наличие", подсчитывается количество.
А как сделать так, чтобы не учитывало количество там, где наличие в опциях "0" ?
В контроллере вот этот блок отвечает за опции:

 /* options */
        $results = $this->model_journal2_super_filter->getOptions($data);
        $this->data['options'] = array();
        foreach ($results as $key => $result) {
            $display_mode = Journal2Utils::getProperty($module_data, 'options.' . $key, 'list');
            if ($display_mode === 'off') {
            $values = array();
            foreach ($result['values'] as $value) {
                $values[] = array(
                    'option_value_id'    => $value['option_value_id'],
                    'option_value_name'    => trim($value['option_value_name']),
                    'count'             => $show_product_count ? $value['total'] : '',
                    'image'                => $this->model_tool_image->resize($value['image'] ? $value['image'] : 'no_image.jpg', self::$IMG_WIDTH, self::$IMG_HEIGHT),
                    'keyword'            => $this->keyword($result['option_name'] . " " .$value['option_value_name'])
            $this->data['option'] = array(
                'option_id'        => $result['option_id'],
                'option_name'    => $result['option_name'],
                'display_mode'    => $display_mode,
                'type'          => Journal2Utils::getProperty($module_data, 'options_type.' . $key, 'single'),
                'values'        => $values,
            $this->template = 'journal2/template/journal2/module/super_filter_options.tpl';
            $filter_groups[] = array(
                'sort_order'    => Journal2Utils::getProperty($module_data, 'sort_orders.o_' . $result['option_id']),
                'html'          => $this->render()

        if (Journal2Utils::getProperty($module_data, 'tags') && !isset($this->request->get['tag'])) {
            $results = $this->model_journal2_super_filter->getTags($data);
            foreach ($results as $result) {
                $this->data['tags'][] = array(
                    'text'      => trim($result['name']),
                    'name'      => trim($result['name']),
                    'count'     => $show_product_count ? $result['total'] : '',
                    'keyword'   => $this->keyword($result['name'])
            if (isset($this->data['tags'])) {
                $this->template = 'journal2/template/journal2/module/super_filter_tags.tpl';
                $filter_groups[] = array(
                    'sort_order'    => Journal2Utils::getProperty($module_data, 'sort_orders.t'),
                    'html'          => $this->render()

А в шаблоне вот эта строчка:

            <li><label><input data-keyword="<?php echo $value['keyword']?>" type="checkbox" name="option[<?php echo $option['option_id']?>]" value="<?php echo $value['option_value_id']; ?>"><span class="sf-name"><?php echo $value['option_value_name']; ?></span> <span class="count-products"><?php echo $value['count']; ?></span></label></li>


Заранее спасибо!

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.

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.