Quote:
Originally Posted by jones
Hmm. I will need to rebuild this mod :O)
If you don't use memberships options in your store you can use this variant:
$mem_list = func_query("SELECT pr.productid, pr.product FROM $sql_tbl[products_categories] AS cat, $sql_tbl[products] AS pr WHERE cat.categoryid = '$product_info[categoryid]' AND pr.productid = cat.productid AND pr.forsale='Y' ORDER BY pr.product");
Alex
|
Hi Alex,
thank you for the PREV|NEXT Mod. It's very handy. I don't even understand why it's not a standart mod in x-cart
Everything is working when it's a product's main category. And when it's an
additional category, the
next and
previous link to the products from the main category while it should keep the id # of additional category.
That's how it looks:
http://www.clikinternational.com/home.php?cat=24
For ex., click on "Glossy Buttons", there should be:
<- Previous (Oval Label) | (Photoshop Style - Light Grey) Next->
but it's not.
I've tried to modify the code but without luck.
Here is what I tried to do:
next_prev.tpl
Code:
{* Previous *}
{if $prev.productid}
<div style="float:left;"><a href="product.php?productid={$prev.productid}&cat={$cat}" title="{$prev.product}"><img src="{$ImagesDir}/larrow.gif" width=9 height=9 border=0 alt="{$lng.lbl_prev_page}"> {$prev.product}</a></div>
{/if}
{* Next *}
{if $next.productid}
<div style="float:right;"><a href="product.php?productid={$next.productid}&cat={$cat}" title="{$next.product}">{$next.product} <img src="{$ImagesDir}/rarrow.gif" width=9 height=9 border=0 alt="{$lng.lbl_next_page}"></a></div>
{/if}
<br><br>
product.php (I didn't change anything here)
Code:
// === Next - Previous products from xCartMod.com ===
$mem_list = func_query("SELECT pr.productid, pr.product FROM $sql_tbl[products_categories] AS cat, $sql_tbl[products] AS pr WHERE cat.categoryid = '$product_info[categoryid]' AND pr.productid = cat.productid AND pr.forsale='Y' ORDER BY pr.product");
$list = array();
if (is_array($mem_list))
foreach($mem_list as $li) {
if ($li["membershipid"] == $user_account["membershipid"] || $li["membershipid"] == 0 || $li["membershipid"] == "")
$list[] = $li;
}
if (is_array($list))
foreach($list as $x=>$li)
if ($li["productid"] == $productid) {
// previous
if ($list[$x-1]["productid"] != "")
$prev = $list[$x-1];
else
$prev = end($list);
// next
if ($list[$x+1]["productid"] != "")
$next = $list[$x+1];
else
$next = $list[0];
}
$smarty->assign("next", $next);
$smarty->assign("prev", $prev);
// === Next - Previous products from xCartMod.com ====
Thank you again for this Mod.

I would appreciate if you can help me.