Previous And Next Product Mod W/ SEO Links

Hello Rattle5,


[quote name=‘rattle5’]Lee Li Pop and Luckdragon:



Thanks for all of your work on this mod. It works great in 1.3.5-4.[/QUOTE]



Put your arrows [COLOR=“Blue”]UNDER[/COLOR] your product’s picture.



Why?



Because, your customers see only your picture.



In addition they are accustomed to using Windows Media Player to watch their personal photos. Use Windows Media Player, you will see that the arrows are [COLOR=“Blue”]UNDER[/COLOR] the pictures!



Don’t break their habits! Let’s put arrows [COLOR=“Blue”]UNDER[/COLOR] product’s picture.





Lee Li Pop

How to install this on 2.04?

Hello ! Where can I find this mod for CS-Cart 2.0 ? Thank you.

[quote name=‘siteseconde’]Hello ! Where can I find this mod for CS-Cart 2.0 ? Thank you.[/QUOTE]



I have just finished my mod for CS-Cart 2.0, it work with SEO. I will share it soon. :wink:

[quote name=‘siteseconde’]I have just finished my mod for CS-Cart 2.0, it work with SEO. I will share it soon. ;)[/QUOTE]



Awesome - can’t wait!

Glen

[quote name=‘sixnin9’]Awesome - can’t wait!

Glen[/QUOTE]



open file : /controllers/customer/products.php



find :



```php

if (count($_SESSION[‘recently_viewed_products’]) > MAX_RECENTLY_VIEWED) {

array_pop($_SESSION[‘recently_viewed_products’]);

}

```



add after :



```php

/* NEXT PREV PRODUCT by laurent.nguyen@siteseconde.com /

$products = db_get_fields(“SELECT product_id FROM ?:products_categories WHERE category_id = ?i AND link_type = ‘M’ ORDER BY position ASC, product_id ASC”, $_SESSION[‘current_category_id’], CART_LANGUAGE);

$current_p = array_search($_REQUEST[‘product_id’], $products);

$prev_p = $products[$current_p-1];

$next_p = $products[$current_p+1];

$view->assign(‘prev_p’, $prev_p);

$view->assign(‘next_p’, $next_p);

if ($prev_p)

$view->assign(‘seo_prev_p’, fn_seo_link(‘p’, $prev_p));

if ($next_p)

$view->assign(‘seo_next_p’, fn_seo_link(‘p’, $next_p));

/
— */

```



open file : /skins/basic/customer/views/products/view.tpl



find :



```php


```

[B]replace by :[/B]

```php
{if $seo_prev_p}<- Précédent{/if} {if $seo_next_p}Suivant ->{/if}


```

It's working perfectly for me.

Enjoy !

This works! Thank you

Did not work on v2.0.5 clean install - all I got was a blank product page.

[quote name=‘Dave the Slave’]Did not work on v2.0.5 clean install - all I got was a blank product page.[/QUOTE]



Not sure if this is the case but I got blank when trying to make a php backup file. say you are editing



products.php



so I was making products.BAK.php to have it as backup, this was causing my cart going blank.

Great mod! thanks a lot for porting this over to 2.x it works great! It was easy to move over to our system and works with buttons! :grin: thanks a lot guys!

blank page also

[quote name=‘Darius’]This works! Thank you[/QUOTE]



I am getting the error :frowning:




Fatal error: Call to undefined function fn_seo_link() in /home/****/public_html/csc/controllers/customer/products.php on line 175

[quote name=‘siteseconde’]



It’s working perfectly for me.



Enjoy ![/QUOTE]



Perfect!



Saint-Cloud Laurent :wink:





Lee Li Pop

To change Previous and Next link into arrows AND place them below product’s image:



1 - Download these arrows:



next.png



previous.png



2 - Save them in this directory:



/skins/[Your Skin]/customer/[COLOR=“Blue”]images[/COLOR]/



3 - Edit this file:



/skins/[Your Skin]/customer/views/products/[COLOR=“Blue”]view.tpl[/COLOR]



4 - Find this code:



{include file="views/products/components/product_images.tpl" product=$product show_detailed_link="Y"}




5 - Change it with:



{include file="views/products/components/product_images.tpl" product=$product show_detailed_link="Y"}
{if $seo_prev_p}{/if} {if $seo_next_p}{/if}







Lee Li Pop

Thanks to siteseconde for an interesting modification, albeit it works kinda weird, at least on my site, or at least not the way I expected it to. I don’t know what Précédent and Suivant mean so I guessed Previous and Next respectively but my Précédent on the first listed product takes me not to the ‘previous’ item in my product list but to a random item on the same product list. So for instance I have six products listed (admin settings are for 6 per page) as so (“<- Précédent Suivant ->” is how the code appears on each respective product page):


  1. Widget A (<- Précédent)
  2. Widget B (<- Précédent Suivant ->)
  3. Widget C (<- Précédent Suivant ->)
  4. Widget D (<- Précédent Suivant ->)
  5. Widget E (<- Précédent Suivant ->)
  6. Widget F (<- Précédent Suivant ->)



    When I click on “<- Précédent” from the Widget A product page it takes me to the Widget F product page. In another category if I click on a product’s “<- Précédent” it may take me to Widget D.



    I thought this modification would take the customer to the “next” product in the product listing and not a randomly selected product. I have SEO enabled.

Can’t seem to make it work for all categories, the next and previous isn’t showing on my last 2 categories…that’s weird…



And I have to agree…it takes us to a random product, not next or previous. I have SEO enabled also

[quote name=‘siteseconde’]open file : /controllers/customer/products.php



find :



```php

if (count($_SESSION[‘recently_viewed_products’]) > MAX_RECENTLY_VIEWED) {

array_pop($_SESSION[‘recently_viewed_products’]);

}

```



add after :



```php

/* NEXT PREV PRODUCT by laurent.nguyen@siteseconde.com /

$products = db_get_fields(“SELECT product_id FROM ?:products_categories WHERE category_id = ?i AND link_type = ‘M’ ORDER BY position ASC, product_id ASC”, $_SESSION[‘current_category_id’], CART_LANGUAGE);

$current_p = array_search($_REQUEST[‘product_id’], $products);

$prev_p = $products[$current_p-1];

$next_p = $products[$current_p+1];

$view->assign(‘prev_p’, $prev_p);

$view->assign(‘next_p’, $next_p);

if ($prev_p)

$view->assign(‘seo_prev_p’, fn_seo_link(‘p’, $prev_p));

if ($next_p)

$view->assign(‘seo_next_p’, fn_seo_link(‘p’, $next_p));

/
— */

```



open file : /skins/basic/customer/views/products/view.tpl



find :



```php


```

[B]replace by :[/B]

```php
{if $seo_prev_p}<- Précédent{/if} {if $seo_next_p}Suivant ->{/if}


```

It's working perfectly for me.

Enjoy ![/QUOTE]
When product status is DISABLE or HIDE is listed as next/prev too.
I need list only active products.
Please, how to?

Just confirmed pianofo is correct - hidden or disabled items are not hidden or disabled using this modification.



A warning to anyone wishing to use this modification it does not work in a logical manner for v2; references to “previous” and “next” should read “random”, and product visibility settings are completely bypassed making this useless in a production or live store environment.

Does anyone have this mod working for version 2.0.*?

Doubt it. As several of us have noticed it is not really “Previous” or “Next” but random. Nice idea just does not work as advertised.