Page 1 of 1

Adding shipping field to cart

Posted: Sun Mar 06, 2011 4:12 am
by OptimusM
Since it is not possible to calculate shipping cost until the customer has proceeded to checkout and chosen a shipping option, I was wondering if it then is possible to instead add a field in the cart window, where it says Shipping rate: calculated on checkout?

Thank you in advance!

Re: Adding shipping field to cart

Posted: Sun Mar 06, 2011 5:30 am
by soyo
Couldn't you just add this to your template?

<Example removed as an alternate placement is required...>

1.4.9.3

Re: Adding shipping field to cart

Posted: Sun Mar 06, 2011 8:31 am
by OptimusM
Thank you for the help, I will add that field to the check-out page. But I was referring to the shopping cart module, which is located on the right or left. Anyone know how to add this?

Re: Adding shipping field to cart

Posted: Sun Mar 06, 2011 1:58 pm
by soyo
Woops ok you meant the module...

Which is good, because I just noticed that the first code I gave you needs to be in a slightly different place, else it will be repeated with multiple items added to the cart... :-( So if you still plan to put something there I can check again for the more proper insertion point... but probably not necessary if you'll be showing it in the module...

Ok then how about changing line 42 in catalog/view/theme/default/template/module/cart.tpl... (and this one should work with multiple items btw)...

from:

Code: Select all

    <div style="padding-top:5px;text-align:center;clear:both;"><a href="<?php echo $view; ?>"><?php echo $text_view; ?></a> | <a href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a></div>
to:

Code: Select all

    <div style="padding-top:5px;text-align:center;clear:both;"><div style="font-size: .8em; text-align:center;"><p>(Shipping calculated at checkout)</p></div><a href="<?php echo $view; ?>"><?php echo $text_view; ?></a> | <a href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a></div>
Remember these are just quick thoughts I'm throwing out here, not fully tested solutions... so some massaging, trial and error is in order... ;-)

1.4.9.3

Re: Adding shipping field to cart

Posted: Sun Mar 06, 2011 5:19 pm
by i2Paq
Why would you suggest something that breaks the multi-lingual of OpenCart?

You automatically assume that he has only the English language in use.

Re: Adding shipping field to cart

Posted: Sun Mar 06, 2011 9:15 pm
by OptimusM
Thank you it works perfectly ! =)

Re: Adding shipping field to cart

Posted: Mon Mar 07, 2011 2:34 am
by soyo
i2Paq wrote:Why would you suggest something that breaks the multi-lingual of OpenCart?

You automatically assume that he has only the English language in use.
Agreed. But I'm not suggesting a fix for the world of Open Cart, just trying to show OptimusM where his personal modification would go. As I stated in my previous message, this is just a quick thought to point him in the right direction, not a full-scale mod... so if he (or anyone else) is using multi-language, they would need to take that into account and modify it accordingly. Of course, if he's just using one language (english or otherwise), then his task is accomplished, albeit for his own personal situation.

In any case, your point is a good one - I will try to be more vigilant in my future responses... ;-)