cubecart / v6

CubeCart Version 6
https://cubecart.com
72 stars 59 forks source link

Invoice Template to Have Language Code #3497

Closed bhsmither closed 5 months ago

bhsmither commented 6 months ago

Feature Request:

Consider that the CubeCart_order_summary has a lang column to indicate the language of the customer that was in use when the order was made (if I recall). When fulfilling the order, an "Invoice Document" is generated.

There is no i18n of that document (like there is for any of the Site Documents).

abrookbanks commented 5 months ago

Closing until this reaches development.

bhsmither commented 5 months ago

My experiments:

orders.index.inc.php, near line 629, find:
            $smarty_data['list_orders'][] = $summary;
            unset($summary, $address);

ABOVE that, add:
$GLOBALS['language']->change($summary['lang'] ?? $GLOBALS['config']->get('config','default_language'));
$summary['language_strings_to_use'] = $GLOBALS['language']->getStrings();

This requires overwriting $LANG when compiling the Sales Invoice.

orders.print.php, near line 183, find:
  {if isset($ORDER_LIST)}
  {foreach from=$ORDER_LIST item=order}

AFTER that, add:
  {$LANG=$order.language_strings_to_use}

This seems to be the simplest, but least optimum as it sends to Smarty an entire language pack for each order.