first, in addons/seo/func.php
search for:
if (preg_match_all('/(\{\$index_script\}\?\{\$target_name\}=products(&|&)product_id=\{\$product.product_id\})([&|&]?)/i', $tpl_source, $matches)) {
foreach ($matches[0] as $key => $match) {
$tpl_source = str_replace($match, '{"p"|fn_seo_link:$product.product_id:$product.product}' . (empty($matches[3][$key]) ? '' : '?'), $tpl_source);
}
}
insert after:
if (preg_match_all('/(\{\$index_script\}\?\{\$target_name\}=products(&|&)product_id=\{\$previous.product_id\})([&|&]?)/i', $tpl_source, $matches)) {
foreach ($matches[0] as $key => $match) {
$tpl_source = str_replace($match, '{"p"|fn_seo_link:$previous.product_id:$previous.product}' . (empty($matches[3][$key]) ? '' : '?'), $tpl_source);
}
}
if (preg_match_all('/(\{\$index_script\}\?\{\$target_name\}=products(&|&)product_id=\{\$next.product_id\})([&|&]?)/i', $tpl_source, $matches)) {
foreach ($matches[0] as $key => $match) {
$tpl_source = str_replace($match, '{"p"|fn_seo_link:$next.product_id:$next.product}' . (empty($matches[3][$key]) ? '' : '?'), $tpl_source);
}
}
save and exit
next in includes/customer/products.php
search for:
if (!empty($product['meta_description']) || !empty($product['meta_keywords'])) {
insert before:
$next_id=0;
$prev_id=0;
$q = "select product_id from $db_tables[products_categories] where category_id=$product[main_category] and link_type='M'";
$test = db_get_hash_array($q,'product_id');
sort($test);
for ($i=0;$i
if ($test[$i]['product_id'] == $product_id) {
if ($i==0) $prev_id = $test[$last]['product_id'];
else $prev_id = $test[$i-1]['product_id'];
if ($i == $last) $next_id = $test[0]['product_id'];
else $next_id = $test[$i+1]['product_id'];
$i = $last;
}
}
$next = fn_get_product_data($next_id, $auth, $cart_language);
$previous = fn_get_product_data($prev_id, $auth, $cart_language);
$smarty->assign('next', $next);
$smarty->assign('previous', $previous);
save and exit
lastly, in skins//customer/products_pages/product_details.tpl
enter something like:
```php
{if ($previous.product_id!=0 && $previous.product_id!='')} « Previous {/if} |
{if ($next.product_id!=0 && $next.product_id!='')} Next » {/if} |
```
wherever you would like the prev/next links to appear (top, bottom, top and bottom, etc...)
save, exit and enjoy
note: if you used the version of the mod I posted in another thread, this is an updated version of that, and some code has changed so that it works with the SEO functionality of cscart's seo addon