COVID2019 и это вот все. Друзья, вся эта история начинает плохо пахнет. Мойте руки, не ходите в люди. Отложите все плановые покупки и положите в носок заначку. Заприте ваших родителей, бабушек-дедушек на даче. Лучше перебдеть чем недобдеть. Берегите себя!

Как вывести количество продуктов в списке производителей


klekovkinandrey

Recommended Posts

Как вывести количество продуктов в списке производителей, т.е количество товаров данного производителя на против каждого производителя
ocstore 2.3

или может подскажите в чем ошибка данного модификатора?

после установки выдает ошибку

код модификатора

  Скрыть контент
<?xml version="1.0" encoding="UTF-8"?>
<modification>
    <name>Show Products of Manufacturers</name>
    <version>1.0.1</version>
    <author>AGriboed | alexv1rs@gmail.com</author>
    <link>http://v1rus.ru</link>
	<code>hideemptymanufacturers</code>
    <file path="catalog/model/catalog/manufacturer.php">
        <operation>
            <search><![CDATA[* FROM " . DB_PREFIX . "manufacturer m LEFT]]></search>
            <add position="replace"><![CDATA[m.*, (SELECT COUNT(*) FROM " . DB_PREFIX . "product as p WHERE p.manufacturer_id=m.manufacturer_id) as products_count FROM " . DB_PREFIX . "manufacturer m LEFT
    ]]></add>
        </operation>
    </file>
    <file path="catalog/controller/product/manufacturer.php">
        <operation>
            <search><![CDATA[$data['categories'][$key]['manufacturer'][] = array(]]></search>
            <add position="after"><![CDATA[
'products_count' => $result['products_count'],
    ]]></add>
        </operation>
    </file>
    <file path="admin/model/catalog/manufacturer.php">
        <operation>
            <search><![CDATA[$sql = "SELECT * FROM " . DB_PREFIX . "manufacturer";]]></search>
            <add position="replace"><![CDATA[
$sql = "SELECT m.*,(SELECT COUNT(*) FROM " . DB_PREFIX . "product as p WHERE p.manufacturer_id=m.manufacturer_id) as products_count FROM " . DB_PREFIX . "manufacturer as m";
    ]]></add>
        </operation>
    </file>
    <file path="admin/language/*/catalog/manufacturer.php">
        <operation>
            <search><![CDATA[$_['column_sort_order']]]></search>
            <add position="before"><![CDATA[
$_['column_products_count']       = 'Products Count';
    ]]></add>
        </operation>
    </file>
    <file path="admin/controller/catalog/manufacturer.php">
        <operation>
            <search><![CDATA['name'            => $result['name'],]]></search>
            <add position="after"><![CDATA[
'products_count'            => $result['products_count'],
    ]]></add>
        </operation>
        <operation>
            <search><![CDATA[$data['text_list'] = $this->language->get('text_list');]]></search>
            <add position="after"><![CDATA[
$data['column_products_count'] = $this->language->get('column_products_count');
    ]]></add>
        </operation>
    </file>
    <file path="admin/view/template/catalog/manufacturer_list.tpl">
        <operation>
            <search><![CDATA[<td class="text-right"><?php echo $column_action; ?></td>]]></search>
            <add position="before"><![CDATA[
<td class="text-right"><?php echo $column_products_count; ?></td>
    ]]></add>
        </operation>
        <operation>
            <search><![CDATA[<td class="text-right"><?php echo $manufacturer['sort_order']; ?></td>]]></search>
            <add position="after"><![CDATA[
<td class="text-right"><?php echo $manufacturer['products_count']; ?></td>
    ]]></add>
        </operation>
    </file>
    <file path="catalog/view/theme/default/template/product/manufacturer_list.tpl">
        <operation>
            <search><![CDATA[echo $manufacturer['name']; ]]></search>
            <add position="replace"><![CDATA[
echo $manufacturer['name']." (".$manufacturer['products_count'].")"; 
    ]]></add>
        </operation>
    </file>
</modification>

 

 

ругается на контроллер

вот на эту часть

	$data['categories'][$key]['manufacturer'][] = array(
				'name' => $name,
				'href' => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $result['manufacturer_id']),
				'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 200) . '..',
				
			);
		}

 

а именно на 50 линию

'href' => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $result['manufacturer_id']),

 

system\storage\modification\catalog\controller\product\manufacturer.php on line 50Notice: Undefined index: products_total in

Ссылка на комментарий
Поделиться на других сайтах

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

×   Вы вставили отформатированное содержимое.   Удалить форматирование

  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.

  • Сейчас на странице   0 пользователей

    • Нет пользователей, просматривающих эту страницу