Post by HATEPOLICY » Sun Sep 23, 2012 9:54 am

Could anyone please advice on how to add Sort/Filter by date for products, front end, for the customers.

I tried searching the forums, no joy, tried extensions, nada also.

We just want to be able to add the option of sorting by date added, along with name, model & price,
I see there is reference to date_added amongst the masses of code, can this be applied to products also somehow?
Running 154.1.

Many thanks in advance.

Skills: Ripp, copy, paste.


New member

Posts

Joined
Tue Nov 22, 2011 5:46 pm
Location - Boosting 30-80hz ranges.

Post by HATEPOLICY » Sun Sep 23, 2012 10:41 am

Edit:
http://forum.opencart.com/viewtopic.php?f=20&t=56125

Could this post apply to product.php?

Thanks.

Skills: Ripp, copy, paste.


New member

Posts

Joined
Tue Nov 22, 2011 5:46 pm
Location - Boosting 30-80hz ranges.

Post by ameliaa » Sat Nov 03, 2012 12:51 am

I am looking for a solution for this too. Anyone?

New member

Posts

Joined
Fri Jan 29, 2010 6:31 pm

Post by ameliaa » Mon Nov 05, 2012 10:05 am

For those who need the solution. I got this from another programmer. This is a VQmod file: date_added_sort_order.xml

Code: Select all

<modification>
	
	<id>Display products by date added at frontend by default</id>
	<version>1.0.0</version>
	<vqmver>2.1</vqmver>
	<author>everthemes.com</author>
	
	<file name="catalog/controller/product/category.php">
		<operation>
			<search position="replace"><![CDATA[$sort = 'p.sort_order';]]></search>
			<add><![CDATA[
				$sort = 'p.date_added';
				]]></add>
		</operation>
		<operation>
			<search position="replace"><![CDATA[$order = 'ASC';]]></search>
			<add><![CDATA[
				$order = 'DESC';
				]]></add>
		</operation>
		<operation>
			<search position="replace"><![CDATA[p.sort_order-ASC]]></search>
			<add><![CDATA[
				p.date_added-DESC
				]]></add>
		</operation>
		<operation>
			<search position="replace"><![CDATA[p.sort_order&order=ASC]]></search>
			<add><![CDATA[
				p.date_added&order=DESC
				]]></add>
		</operation>
	</file>
	
</modification>

New member

Posts

Joined
Fri Jan 29, 2010 6:31 pm

Post by napok » Tue Feb 26, 2013 11:40 pm

Thanks ameliaa,
it works well.
Now the only down turn is that, if you try another sorting option like for instance price and then go back to default, it sorts everything alphabetically (that's default) but backwards- so Z-A.
Any idea to put the default option back in place? Just looks funny to have Z items first as default.
Alexandra

New member

Posts

Joined
Mon Feb 11, 2013 1:46 am

Post by botonakis » Wed May 15, 2013 6:01 pm

Thank you ameliaa.

User avatar
Active Member

Posts

Joined
Tue Jan 24, 2012 7:55 pm
Location - Athens, Greece

Post by neocreo » Mon Nov 04, 2013 6:23 pm

That vqmod that Ameliaa posted did the trick - however, The sorting and filtering is also used on the search page, so Add on the same file operation for catalog/controller/product/search.php

Code: Select all

<file name="catalog/controller/product/search.php">
      <operation>
         <search position="replace"><![CDATA[$sort = 'p.sort_order';]]></search>
         <add><![CDATA[
            $sort = 'p.date_added';
            ]]></add>
      </operation>
      <operation>
         <search position="replace"><![CDATA[$order = 'ASC';]]></search>
         <add><![CDATA[
            $order = 'DESC';
            ]]></add>
      </operation>
      <operation>
         <search position="replace"><![CDATA[p.sort_order-ASC]]></search>
         <add><![CDATA[p.date_added-DESC]]></add>
      </operation>
      <operation>
         <search position="replace"><![CDATA[p.sort_order&order=ASC]]></search>
         <add><![CDATA[p.date_added&order=DESC]]></add>
      </operation>    
   </file>
Also, if you run into any problems with the sorting not working in the front end, just remove the white-space inside the CDATA and keep it on one line.

Newbie

Posts

Joined
Fri Oct 04, 2013 2:58 pm

Post by tolinho » Sat Nov 09, 2013 8:53 pm

Hi.
Thanks ameliaa and neocreo :)
You made my day!!

New member

Posts

Joined
Sat Jul 21, 2012 2:01 am

Post by modernmagic » Wed Nov 27, 2013 1:45 pm

I have successfully created and installed the "date_added_sort_order.xml".

Is there a way to only have this only affect a specific category of products?

Joomla Web Site Designer at www.modernmagic.com


User avatar
New member

Posts

Joined
Sat Feb 09, 2013 4:55 am


Post by guldan » Tue Apr 22, 2014 5:15 pm

Yes, the same question! How to change the default sort for specific/certain category only?
I think we can use the path/category id, but I don't know where to put it. In model? In controller?
Please help :)

Newbie

Posts

Joined
Sat Apr 06, 2013 5:06 pm

Post by modernmagic » Tue Apr 22, 2014 11:39 pm

Guldan,

There appears to be NO support anymore. I asked in Nov 2013.

Joomla Web Site Designer at www.modernmagic.com


User avatar
New member

Posts

Joined
Sat Feb 09, 2013 4:55 am


Post by guldan » Wed Apr 23, 2014 12:53 pm

Hi modernmagic,
I've just created a new thread, and got a response that solve our problem :)
Check here:
http://forum.opencart.com/viewtopic.php?f=20&t=123925

Newbie

Posts

Joined
Sat Apr 06, 2013 5:06 pm

Post by ozkiremitci » Mon May 25, 2015 9:48 am

how to multi sort ?

example sort by date and quantity.
http://forum.opencart.com/viewtopic.php?f=20&t=145304

Newbie

Posts

Joined
Thu Jan 26, 2012 9:48 pm


Post by paddys_1 » Mon Oct 16, 2017 2:02 pm

There is an OC Mod that changes the sort order to show items by the date added, so the most recent are displayed first.

Image


User avatar
New member

Posts

Joined
Wed Jul 16, 2014 6:04 am
Who is online

Users browsing this forum: ozstar and 70 guests