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.
   
 
Pull data to a Combo box from a channel, select a row in combo box, and check them in cart
Posted: 30 July 2012 06:15 PM   [ Ignore ]
Has a Great Personality
Rank
Total Posts:  37
Joined  2012-05-15

Please help me to solve this issue

I want to get data from a table in a channel, keep them in a combo box, select one row from data rows and see them in cart.

The issue
I cannot see my selection in cart.  Cart is empty.

I have a table in channel “Tea & Herbs”.
It has four rows and three columns

I pull data from my “Tea & Herbs”  Channel. I use data modifier.

————————————————————————————
|  {option_value}  |  {option_label}  |  {price}  |
————————————————————————————
|        1         |    25gm         |  $3.50   |
————————————————————————————
|        2         |    110gm       |  $10.50 |
————————————————————————————
|        3         |    1lb           |  $50.50 |
————————————————————————————
|        4         |      15p         |  $5.50   |
————————————————————————————

This is the code I use to pull data from above table

{exp:channel:entries}
    {exp
:cartthrob:add_to_cart_form entry_id="{entry_id}" return=""}   
      
<select>
            
{retail_price}
                   
<option {selected} value="{option_value">{option_name} {price}</option>
            
{/retail_price}
                    
<input type="submit" value="Add to Cart">
      </
select>  
   
{/exp:cartthrob:add_to_cart_form} 


This is the out put

(Combo box and and button)

I want to select one choice out of four choices.  Then I want to see my selection in cart at the same page.


This is the code I use

{exp:cartthrob:item_options row_id="{row_id}" }
    {select} 
        
<option {selected} value="{option_value}">{option_name} {price}</option>
    
{/select}
 {
/exp:cartthrob:item_options} 

But nothing appears in the page.

Please guide me to find my choice in the cart.

Thank you very much

[ Edited: 30 July 2012 06:17 PM by venk ]
Image Attachments
Output.png
Profile
 
 
Posted: 31 July 2012 02:45 AM   [ Ignore ]   [ # 1 ]
Has a Great Personality
Rank
Total Posts:  37
Joined  2012-05-15

Can someone guide me to solve this issue?

Thanks

Profile
 
 
Posted: 31 July 2012 08:01 PM   [ Ignore ]   [ # 2 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  10222
Joined  2008-09-29

Can someone guide me to solve this issue?

Apologies. I missed this one.

Try this. Create a blank template (for testing purposes) and add the following code to it.

<div>
<
h2>Add to cart</h2>
    
{exp:channel:entries channel="products" dynamic="no"}
        
<div>
        
{exp:cartthrob:add_to_cart_form entry_id="{entry_id}" return=""}   
            {exp
:cartthrob:item_options entry_id="{entry_id}" }
                {select} 
                    
<option value="{option_value}">{option_name} {price}</option>
                
{/select}
            {
/exp:cartthrob:item_options}
       {
/exp:cartthrob:add_to_cart_form} 
        
</div>
    
{/exp:channel:entries}
</div>


<
div>
<
h2>View Cart</h2>
    
{exp:cartthrob:cart_items_info}
        
<div>
        
{title}<br>
        
{exp:cartthrob:item_options row_id="{row_id}" }
            {select} 
                
<option {selected} value="{option_value}">{option_name} {price}</option>
            
{/select}
        {
/exp:cartthrob:item_options}
        
</div>
    
{/exp:cartthrob:cart_items_info}
</div
 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 August 2012 04:55 AM   [ Ignore ]   [ # 3 ]
Has a Great Personality
Rank
Total Posts:  37
Joined  2012-05-15

Thank you very much.grin

I will test the code and let you know the result.

Profile
 
 
Posted: 01 August 2012 07:49 AM   [ Ignore ]   [ # 4 ]
Has a Great Personality
Rank
Total Posts:  37
Joined  2012-05-15

Thank you very much.

Is there a way to print the customer choice (option value, option name and price)made by
customer from combo box to the screen without displaying in a combo box?

Please guide me

Profile
 
 
Posted: 01 August 2012 08:11 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  10222
Joined  2008-09-29

Once the customer’s selected an option and it’s in the cart, there are several ways to display it.

1. Using Cart Items Info tags (useful if you KNOW he name of the option and you want to display only that option)

{exp:cartthrob:cart_items_info}
{item_options
:your_option}

{item_options
:your_option:price}

{item_options
:your_option:option_name}

for instance
{item_options:product_size}
{item_options
:product_color}


{
/exp:cartthrob:cart_items_info} 

 

2.  or you could add the item options tag which will output any selected option, You can do it in a list using the following example.

{exp:cartthrob:cart_items_info}
{exp:cartthrob:item_options row_id=”{row_id}”}
  {options}
      <label>{option_label}</label>
      {if selected}
        {option_name} {option_value} {price}
      {/if}
  {/options}
{/exp:cartthrob:item_options}
{/exp:cartthrob:cart_items_info}

http://cartthrob.com/docs/tags_detail/item_options/
http://cartthrob.com/docs/tags_detail/cart_items_info/

 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 August 2012 08:47 AM   [ Ignore ]   [ # 6 ]
Has a Great Personality
Rank
Total Posts:  37
Joined  2012-05-15

Thank you very much for the prompt reply.

Profile
 
 
Posted: 01 August 2012 11:23 AM   [ Ignore ]   [ # 7 ]
Has a Great Personality
Rank
Total Posts:  37
Joined  2012-05-15

Thank you very much Chris.

It works:-)

Profile