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

Add to cart button on product listing

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 01-15-2003, 06:30 AM
 
Blackhawk Blackhawk is offline
 

Senior Member
  
Join Date: Dec 2002
Location: United States
Posts: 101
 

Default Thanks

This code took 2 items of my TODO list at one time!! Thanks LeeD!!
Reply With Quote
  #12  
Old 01-15-2003, 04:49 PM
 
John7 John7 is offline
 

Senior Member
  
Join Date: Jan 2003
Posts: 136
 

Default

Okay I'm gonna start a new thread with my question then.
Reply With Quote
  #13  
Old 02-17-2003, 03:08 PM
 
movienett movienett is offline
 

Member
  
Join Date: Feb 2003
Location: Norway
Posts: 27
 

Default

would anyone be so kind and paste in the code for 3 columns layout ?

thx !!!
Reply With Quote
  #14  
Old 03-07-2003, 04:08 AM
 
ajaycg ajaycg is offline
 

Newbie
  
Join Date: Jan 2003
Posts: 8
 

Default fantastic, but one slight bug??;o(

Hi LeeD

I've implemented the addtocart to show up in the main product list, however whenever I press the addtocart for the first top most product listed, I get an error and it doesn't work, however it works for all the products that follow beneath it.

Any ideas?

I tried it in Netscape and it works fine..

the url for the first product is document.orderform_0.submit

is it something to do with it being Zero?

Cheers

Aj..
Reply With Quote
  #15  
Old 03-07-2003, 05:48 AM
 
machnhed1 machnhed1 is offline
 

eXpert
  
Join Date: Feb 2003
Location: Illinois
Posts: 274
 

Default Excellent Work

leed,

Just wanted to say thanks for the great code. It worked like a charm, kudos to you.

P.S. - You can edit your original post to remove the [/i] so that it doesn't keep tripping people up. Then just delete your "Oops..." post.
Reply With Quote
  #16  
Old 03-08-2003, 08:47 PM
 
aussib aussib is offline
 

Newbie
  
Join Date: Mar 2003
Posts: 9
 

Default

Thanks for this code I changed it slightly for people who only want one product per row....

Quote:
{* $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>
</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>
<tr><td>
<form name=orderform_{%product.index%} method=post action="cart.php?mode=add">
<td align=left> <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}>Mor e info...</a>
</td>
</form>

</td>
</tr>

</table>






{/section}
Works a treat
Reply With Quote
  #17  
Old 03-09-2003, 01:48 AM
 
ajaycg ajaycg is offline
 

Newbie
  
Join Date: Jan 2003
Posts: 8
 

Default 1st item in list to cart

Hi Aussieb

Cheers for that.. much cleaner than I one I fudged, Im still getting the same problem though, I cant seem to add the first item, comes up with error, it doesnt submit, yet all the ones below all add to cart perfectly.

Any ideas..

Cheers

-Aj..
Reply With Quote
  #18  
Old 04-06-2003, 12:32 AM
 
aussib aussib is offline
 

Newbie
  
Join Date: Mar 2003
Posts: 9
 

Default

sorry I can't be of help - I didn't have that problem when I made the change - all products were working fine.,
I have actually just done a total re install so am back to square one myself - teach me for hurrying and not making backup copies won't it?!
Reply With Quote
  #19  
Old 04-06-2003, 05:14 AM
 
aussib aussib is offline
 

Newbie
  
Join Date: Mar 2003
Posts: 9
 

Default

ok - I have added this code again and I am not not sure what you mean. Do you mean the first listed product won't add? Mine will so not sure what the prob you are having is?
I have tested all the products on all the pages and they work a treat?

Is it skin1/customer/main/products.tpl that you changed?
Reply With Quote
  #20  
Old 04-06-2003, 07:51 AM
 
ajaycg ajaycg is offline
 

Newbie
  
Join Date: Jan 2003
Posts: 8
 

Default

Hey, cheers for responding.

I blew away the db, reimported, and it works fine now.. bizarre!!!

thanks matey

Aj..
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 04:13 PM.

   

 
X-Cart forums © 2001-2020