Post by Lord_Azure » Thu May 03, 2007 1:34 am

As you may have noticed, the latest products always stays on the the first 6 you entered.

By changing the line in >catalog>plugin>home.php at lline 20

from

$results = $database->rows("select * from product p left join product_description pd on (p.product_id = pd.product_id) left join image i on (p.image_id = i.image_id) where p.status = '1' and pd.language_id = '" . (int)$language->id . "' and p.date_available rows("select * from product p left join product_description pd on (p.product_id = pd.product_id) left join image i on (p.image_id = i.image_id) where p.status = '1' and pd.language_id = '" . (int)$language->id . "' and p.date_available < now() and p.status = '1' order by p.date_added desc limit 6");

this changes the view to the last 6 you entered into your shop.

New member

Posts

Joined
Thu Nov 23, 2006 2:16 am

Post by tchemis » Fri Sep 14, 2007 7:06 am

This still works for v0.7.6.1 however the file structure seems to have changed the file is in catalog\controller\home.php and the line number is 34


$results = $database->getRows("select * from product p left join product_description pd on (p.product_id = pd.product_id) left join image i on (p.image_id = i.image_id) where p.status = '1' and pd.language_id = '" . (int)$language->getId() . "' and p.date_available getRows("select * from product p left join product_description pd on (p.product_id = pd.product_id) left join image i on (p.image_id = i.image_id) where p.status = '1' and pd.language_id = '" . (int)$language->getId() . "' and p.date_available < now() and p.status = '1' order by p.date_added desc limit 6");

Note: Only "desc" is added to the query and if you wanted more than 6 product than change 6 to the number of products displayed.
Last edited by tchemis on Fri Sep 14, 2007 7:09 am, edited 1 time in total.

Active Member

Posts

Joined
Tue Aug 21, 2007 9:23 am

Post by d77 » Fri Sep 14, 2007 7:56 am

is this not a bug that should be addressed in the core code rather than a mod we keep synching?

User avatar
d77
Active Member

Posts

Joined
Sat Apr 14, 2007 8:04 am

Post by luvz2drv » Fri Sep 14, 2007 9:16 am

what you have to remember too is that if all your products are just entered  it will have all of them to use..  under a shop that has been running for a length of time ... it will work better.

I understand the concern -- and think a better run at it would be to address it with a random approach to the available products that are new...    also hard coding that limits??  why that can be set in the admin... can it not?  if so it should be..  (not yet looked to confirm that)

-=Luvz2drv=-

luvz2drv


Post by Daniel » Fri Sep 14, 2007 4:48 pm

Just noticed the bug.

it should be:

$results = $database->getRows("select * from product p left join product_description pd on (p.product_id = pd.product_id) left join image i on (p.image_id = i.image_id) where p.status = '1' and pd.language_id = '" . (int)$language->getId() . "' and p.date_available < now() and p.status = '1' order by p.date_added desc limit 6");

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by hm2k » Wed Mar 12, 2008 12:24 pm

"This topic has not been posted in for at least 120 days."

This doesn't appear to be in the core code yet...

OPEN \catalog\controller\home.php
FIND
$results = $database->getRows("select * from product p left join product_description pd on (p.product_id = pd.product_id) left join image i on (p.image_id = i.image_id) where p.status = '1' and pd.language_id = '" . (int)$language->getId() . "' and p.date_available getRows("select * from product p left join product_description pd on (p.product_id = pd.product_id) left join image i on (p.image_id = i.image_id) where p.status = '1' and pd.language_id = '" . (int)$language->getId() . "' and p.date_available < now() and p.status = '1' order by p.date_added desc limit 6");


You'll notice the difference is the "desc" which reverses the list.
Last edited by hm2k on Wed Mar 12, 2008 12:37 pm, edited 1 time in total.

UK Web Hosting


User avatar
Global Moderator

Posts

Joined
Tue Mar 11, 2008 9:06 am
Location - UK

Post by Nonconforme » Sat Apr 05, 2008 10:42 am

thanks a lot it work fine

Newbie

Posts

Joined
Sat Apr 05, 2008 7:02 am

Post by etapombas » Sat Jul 26, 2008 9:37 am

i change my code to:

.. and p.date_available <= now()

i put = after <

Newbie

Posts

Joined
Thu May 29, 2008 3:23 am
Who is online

Users browsing this forum: No registered users and 3 guests