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

фильтр товаров в админке [Поддержка]


freelancer

Recommended Posts

хорошая новость. сегодня фильтр вошел в сборку ocStore + была добавлена фича

Очень не хватет запоминания выбранного фильтра. Без этого, все удобства сводятся на нет... Напиши пожалуйста, какие изменения необходимо внести в файлы, чтоб реализовать ето.

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

Подскажите, как правильно поменять в файле admin/model/catalog/product_ajax.php строка 505 (ругается на нее)

$this->data['categories'] = $this->model_catalog_category->getCategories();

Текст ошибки PHP Warning:  Missing argument 1 for ModelCatalogCategory::getCategories(), called in /admin/controller/catalog/product_ajax.php on line 505 and defined in /admin/model/catalog/category.php on line 207
 

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


Фрилансер, спасибо большое за мод. Он очень нужный и полезный.

Присоединяюсь к предыдущим просьбам. Очень не хватет запоминания выбранного фильтра. Без этого, все удобства сводятся на нет... Напиши пожалуйста, какие изменения необходимо внести в файлы, чтоб реализовать ето.

 

Так что кто-то решил проблему?

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


при оформлении заказа теперь ошибка:

 

Notice: Undefined variable: text_checkout_option in /doc/www/f-taras/data/www/shop.bioaquarium.ru/catalog/view/theme/megastore/template/checkout/checkout.tpl on line 14

Notice: Undefined variable: logged in /doc/www/f-taras/data/www/shop.bioaquarium.ru/catalog/view/theme/megastore/template/checkout/checkout.tpl on line 17

Notice: Undefined variable: text_checkout_account in /doc/www/f-taras/data/www/shop.bioaquarium.ru/catalog/view/theme/megastore/template/checkout/checkout.tpl on line 19

Notice: Undefined variable: shipping_required in /doc/www/f-taras/data/www/shop.bioaquarium.ru/catalog/view/theme/megastore/template/checkout/checkout.tpl on line 28

Notice: Undefined variable: text_checkout_payment_method in /doc/www/f-taras/data/www/shop.bioaquarium.ru/catalog/view/theme/megastore/template/checkout/checkout.tpl on line 39
Notice: Undefined variable: text_checkout_confirm in /doc/www/f-taras/data/www/shop.bioaquarium.ru/catalog/view/theme/megastore/template/checkout/checkout.tpl on line 43

 

что делать?

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


  • 2 weeks later...

если хватит способностей можно выцепить комит

