Your account is limited to posting only in the Pre-Sales Questions forum.
Support forum access is limited to members with a purchase history.

If you are working on behalf of another member, please contact us with the name of the license holder and we will upgrade your account.
   
 
On-The-Fly Products (hard coded products)
Posted: 25 February 2010 03:43 PM   [ Ignore ]
Administrator
Avatar
RankRankRank
Total Posts:  3369
Joined  2009-05-29

Let’s say you are going to be selling one (or just a few) product(s) on your site. You may not want/need to store your products in a weblog because it seems like overkill for just a few products. Using the power of the add_to_cart_form, you can add items to your cart without having that product in a weblog.

{exp:cartthrob:add_to_cart_form 
    
return="cart/view_cart"
    
on_the_fly="y"
    
price="9.95" 
    
title="Our Site T-Shirt"
    
shipping="5"
    
weight="2"
    
}
Cost
: $9.95<br />
Shipping Cost: $5<br />
Shipping Weight2 lbs<br />
Quantity: <input type="text" name="quantity" value="1" /><br /><br />

<
input type="submit" value="Add to Cart" />

{/exp:cartthrob:add_to_cart_form} 

If you are selling multiple sizes/colors of T-Shirt, you can use the item_options variable within the add_to_cart_form tag. In this scenario, you most likely will need to set the extension setting called “Allow items to appear more than once in cart” to yes. This can be found in Product Settings > Product Options.

{exp:cartthrob:add_to_cart_form 
    
return="cart/view_cart"
    
on_the_fly="y"
    
price="9.95" 
    
title="Our Site T-Shirt"
    
shipping="5"
    
weight="2"
    
}
Cost
: $9.95<br />
Shipping Cost: $5<br />
Shipping Weight2 lbs<br /><br />
Quantity: <input type="text" name="quantity" value="1" /><br /><br />

Color{item_options:select:color values="red:Red|blue:Blue|green:Green"}<br />

<
br />

Size
{item_options:select:size}
    
<option value="S">Small</option>
    <
option value="M">Medium</option>
    <
option value="L">Large</option>
{/item_options:select:size}

<br />

<
input type="submit" value="Add to Cart" />

{/exp:cartthrob:add_to_cart_form} 
Profile
 
 
Posted: 01 December 2010 05:49 AM   [ Ignore ]   [ # 1 ]
Has a Nice Profile
RankRank
Total Posts:  165
Joined  2010-03-01

Is there anyway to automatically add a hardcoded product as soon as they hit a page?

Profile
 
 
Posted: 01 December 2010 06:04 AM   [ Ignore ]   [ # 2 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  8342
Joined  2008-09-29

yes

http://cartthrob.com/docs/tags_detail/add_to_cart

{exp:cartthrob:add_to_cart  
quantity
="1" 
title "whatevs"
price="10" 
item_options:whatever="green"
return="cart/index"
 Signature 

NOTE: If I say “I will look into x” and you PM me information, please do not hesitate to contact me again about it, if I do not respond in several hours, or at most a day. Please feel free to remind me as you see fit

Profile
 
 
Posted: 01 December 2010 06:15 AM   [ Ignore ]   [ # 3 ]
Has a Nice Profile
RankRank
Total Posts:  165
Joined  2010-03-01

Sweet!

PS. You forgot -

on_the_fly="yes" 

wink


UPDATE: I discounted this tag as the docs mention none of the above parameters…

Profile