enter image description hereHi I added this code in my list.phtml file in order to add some info in my product list grid page (see picture attached) and added some div class so that I can change the style and move it around. I know it is probably not the correct way however it works. Now the problem is that I am unable to translate this part in french. Is there a way I can do this? I tried inline and .csv files in my locale but doesn't work and I am pretty sure it is because my codes below are not the correct way to do it. Please help. Thank you

  • <div class="msrp"> Retail Price: <?php echo Mage::helper('core')->currency($_product->getMsrp(),true,false); ?> </div> <div class="qtyleftgrid"> <?php $qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getStockQty(); ?> <?php if ($qty): ?> Qty Left: <?php echo $qty; ?> <?php else: ?> SOLD OUT <?php endif; ?> </div> <div class="yourprice"> Our Price </div> – James Tsai Jan 12 '15 at 18:28

Any text that needs to be translated should be passed through the translate helper. In your template file instead of echoing your text as a string you need to use the translate function on the block. e.g

<div><?php echo $this->__('translated text goes here'); ?></div>

If you do this you should be able to translate the text using your locale csv files.

  • Thankyou very much. It works!!! – James Tsai Jan 13 '15 at 23:28

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.