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

add to cart link?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-27-2004, 06:20 AM
 
Emerson Emerson is offline
 

X-Man
  
Join Date: Mar 2004
Location: Atlanta, GA
Posts: 2,209
 

Default add to cart link?

Do you guys know how I can add an add to cart text link on the products.tpl file?

Thanks
__________________
Emerson
Total Server Solutions LLC- Quality X-Cart Hosting
Recommended X-Cart Hosting Provider - US and UK servers
Does your host backup your site? We do EVERY HOUR!!!
Shared Hosting | Managed Cloud | Dedicated Servers
Reply With Quote
  #2  
Old 09-27-2004, 07:12 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

Version ?
Reply With Quote
  #3  
Old 09-27-2004, 07:14 AM
 
Emerson Emerson is offline
 

X-Man
  
Join Date: Mar 2004
Location: Atlanta, GA
Posts: 2,209
 

Default

DOH!
Sorry Jon
4.0.4
__________________
Emerson
Total Server Solutions LLC- Quality X-Cart Hosting
Recommended X-Cart Hosting Provider - US and UK servers
Does your host backup your site? We do EVERY HOUR!!!
Shared Hosting | Managed Cloud | Dedicated Servers
Reply With Quote
  #4  
Old 09-27-2004, 07:26 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

4.0 doesn't have an add to cart there ?

I pulled some key code from the product.tpl that you can try adding to the products.tpl

No idea if this will work but backup and give it a try

Code:
{* MUST SHOW FORM POST (Note the form name is modified for each product)*} <FORM name="orderform-{$product.productid}" method="post" action="cart.php?mode=add" OnSubmit="javascript: return FormValidation();"> {* MUST SHOW HIDDEN FIELDS *} <INPUT type="hidden" name="productid" value="{$product.productid}"> <INPUT type="hidden" name="cat" value="{$smarty.get.cat|escape:"html"}"> <INPUT type="hidden" name="page" value="{$smarty.get.page|escape:"html"}"> {* To show subscription information *} {if $active_modules.Subscriptions ne "" and $subscription} {include file="modules/Subscriptions/subscription_info.tpl"} {/if} {* To show product options *} {if $active_modules.Product_Options ne ""} { include file="modules/Product_Options/customer_options.tpl"} {/if} {* To show amount text box*} {if $product.distribution eq ""} <input type="text" name="amount"> {/if} {* Submit Button *} {if $js_enabled} {if $smarty.get.pconf ne ""} <INPUT type="hidden" name="slot" value="{$smarty.get.slot}"> <INPUT type="hidden" name="addproductid" value="{$product.productid}"> {include file="buttons/button.tpl" button_title=$lng.lbl_pconf_add_to_configuration style="button" href="javascript:if(FormValidation()) `$ldelim`document.orderform.productid.value='`$smarty.get.pconf`';document.orderform.action='pconf.php';document.orderform.submit()`$rdelim`"} {/if} {if $product.forsale ne "B"} {include file="buttons/add_to_cart.tpl" style="button" href="javascript:if (FormValidation()) document.orderform.submit()"} {else} {$lng.txt_pconf_product_is_bundled} {/if} {else} {include file="submit_wo_js.tpl" value=$lng.lbl_add_to_cart} {/if} {* MUST SHOW FORM END *} </FORM>
Reply With Quote
  #5  
Old 09-27-2004, 07:41 AM
 
Emerson Emerson is offline
 

X-Man
  
Join Date: Mar 2004
Location: Atlanta, GA
Posts: 2,209
 

Default

Nope, that didn't do it
__________________
Emerson
Total Server Solutions LLC- Quality X-Cart Hosting
Recommended X-Cart Hosting Provider - US and UK servers
Does your host backup your site? We do EVERY HOUR!!!
Shared Hosting | Managed Cloud | Dedicated Servers
Reply With Quote
  #6  
Old 09-27-2004, 07:50 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

How did u implement it?
Reply With Quote
  #7  
Old 09-27-2004, 07:53 AM
 
Emerson Emerson is offline
 

X-Man
  
Join Date: Mar 2004
Location: Atlanta, GA
Posts: 2,209
 

Default

I copied the code above into the products.tpl file.
Tryed a couple of different things but no matter what I do I get a JS error)object expected) when I click the button.
__________________
Emerson
Total Server Solutions LLC- Quality X-Cart Hosting
Recommended X-Cart Hosting Provider - US and UK servers
Does your host backup your site? We do EVERY HOUR!!!
Shared Hosting | Managed Cloud | Dedicated Servers
Reply With Quote
  #8  
Old 09-27-2004, 08:12 AM
 
Emerson Emerson is offline
 

X-Man
  
Join Date: Mar 2004
Location: Atlanta, GA
Posts: 2,209
 

Default

Here it is:
Code:

This will add the product to the cart from the products.tpl file.

Now if I could figure out how to get the extra fields to display on the products.tpl my store would be finished
__________________
Emerson
Total Server Solutions LLC- Quality X-Cart Hosting
Recommended X-Cart Hosting Provider - US and UK servers
Does your host backup your site? We do EVERY HOUR!!!
Shared Hosting | Managed Cloud | Dedicated Servers
Reply With Quote
  #9  
Old 09-27-2004, 09:17 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

Pretty sure you need a form field in order to do product options, amounts, etc. I have it functioning well on my store with the 3.5.x version.

You can't just copy the code I provided exactly, you have to take those components and implement them skillfully so that they appear around each product.

If you'd like some assistance and have MSN Messenger you can PM me your MSN email
Reply With Quote
  #10  
Old 09-27-2004, 09:38 AM
 
Emerson Emerson is offline
 

X-Man
  
Join Date: Mar 2004
Location: Atlanta, GA
Posts: 2,209
 

Default

Hi Jon,
I got the link to work with the code I posted above.

Thanks
__________________
Emerson
Total Server Solutions LLC- Quality X-Cart Hosting
Recommended X-Cart Hosting Provider - US and UK servers
Does your host backup your site? We do EVERY HOUR!!!
Shared Hosting | Managed Cloud | Dedicated Servers
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 03:32 AM.

   

 
X-Cart forums © 2001-2020