Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Add to cart button

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 05-03-2003, 01:02 PM
 
aden aden is offline
 

Member
  
Join Date: Mar 2003
Posts: 16
 

Default Add to cart button

Hi I have read over the add to cart post, and added it the products.tpl , It seems to work for the first two products listed, but for the rest of the products when i click on the add to cart button, it gives me the message: "Access denied ! You are not allowed to access that resource!"

Can anyone tell me why i may be getting this message? I added the <form> </form> code to my products.tpl, which is from the earlier post concerning the add to cart button. Can someone look over the following code to see why I may be getting the above error message? To see the problem in actions you can go to "www.healthtreasures.com/xcart/customer " You can click on any of the product categories. you notice that it works and adds the first two products on the list, but if you try to click on the add to cart button for the ones below, it gives me the above mentioned error message. Any help would be appreciated. Thanks.

Aden
-----------------------------------------

{* $Id: products.tpl,v 1.21.2.1 2003/01/20 12:57:59 svowl Exp $ *}
{section name=product loop=$products}
<table border=0 width=100%>
<tr><td width=90 align=center valign=top>
<a href=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}>{in clude file="product_thumbnail.tpl" productid=$products[product].productid image_x=70 product=$products[product].product}
{$lng.lbl_see_details}</a>


<form name=orderform_{%product.index%} method=post action="cart.php?mode=add">
<a href="javascript: document.orderform_{%product.index%}.submit()">
{include file="buttons/add_to_cart.tpl"}</a>
<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=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}></a>
</form> </td>
<td valign=top>
{$products[product].product|escape}</font>
<font size=1>




{$products[product].descr|truncate:300:"...":true}


</font>
<hr size=1 noshade width=230 align=left>
{if $active_modules.Subscriptions ne "" and $products[product].catalogprice}
{include file="modules/Subscriptions/subscription_info_inlist.tpl"}
{else}
{if $products[product].price ne 0}
{if $products[product].discount ne 0}
<font class=MarketPrice>{$lng.lbl_market_price}: <s>
{math equation="price/(1-(discount/100))" price=$products[product].price discount=$products[product].discount format="%d.00" assign=unformatted}{include file="currency.tpl" value=$unformatted}
</s></font>

{/if}
<font class=ProductPrice>{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].price}</font>{if $products[product].discount ne 0}, save {$products[product].discount}%{/if}{if $config.General.use_vat eq "Y"}, {$lng.lbl_including_vat} {$products[product].vat}%{/if}
{else}
<font class=ProductPrice>{$lng.lbl_enter_your_price}</font>
{/if}
{/if}
</td></tr>
</table>






{/section}
------------------------------------------------
Reply With Quote
  #2  
Old 05-17-2003, 11:27 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

have you got a url for this that I could peek at to see if there is anything wrong with the html output of the template?
__________________
ex x-cart guru
Reply With Quote
  #3  
Old 05-18-2003, 07:55 AM
 
aden aden is offline
 

Member
  
Join Date: Mar 2003
Posts: 16
 

Default Add to cart

Hi,

Yes, the url for the cart is http://www.healthtreasures.com/xcart/customer/

please let me knwo what you find that maybe the problem. I appreciate your help very much.

Thanks,

Aden
Reply With Quote
  #4  
Old 05-21-2003, 08:48 PM
  RazorWriter's Avatar 
RazorWriter RazorWriter is offline
 

Advanced Member
  
Join Date: Dec 2002
Location: Arizona, USA
Posts: 50
 

Default

I added this to my cart and it works fine. I don't know what could be wrong your code, but then again this only like the third template I've ever touched.

It does look like you have an extra href tag that shoulnt be inside the form though:

<a href=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}></a>
Reply With Quote
  #5  
Old 05-22-2003, 03:37 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

javascript: document.orderform_5.submit()

notice how this changes on each product. the orderform_? bit goes up.

Look like you may have dropped this code into the wriong place and its in a loop.

I would restore the template and try again. make sure your code goes within the section tabs
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:47 AM.

   

 
X-Cart forums © 2001-2020