1

I've been learning cart throb for about a month off and on and there's one functionality that seems to be missing. If I'm trying to purchase three black shirts I will use a quantity tag:

{exp:cartthrob:multi_add_to_cart_form class='forms product-forms id{purchasable_products:entry_id} off' entry_id="{purchasable_products:entry_id}" no_tax="{no_tax}"}

                <input type="hidden" name="entry_id[{count}]" value="{entry_id}" />

                    {exp:cartthrob:item_options entry_id="{purchasable_products:entry_id}"}

                        {select class='width-70 margin-bottom' limit="1"}
                            <option {selected} value="{option_value}">{option_value} {if option_price_numeric != 0} ({option_price}){/if}</option>
                        {/select}

                    {/exp:cartthrob:item_options}

                    <input type="text" class="product_quantity" name="quantity[{count}]" value="1">

                    </label>

                    <p>
                        <button type="submit" class="btn btn-green add-to-cart" data-target="cart-update">Add to Cart</button>
                        <a href="/shopping/view-cart" class="btn btn-blue btn-disabled view-cart-button"><i class="icon icon-shopping-cart"></i>View Cart</a>
                        <a href="/shopping/checkout" class="btn btn-green btn-disabled checkout-button">Checkout</a>
                    </p>
                {/exp:cartthrob:multi_add_to_cart_form}

When I add those three items, they show in my cart as three separate entries rather than one entry with one quantity.

Which says items are added, but the cart total is $0.00 and still shows as multiple entires in the view cart page. View cart code is

{exp:cartthrob:cart_items_info} 
    {product_photos limit='1'}
            <img src="{product_photos:photo}" alt="{product_photos:photo_title}">
    {/product_photos}
    <h3 class="pull-left">{title}</h3>

Which results in looped out items, but adds no money to the cart. My goal is to only show a single item, with its proper quantity and proper cart price.

1

This is a settings in your CartThrob options, I don't have the latest version of CT installed but should be able to goto CartThrob > Products > Product Options > Split multiple quantities into single items. In your case you would probably want "No".

From the cartthrob_lang.php file since I don't think it is mentioned in their docs:

If your prodcts can be configured with unique options (like color, shape, size, personalization) set this to "yes." Normally, if your products do not have configuration options, setting this to "no" add quantiy if "add to cart" is used multiple times on the same product. If this is set to "yes" each time "add to cart" is used on one product a completely new product will be added to the cart.

Since it appears you are only adding a single item to the cart you would be perfectly fine using the add_to_cart_form instead of the multi.

Your view cart_items_info tag does not look complete which would cause some issues with proper outputting. I think you are interested in the {exp:cart throb:cart_total} or {exp:cart throb:cart_subtotal} tags among others to show the actual cart value along side of {exp:cart throb:cart_items_info} tag pair.

| improve this answer | |
  • I have updated my answer to address the second portion of your question. – Justin Long Apr 29 '15 at 21:19
  • Brilliant! In the latest version the nav tree looks like CartThrob > Products then scroll to the bottom to find "Product Options." From there you'll see "Split multiple quantities into single items" and select "no." – thatgibbyguy Apr 30 '15 at 14:27
  • Glad that I was able to help. – Justin Long Apr 30 '15 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.