Cart: Check If It Contains Items With Free Shipping

CS-Cart 2.1.4



I need to check if shopping cart contains products with free shipping (in our case items that are shipped by email as coupon codes)



If cart contains this kind of items, I need to add a fixed amount for taxes and handling to order total.



I am trying to modify views/checkout/components/cart_content.tpl,(I think it's the right file?)



I need to check each product (cycle cs-cart $smarty.session.cart.products , am I right?) and adding a"tax and expenses" amount and then that amount to cart total



any hints?

thanks

Hi,

You are on the wrong track, you need to modify php files ;) tpl are just for display, php files are doing the hard work

You can check the hook function [color=#ff0000]calculate_cart_items[/color]

the documentation can be found here [url=“Hooks base”]Hooks base



I hope that helps,





Valentin

[color=#808080][size=2]part of hungryweb.net[/size][/color]

thanks, I am mostly done editing some bits on a tpl file called [color=#ff0000]checkout_totals_info.tpl[/color]



If cart comtains all items with free shipping i need to add 1.35 euros to total (small amount for processing email orders). If there's at least a physical products this small amount is not needed.



here's what I did, (It works well but I need some more work…1.35 has been added to cart total, but on checkout it disappears. I think I need to investogate what you suggest: [color=#ff0000]calculate_cart_items[/color])





{if $location == “cart” && $cart.shipping_required == false }



  • {$lang.payment_surcharge}:

    {include file=“common_templates/price.tpl” value=“1.35” span_id=“payment_surcharge_value”}



  • {math equation=“x+y” x=$cart.total y=“1.35” assign=“_total”}

    {/if}

    i have got this working until checkout…

    but once processed, order total remain the same



    How can I access Order Total amount? I am fiddling with $order_info but no luck so far… :-(

    I have been figuring out how to do a similar thing but just to alter displayed options. As per Vali's post as you are wanting to make database cart changes you are in the wrong place to do this really. Sounds like you are making template/display changes which are then lost as are not being saved to the database. I'm guessing it could be done here in some messy way but you have to update the mysql database maybe…