I've got a cartthrob site where I have two product channels and then an "on_the_fly" product, where a user will enter their data for account number, price and client fields. Here is my add_to_cart code:
{exp:cartthrob:add_to_cart_form
allow_user_price="yes"
entry_id="{entry_id}"
on_the_fly="y"
return="cart"
tax_exempt="yes"
title="Online Bill Pay"
}
<input type="text" name="item_options[account_number]" value="" placeholder="Account Number">
<input type="text" name="price" value="" placeholder="Dollar Amount Owed">
<input type="text" name="item_options[client]" value="" placeholder="Person Being Served">
<input type="submit" value="Add to Cart">
{/exp:cartthrob:add_to_cart_form}
I would assume that would put an item in my cart titled: "Online Bill Pay" with the three options of account_number, price and client appearing in the cart. Only thing that appears in the cart is the title (obviously, its hard-coded) and the price.
And here is my cart template (the switchee conditional is hopefully used to help decipher between my two product channels and the one that I'm adding on the fly) which has no channel name. Perhaps there is a better way to detecting this -- if so I'm open to suggestions.
{exp:cartthrob:cart_items_info}
{if no_items}There's nothing in your cart{/if}
{if first_row}
{exp:cartthrob:update_cart_form return="/cart/"}
{/if}
{exp:switchee variable='{channel_short_name}' parse='inward'}
{case value='events|workshops'}
{exp:channel_images:images entry_id="{entry_id}"}
<img src="{image:url:large}">
{/exp:channel_images:images}
{/case}
{case value=''}
<img src="image.jpg">
{/case}
{/exp:switchee}
<a href="{exp:switchee variable='{channel_short_name}' parse='inward'}
{case value='events'}/events/{url_title}{/case}
{case value='workshops'}/workshops/{url_title}{/case}
{case value=''}/pay{/case}{/exp:switchee}">{title}</a>
{if dynamic}
{exp:cartthrob:item_options row_id="{row_id}"}
{options}
{option_value}
{/options}
{/exp:cartthrob:item_options}
{if:else}
{summary}
{/if}
Quantity: {quantity} @ {item_price}/ea
<a href="/cart/delete/{row_id}">Remove Item</a>
<h4>{cart_total}</h4>
{/exp:cartthrob:cart_items_info}
To recap: I'm not getting the item options for account number or client in the add to cart form to show in the cart. In the cart, I'm unable to detect if this is an existing product channel or my on the fly, user-populated product. Can anyone please advise where I'm going wrong? TIA.