2

CartThrob appears to be tossing data away from package options on checkout. For example, if I have a package with 2 T-Shirts, with 3 options available per shirt, CartThrob only saves some of the options on checkout which leaves the data with inaccurate fulfillment data.

To test, I went and created a Package with 2 of the same items in it (1 T-Shirt twice). When I add 1 shirt with options of Black, Small, and Long Sleeve, and the other shirt with Large, White, and Short Sleeve, CartThrob only saves some of the info.

I'm using this with CartThrob 2.5 and EE 2.7.3 on PHP 5.4.7.

Am I missing something?

I've done a dump of the serialized data from the db and here's the output:

[product_size] => small
[product_options_other] => short
[product_color] => black
[sub_items] => Array
    (
        [0] => Array
            (
                [entry_id] => 3
                [title] => Test T-Shirt
                [site_id] => 1
                [quantity] => 1
                [price] => 40
                [price_plus_tax] => 48
                [weight] => 2
                [shipping] => 10
                [no_tax] => 
                [no_shipping] => 
                [product_size] => 
            )

        [1] => Array
            (
                [entry_id] => 3
                [title] => Test T-Shirt
                [site_id] => 1
                [quantity] => 1
                [price] => 40
                [price_plus_tax] => 48
                [weight] => 2
                [shipping] => 10
                [no_tax] => 
                [no_shipping] => 
                [product_size] => large
            )

    )

)

Note that the individual product arrays from the package are missing all the meta except size, but only 1 has a value.

  • Is there any consistency with the info that is saved vs what isn't saved? – Anna_MediaGirl Feb 7 '14 at 19:30
  • Not quite sure I follow you Anna. The data that's saved isn't the same as was in the cart so, no it's not consistent? – Eric Lamb Feb 7 '14 at 19:37
  • More meaning... is it always the 1st & 2nd option and not the 3rd? – Anna_MediaGirl Feb 7 '14 at 19:47
  • In your packages entry, have you made sure that all of your product's options in your packages field have the "Allow Selection?" box checked? – CartThrob - Barrett Feb 7 '14 at 21:58
  • Oh, Barrett, did you mean "did I do it the right way and not make up my own stupid way that I hoped would work?" 'cause, yeah, that's what I did. I really need to read... – Eric Lamb Feb 8 '14 at 1:14
0

As Chris Barrett said above, you have to check the boxes next to your product options allowing selection and you're all good.

Also, the Update Cart page/template needs to take into account whether the product is a Package ({if is_package}) and setting up the options form fields accordingly. That was my main problem actually; the View Cart form was setup thinking the Package was a stand alone product, so was outputting the options for one of the products instead of the options for each of the products in the Package.

Here's a snippet I used to implement in the default Store template (be sure to include in the {exp:cartthrob:update_cart_form} tag pair):

{if is_package}


    {package}
    {sub:title}<br />

    {exp:cartthrob:item_options row_id="{sub:row_id}"}
        <div class="control-group">

            {if dynamic}
                <label class="control-label" for="{option_field}">{option_label}</label>
                <div class="controls">{input}</div>
            {if:else}
                {if options_exist}
                    <label class="control-label" for="{option_field}">{option_label}</label>
                    <div class="controls">
                    {select} 
                        <option {selected} value="{option_value}">
                            {option_name}{if option_price_numeric != 0} +{option_price}{/if}
                        </option>
                    {/select}
                    </div>
                {/if}
            {/if}
        </div>
       {/exp:cartthrob:item_options}
    {/package}

{if:else}

    {exp:cartthrob:item_options row_id="{row_id}"}
        <div class="control-group">

            {if dynamic}
                <label class="control-label" for="{option_field}">{option_label}</label>
                <div class="controls">{input}</div>
            {if:else}
                {if options_exist}
                    <label class="control-label" for="{option_field}">{option_label}</label>
                    <div class="controls">
                    {select} 
                        <option {selected} value="{option_value}">
                            {option_name}{if option_price_numeric != 0} +{option_price}{/if}
                        </option>
                    {/select}
                    </div>
                {/if}
            {/if}
        </div>
       {/exp:cartthrob:item_options}
{/if}
| improve this answer | |

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.