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

[Решено] Помогите доработать модуль AnyList


Recommended Posts

Здравствуйте Гуру программирования. Все известен, наверное, бесплатный модуль AnyList http://www.opencart.com/index.php?route=extension/extension/info&extension_id=9086, модуль мне подходит, но надо немного доработать.

Суть доработке заключается в следующем. Если выставить модуль в карточку товара и поставить сортировку по цене. Мне надо запрограммировать так что бы сортировка по цене была такая, что бы показывались те товары с ценой в пределе +10% и -10% от цены товара на которой показывается данный модуль.

Вроде нашел код где сортировка выставляется catalog\model\anylist.php

 if (isset($filter['sort']) and $filter['sort']!='') {
            $cols = $this->db->query("SELECT COLUMN_NAME FROM `information_schema`.`COLUMNS` WHERE TABLE_NAME='".DB_PREFIX."product' and TABLE_SCHEMA='".DB_DATABASE."' and COLUMN_NAME='".$filter['sort']."'");
            if ($cols) {
                $sql .= " ORDER BY ".$filter['sort'];
                if (isset($filter['order']) and trim(strtolower($filter['order']))=='desc')
                    $sql .= ' DESC';
            } else {
                die("AnyList: SORT FIELD ".$filter['sort']." not found in product table. Only fields in product table are allowed.");
            }
        }

 

Но как ту поставить мое условие незнаю.

Заранее благодарен за дельные советы.

 

Link to comment
Share on other sites


Проценты задаются на 4-ой строчек, переменная $procent; 0.15 это 15%. Работает с учетом акций. Пробуйте.

 

Заменить файл catalog/controller/module/anylist.php

anylist.php

Link to comment
Share on other sites


Спасибо, но что то не работает. Выдает ошибку в строке 175

    if (count($res)>$limit) {
                $randomRes =  ($limit>1) ? array_rand($res,$limit) : array(rand(0,count($res)-1));

Link to comment
Share on other sites


не работает все равно на эту же строчку выдается ошибка. И еще вы удалили один блок

// If ANY of product's category exists in filter  
                //foreach($rc as $c) {
                //    $ok = ($ok OR array_search($c['category_id'],$limitprc)!==false);
                //}

И оставили закоментированый блок

// If EXACT of product's categories exists in filter  
                // foreach($rc as $c) {
                //     $ok = ($ok AND array_search($c['category_id'],$limitprc)!==false);
                // }

Я раскоментировал нижний блок, и поэтому у меня модуль показывается или в товарах определенных производителях или в товарах определенной категории.

Link to comment
Share on other sites


Я ничего не комментировал, это комментарии разработчика :) У вас какая версия OpenCart?

И пришлите текст ошибки:)

Link to comment
Share on other sites


  • 3 weeks later...

Я поставил на тестовом сайте вот страница http://test.prostomag.odessa.ua/melkaja-bytovaja-tehnika/aerogrili/ajerogril-supra-ags-1211.html

Notice: Undefined variable: limit in

Подскажите, как вы сделали чтобы товары показывались в карточке продукта только в определенной категории а не во всех категориях?

Link to comment
Share on other sites

  • 1 year later...

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.