The Base Price in the store in English is "Starting at" $00.00. In Japanese the order needs to be reversed to $00.00 "From" (yori). Is this possible?
The Base Price in the store in English is "Starting at" $00.00. In Japanese the order needs to be reversed to $00.00 "From" (yori). Is this possible?
Haven't looked at the area of the code, but generally speaking yes. If the line to be shown is setup to provide text with a variable substitution such as %d then the order of the variable could be moved around for each language in the language defines. That probably would end up being the easiest/most direct solution and may survive upgrading possibly easiest.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
As mc12345678 indicated, it's possible and requires changes to two of your template-override files. I'm "assuming" that your main japanese language file is in /includes/languages/japanese.php, that your currently-selected template is named YOUR_TEMPLATE and that the products in your store are all of type 'Product-General' (which uses the product_info product type). Given those assumptions, you'll need to change two files:
- /includes/languages/YOUR_TEMPLATE/japanese.php. Locate the variable named TEXT_BASE_PRICE and change its definition to 'From (yori)'.
- /includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php. For v1.5.1, on line 70, change
toCode:echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);
Code:echo $one_time . zen_get_products_display_price((int)$_GET['products_id']) . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '');
Well, my understandingof the situation was that there is one template, but that there was more than one language at play. In the one language the units prefaced the amount, in the other they were a suffix. What I was considering, and sorry for taking so long to provide more on what I was thinking, was that the define for the text: starting at: would include the appropriate symbol to provide the text for the cost. So that a sprintf() could be used in the template to feed the statement.
So in english: the define would be something like 'Starting at: %s'
And in Japanese it would be '%s yori'
In both cases assuming that %s was the correct symbol to provide the cost with the units in the correct sequence and with the correct number of digits (a string).
If the units are not attached to the cost value before sending to the above sprintf command, then the units could be fed to the command and for the approriate language they could be properly sequenced:
English:define('STARTAT','starting at: %2$s%1$f');
Sprintf(STARTAT,$cost,$symbol);
Japanese: define('STARTAT','%1$f%2$s yuni');
Sprintf(STARTAT,$cost,$symbol);
This defines the variable STARTAT as the language defined variable that normally desplays the starting at text; however, the correct constant should be used in place of it. The sprintf command would be on the template wherever the current starting at text begins, the $cost variable would be the floating point value of the cost, although if the cost is already a string that includes the units then the define is simplified with just a %s and the call to the sprintf function would only have two arguments instead of three. (The first for the string to be displayed, the second for the first variable being substituted, and each subsequent being the next variable.) In the above example: %2$s means to use the second argument (in this case the third variable) in the sprintf and treat it as a string. %1$f means use the first argument (second variable) in the sprintf and treat it as a floating point.
This way, the template will have one means of displaying the information, and it will be the language specific portion that will provide the formatting. This may be an issue for upgrading in the future, at least is something to consider when doing the upgrade. Item(s) affected:template, language files, potentially core like files depending on how implemented.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Good idea, mc12345678, perhaps it should be a suggestion for a future Zen Cart version! Good use of the $ modifier on the sprintf format, too (it's quite underused).
Thank you for your help. I will try the template modification lat9 suggested.
Thank you mc12345678 for suggesting a more permanent solution, I hope the feature is added in future versions.
and shucks now I see that will become confusing to an English reader since the word order in English will be strange.
To:Code:echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);
And then also change the TEXT_BASE_PRICE for each language to use the %s where he price to appear: english at the end, japanese at the beginning.Code:echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? sprintf(TEXT_BASE_PRICE, zen_get_products_display_price((int)$_GET['products_id'])) : zen_get_products_display_price((int)$_GET['products_id']));
And that should do it for you I think. :) not tested, but also why I provided the version that I did, because japanese would need it at the beginning, but english (and probably some other languages) would need it at the end.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
A solution is to change the English "$100 and up", not perfect but okay. Japanese is more finicky so the word order "$100 より" (yori) is perfect.
Follow the steps explained by lat9
Change two files:
/includes/languages/YOUR_TEMPLATE/japanese.php. Locate the variable named TEXT_BASE_PRICE and change its definition to 'From ( yori)'.
/includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php.
Make the script changes to tpl_product_info_display.php.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Bookmarks