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

Атрибуты в модуле Рекоменд и Хиты продаж


Recommended Posts

1. Не получается вывести атрибуты в модуле Хиты продажю
Делал по аналогии как делал с модулем Рекомендуемые, там работает, а в Хитах нет.
как делал в Рекомендуемые
FEATURED.PHP
после

$this->load->language('module/featured');

добавил

$this->load->language('product/product');

после

'product_id'  => $product_info['product_id'],

добавил

'attribute_groups' => $this->model_catalog_product->getProductAttributes($product_info['product_id']),

FEATURED.TPL

<div class="concurentus">
    <?php if($product['attribute_groups']) { ?>
        <?php foreach($product['attribute_groups'] as $attribute_group) { ?>
            <p class="concurentus-title"><?php echo $attribute_group['name']; ?></p>

                <?php foreach($attribute_group['attribute'] as $attribute) { ?>
                    <p class="concurentus-text"><?php echo $attribute['name']; ?></p>
                    <!--<td><?php echo $attribute['text']; ?></td>-->
                <?php } ?>
        <?php } ?>
    <?php } ?>
</div>

2. Как можно сделать, чтобы в Хитах отображались товары, которые я сам выберу в админке или по id?

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


1) Не работает понятие широкое что именно не работает?? какие ошибки ? есть ли они вообще ?

2) Ну тут посмотри другие модули как там зделано как вариант записиваеш в базу масив с id товаров и потом просто в модуле розбираеш этот масив через цикл и в $this->model_catalog_product->getProduct($id);получаеш информацию о товарах которые ты в админке выбрал. 

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

1) Не работает понятие широкое что именно не работает?? какие ошибки ? есть ли они вообще ?

2) Ну тут посмотри другие модули как там зделано как вариант записиваеш в базу масив с id товаров и потом просто в модуле розбираеш этот масив через цикл и в $this->model_catalog_product->getProduct($id);получаеш информацию о товарах которые ты в админке выбрал. 

Notice: Undefined variable: product_info in /home/.../...\/docs/vqmod/vqcache/vq2-catalog_controller_module_bestseller.php on line 76Notice: Undefined variable: product_info in /home/.../.../docs/vqmod/vqcache/vq2-catalog_controller_module_bestseller.php on line 76Notice: Undefined variable: product_info in /home/.../.../docs/vqmod/vqcache/vq2-catalog_controller_module_bestseller.php on line 76Notice: Undefined variable: product_info in /home/.../.../docs/vqmod/vqcache/vq2-catalog_controller_module_bestseller.php on line 76

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


<?php
class ControllerModuleBestSeller extends Controller {
    public function index($setting) {
        $this->load->language('module/bestseller');
        $this->load->language('product/product');

        $data['heading_title'] = $this->language->get('heading_title');

        $data['text_tax'] = $this->language->get('text_tax');

        $data['button_cart'] = $this->language->get('button_cart');
        $data['button_wishlist'] = $this->language->get('button_wishlist');
        $data['button_compare'] = $this->language->get('button_compare');

        $this->load->model('catalog/product');

        $this->load->model('tool/image');

        $data['products'] = array();

        $results = $this->model_catalog_product->getBestSellerProducts($setting['limit']);

        if ($results) {
            foreach ($results as $result) {
                if ($result['image']) {
                    $image = $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height']);
                } else {
                    $image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
                }

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

                if ((float)$result['special']) {
                    $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $special = false;
                }

                if ($this->config->get('config_tax')) {
                    $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price']);
                } else {
                    $tax = false;
                }

                if ($this->config->get('config_review_status')) {
                    $rating = $result['rating'];
                } else {
                    $rating = false;
                }

                $data['products'][] = array(
                    'product_id'  => $result['product_id'],
                    'attribute_groups' => $this->model_catalog_product->getProductAttributes($product_info['product_id']),
                    'thumb'       => $image,
                    'name'        => $result['name'],
                    'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('config_product_description_length')) . '..',
                    'price'       => $price,
                    'special'     => $special,
                    'tax'         => $tax,
                    'rating'      => $rating,
                    'href'        => $this->url->link('product/product', 'product_id=' . $result['product_id'])
                );
            }

            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/bestseller.tpl')) {
                return $this->load->view($this->config->get('config_template') . '/template/module/bestseller.tpl', $data);
            } else {
                return $this->load->view('default/template/module/bestseller.tpl', $data);
            }
        }
    }
}
 

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


Notice: Undefined variable: product_info in /home/.../...\/docs/vqmod/vqcache/vq2-catalog_controller_module_bestseller.php on line 76Notice: Undefined variable: product_info in /home/.../.../docs/vqmod/vqcache/vq2-catalog_controller_module_bestseller.php on line 76Notice: Undefined variable: product_info in /home/.../.../docs/vqmod/vqcache/vq2-catalog_controller_module_bestseller.php on line 76Notice: Undefined variable: product_info in /home/.../.../docs/vqmod/vqcache/vq2-catalog_controller_module_bestseller.php on line 76

В место $product_info['product_id'] вставте $result['product_id']

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

В место $product_info['product_id'] вставте $result['product_id']

Спасибо огромное за помощь, все заработало

Змінено користувачем Baskethome
Надіслати
Поділитися на інших сайтах


Створіть аккаунт або увійдіть для коментування

Ви повинні бути користувачем, щоб залишити коментар

Створити обліковий запис

Зареєструйтеся для отримання облікового запису. Це просто!

Зареєструвати аккаунт

Вхід

Уже зареєстровані? Увійдіть тут.

Вхід зараз
  • Зараз на сторінці   0 користувачів

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

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

Important Information

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