2

There are a number of changes that I would like to make to the theme but I give just one here as an example. Where the dropdown says 'Choose an Option', I like to be polite and ask users to 'Please Choose an Option'.

So, I enable template path hints and block name hints. The block name hint in the image obscures the full path to the file which is...

frontend/default/paul_overrides/template/catalog/product/view/type/options/configurable.phtml

enter image description here

When I get to configurable.phtml there is very little there...

enter image description here

I do notice the ability to change 'Choose an Option' but when I did change it, it doesn't change on the site. So I don't understand why, it must be getting that from somewhere else.

Also the block name hints. So i have Mage_Catalog_Block_Product_View_Type_Configurable What does that refer to and how does that help me find the code that is creating the html?


Update

Thank You fschmengler.

I created translate.csv in my child theme 'paul_overrides', I inserted the line you suggested into this and also the file highlighted below to make sure i would catch it. Unfortunately neither worked and I am still getting the original display on the dropdown.

enter image description here

Any ideas?

Must say, I'm very surprised at magento, it is hailed as being easy to modify but if this example is anything to go by it seems anything but easy.

Appreciate any help.

  • Actually, "easy to modify" is not how I would describe Magento, you can modify pretty much but the learning curve is steep – Fabian Schmengler Jul 22 '15 at 17:05
  • Did you clean the cache? – Fabian Schmengler Jul 22 '15 at 17:06
  • Thank You fschmengler, I have cache disabled in during development. – PeterC Jul 23 '15 at 16:14
1

Don't change texts in the phtml templates, use translation instead.

In your case, you want to change the return value of $this->__('Choose an option...'). When the dropdown is populated dynamically with JavaScript, the same translation is used again (and this is why changing the value only in this template did not work).

The block type Mage_Catalog_Block_Product_View_Type_Configurable is the class that is used to render this template and you can tell from it that it's in the Mage_Catalog module.

With this information, you can change the translation in your theme:

How to change the translation

  1. Open the file app/design/[your_package]/[your_theme]/locale/en_US/translate.csv or create it if it does not exist.
  2. Add this line:

    "Mage_Catalog::Choose an option...","Please choose an option..."
    

This will tell Magento to use "Please choose an option..." instead of "Choose an option..." everywhere in the Mage_Catalog module.


Alternatively you can use the inline translation feature, as explained here: http://inchoo.net/magento/inline-translation-in-magento/ - this will store your changed translations in the database instead.

It's easy to use but you cannot search for the texts in the code base anymore and it's harder to migrate/deploy the translations to another system. So I prefer using translation files but YMMV.

1

This drop is generated by JavaScript,json object.

If it option value,Choose an Option text is coming from

For Custom option: - Mage_Catalog_Block_Product_View_Options_Type_Select

  • js/varien/product.js make dropdown for custom option product

For configurable product option:

Mage_Catalog_Block_Product_View_Type_Configurable


<?php

class Mage_Catalog_Block_Product_View_Type_Configurable extends Mage_Catalog_Block_Product_View_Abstract
{
 public function getJsonConfig()
    {.....
        $config = array(
            'attributes'        => $attributes,
            'template'          => str_replace('%s', '#{price}', $store->getCurrentCurrency()->getOutputFormat()),
            'basePrice'         => $this->_registerJsPrice($this->_convertPrice($currentProduct->getFinalPrice())),
            'oldPrice'          => $this->_registerJsPrice($this->_convertPrice($currentProduct->getPrice())),
            'productId'         => $currentProduct->getId(),
            'chooseText'        => Mage::helper('catalog')->__('Choose an Option...'),
            'taxConfig'         => $taxConfig
        );

        .......
    }


}

You need to change on this class for the text.

js/varien/configurable.js make dropdown for configurable product

  • Or use translation. – eetzen Jul 22 '15 at 5:45
  • Yes. It really good idea.. But whenever it have mule varien that time createvisdue – Amit Bera Jul 22 '15 at 5:47
  • 1
    If there's an answer in there somewhere I can't find it! – PeterC Jul 22 '15 at 5:55
0

Really easy way to change this is to log into admin goto Systen->Config->Developer->Translate Inline. Enable for front end for what every view you want then go to your product page.

Now simply find the tiny book icon and click on it, from here you can quickly and easily change this text to whatever you want without touching a line of code.

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.