Order statuses are not localized in frontend and backend

Started by konstantin-shkodskih, February 04, 2013, 12:15:54 PM

Previous topic - Next topic

konstantin-shkodskih

Hi, VirtueMart Team!

I noticed that order status names are not localized.

Initially order status codes and names defined in #__virtuemart_orderstates table as:
'P' => 'Pending
'U' => 'Confirmed by shopper
'C' => 'Confirmed
'X' => 'Cancelled
'R' => 'Refunded
'S' => 'Shipped

Next, order status name has been displays like this code:
$orderstatuses[$_ordstat->order_status_code] = JText::_($_ordstat->order_status_name);

Language constants in FE and BE files xx-XX.com_virtuemart.ini defined as:
COM_VIRTUEMART_ORDER_STATUS_CANCELLED
COM_VIRTUEMART_ORDER_STATUS_CONFIRMED
COM_VIRTUEMART_ORDER_STATUS_CONFIRMED_BY_SHOPPER
COM_VIRTUEMART_ORDER_STATUS_PENDING
COM_VIRTUEMART_ORDER_STATUS_REFUNDED
COM_VIRTUEMART_ORDER_STATUS_SHIPPED

But not so:
PENDING
CONFIRMED_BY_SHOPPER
CONFIRMED
CANCELLED
REFUNDED
SHIPPED

As a result, the variables are shown not localized.



there must be so



Probably the easiest thing I could do is to replace the names of the constants in the language files,
but then left untranslated string "Confirmed by shopper" due to the presence of whitespaces.

Either change the code to something like this:
$orderstatuses[$_ordstat->order_status_code] = JText::_('COM_VIRTUEMART_ORDER_STATUS_' . str_replace(' ', '_', $_ordstat->order_status_name));

in backend:
administrator/components/com_virtuemart/views/orderstatus/tmpl/default.php
administrator/components/com_virtuemart/views/orderstatus/tmpl/edit.php
administrator/components/com_virtuemart/models/fields/orderstatus.php
administrator/components/com_virtuemart/helpers/shopfunctions.php
administrator/components/com_virtuemart/views/orders/view.html.php
administrator/components/com_virtuemart/views/orderstatus/view.html.php
administrator/components/com_virtuemart/views/orders/view.pdf.php
administrator/components/com_virtuemart/views/orders/view.raw.php

in frontend:
components/com_virtuemart/views/orders/view.html.php

Until I changed the code.

--
Regards, Konstantin Shkodskih