Post by Johnathan » Wed Jul 14, 2010 12:55 am

I think it works a lot better for Latest Products to be based on date_available instead of date_added, since date_available can be changed in the admin. This way products can be created ahead of time and still appear on the correct date as a "latest product". It's an easy fix, too:

IN:

Code: Select all

/catalog/model/catalog/product.php
REPLACE:

Code: Select all

ORDER BY p.date_added
WITH:

Code: Select all

ORDER BY p.date_available
Last edited by i2Paq on Thu Oct 14, 2010 12:01 am, edited 1 time in total.
Reason: Topic moved

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by mystifier » Wed Jul 14, 2010 5:18 am

I actually changed it to p.date_modified which provides a very simple mechanism for controlling the order - to bubble a product to the top, it simply needs to be edited and saved again (even if this is only to delete a character and replace it again).

Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products


User avatar
Active Member

Posts

Joined
Tue May 18, 2010 5:15 pm

Post by Johnathan » Wed Jul 14, 2010 5:59 am

That works well too, but I didn't want products that I edit the information for (options, categories, etc.) to be bumped to the top of the list. I prefer date_available because you can set it, so it works independently from editing other options. Just my preference.

Also, I originally had this thread in the Feature Requests forum because I think this should be added to the core. Does somebody disagree with me?

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by mystifier » Wed Jul 14, 2010 2:10 pm

Johnathan wrote:Does somebody disagree with me?
I do. ;D

I picked date_modified over date_available because it is greater precision datetime whereas date_available is date and generally, many products get added on the same day.

The fact that you can easily change the date available easily and so change its position to suit makes much more sense than what I did but it may not be possible to use the true date where positional control over multiple products is desired. Out of the three, date_add is by far the least useful.

I have just bowed to your better thinking and changed to date_available but I think it needs a secondary field to sort by.

Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products


User avatar
Active Member

Posts

Joined
Tue May 18, 2010 5:15 pm

Post by Qphoria » Wed Jul 14, 2010 9:33 pm

I did disagree yesterday.. but it sounds better today. Either way, I'll take it under advisement. In the mean time, others will benefit from this more as a mod for now.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Johnathan » Sat Jul 17, 2010 12:05 pm

Thanks for both your considered responses. I see what you mean about date_modified...for my wife and myself, we just change date_available on products that we don't want as latest products to an earlier day. Of course, if you have lots of products appearing on a single day in the future, that's not as useful. :)

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by opencartnovice » Tue Oct 12, 2010 7:39 am

Johnathan wrote:Thanks for both your considered responses. I see what you mean about date_modified...for my wife and myself, we just change date_available on products that we don't want as latest products to an earlier day. Of course, if you have lots of products appearing on a single day in the future, that's not as useful. :)
I'm in the same side with Johnathan when setting an online store. It is requested that "just arrived items" appear in home page i.e. their data has been already in system but their stock was out, but now back full, and so I change the date as Johnathan's comments. Thanks

New member

Posts

Joined
Thu Oct 07, 2010 5:12 am

Post by onlinephilately » Tue Mar 01, 2011 9:11 pm

Hello,

I have tried this but I would like to change it so that the Latest only show products that have been added let's say the last 10 days.

How do I fix this?

New member

Posts

Joined
Thu Jan 27, 2011 3:14 am

Post by jules » Sat May 28, 2011 3:40 pm

(I don't know if this thread is still alive or history, but I find it interesting.)
I thank all of you for these brilliant comments and suggestions. I also agree with Mystifier that a 'sort order' will add to the flexibility of this module. Overall, it might just be better to give the administrator some options (date added, date modified, dated available) to chose from according to his or her own convenience. Finally, I suggest one more option - a 'forced' option which lets a particular product persist and show up no matter what. And, like Jonathan suggested, this should make it to the core if possible. Thanks again.

New member

Posts

Joined
Tue May 10, 2011 3:15 am

Post by matte2k » Wed Oct 24, 2012 3:51 am

Johnathan wrote:I think it works a lot better for Latest Products to be based on date_available instead of date_added, since date_available can be changed in the admin. This way products can be created ahead of time and still appear on the correct date as a "latest product". It's an easy fix, too:

IN:

Code: Select all

/catalog/model/catalog/product.php
REPLACE:

Code: Select all

ORDER BY p.date_added
WITH:

Code: Select all

ORDER BY p.date_available
is this the correct way to do it even in 1.5.1.3
cause it doesn't seem to work :(

Active Member

Posts

Joined
Thu Mar 01, 2012 7:07 pm

Post by labeshops » Wed Oct 24, 2012 4:11 am

From the date of the original post, I would guess this was done for 1.4, not 1.5.

Running Opencart v3.0.3.9 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by matte2k » Wed Oct 24, 2012 4:20 am

labeshops wrote:From the date of the original post, I would guess this was done for 1.4, not 1.5.
Yes me 2..
I guess the correct file in 1.5.1.3 is catalog/controller/module/latest.php.
But when changing to p.date_published the sort order changes but to something totally random :(

Active Member

Posts

Joined
Thu Mar 01, 2012 7:07 pm

Post by Johnathan » Wed Oct 24, 2012 9:12 pm

The original change was for 1.4.x versions, but it still works in all 1.5.x versions. Make sure you delete your /system/cache/ files (specifically, the ones that start with product.latest.). It's probably just caching the old product list and using that instead.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by matte2k » Wed Oct 24, 2012 9:20 pm

Ok I will try that!
Is the correct file: I guess the correct file in 1.5.1.3 is catalog/controller/module/latest.php ?
I have a table in the sql databas named "date_published". Should the change then be: "p.date_published"?
What is "p." stands for?

Active Member

Posts

Joined
Thu Mar 01, 2012 7:07 pm

Post by matte2k » Thu Oct 25, 2012 3:57 am

nope... that didn't work! :(

Active Member

Posts

Joined
Thu Mar 01, 2012 7:07 pm

Post by Johnathan » Thu Oct 25, 2012 8:07 pm

There is no date_published in the default OpenCart, so you must be using a mod or extension. The change in the default OpenCart file is exactly as I've described. You should contact the author of that extension for help adjusting it.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by matte2k » Sun May 12, 2013 8:18 pm

I need help!

I want my latest module to show the latest product that I've added to be displayed first.

In catalog/model/catalog/product.php it's written "ORDER BY p.date_added DESC LIMIT"
In catalog/controller/module/product.php it's written "p.date_added"

But it still doesnt display it that way. What am I doing wrong?


edit: I run 1.5.1.3

Active Member

Posts

Joined
Thu Mar 01, 2012 7:07 pm
Who is online

Users browsing this forum: No registered users and 5 guests