X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Random Image or Random Products - Category Specific (https://forum.x-cart.com/showthread.php?t=17659)

totaltec 10-24-2012 07:33 PM

Re: Random Image or Random Products - Category Specific
 
If you have the product id then you have the URL. the URL is product.php?productid={$productid} Look at the template, what is the code for the link look like?

franki 10-24-2012 07:40 PM

Re: Random Image or Random Products - Category Specific
 
I'm using the exact template as provided in this thread, but a href is blank in the rendered HTML.

Code:

[random.tpl]

{capture name=dialog}
{if $r_products ne ""}
{include file="customer/main/products.tpl" products=$r_products}
{/if}
{/capture}
{include file="dialog.tpl" content=$smarty.capture.dialog extra="width=100%"}


Do we need to pass more parameters herein?

and customer/main/products.tpl is the stock xcart file without any mods...

franki 10-25-2012 01:34 AM

Re: Random Image or Random Products - Category Specific
 
Code:

<a href="{$product.alt_url|default:$product.page_url|amp}" class="product-title">{$product.product|amp}</a>

the above is the a href code from products.tpl

and by changing it to (and create a new template file so not to wreck products.tmp; e.g. products_random.tpl:

Code:

<a href="product.php?productid={$product.productid}" class="product-title">{$product.product|amp}</a>

This now fixes the problems.

One other thing is, this only display the product name (and link) and it's thumbnail, but it doesn't display the price, buy now button, etc...


All times are GMT -8. The time now is 07:22 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.