[MOD] Increase Limit for Recently Viewed Side Panel

For Articles relating to more than one ISC version
Post Reply
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

[MOD] Increase Limit for Recently Viewed Side Panel

Post by Martin »

(Authored by Harvey Goldman)

I display recently viewed items on the centre part of the cart page using the panel: SideProductRecentlyViewed panel.

No matter what I tried I could not get it to display more than 5 items. Tech support got back to me and advised me as follows.

Locate file /includes/classes/class.product.php.

Roughly line 222 you should have this block of code:

Code: Select all

// Only store the 5 most recent product Id's
if (count($viewed_products) > 5) {
$reverse_viewed_products = array_reverse($viewed_products);
$viewed_products = array();

for ($i = 0; $i < 5; $i++) {
$viewed_products[] = $reverse_viewed_products[$i];
}

// Reverse the array so the oldest products show first
$viewed_products = array_reverse($viewed_products);
By changing the two instances of 5 to a higher figure you will be able to show more products.

The lines are:

Code: Select all

if (count($viewed_products) > 5) {
and..

Code: Select all

for ($i = 0; $i < 5; $i++) {
This is known to work in v. 5.0.2 and 5.0.3.

It's likely to work in 4.x and later versions of 5.x as well.
The Impossible can be on your desk by lunchtime, Miracles will take a little longer
SnailSolution Interspire Mods/Hacks store
Post Reply