Previous And Next Product Mod W/ SEO Links

Maybe not perfectly but it does work for me.

[quote name=‘Dave the Slave’]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.[/QUOTE]

I did see from some websites it’s not always prev and next. Sometimes it’s random.

Doesn’t it work with SEO on?

I will fix my mod soon.

Thanks for the reports.

[quote name=‘siteseconde’]I will fix my mod soon.

Thanks for the reports.[/QUOTE]



1 - Open file : /controllers/customer/[COLOR=“Red”]products.php[/COLOR]



Find this code :



```php

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

array_pop($_SESSION[‘recently_viewed_products’]);

}

```



Add this code after :



```php

/*

** Next Prev Product by http://www.siteseconde.com/

*/

$products = db_get_fields(“

SELECT pc.product_id FROM ?:products_categories pc

JOIN ?:products p

ON p.product_id = pc.product_id

WHERE pc.category_id = ?i

AND p.status = ‘A’

ORDER BY pc.position ASC, pc.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));

```



2 - Open file : /skins/basic/customer/views/products/[COLOR=“Red”]view.tpl[/COLOR] (by default)

Or /skins/[skin_name]/customer/views/products/[COLOR=“Red”]view.tpl[/COLOR] (replace [skin_name] by the name of your current skin)



Find this code :



```php


```

[B][U]2.1[/U] - Text version[/B]

[U]Replace this code by :[/U]

```php

{if $seo_prev_p}<- Previous product{/if}
{if $seo_next_p}Next product ->{/if}


```

[B][U]2.2[/U] - Image version[/B]

[U]Replace this code by :[/U]

```php

{if $seo_prev_p}Previous product{/if}
{if $seo_next_p}Next product{/if}


```

And

Don't forget to save your pictures [B][COLOR="Red"]prev.png[/COLOR][/B] (for previous product) and [B][COLOR="Red"]next.png[/COLOR][/B] (for next product) to this directory :
[B]/skins/basic/customer/images/[/B] (by default)
Or [B]/skins/[skin_name]/customer/images/[/B] (replace [skin_name] by the name of your current skin).

This mod works perfectly with CS-CART 2.0.8, i will try it on CS-CART 2.0.10 soon.

[B]How it's work ?[/B]
This mod will find the previous and next product by position on the same category. If the same position was found, they will be listed by product id. If you want to change the order of the list, you have change the SQL request. I'm working on a fix of the listing with the parameters of categories.

[B][COLOR="Red"]Sorry for my bad english, i'm french.[/COLOR][/B]

It works sorting next and previous products, the problem with my cart is that the text beside the product image gets on top of it.

I tried to change the padding but no luck, it still messes with the text.

Does anyone have this running on their store for me to look at?

You can see a demo here : [url]chiarelli.com - This website is for sale! - chiarelli Resources and Information.

I need a previous and next button/link on product lists and product detailed pages. Is there any coding out and about to make this work with the latest version.



Thanks

1 - Open file : /controllers/customer/products.php, remplace by this code for 2.1.1



```php

// Next Prev Product



$products_chemin = db_get_fields(“SELECT pc.product_id FROM ?:products_categories pc JOIN ?:products p ON p.product_id = pc.product_id WHERE pc.category_id = ?i AND p.status = ‘A’ ORDER BY pc.position ASC, pc.product_id ASC”, $_SESSION[‘current_category_id’], CART_LANGUAGE);

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

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

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

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

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

if ($prev_p){

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

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

}

if ($next_p){

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

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

}

```



fn_seo_link doesn’t exist with last version. I don’t try with SEO Activate, maybe some modification to get good url :slight_smile:



2 - Open file : /skins/basic/customer/blocks/product_templates/default_template.tpl, remplace by this code for 2.1.1



```php


{if $seo_prev_p}<- {$lang.previous_product}
{$seo_prev_p|fn_get_product_name|escape}
{/if}
{if $seo_next_p}{$lang.next_product} ->
{$seo_next_p|fn_get_product_name|escape}
{/if}

```