На сколько это затратно?  ставить сборку это слишком.... а без запоминания выбора нет смысла в модуле...((((((

Жалко....а так обрадовался модулю....

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


 

шибка 

Fatal error: Call to undefined method ModelCatalogCategory::getPath() in /сайт/admin/model/catalog/product_ajax.php on line 10

 

Версия Opencart 1.5.5.1.

В этой версии функции getPath нет. Поэтому делаем так:

В файле /сайт/admin/model/catalog/product_ajax.php с 9 строчки

foreach ($query->rows as $row) {
	$categories[] = $this->model_catalog_category->getPath($row['category_id']);
}			

меняем на

$category_info = array();
foreach ($query->rows as $row) {
	$category_info = $this->model_catalog_category->getCategory($row['category_id']);
	$categories[] = $category_info['path'];
}			

Пардон, лечение нашёл.

Только теперь в админке сверху вот что:

Warning: Missing argument 1 for ModelCatalogCategory::getCategories(), called in www/admin/controller/catalog/product_ajax.php on line 505 and defined in /www/admin/model/catalog/category.php on line 207

 

И действительно, на 505 строке контроллера модуля вот что:

$this->data['categories'] = $this->model_catalog_category->getCategories();

Хотя метод описан так:

public function getCategories($data)

Какой аргумент ему скормить?

Я канеш понимаю, что он и без него работает, но warning напрягает)   

 

UPD: Вставил аргументом 0, работает. Решение взял из admin/controller/catalog/product.php.

Строка 1098:

$this->data['categories'] = $this->model_catalog_category->getCategories(0);

admin/controller/catalog/product_ajax.php 

Строка 505:

$this->data['categories'] = $this->model_catalog_category->getCategories(0);

Всё норм работает) 

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


А как этот фильтр удалить?

удалил все залитые ранее файлы - список товаров пререстал вообще работать :)

Да тоже интересует этот вопрос!!!! Хочу удалить но после этого уже боязно((((

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


Вот vqmod фильтрует правда только  по категориям Но работает зато без аякса и запоминает выбор проверено 1.5.4:

 

<modification>
 
<id>Filter Products By Category</id>
<version>1.0.0</version>
<vqmver>1.0.8</vqmver>
<author>Modification: Hildebrando; vQmod: Gigo</author>
 
<file name="admin/controller/catalog/product.php">
        <operation>
            <search position="before" index="1"><![CDATA[
            if (isset($this->request->get['filter_status'])) {
            ]]></search>
            <add><![CDATA[
//filter category start//
if (isset($this->request->get['filter_category'])) {
                $url .= '&filter_category=' . $this->request->get['filter_category'];
            }
//filter category end//
            ]]></add>
        </operation>
 
        <operation>
            <search position="before" index="2"><![CDATA[
            if (isset($this->request->get['filter_status'])) {
            ]]></search>
            <add><![CDATA[
//filter category start//
if (isset($this->request->get['filter_category'])) {
                $url .= '&filter_category=' . $this->request->get['filter_category'];
            }
//filter category end//
            ]]></add>
        </operation>
 
        <operation>
            <search position="before" index="4"><![CDATA[
            if (isset($this->request->get['filter_quantity'])) {
            ]]></search>
            <add><![CDATA[
//filter category start//
if (isset($this->request->get['filter_category'])) {
                $url .= '&filter_category=' . $this->request->get['filter_category'];
            }
            //filter category end//
            ]]></add>
        </operation>
 
        <operation>
            <search position="before" index="5"><![CDATA[
            if (isset($this->request->get['filter_status'])) {
            ]]></search>
            <add><![CDATA[
       //filter category start//
if (isset($this->request->get['filter_category'])) {
$filter_category = $this->request->get['filter_category'];
} else {
$filter_category = NULL;
}
        //filter category end//
            ]]></add>
        </operation>
 
        <operation>
            <search position="before" index="6"><![CDATA[
            if (isset($this->request->get['filter_status'])) {
            ]]></search>
            <add><![CDATA[
//filter category start//
if (isset($this->request->get['filter_category'])) {
$url .= '&filter_category=' . $this->request->get['filter_category'];
}
       //filter category end//
            ]]></add>
        </operation>
 
        <operation>
            <search position="before"><![CDATA[
            'filter_status'   => $filter_status,
            ]]></search>
            <add><![CDATA[
//filter category start//
            'filter_category' => $filter_category,
// End
            ]]></add>
        </operation>
 
        <operation>
            <search position="after" index="1"><![CDATA[
            $results = $this->model_catalog_product->getProducts($data);
            ]]></search>
            <add><![CDATA[
//filter category start//
$this->load->model('catalog/category');
$this->data['categories'] = $this->model_catalog_category->getCategories(0);
       //filter category end//
            ]]></add>
        </operation>
 
        <operation>
            <search position="before"><![CDATA[
            if ($result['image'] && file_exists(DIR_IMAGE . $result['image'])) {
            ]]></search>
            <add><![CDATA[
//filter category start//
            $category =  $this->model_catalog_product->getProductCategories($result['product_id']);
            //filter category end//
            ]]></add>
        </operation>
 
        <operation>
            <search position="after"><![CDATA[
            'price'      => $result['price'],
            ]]></search>
            <add><![CDATA[
//filter category start//
'category'   => $category,
                //filter category end//
            ]]></add>
        </operation>
 
        <operation>
            <search position="after"><![CDATA[
            $this->data['column_name'] = $this->language->get('column_name');
            ]]></search>
            <add><![CDATA[
// Add
$this->data['column_category'] = $this->language->get('column_category');
// End add
            ]]></add>
        </operation>
 
        <operation>
            <search position="after"><![CDATA[
            $this->data['sort_model'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.model' . $url, 'SSL');
            ]]></search>
            <add><![CDATA[
//filter category start//
       $this->data['sort_category'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p2c.category' . $url, 'SSL');
       //filter category end//
            ]]></add>
        </operation>
 
        <operation>
            <search position="before" index="8"><![CDATA[
            if (isset($this->request->get['filter_quantity'])) {
            ]]></search>
            <add><![CDATA[
// Add
       if (isset($this->request->get['filter_category'])) {
$url .= '&filter_category=' . $this->request->get['filter_category'];
}
       // End add
            ]]></add>
        </operation>
 
        <operation>
            <search position="before"><![CDATA[
            $this->data['filter_price'] = $filter_price;
            ]]></search>
            <add><![CDATA[
// Add
       $this->data['filter_category'] = $filter_category;
       // End add
            ]]></add>
        </operation>
 
        <operation>
            <search position="before" index="9"><![CDATA[
            if (isset($this->request->get['filter_model'])) {
            ]]></search>
            <add><![CDATA[
//filter category start//
if (isset($this->request->get['filter_category'])) {
$url .= '&filter_category=' . $this->request->get['filter_category'];
}
       //filter category end//
            ]]></add>
        </operation>
</file>
 
<file name="admin/language/english/catalog/product.php">
        <operation>
            <search position="after"><![CDATA[
            $_['column_image']
            ]]></search>
            <add><![CDATA[
// Add
$_['column_category']        = 'Category';
// End add
            ]]></add>
        </operation>
</file>
 
<file name="admin/language/russian/catalog/product.php">
        <operation>
            <search position="after"><![CDATA[
            $_['column_image']
            ]]></search>
            <add><![CDATA[
// Add
$_['column_category']        = 'Категория';
// End add
            ]]></add>
        </operation>
</file>
 
<file name="admin/model/catalog/product.php">
        <operation error="skip">
            <search position="replace"><![CDATA[
            if (!empty($data['filter_category_id'])) {
            ]]></search>
            <add><![CDATA[
// renamed filter_category_id to filter_category
if (!empty($data['filter_category'])) {
            ]]></add>
        </operation>
        
        <operation error="skip">
            <search position="replace"><![CDATA[
            $implode_data[] = "category_id = '" . (int)$data['filter_category_id'] . "'";
            ]]></search>
            <add><![CDATA[
$implode_data[] = "category_id = '" . (int)$data['filter_category'] . "'";
            ]]></add>
        </operation>
        
        <operation error="skip">
            <search position="replace"><![CDATA[
            $categories = $this->model_catalog_category->getCategories($data['filter_category_id']);
            ]]></search>
            <add><![CDATA[
$categories = $this->model_catalog_category->getCategories($data['filter_category']);
            ]]></add>
        </operation>
        
        <operation error="skip">
            <search position="replace"><![CDATA[
            $sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";
            ]]></search>
            <add><![CDATA[
$sql .= " AND p2c.category_id = '" . (int)$data['filter_category'] . "'";
            ]]></add>
        </operation>
                
        <operation error="skip">
            <search position="before"><![CDATA[
            'p.quantity',
            ]]></search>
            <add><![CDATA[
// add
                'p2c.category_id',
// end
            ]]></add>
        </operation>
</file>
 
<file name="admin/view/template/catalog/product_list.tpl">
       
        <operation>
            <search position="before"><![CDATA[
            <td class="right"><?php if ($sort == 'p.quantity') { ?>
            ]]></search>
            <add><![CDATA[
 <td class="left"><?php if ($sort == 'p2c.category_id') { ?>
<a href="<?php echo $sort_category; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_category; ?></a>
<?php } else { ?>
<a href="<?php echo $sort_category; ?>"><?php echo $column_category; ?></a>
 <?php } ?></td>
            ]]></add>
        </operation>
 
        <operation>
            <search position="after"><![CDATA[
            <td align="left"><input type="text" name="filter_price" value="<?php echo $filter_price; ?>" size="8"/></td>
            ]]></search>
            <add><![CDATA[
 <td ><select name=filter_category" style="width: 18em;" >
              <option value="*"></option>
              <?php foreach ($categories as $category) { ?>
                <?php if ($category['category_id]==$filter_category) { ?>
                  <option value="<?php echo $category['category_id']; ?>" selected="selected"><?php echo $category['name']; ?></option>
                <?php } else { ?>
                  <option value="<?php echo $category['category_id']; ?>"><?php echo $category['name']; ?></option> 
                <?php } ?>
              <?php } ?>
              </td>
            ]]></add>
        </operation>
 
        <operation>
            <search position="before"><![CDATA[
            <td class=right"><?php if ($product['quantity] <= 0) { ?>
            ]]></search>
            <add><![CDATA[
  <td class=left">
                <?php foreach ($categories as $category) { ?>
                <?php if (in_array($category['category_id], $product['category'])) { ?>
                <?php echo $category['name'];?><br>
                <?php } ?> <?php } ?>
              </td>
            ]]></add>
        </operation>
 
        <operation>
            <search position="before"><![CDATA[
            var filter_quantity = $('input[name=\'filter_quantity\']').attr('value');
            ]]></search>
            <add><![CDATA[
var filter_category = $('select[name=\'filter_category\']').attr('value');
   
    if (filter_category != '*') {
url += '&filter_category=' + encodeURIComponent(filter_category);
}
            ]]></add>
        </operation>
        
</file>
 
</modification>
  • +1 1
Надіслати
Поділитися на інших сайтах


 

Вот vqmod фильтрует правда только  по категориям Но работает зато без аякса и запоминает выбор проверено 1.5.4:

..

 

что значит "зато" ? ))

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

Уважаемый, Freelancer!

Как избавиться от фильтра? При удалении записанных ранее файлов, страница с товарами в админке не работает.

В текущей реализации работать не возможно! При любой операции все время возвращает на первую  страницу. Это ужас.

 

заранее - спасибо

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


Поставил на 1.5.4.1, всё работает классно. А можно еще добавить артикул (SKU) ?

Присоединяюсь к вопросу, есть необходимость добавить столбец "SKU или код поставщика:"  

 

У меня на 1.5.4.1 все встало на ура, автору спасибо, сумел довести  фильтр ОС до нормального состояния.

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


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

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

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

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

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

Вхід

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

Вхід зараз

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

Important Information

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