Post by kg0925 » Mon Aug 13, 2018 7:41 pm

i have customize this ocmod to sort new to old products. newest product show first. but it's not working. did i any mistake. please look in to code and let me know. thanks.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<modification>
	<name>latest to old Checker</name>
	<version>1.0</version>
	<author>KG</author>
	<code>latest_to_old_sorting</code>
	<link>fashiondeal.in</link>
	<file name="catalog/controller/product/category.php">
        <operation>
            <search><![CDATA[$sort = 'p.sort_order';]]></search>
            <add position="replace"><![CDATA[$sort = 'p.date_added';]]></add>
        </operation>
        <operation>
            <search><![CDATA[$order = 'ASC';]]></search>
            <add position="replace"><![CDATA[$order = 'DESC';]]></add>
        </operation>
        <operation>
            <search><![CDATA['value' => 'p.sort_order-ASC',]]></search>
            <add position="after" offset="3"><![CDATA[
			$this->data['sorts'][] = array(
				'text'  => $this->language->get('text_date_added_asc'),
				'value' => 'p.date_added-ASC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.date_added&order=ASC' . $url)
			);
			
			$this->data['sorts'][] = array(
				'text'  => $this->language->get('text_date_added_desc'),
				'value' => 'p.date_added-DESC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.date_added&order=DESC' . $url)
			);
            ]]></add>
        </operation>
	</file>
	<file name="catalog/language/*/product/category.php">
        <operation>
            <search><![CDATA[$_['text_default']      = 'Default';]]></search>
            <add position="after"><![CDATA[$_['text_date_added_desc']   = 'Date (Latest - Oldest)';
$_['text_date_added_asc']   = 'Date (Oldest - Latest)';
			]]></add>
        </operation>
	</file>
</modification>

New member

Posts

Joined
Wed Mar 29, 2017 11:09 pm

Post by xxvirusxx » Mon Aug 13, 2018 9:22 pm

Change

Code: Select all

$this->data['sorts'][] = array(
in to

Code: Select all

$data['sorts'][] = array(

Active Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm

Post by kg0925 » Wed Aug 15, 2018 1:00 pm

xxvirusxx wrote:
Mon Aug 13, 2018 9:22 pm
Change

Code: Select all

$this->data['sorts'][] = array(
in to

Code: Select all

$data['sorts'][] = array(
it's not working. any other solution? i just need to show newest products first on category page.

New member

Posts

Joined
Wed Mar 29, 2017 11:09 pm

Post by cyclops12 » Thu Aug 16, 2018 12:58 am

Try this

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<modification>
	<name>latest to old Checker</name>
	<version>1.0</version>
	<author>KG</author>
	<code>latest_to_old_sorting</code>
	<link>fashiondeal.in</link>
	<file name="catalog/controller/product/category.php">
        <operation>
            <search><![CDATA[$sort = 'p.sort_order';]]></search>
            <add position="replace"><![CDATA[$sort = 'p.date_added';]]></add>
        </operation>
        <operation>
            <search><![CDATA[$order = 'ASC';]]></search>
            <add position="replace"><![CDATA[$order = 'DESC';]]></add>
        </operation>
        <operation>
            <search><![CDATA['value' => 'p.sort_order-ASC',]]></search>
            <add position="after" offset="3"><![CDATA[
			$data['sorts'][] = array(
				'text'  => $this->language->get('text_date_added_asc'),
				'value' => 'p.date_added-ASC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.date_added&order=ASC' . $url)
			);
			
			$data['sorts'][] = array(
				'text'  => $this->language->get('text_date_added_desc'),
				'value' => 'p.date_added-DESC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.date_added&order=DESC' . $url)
			);
            ]]></add>
        </operation>
	</file>
	<file name="catalog/language/*/product/category.php">
        <operation>
            <search><![CDATA[$_['text_default']      = 'Default';]]></search>
            <add position="after"><![CDATA[$_['text_date_added_desc']   = 'Date (Latest - Oldest)';
$_['text_date_added_asc']   = 'Date (Oldest - Latest)';
			]]></add>
        </operation>
	</file>
</modification>

Active Member
Online

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by kg0925 » Wed Aug 22, 2018 7:42 pm

cyclops12 wrote:
Thu Aug 16, 2018 12:58 am
Try this

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<modification>
	<name>latest to old Checker</name>
	<version>1.0</version>
	<author>KG</author>
	<code>latest_to_old_sorting</code>
	<link>fashiondeal.in</link>
	<file name="catalog/controller/product/category.php">
        <operation>
            <search><![CDATA[$sort = 'p.sort_order';]]></search>
            <add position="replace"><![CDATA[$sort = 'p.date_added';]]></add>
        </operation>
        <operation>
            <search><![CDATA[$order = 'ASC';]]></search>
            <add position="replace"><![CDATA[$order = 'DESC';]]></add>
        </operation>
        <operation>
            <search><![CDATA['value' => 'p.sort_order-ASC',]]></search>
            <add position="after" offset="3"><![CDATA[
			$data['sorts'][] = array(
				'text'  => $this->language->get('text_date_added_asc'),
				'value' => 'p.date_added-ASC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.date_added&order=ASC' . $url)
			);
			
			$data['sorts'][] = array(
				'text'  => $this->language->get('text_date_added_desc'),
				'value' => 'p.date_added-DESC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.date_added&order=DESC' . $url)
			);
            ]]></add>
        </operation>
	</file>
	<file name="catalog/language/*/product/category.php">
        <operation>
            <search><![CDATA[$_['text_default']      = 'Default';]]></search>
            <add position="after"><![CDATA[$_['text_date_added_desc']   = 'Date (Latest - Oldest)';
$_['text_date_added_asc']   = 'Date (Oldest - Latest)';
			]]></add>
        </operation>
	</file>
</modification>
this mod is not working with installer. if i directly change it to modification file then it's working. seems like ocmod is not working properly

New member

Posts

Joined
Wed Mar 29, 2017 11:09 pm

Post by cyclops12 » Thu Aug 23, 2018 12:39 am

Sorry that is a vqmod file so will not work using installer.
Can be changed into ocmod though.

Active Member
Online

Posts

Joined
Sun Sep 27, 2015 1:10 am
Who is online

Users browsing this forum: No registered users and 4 guests