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:  3541
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:  171
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:  10218
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 

We’re moving away from the forums, though not entirely and not immediately. Lack of support lately is coincidental to that. Unfortunately we’ve had a bad month with it, but we do not forsee that we will have any continued problems with support through our portal going forward, or on forums while we’re still transitioning. We will send out a newsletter and make additional notifications through twitter and other outlets over the coming weeks.

Moving forward; things returning to normal.

Profile
 
 
Posted: 01 December 2010 06:15 AM   [ Ignore ]   [ # 3 ]
Has a Nice Profile
RankRank
Total Posts:  171
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
 
 
Posted: 23 July 2012 12:24 PM   [ Ignore ]   [ # 4 ]
Wallflower
Rank
Total Posts:  18
Joined  2010-09-28

This doesn’t work for me. I get an error that the entry_id must be present.

Profile
 
 
Posted: 24 July 2012 12:05 PM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  10218
Joined  2008-09-29
{exp:cartthrob:add_to_cart  
quantity
="1" 
title "wharves"
on_the_fly="yes"
price="10" 
item_options:whatever="green"
return="cart/index"

 

As Hambo mentioned… needed to add on_the_fly parameter, otherwise entry id is required.

 Signature 

We’re moving away from the forums, though not entirely and not immediately. Lack of support lately is coincidental to that. Unfortunately we’ve had a bad month with it, but we do not forsee that we will have any continued problems with support through our portal going forward, or on forums while we’re still transitioning. We will send out a newsletter and make additional notifications through twitter and other outlets over the coming weeks.

Moving forward; things returning to normal.

Profile
 
 
Posted: 16 March 2013 08:36 AM   [ Ignore ]   [ # 6 ]
Wallflower
Rank
Total Posts:  13
Joined  2012-01-03

I also can’t get this to work - the on_the_fly parameter doesn’t seem to be available in the add_to_cart tag, only in the add_to_cart_form tag.

Profile