X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Product listing with "add to cart" functionality (https://forum.x-cart.com/showthread.php?t=46)

B00MER 09-21-2002 02:43 PM

Product listing with "add to cart" functionality
 
Ability to make product listings with option to add to cart instead of making the customer click to product details before adding to their cart:

Code:

{* ADD TO CART by Josh Sowin | petsupplyonline.com *}
<form name=orderform_{%product.index%} method=post action="cart.php?mode=add">
<input type=hidden name=amount value=1>
<input type=hidden name=mode value=add>
<input type=hidden name=productid value="{$products[product].productid}">
<input type=hidden name=cat value="{$smarty.get.cat}">
<input type=hidden name=page value="{$smarty.get.page}">
<a href="javascript: document.orderform_{%product.index%}.submit()">
{include file="buttons/add_to_cart.tpl"}</a>
</form>


Thank Josh for such luvely template editing!

kudos! :wink:

amanda 10-09-2002 07:01 PM

Hi

At the risk of sounding like an idiot, where exactly do we put that code?

Thanks
Amanda

B00MER 10-09-2002 07:19 PM

[skin1]/customer/main/featured.tpl

:roll:

Anonymous 10-13-2002 06:58 PM

Ummm

I am having a bit of a problem with it... I am using the latest version x-cart.com and here is what I have changed in the file you said...

{* $Id: featured.tpl,v 1.13 2002/05/20 06:55:20 lucky Exp $ *}
{capture name=dialog}
{if $f_products ne ""}
{include file="customer/main/products.tpl" products=$f_products}
{else}
{$lng.txt_no_featured}
{/if}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_featured_products content=$smarty.capture.dialog extra="width=100%"}

{* ADD TO CART by Josh Sowin | petsupplyonline.com *}
<form name=orderform_{%product.index%} method=post action="cart.php?mode=add">
<input type=hidden name=amount value=1>
<input type=hidden name=mode value=add>
<input type=hidden name=productid value="{$products[product].productid}">
<input type=hidden name=cat value="{$smarty.get.cat}">
<input type=hidden name=page value="{$smarty.get.page}">
<a href="javascript: document.orderform_{%product.index%}.submit()">
{include file="buttons/add_to_cart.tpl"}</a>
</form>


But that didn't seem to work....

Thanks for your help.
Amanda

Jeannie 10-13-2002 08:21 PM

I'm running v3.1
Just trying out different places and found that if you add Josh's code to customer/main/products.tpl you will have an Add to Cart button on the product listing. And if you click the product to view details you have another Add to Cart button.

Anonymous 10-13-2002 10:24 PM

Thanks for that, got it working now :-)

Anonymous 10-14-2002 01:43 AM

Ok, now I have sorted that, any idea's on having a 'wish list' button on the same page???

Thanks again guys...

Amanda

B00MER 10-14-2002 02:11 AM

Code:

<a href="javascript:document.orderform_{%product.index%}.mode.value='add2wl'; document.orderform_{%product.index%}.submit()">

:wink:


All times are GMT -8. The time now is 09:28 AM.

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