In Magento (v1.9.3.1) I want to replace 'Out of Stock' to 'Sorry sold out' Which file I need to edit please? I want a solution that is not lost after migration.
5 Answers
If you did not change template setting, you should look for it in app/design/frontend/base/default/template
folder. There are some places that you need to change:
- Product view: in
catalog/product/view/type/default.phtml
- Product list:
catalog/product/list.phtml
You should also find different places for different types of products as well.
Or I think you can change by editing CSV translation file (app/locale/en_US/Mage_Catalog.csv
).
The easiest solution which makes it possible to do things well and allowing to not modify the phtml file is to change the translation file app/locale/language_ISO/Mage_Catalog.csv
In the line about 465 "Out of Stock","Sorry sold out"
EDIT: If you haven't modified the phtml, check please if you have this piece of code:
<?php echo $this->helper('catalog')->__('Out of stock') ?>
-
Sorry what is the advantage of this over solution below? I don't want it to be overwritten after an upgrade.– LitMApr 11, 2017 at 8:24
-
Excuse me but I have given you the best way to do it, there is no other way I think, as for your changes you have to save the file that you modified then you make a merge. If you plan to modify the phtml it will be even worse and I advise against it. The translation functions are made for this.– PЯINCƎApr 11, 2017 at 8:37
-
Thanks but I have this directory app/locale/en_US/Mage_Catalog.csv + it doesn't work. I have cleared cache as well.– LitMApr 11, 2017 at 9:23
-
Where you want to display this "Sorry sold out" in
catalog/product/view/view.phtml
right ? it should work and you should have<?php echo $this->helper('catalog')->__('Out of stock') ?>
in the phtml If you have not modified it– PЯINCƎApr 11, 2017 at 10:01
app/design/frontend/YOURTHEME/default/template/catalog/product/view/type/default.phtml
<?php if ($_product->isAvailable()): ?>
<p class="availability in-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('Places Available') ?></span></p>
<?php else: ?>
<p class="availability out-of-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('All Booked - Please Contact Us') ?></span></p>
<?php endif; ?>
As you are saying you want to migrate then you can use database(inline) translation because database translation will migrate to migento2
so here is the example how you can translate the word in.
http://inchoo.net/magento/inline-translation-in-magento/
please check above tutorial will teach you how to use database(inline) translation.
Thank you all for pointing me in right direction. After some trial I solved it by updating below files.
/app/design/frontend/mytheme/mychildtheme/template/catalog/product
Files: list.phtml & view.phtml
Mage_Catalog.csv
file of your store language folder in locale folder