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.
   
 
Shopping Cart Problems
Posted: 01 March 2012 08:29 AM   [ Ignore ]
Is a Really Great Dancer
Avatar
RankRank
Total Posts:  69
Joined  2011-03-27

Im having a few issues with my shopping cart….

1. Id like to show the “Option Name” not the “Option” in the basket. Is there a way of doing something like this…

{item_options:cf_product_option_colour:option_name} 

2. My basket doesn’t update/delete items properly. It only lets me delete the bottom item if theres 3 items for example, or if i select all 3 items and press delete/update it just refreshes the page and doesn’t do anything. How can i fix this? Here’s my code:

{exp:cartthrob:cart_items_info}

 {if no_results}
 
<div class="note">Your basket is currently empty</div>
  
 
{/if}
 
 {exp
:channel:entries channel="{channels}" orderby="date" disable="{sn_disable_default}" limit="1"}
 
  {exp
:cartthrob:update_cart_form return="basket/index"}
  
   {if first_row}
    
<table cellpadding="0" cellspacing="0">
     <
tr>
      <
th>Product</th>
      <
th>Colour</th>
      <
th>Size</th>
      <
th>Price</th>
      <
th>Quantity</th>
      <
th>Remove</th>
     </
tr>
   
{/if}
     
<tr>
      <
td>{title}</td>
      <
td>{item_options:cf_product_option_colour}</td>
      <
td>{item_options:cf_product_option_size}</td>
      <
td>&pound;{cf_product_price}</td>
      <
td><input type="text" name="quantity[{row_id}]" value="{quantity}" class="quantity w30" /></td>
      <
td><input type="checkbox" name="delete[{row_id}]" class="checkbox"></td>
     </
tr>
   
{if last_row}
     
<tr>
      <
td colspan="5" class="table-title">Total Items</td>
      <
td class="table-title-value">{exp:cartthrob:total_items_count}</td>
     </
tr>
     <
tr>
      <
td colspan="5" class="table-title">Subtotal</td>
      <
td class="table-title-value">{cart_subtotal}</td>
     </
tr>
     <
tr>
      <
td colspan="5" class="table-title">Shipping</td>
      <
td class="table-title-value">{cart_shipping}</td>
     </
tr>
     <
tr>
      <
td colspan="5" class="table-title">Discount</td>
      <
td class="table-title-value">{cart_discount}</td>
     </
tr>
     <
tr>
      <
td colspan="5" class="table-title">VAT</td>
      <
td class="table-title-value">{cart_tax} ({cart_tax_rate}%)</td>
     </
tr>
     <
tr>
      <
td colspan="5" class="table-title">Total</td>
      <
td class="table-title-value">{cart_total}</td>
     </
tr>
    </
table>
    
    <
div class="box-content fr w320 mt18">
     <
input type="submit" value="Update Basket" title="Update Basket" class="btn-ui mr5 fl" />
     <
a href="{site_url}index.php/shop/" title="Continue Shopping" class="btn-ui colour-pink">Continue Shopping</a>
     <
a href="{site_url}index.php/basket/checkout/" title="Checkout" class="btn-ui colour-pink">Checkout</a>
    </
div>
    
   
{/if}
   
  {
/exp:cartthrob:update_cart_form}
 
 {
/exp:channel:entries}

{
/exp:cartthrob:cart_items_info} 
Profile
 
 
Posted: 01 March 2012 01:34 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRank
Total Posts:  465
Joined  2008-09-30

1. Provided that your cf_product_option_colour modifier has a field called “option_name” that is precisely how you would display it.

2. Your update_cart_form is being looped so you’re generating several forms on the page. Try this:

{exp:cartthrob:cart_items_info}

{if no_results}
    
<div class="note">Your basket is currently empty</div>
{/if}

{if first_row}
{exp
:cartthrob:update_cart_form return="basket/index"}
    
<table cellpadding="0" cellspacing="0">
     <
tr>
      <
th>Product</th>
      <
th>Colour</th>
      <
th>Size</th>
      <
th>Price</th>
      <
th>Quantity</th>
      <
th>Remove</th>
     </
tr>
   
{/if}
     
<tr>
      <
td>{title}</td>
      <
td>{item_options:cf_product_option_colour}</td>
      <
td>{item_options:cf_product_option_size}</td>
      <
td>&pound;{cf_product_price}</td>
      <
td><input type="text" name="quantity[{row_id}]" value="{quantity}" class="quantity w30" /></td>
      <
td><input type="checkbox" name="delete[{row_id}]" class="checkbox"></td>
     </
tr>
   
{if last_row}
     
<tr>
      <
td colspan="5" class="table-title">Total Items</td>
      <
td class="table-title-value">{exp:cartthrob:total_items_count}</td>
     </
tr>
     <
tr>
      <
td colspan="5" class="table-title">Subtotal</td>
      <
td class="table-title-value">{cart_subtotal}</td>
     </
tr>
     <
tr>
      <
td colspan="5" class="table-title">Shipping</td>
      <
td class="table-title-value">{cart_shipping}</td>
     </
tr>
     <
tr>
      <
td colspan="5" class="table-title">Discount</td>
      <
td class="table-title-value">{cart_discount}</td>
     </
tr>
     <
tr>
      <
td colspan="5" class="table-title">VAT</td>
      <
td class="table-title-value">{cart_tax} ({cart_tax_rate}%)</td>
     </
tr>
     <
tr>
      <
td colspan="5" class="table-title">Total</td>
      <
td class="table-title-value">{cart_total}</td>
     </
tr>
    </
table>
    
    <
div class="box-content fr w320 mt18">
     <
input type="submit" value="Update Basket" title="Update Basket" class="btn-ui mr5 fl" />
     <
a href="{site_url}index.php/shop/" title="Continue Shopping" class="btn-ui colour-pink">Continue Shopping</a>
     <
a href="{site_url}index.php/basket/checkout/" title="Checkout" class="btn-ui colour-pink">Checkout</a>
    </
div>
    
{/exp:cartthrob:update_cart_form}
   {
/if}
   
{
/exp:cartthrob:cart_items_info} 

 

 

Profile
 
 
Posted: 02 March 2012 04:21 AM   [ Ignore ]   [ # 2 ]
Is a Really Great Dancer
Avatar
RankRank
Total Posts:  69
Joined  2011-03-27

Spot on, that works great!

But i did try:

{item_options:cf_product_option_colour:option_name}

and it doesn’t work?

Profile
 
 
Posted: 02 March 2012 04:52 AM   [ Ignore ]   [ # 3 ]
Is a Really Great Dancer
Avatar
RankRank
Total Posts:  69
Joined  2011-03-27

Oh wait it does now. I don’t think it was locating it as a modifier, until i added option_value instead of just option to my Matrix

Profile
 
 
Posted: 05 March 2012 10:41 AM   [ Ignore ]   [ # 4 ]
Administrator
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Correct. CartThrob won’t recognize a Matrix field as a modifier without the option_value column.

Profile