A small but useful revision allows to display arbitrary text instead of a zero price value in Opencart (ocStore) 1.5 x. For example, when the price of goods is 0.00 (zero), you can print the inscription “contract Price” or “specify the Price” or in General, anything depending on your needs (also, instead of text, you can add the button code to the calling form or html code).
< h2>Opencart (ocStore) 1.5 x output arbitrary text at zero price:
In fact, the method is very simple and comes down to editing only two files. In the file:
system/library/currency.php
pre by string:
1 | $string = ''; |
add:
1 2 3 | if ($format && (int)$value == 0) { return $this->language->get('text_zero'); } |
and in the main language file (if the store is multilingual, then all the major files used languages):
catalog/language/russian/russian.php
add a line with the desired text:
1 | $_['text_zero'] = 'specify Price'; |
well or shtml code instead of the example text in single quotes.
It should also be noted that this edit affects the output of the label instead of the price not only in the catalog but also in all modules and in the shopping cart.