latest products not updating

General Support for technical Issues relating to AlegroCart
mikki
Posts: 13
Joined: Mon Aug 23, 2010 9:00 am

latest products not updating

Post by mikki » Tue Aug 24, 2010 3:57 am

Sorry everyone. Seeing as people were helpful on the last post I've found another problem :]

Have just reinstated the latest products code but i'm not sure why it's showing the products it is. I added a new test product and it didn't show up as a newly added product. Running Opencart 0.7.7/8.

http://www.foxythings4u.com/oc/

Original opencart code----------------------------------------------------

<div class="heading"><?php echo $text_latest; ?></div>
<?php foreach ($products as $product) { ?>
<div class="products"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a><br /><b><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></b><br /><?php echo $product['price']; ?></div>
<?php } ?>

----------------------------------------------------------------------------

Thanks,

Michael

User avatar
leo
admin
Posts: 4320
Joined: Sun Dec 13, 2009 8:27 am
Location: Hungary

Re: latest products not updating

Post by leo » Tue Aug 24, 2010 4:47 am

The problem is not in the tlp file.
Try this. Change in catalog/extension/modul/latest.php the line from:

Code: Select all

$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);
to

Code: Select all

$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' and p.latestpr = '1' order by p.date_added desc" . $limit);

User avatar
Brent
Site Admin
Posts: 4459
Joined: Sat Dec 12, 2009 3:35 pm
Location: Canada eh

Re: latest products not updating

Post by Brent » Tue Aug 24, 2010 4:56 am

I curious. What is latestpr?

Code: Select all

p.latestpr = '1'

mikki
Posts: 13
Joined: Mon Aug 23, 2010 9:00 am

Re: latest products not updating

Post by mikki » Tue Aug 24, 2010 5:00 am

Well the interesting thing with that is that I don't have a latest.php module. I did look for it, but it doesn't seem to exist. Found a 0.7.9 install zip and it's not in their either. So I can only assume that is a later addition; maybe 0.8x.

User avatar
leo
admin
Posts: 4320
Joined: Sun Dec 13, 2009 8:27 am
Location: Hungary

Re: latest products not updating

Post by leo » Tue Aug 24, 2010 5:39 am

Code: Select all

ALTER TABLE `product`
  ADD `latestpr` int(1) NOT NULL default '0' AFTER `status`,
  ADD `special_offer` int(1) NOT NULL default '0' AFTER `status`,
  ADD `featured` int(1) NOT NULL default '0' AFTER `status`;
OK. Sorry. This was an addon to 0.7x

To correct the original latest problem open /catalog/controller/home.php

Code: Select all

$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 limit 6");
Change p.date_added limit to p.date_added desc limit

User avatar
Brent
Site Admin
Posts: 4459
Joined: Sat Dec 12, 2009 3:35 pm
Location: Canada eh

Re: latest products not updating

Post by Brent » Tue Aug 24, 2010 6:12 am

ADD `latestpr` int(1) NOT NULL default '0' AFTER `status`,
I have never had that column.
What purpose is it used for? Do we need it.

In the code here, latest is always created by the latest products added.

Mikki
I don't know where you will find the code for pre 7.9 versions.
There where quite a few core changes and a 7.9 version won't work with 7.8 or earlier without modifications.

User avatar
leo
admin
Posts: 4320
Joined: Sun Dec 13, 2009 8:27 am
Location: Hungary

Re: latest products not updating

Post by leo » Tue Aug 24, 2010 6:34 am

Ok, I remember.
Somebody asked me add the possibility to enable/disable products showing up in latest as well.
Attachments
Products_1282656428760.png
Products_1282656428760.png (8.55 KiB) Viewed 15391 times

mikki
Posts: 13
Joined: Mon Aug 23, 2010 9:00 am

Re: latest products not updating

Post by mikki » Tue Aug 24, 2010 6:36 am

My version is old enough to not have any way to find out what version it is, heh.

I assume that even the version I have came with latest products and that it worked or it'd be pointless it being there :]

I'm trying not to upgrade incase it breaks everything which it why I'm just hacking what I can to get it to work. Next year it'll all be migrated to super duper latest version.

User avatar
leo
admin
Posts: 4320
Joined: Sun Dec 13, 2009 8:27 am
Location: Hungary

Re: latest products not updating

Post by leo » Tue Aug 24, 2010 7:06 am

mikki
As I have mentioned above the problem with latest products is the missing "desc" in /catalog/controller/home.php .
Without it the cart shows the first added products instead of the last added.

User avatar
Brent
Site Admin
Posts: 4459
Joined: Sat Dec 12, 2009 3:35 pm
Location: Canada eh

Re: latest products not updating

Post by Brent » Tue Aug 24, 2010 7:07 am

In home.php, post the function latest(&$view) code

Post Reply