Change "cart" to "Basket"
Hi
How can I change "Add to cart" to "Add to Basket", "Shopping cart" to "Shopping Basket" and so on?
Basically, because I'm developing a UK website, I'm looking to change each instance of "cart" to "basket" as that is more appropriate for this country.
Thanks.
Richard
Comments
I would think this is a job
I would think this is a job for the String Overrides module: http://drupal.org/project/stringoverrides
That seems to work in most places...
That seems to work in most places. However the message that appears when a product is added still says "your cart" (it's linked to the cart page) even though I've set "your cart" to be replace with "your basket" in String Overrides. Any idea how to go about changing this as well? Not much use if it's not going to be consistent.
Thanks.
Find and replace?
I did this by using Find and (Selective) Replace tools on my dreamweaver. You can set it to search for a string in file within a folder structure. Click Find and then hit replace is you find a valid match. i.e. text outputs.
I know thats a pretty basic way to do it, but it works.
Which folder(s) did you search?
Which folder(s) did you search?
I'm guessing this would have to be done after each update... I'd like to avoid that if at all possible.
Thanks.
yep updating is definitely
yep updating is definitely the down side to it. I am slowly learning learning Drupal, but finding it pretty tricky to do what I would consider simple things.
I am using the durpal install which contains the Commerce module pack, its called "Commerce KickStart"
With this I start my search in Profiles\commerce_Kickstart folder, I use full recursive search so all files in all folders are searched. If I had just added the commerce modules manually I would search the Sites\All\modules folders, cause thats where your downloaded modules 'should' reside.
hope it helps.
Thanks. I searched the
Thanks. I searched the commerce module folder which helped me identify exactly what strings to enter in the Sting Overrides module settings page. I would definitely recommend using that module over find & replace.
:)
Use Drupal translation functionality
I would use the Drupal Locale and Content Translation modules for this.
You can then set up a new language (British English) and simply translate all sentences with "cart" in it (and any other American English terms).
I'm actually doing this just now and might export the translation files and post this somewhere at some point.
String Overrides Works
I've managed to get this done with the String Overrides module. Here are the strings and their replacements (notice I've had to replace !cart-url with the actual site-relative path):
%title added to <a href="!cart-url">your cart</a>.
%title added to your <a href="/cart">shopping basket</a>.
%title could not be added to your cart.
%title could not be added to your shopping basket.
%title removed from your cart.
%title removed from your shopping basket.
Add to cart
Add to Basket
Shopping cart
Shopping Basket
Update cart
Update Basket
Your shopping cart has been updated.
Your shopping basket has been updated.
Your shopping cart is empty.
Your shopping basket is empty.
Shopping cart contents
Shopping basket contents
Just the url to sort now, which should hopefully just be a case of using some kind of redirect code/module.
Thanks for all the help.
Thanks, and one more
Thanks for this list. You saved me a lot of time! There'a another to add...
View cart
View basket
Ditto to the last comment,
Ditto to the last comment, have saved me a lot of time!
Works
Added the following to local.settings.php because we use Aeigr and you can't edit settings.php. Anyway same difference.
$conf['locale_custom_strings_en'][''] = array(
'Add to cart' => 'Add to Shopping Bag',
);
settings.php
Never used it, but it must be possible to add some string overrides in your settings.php
<?php
/**
* String overrides:
*
* To override specific strings on your site with or without enabling locale
* module, add an entry to this list. This functionality allows you to change
* a small number of your site's default English language interface strings.
*
* Remove the leading hash signs to enable.
*/
# $conf['locale_custom_strings_en'][''] = array(
# 'forum' => 'Discussion board',
# '@count min' => '@count minutes',
# );
?>
Thanks to spoetnik & Jason
Thanks to spoetnik & Jason Martino that config variable solve my case
Where do you get this variable?
Try hook_form_FORM_ID_alter()
I had an analogous problem when I actually wanted to get rid of the button itself, have a look at http://www.drupalcommerce.org/node/2528. I solved it by using hook_form_FORM_ID_alter() and I'm sure you could use it too, try:
function mymodule_form_commerce_cart_add_to_cart_form_alter (&$form, &$form_state, $form_id) {
// Change the text on the Add to Cart submit button
$form['submit'] = array('#value' => t('Add to basket'));
}
No promises though, I haven't tried it but I'm reasonably confident! :) Good luck.
thanks
Thanks for sharing that list of overrides - it saved me a bit of poking around!
This helped me, thanks!
This helped me, thanks!
My full array for settings.php
$conf['locale_custom_strings_en'][''] = array(
'Add to cart' => 'Add to Shopping Bag',
'Enter Quantity' => 'Quantity',
'Shopping cart' => 'Shopping Bag',
'Update cart' => 'Update Bag',
'Your shopping cart has been updated.' => 'Your Shopping Bag has been updated.',
'Your shopping cart is empty.' => 'Your Shopping Bag is empty.',
'Shopping cart contents' => 'Shopping Bag contents',
'Item successfully added to your cart' => 'Item successfully added to your bag',
);
There's a module for that...
Just used the Commerce Cart to Basket module on a site I am working on and it worked perfectly.