Changing customer text in cart/ checkout

Permalink Browser Info Environment
Hey John,

First of all - thank you. Great Add on. Client loves it.

I'm having some trouble changing the text towards the end of checkout. We have 1 zone, Canada, which adds $2.

The message when not qualifying for the zone (cont. US) is "Eligible For Free Shipping Delivery to ." and when qualifying "Delivery to zone Canada.".

I looked up the text 'Delivery to zone' in the controller.php, found it in two locations, and can't seem to change it on the site. I copied it, along with it's 5 nested folders, over to the root/models folder.

Might you have any other suggestions? This is more a generic C5 issue, but copying logic into a corresponding root folder has overwritten what I've needed in the past...

Thanks!

Joel

joel@joelsites.com

Type: Discussion
Status: Archived
joelhansen
View Replies: View Best Answer
joelhansen replied on at Permalink Reply 1 Attachment
joelhansen
Here is where I copied the logic to for editing. Thanks John!
JohntheFish replied on at Permalink Reply
JohntheFish
Overrides of shipping methods is handled by core commerce rather than by the shipping method itself. I suspect that you may have to uninstall zone based shipping for the override to work.

Whenever I get into display mashing issues, I tend to reach for jQuery. If you are comfortable with jQuery, you could do something like I posted for unknown costs at: http://www.concrete5.org/marketplace/addons/zone-based-shipping/for...

I also posted some completely untested code to modify a cost of '0' to 'Free' in a support request (code and text copied here). Its untested, so will likely need tweaking and debugging.
<script>
$(document).ready(function() {
  $("td.ccm-core-commerce-cart-price").each(function(){
    var price = parseInt($(this).text(),10);
    if (price == 0){
      $(this).text('Free');
    }
  });
});
</script>


What the script does is look for table elements (td) of class 'ccm-core-commerce-cart-price', extract the numeric part, and where it is '0' change it to 'Free'.

Beware that it will change all elements that match, not just the shipping row of the cart.

The easiest place to put the code is at the end of a theme header or footer. But it could go anywhere that puts html onto the page.

You could use a similar technique to modify the delivery message text. Again, completely untested script:
<script>
$(document).ready(function() {
  $("#ccm-core-commerce-checkout-cart td.ccm-core-commerce-cart-name").each(function(){
    var cn_text = $(this).text();
    if (cn_text.match(/Delivery to ....../i)){ // whatever you want to match and replace
      $(this).text('Whatever you want the text to be');
    }
  });
});
</script>

This looks through rows of the checkout table, finds one with the delivery message, and replaces the text in it.


Adding some user configuration capability for the checkout messages (at least as far as I can within the overall confines of core commerce) is something I have on my list of enhancements for version 2. However, I don't expect to have time to do this before the end of January.
JohntheFish replied on at Permalink Reply
JohntheFish
If you get the overrides to work, or alternatively just hack the controller in place and make a note in case of any upgrade, its only the first bit of text you need to change (line 606)
$ship_note = t('Delivery to zone ').......


The second use of the text on line 612 is only for the built in diagnostics, so the customer never sees it.
joelhansen replied on at Permalink Reply
joelhansen
Hey John!

Thanks for the in-depth reply. Yeah, giving the client control of that text is a much requested feature for your next update, even if I have to pay for it!

I changed the $ship_note in /models and it took an uninstall/ reinstall for the changes to take effect. For some reason (luckily, I suppose) none of my shipping rules were removed. So, all is well and it's working!

Another oddity is that when custom shipping criteria is not met it displays the custom "Eligible for free shipping" message in addition to $ship_note. In our case that means all US orders which are free shipping display "Eligible for free shipping Delivery to". I simply made a United States zone with $0.00 addition and don't currently use the customizable 'free shipping' message.

It'll work! :)

Other than the lack of message control on the front-end this add on is truly superb. Thanks again for your help.

Joel

http://www.guavakids.com
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
After a few requests I have decided to bring forward the configurable message functionality on zone based shipping (rather than leave it for the next major version).

It is currently in beta test and I expect to have version Zone Based Shipping version 1.1 with configurable customer messages ready to go within the next few days.
JohntheFish replied on at Permalink Reply
JohntheFish
Version 1.1 is now released with configurable messages for the cost rules.
JohntheFish replied on at Permalink Reply
JohntheFish
Version 1.5 has now extended the configurable message mechanism and includes special processing for 'null' messages, so that 'null' is returned to eCommerce.
JohntheFish replied on at Permalink Reply
JohntheFish
The following placeholders can now be used within any checkout message or the unknown cost message:

[%shipping-zone%] - the zone matched.
[%cart-weight%] - the cart weight.
[%mod-cart-weight%] - the modified cart weight.
[%items%] - the number of items in the cart.
[%null%] - forces a null return, so no shipping method.

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.