Open bhsmither opened 7 months ago
Perhaps in Language->__construct()
, when assigning language to $this->language
, extract the default_currency
from that language's config.xml
file and record that in $SESSION
.
Well, now it's working. Weird.
I believe it is because, in Store Settings, the Default Currency drop-down selector gets populated with all currencies that are enabled at that time.
However, this does not reflect what is actually the state of the Config array -- a currency could still be a member of the Config, yet the Default Currency shows blank.
Likewise, a currency could not be a member of Config, yet the Default Currency is populated and shows the first option.
That is because there is no "--Please Select--" option to indicate that there is missing a currency as a member of Config.
This is misleading.
The admin would have to Save the settings - even if nothing changes - so that the displayed option of the Default Currency selector gets loaded into Config.
As a follow-on from #3476, when, for whatever reason, there became no enabled currencies for the storefront visitor, the prices might still be getting calculated for display (I will need to double-check).
Likewise, in a different (cookie-based) session, once the prices are no longer being calculated for display (because there are no enabled currencies - for whatever reason), and then currencies do become enabled, the prices are not calculated for display.
The reason suspected is that
$SESSION
keeps a record of what currency (and language) is being used. So, if a new session is started while no currency is enabled, this new session will have no record of having a currency, and will never have a record as long as this session is being used.The visitor will need to know that cookies will need to be cleared, and know how to do it.
Suggest that everytime, when an existing cookie-based session is being restored/reloaded, to check for a few essential elements: chosen language - default if none, and chosen currency - default if none.
Suggest, for a logged-in customer, add a column in CubeCart_customer to record preferred currency just the same as preferred language.
Then, as with determining the source of the session's language, also in like manner, determine the source of the session's currency.