3 - Create 2 lang variables in BACK OFFICE for $lang.next_product & $lang.previous_product

Hello Creativeuser,



Thank you.



Your PHP code works fine!


[quote name=‘creativeuser’]

fn_seo_link doesn’t exist with last version. I don’t try with SEO Activate, maybe some modification to get good url :)[/QUOTE]



Here is my solution SEO compatible for CSC 2.1.2:


```php










{if $seo_prev_p}http://Your-WEBSITE.COM{“products.view?product_id=$seo_prev_p”|fn_url}”>
{$seo_prev_p|fn_get_product_name|escape}
{else}>>>{/if}
|| {if $seo_next_p}http://Your-WEBSITE.COM{“products.view?product_id=$seo_next_p”|fn_url}” title=“{$seo_next_p|fn_get_product_name|escape}”>Next product
{$seo_next_p|fn_get_product_name|escape}
{else}<<<{/if}
```

[B][SIZE="3"]I would like to have an endless loop for Next and Previous links, is it possible?[/SIZE][/B]

[edit]
[B][SIZE="3"]Yes it is possible to have an endless loop, please, see this post below:[/SIZE][/B]

[url]http://forum.cs-cart.com/showthread.php?p=107454#post107454[/url]
[/edit]


Lee Li Pop

sorry i don’t know how you can put an endless loop, thanks for SEO :=)

Hi, I’m getting confused. I’m working in ver. 2.1.2.



Can someone tell me if I need to do the changes from the beginning of this post, adding all the bits as I go along or are there only specific parts that apply to this version.



As you can tell I’m new to CS-Cart, but even so this seems like a change I should be able to muddle through myself (on my dev site…) instead of paying a developer, just need to know where to start.



Thanks for any help.

[quote name=‘wls’] instead of paying a developer[/QUOTE]



Please wls, DO NOT hire any developer.



Here is my /controllers/customer/[COLOR=“Red”]products.php[/COLOR]:



