4

I'm scratching my head with a Cart Throb problem.

I have a custom extension that handles tax, and it is returning the value of tax properly. But the tax is not being added to the total in the cart.

At this point I'm stuck and can't make any progress. Any help would be appreciated.

The extension file is available here: download

So the returned tax value from the extension is correct, but it's not having any effect on the total.

The template code looks like this:

{exp:cartthrob:cart_items_info}

        {if first_row}
            <table class="ck-table">
            <tbody>
                <tr class="ck-header">
                    <th class="ck-header-id">ID</th>
                    <th class="ck-header-product">Product</th>
                    <th class="ck-header-price">Price</th>
                    <th class="ck-header-quantity">Quantity</th>
                    <th class="ck-header-cost">Cost</th>
                </tr>
        {/if}

                <tr class="ck-product{if title == 'Cooler Case'} ck-cooler-case{/if}">
                    <td>{prd_id}</td>
                    <td>{title}</td>
                    <td>{item_price}</td>
                    <td>{quantity}</td>
                    <td>{item_subtotal}</td>
                </tr>

        {if last_row}
                <tr class="ck-subtotal">
                    <td colspan="2"></td>
                    <td class="ck-subtotal-label">Subtotal:</td>
                    <td class="ck-subtotal-cost" colspan="2">{cart_subtotal}</td>
                </tr>
        {exp:cartthrob_order_discounts field="order_discounts"}
        {if has_discounts}
        {discounts}
        {if discount_count == 1}
                <tr class="ck-discount-header">
                    <th colspan="2"></th>
                    <th class="ck-discount-title">Discounts</th>
                    <th class="ck-discount-amount" colspan="2">Savings</th>
                </tr>
        {/if}
                <tr class="ck-discount">
                    <td colspan="2"></td>
                    <td class="ck-discount-title">{discount_title}</td>
                    <td class="ck-discount-amount" colspan="2">-{discount_amount}</td>
                </tr>
        {/discounts}
        {/if}
        {/exp:cartthrob_order_discounts}
                {!--
                <tr class="ck-discount">
                    <td colspan="2"></td>
                    <td class="ck-subtotal-label">Total Discounts:</td>
                    <td class="ck-subtotal-cost" colspan="2">-{cart_discount}</td>
                </tr>
                --}
                <tr class="ck-subtotal">
                    <td colspan="2"></td>
                    <td class="ck-subtotal-label">Shipping:</td>
                    <td class="ck-subtotal-cost" colspan="2">{cart_shipping}</td>
                </tr>
                <tr class="ck-subtotal">
                    <td colspan="2"></td>
                    <td class="ck-subtotal-label">Tax:</td>
                    <td class="ck-subtotal-cost" colspan="2">{cart_tax}</td>
                </tr>
                <tr class="ck-total">
                    <td colspan="2"></td>
                    <td class="ck-total-label">Total:</td>
                    <td class="ck-total-cost" colspan="2">{cart_total}</td>
                </tr>
                <tr class="ck-buttons">
                    <td colspan="3"></td>
                    <td colspan="2">
                        <a href="/checkout/payment/" class="btn-sprite" id="btn-continue">Continue</a>
                    </td>
                </tr>
            </tbody>
            </table>
        {/if}

        {if no_results}
            <p>There is nothing in your cart.</p>
        {/if}

    {/exp:cartthrob:cart_items_info}

and here is the add to cart form:

{exp:cartthrob:add_to_cart_form return="cart"}

    {!-- Required Hidden Fields --}
    <input type="hidden" name="entry_id" value="{entry_id}" />
    {!-- Used by AJAX add to cart --}
    <input type="hidden" name="ajax_product_title" value="{title}" />
    <input type="hidden" name="ajax_image_url" value="{product_detail_image}" />

    <table>
        <tr>
            <th class="pl-add-to-cart-quantity">Qnty.</th>
            <th class="pl-add-to-cart-recipient">Send to</th>
        </tr>
        <tr>
            <td>
                <select name="quantity">
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                    <option value="5">5</option>
                    <option value="6">6</option>
                    <option value="7">7</option>
                    <option value="8">8</option>
                    <option value="9">9</option>
                    <option value="10">10</option>
                    <option value="11">11</option>
                    <option value="12">12</option>
                    <option value="13">13</option>
                    <option value="14">14</option>
                    <option value="15">15</option>
                    <option value="16">16</option>
                    <option value="17">17</option>
                    <option value="18">18</option>
                    <option value="19">19</option>
                    <option value="20">20</option>
                    <option value="21">21</option>
                    <option value="22">22</option>
                    <option value="23">23</option>
                    <option value="24">24</option>
                    <option value="25">25</option>
                    <option value="26">26</option>
                    <option value="27">27</option>
                    <option value="28">28</option>
                    <option value="29">29</option>
                    <option value="30">30</option>
                </select>
            </td>
            <td>
                {!--
                    @NOTE: this outputs a select menu to assign the product to a recipient using item_options[address_id]
                --}
                {exp:cartthrob_multi_shipto:address_select new_recipient="yes" class="recipient-selector"}
            </td>
        </tr>
    </table>

    <a class="submit-image-replace sprite-add-to-cart ajax-add-to-cart" href="/cart/">Add to Cart</a>
    <input type="submit" class="hide" value="Add to Cart" />

{/exp:cartthrob:add_to_cart_form}
8
  • More details would help gather more answers with better quality. Perhaps a download to the custom extension or details about exactly what it is doing and then template code as well. – CreateSean Dec 21 '12 at 16:56
  • can you also post your add_to_cart form? – Mel Dec 22 '12 at 12:11
  • sure thing, posted – mjr Dec 22 '12 at 17:58
  • Have you contacted CartThrob support with this? Those folks don't spend any time here I don't think. You might have better luck in their support forums. – Derek Hogue Jan 4 '13 at 14:03
  • Yes, I have. Because this post was made during the Christmas season and response time from them has been slow, I was trying every option available to me. I understand it's a complex question, but figured there's not harm in asking? Maybe someone out there smarter than me that has come across something similar before. – mjr Jan 4 '13 at 17:26
1

Issue resolved with the CT guys help. For your info...

There is a Cart Throb core file that has a method to calculate the total. That method was checking for the value of the tax plugin but not the extension. They modified the core file and now it checks for both plugin and extension.

Future versions of CT will have this baked in.

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.