I am new to Opencart development and below in my first extension but somehow after installing it and clearing all modifications, it is not making any changes to my store (specifically to catalog > products page)
Can anyone please point me to the issue ?
For OC v3.0.3.6, I have created an "install.xml" file where I have added the below code:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Sort Admin Products by ID (V3x)</name>
<code>sort_admin_products_by_id</code>
<version>3.0</version>
<author>azzicharbel</author>
<file path="admin/view/template/catalog/product_list.twig">
<operation>
<search><![CDATA[<td class="text-center">{{ column_image }}</td>]]></search>
<add position="before"><![CDATA[
<td class="text-center">{% if sort == 'p.product_id' %} <a href="{{ sort_product_id }}" class="{{ order|lower }}">ID</a> {% else %} <a href="{{ sort_product_id }}">ID</a> {% endif %}</td>
]]></add>
</operation>
<operation>
<search><![CDATA[<td class="text-center">{% if product.image %} <img src="{{ product.image }}" alt="{{ product.name }}" class="img-thumbnail" /> {% else %} <span class="img-thumbnail list"><i class="fa fa-camera fa-2x"></i></span> {% endif %}</td>]]></search>
<add position="before"><![CDATA[
<td class="text-center">{{ product.product_id }}</td>
]]></add>
</operation>
</file>
<file path="admin/controller/catalog/product.php">
<operation>
<search><![CDATA[$data['sort_name'] = $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . '&sort=pd.name' . $url, true);]]></search>
<add position="before"><![CDATA[
$data['sort_product_id'] = $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'] . '&sort=p.product_id' . $url, true);
]]></add>
</operation>
<operation>
<search><![CDATA[$sort = 'pd.name';]]></search>
<add position="replace"><![CDATA[
$sort = 'p.product_id';
]]></add>
</operation>
<operation>
<search><![CDATA[$order = 'ASC';]]></search>
<add position="replace"><![CDATA[
$order = 'DESC';
]]></add>
</operation>
</file>
<file path="admin/model/catalog/product.php">
<operation>
<search><![CDATA[$sort_data = array(]]></search>
<add position="after"><![CDATA[
'p.product_id',
]]></add>
</operation>
</file>
</modification>