```php
/***************************************************************************

  •                                                                      *
  • Copyright (c) 2004 Simbirsk Technologies Ltd. All rights reserved. *
  •                                                                      *
  • This is commercial software, only users who have purchased a valid *
  • license and accept to the terms of the License Agreement can install *
  • and use this program. *
  •                                                                      *

****************************************************************************

  • PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
  • “copyright.txt” FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *

    ***************************************************************************/





    //

    // $Id: products.php 10430 2010-08-17 08:24:19Z andyye $

    //



    if ( !defined(‘AREA’) ) { die(‘Access denied’); }



    //

    // Search products

    //

    if ($mode == ‘search’) {



    $params = $_REQUEST;



    if (!empty($params[‘search_performed’]) || !empty($params[‘features_hash’])) {



    fn_add_breadcrumb(fn_get_lang_var(‘advanced_search’), “products.search” . (!empty($_REQUEST[‘advanced_filter’]) ? ‘?advanced_filter=Y’ : ‘’));

    fn_add_breadcrumb(fn_get_lang_var(‘search_results’));

    $params = $_REQUEST;

    $params[‘type’] = ‘extended’;

    list($products, $search, $products_count) = fn_get_products($params, Registry::get(‘settings.Appearance.products_per_page’));



    if (!empty($products)) {

    foreach ($products as $k => $v) {

    fn_gather_additional_product_data($products[$k], true, true);

    }

    }



    if (!empty($products)) {

    $_SESSION[‘continue_url’] = Registry::get(‘config.current_url’);

    }



    $selected_layout = fn_get_products_layout($params);



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

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

    $view->assign(‘product_count’, $products_count);

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

    } else {

    fn_add_breadcrumb(fn_get_lang_var(‘advanced_search’));

    }

    if (!empty($params[‘advanced_filter’])) {



    $params[‘get_all’] = ‘Y’;



    list($filters, $view_all_filter) = fn_get_filters_products_count($params);

    $view->assign(‘filter_features’, $filters);

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

    }

    //

    // View product details

    //

    } elseif ($mode == ‘view’) {



    $_REQUEST[‘product_id’] = empty($_REQUEST[‘product_id’]) ? 0 : $_REQUEST[‘product_id’];

    $product = fn_get_product_data($_REQUEST[‘product_id’], $auth, CART_LANGUAGE, ‘’, true, true, true, true, ($auth[‘area’] == ‘A’ && !empty($_REQUEST[‘action’]) && $_REQUEST[‘action’] == ‘preview’));



    if (empty($product)) {

    return array(CONTROLLER_STATUS_NO_PAGE);

    }



    if (empty($_SESSION[‘current_category_id’]) || empty($product[‘category_ids’][$_SESSION[‘current_category_id’]])) {

    $_SESSION[‘current_category_id’] = $product[‘main_category’];

    }



    if (!empty($product[‘meta_description’]) || !empty($product[‘meta_keywords’])) {

    $view->assign(‘meta_description’, $product[‘meta_description’]);

    $view->assign(‘meta_keywords’, $product[‘meta_keywords’]);



    } else {

    $meta_tags = db_get_row(“SELECT meta_description, meta_keywords FROM ?:category_descriptions WHERE category_id = ?i AND lang_code = ?s”, $_SESSION[‘current_category_id’], CART_LANGUAGE);

    if (!empty($meta_tags)) {

    $view->assign(‘meta_description’, $meta_tags[‘meta_description’]);

    $view->assign(‘meta_keywords’, $meta_tags[‘meta_keywords’]);

    }

    }



    $_SESSION[‘continue_url’] = “categories.view?category_id=$_SESSION[current_category_id]”;



    $parent_ids = explode(‘/’, db_get_field(“SELECT id_path FROM ?:categories WHERE category_id = ?i”, $_SESSION[‘current_category_id’]));



    if (!empty($parent_ids)) {

    $cats = fn_get_category_name($parent_ids);

    foreach($parent_ids as $c_id) {

    fn_add_breadcrumb($cats[$c_id], “categories.view?category_id=$c_id”);

    }

    }



    fn_add_breadcrumb($product[‘product’]);



    if (!empty($_REQUEST[‘combination’])) {

    $product[‘combination’] = $_REQUEST[‘combination’];

    }



    fn_gather_additional_product_data($product, true, true);

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



    // If page title for this product is exist than assign it to template

    if (!empty($product[‘page_title’])) {

    $view->assign(‘page_title’, $product[‘page_title’]);

    }



    $files = fn_get_product_files($_REQUEST[‘product_id’], true);



    if (!empty($files)) {

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

    }



    /
    [Block manager tabs] /

    $_blocks = $view->get_var(‘blocks’);

    foreach ($_blocks as $block) {

    if (!empty($block[‘text_id’]) && $block[‘text_id’] == ‘product_details’) {

    $tabs_group_id = $block[‘block_id’];

    break;

    }

    }

    if (!empty($tabs_group_id)) {

    $view->assign(‘tabs_block_id’, $tabs_group_id);

    foreach ($blocks as $block) {

    if (!empty($block[‘group_id’]) && $block[‘group_id’] == $tabs_group_id) {

    Registry::set('navigation.tabs.block
    ’ . $block[‘block_id’], array (

    ‘title’ => $block[‘description’],

    ‘js’ => true

    ));

    }

    }

    }

    /
    [/Block manager tabs] */



    // Set recently viewed products history

    if (!empty($_SESSION[‘recently_viewed_products’])) {

    $recently_viewed_product_id = array_search($_REQUEST[‘product_id’], $_SESSION[‘recently_viewed_products’]);

    // Existing product will be moved on the top of the list

    if ($recently_viewed_product_id !== FALSE) {

    // Remove the existing product to put it on the top later

    unset($_SESSION[‘recently_viewed_products’][$recently_viewed_product_id]);

    // Re-sort the array

    $_SESSION[‘recently_viewed_products’] = array_values($_SESSION[‘recently_viewed_products’]);

    }

    array_unshift($_SESSION[‘recently_viewed_products’], $_REQUEST[‘product_id’]);

    } elseif (empty($_SESSION[‘recently_viewed_products’])) {

    $_SESSION[‘recently_viewed_products’] = array($_REQUEST[‘product_id’]);

    }



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

    array_pop($_SESSION[‘recently_viewed_products’]);

    }



    // Next Prev Product



    $products_chemin = 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_chemin);

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

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



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

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



    if ($prev_p){

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

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

    }



    if ($next_p){

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

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

    }



    // End Prev Product



    // Increase product popularity

    if (empty($_SESSION[‘products_popularity’][‘viewed’][$_REQUEST[‘product_id’]])) {

    $_data = array (

    ‘product_id’ => $_REQUEST[‘product_id’],

    ‘viewed’ => 1,

    ‘total’ => POPULARITY_VIEW

    );



    db_query(“INSERT INTO ?:product_popularity ?e ON DUPLICATE KEY UPDATE viewed = viewed + 1, total = total + ?i”, $_data, POPULARITY_VIEW);



    $_SESSION[‘products_popularity’][‘viewed’][$_REQUEST[‘product_id’]] = true;

    }

    }



    ?> ```



    Here is the Next / Preview part of my /skins/[skin_name]/blocks/product_templates/[COLOR=“Red”]default_template.tpl[/COLOR]



    Nota Bene:



    Paste it where you want / need:



    ```php
    {if $seo_prev_p}http://localhost{“products.view?product_id=$seo_prev_p”|fn_url}”>
    {$seo_prev_p|fn_get_product_name|escape}
    {else}>>>{/if}
    || {if $seo_next_p}http://localhost{“products.view?product_id=$seo_next_p”|fn_url}” title=“{$seo_next_p|fn_get_product_name|escape}”>Next product
    {$seo_next_p|fn_get_product_name|escape}
    {else}<<<{/if}
    ```



    For your information, I pasted it over the picture of the product:


[QUOTE]{if !$no_images}





And so on…[/QUOTE]





Lee Li Pop

Hello All,



Here is how to have a Next / Previous Products with an endless loop of the products in category, forward as backward.



100% SEO compatible.



Works fine in CS-Cart 2.1.2 with SEO turn ON.



Here is my /controllers/customer/[COLOR=“Red”]products.php[/COLOR]:



```php
/***************************************************************************

  •                                                                      * 
  • Copyright (c) 2004 Simbirsk Technologies Ltd. All rights reserved. *
  •                                                                      * 
  • This is commercial software, only users who have purchased a valid *
  • license and accept to the terms of the License Agreement can install *
  • and use this program. *
  •                                                                      * 

****************************************************************************

  • PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
  • “copyright.txt” FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *

    ***************************************************************************/





    //

    // $Id: products.php 10430 2010-08-17 08:24:19Z andyye $

    //



    if ( !defined(‘AREA’) ) { die(‘Access denied’); }



    //

    // Search products

    //

    if ($mode == ‘search’) {



    $params = $_REQUEST;



    if (!empty($params[‘search_performed’]) || !empty($params[‘features_hash’])) {



    fn_add_breadcrumb(fn_get_lang_var(‘advanced_search’), “products.search” . (!empty($_REQUEST[‘advanced_filter’]) ? ‘?advanced_filter=Y’ : ‘’));

    fn_add_breadcrumb(fn_get_lang_var(‘search_results’));

    $params = $_REQUEST;

    $params[‘type’] = ‘extended’;

    list($products, $search, $products_count) = fn_get_products($params, Registry::get(‘settings.Appearance.products_per_page’));



    if (!empty($products)) {

    foreach ($products as $k => $v) {

    fn_gather_additional_product_data($products[$k], true, true);

    }

    }



    if (!empty($products)) {

    $_SESSION[‘continue_url’] = Registry::get(‘config.current_url’);

    }



    $selected_layout = fn_get_products_layout($params);



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

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

    $view->assign(‘product_count’, $products_count);

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

    } else {

    fn_add_breadcrumb(fn_get_lang_var(‘advanced_search’));

    }

    if (!empty($params[‘advanced_filter’])) {



    $params[‘get_all’] = ‘Y’;



    list($filters, $view_all_filter) = fn_get_filters_products_count($params);

    $view->assign(‘filter_features’, $filters);

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

    }

    //

    // View product details

    //

    } elseif ($mode == ‘view’) {



    $_REQUEST[‘product_id’] = empty($_REQUEST[‘product_id’]) ? 0 : $_REQUEST[‘product_id’];

    $product = fn_get_product_data($_REQUEST[‘product_id’], $auth, CART_LANGUAGE, ‘’, true, true, true, true, ($auth[‘area’] == ‘A’ && !empty($_REQUEST[‘action’]) && $_REQUEST[‘action’] == ‘preview’));



    if (empty($product)) {

    return array(CONTROLLER_STATUS_NO_PAGE);

    }



    if (empty($_SESSION[‘current_category_id’]) || empty($product[‘category_ids’][$_SESSION[‘current_category_id’]])) {

    $_SESSION[‘current_category_id’] = $product[‘main_category’];

    }



    if (!empty($product[‘meta_description’]) || !empty($product[‘meta_keywords’])) {

    $view->assign(‘meta_description’, $product[‘meta_description’]);

    $view->assign(‘meta_keywords’, $product[‘meta_keywords’]);



    } else {

    $meta_tags = db_get_row(“SELECT meta_description, meta_keywords FROM ?:category_descriptions WHERE category_id = ?i AND lang_code = ?s”, $_SESSION[‘current_category_id’], CART_LANGUAGE);

    if (!empty($meta_tags)) {

    $view->assign(‘meta_description’, $meta_tags[‘meta_description’]);

    $view->assign(‘meta_keywords’, $meta_tags[‘meta_keywords’]);

    }

    }



    $_SESSION[‘continue_url’] = “categories.view?category_id=$_SESSION[current_category_id]”;



    $parent_ids = explode(‘/’, db_get_field(“SELECT id_path FROM ?:categories WHERE category_id = ?i”, $_SESSION[‘current_category_id’]));



    if (!empty($parent_ids)) {

    $cats = fn_get_category_name($parent_ids);

    foreach($parent_ids as $c_id) {

    fn_add_breadcrumb($cats[$c_id], “categories.view?category_id=$c_id”);

    }

    }



    fn_add_breadcrumb($product[‘product’]);



    if (!empty($_REQUEST[‘combination’])) {

    $product[‘combination’] = $_REQUEST[‘combination’];

    }



    fn_gather_additional_product_data($product, true, true);

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



    // If page title for this product is exist than assign it to template

    if (!empty($product[‘page_title’])) {

    $view->assign(‘page_title’, $product[‘page_title’]);

    }



    $files = fn_get_product_files($_REQUEST[‘product_id’], true);



    if (!empty($files)) {

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

    }



    /
    [Block manager tabs] /

    $_blocks = $view->get_var(‘blocks’);

    foreach ($_blocks as $block) {

    if (!empty($block[‘text_id’]) && $block[‘text_id’] == ‘product_details’) {

    $tabs_group_id = $block[‘block_id’];

    break;

    }

    }

    if (!empty($tabs_group_id)) {

    $view->assign(‘tabs_block_id’, $tabs_group_id);

    foreach ($blocks as $block) {

    if (!empty($block[‘group_id’]) && $block[‘group_id’] == $tabs_group_id) {

    Registry::set('navigation.tabs.block
    ’ . $block[‘block_id’], array (

    ‘title’ => $block[‘description’],

    ‘js’ => true

    ));

    }

    }

    }

    /
    [/Block manager tabs] */



    // Set recently viewed products history

    if (!empty($_SESSION[‘recently_viewed_products’])) {

    $recently_viewed_product_id = array_search($_REQUEST[‘product_id’], $_SESSION[‘recently_viewed_products’]);

    // Existing product will be moved on the top of the list

    if ($recently_viewed_product_id !== FALSE) {

    // Remove the existing product to put it on the top later

    unset($_SESSION[‘recently_viewed_products’][$recently_viewed_product_id]);

    // Re-sort the array

    $_SESSION[‘recently_viewed_products’] = array_values($_SESSION[‘recently_viewed_products’]);

    }

    array_unshift($_SESSION[‘recently_viewed_products’], $_REQUEST[‘product_id’]);

    } elseif (empty($_SESSION[‘recently_viewed_products’])) {

    $_SESSION[‘recently_viewed_products’] = array($_REQUEST[‘product_id’]);

    }



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

    array_pop($_SESSION[‘recently_viewed_products’]);

    }



    //////// Next Prev Product by laurent [dot] nguyen [at] siteseconde [dot] com - http://www.siteseconde.com/

    $products_chemin = 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_chemin);



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

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





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

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



    if ($prev_p){

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

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

    }



    if ($next_p){

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

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

    }



    //////// Loop of the products in category by Li Lee Pop - http://forum.cs-cart.com/member.php?u=1576



    //////// FIRST Product of the Category



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





    $current_first = array_search($_REQUEST[‘product_id’], $products_first);



    $seo_products_first = $products_first[$current_first];



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



    /////// End of FIRST Product of the Category



    //////// LAST Product of the Category



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





    $current_last = array_search($_REQUEST[‘product_id’], $last_products);



    $last_seo_products = $last_products[$current_last];



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



    //////// End of LAST Product of the Category



    //////// End of Loop of the products in the Category



    //////// End Next Prev Product



    // Increase product popularity

    if (empty($_SESSION[‘products_popularity’][‘viewed’][$_REQUEST[‘product_id’]])) {

    $_data = array (

    ‘product_id’ => $_REQUEST[‘product_id’],

    ‘viewed’ => 1,

    ‘total’ => POPULARITY_VIEW

    );



    db_query(“INSERT INTO ?:product_popularity ?e ON DUPLICATE KEY UPDATE viewed = viewed + 1, total = total + ?i”, $_data, POPULARITY_VIEW);



    $_SESSION[‘products_popularity’][‘viewed’][$_REQUEST[‘product_id’]] = true;

    }

    }



    ?> ```



    Here is the Next / Preview with Endless Loop part of my /skins/[skin_name]/blocks/product_templates/[COLOR=“Red”]default_template.tpl[/COLOR]



    Nota Bene:



    Paste it where you want / need:



    ```php
    {if $seo_prev_p}http://YourWebsite.com{“products.view?product_id=$seo_prev_p”|fn_url}”>
    {$seo_prev_p|fn_get_product_name|escape}
    {else}http://YourWebsite.com{“products.view?product_id=$last_seo_products”|fn_url}” title=“{$last_seo_products|fn_get_product_name|escape}”>Next product
    {$last_seo_products|fn_get_product_name|escape}
    {/if}
    {$number_pro} {if $seo_next_p}http://YourWebsite.com{“products.view?product_id=$seo_next_p”|fn_url}” title=“{$seo_next_p|fn_get_product_name|escape}”>Next product
    {$seo_next_p|fn_get_product_name|escape}
    {else}http://YourWebsite.com{“products.view?product_id=$seo_products_first”|fn_url}” title=“{$seo_products_first|fn_get_product_name|escape}”>Next product
    {$seo_products_first|fn_get_product_name|escape}
    {/if}
    ```



    For your information, I pasted it over the picture of the product:


[QUOTE]{if !$no_images}





And so on…[/QUOTE]





Lee Li Pop

I’m BAAAAACK :slight_smile: been gone for awhile, and had been writing my own cms application so I hadn’t had a chance to work on stuff for cs-cart in a long time… but I’m back now, and hoping to be able to contribute asap :slight_smile:

Luckydragon,



A very warm welcome back!!! You were missed :wink:

now, all I have to do is start familiarizing myself with v2.x and I’ll be good to go :slight_smile:

Glad to see you around again.

[quote name=‘luckdragon’][SIZE=“4”]I’m BAAAAACK[/SIZE][/QUOTE]







[SIZE=“4”]What?! So much time without news?![/SIZE]



(Welcome back! :stuck_out_tongue: )







Lee Li Pop



PS: Source: [url]http://www.liweiart.com/[/url]