Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Localization Support Rate Topic   - - - - -

 
  • camerojo
  • Advanced Member
  • Members
  • Join Date: 16-Nov 12
  • 84 posts

Posted 08 November 2015 - 06:27 AM #1

Localization is a very powerful and elegantly implemented feature of CSCart. However, many people will not need it so it is disabled by default.

 

Basically it allows your CSCart website to appear different depending on where it is being accessed from. So, for example, if your website is being accessed from Germany you will probably want to display the website in the German language, with prices in Euros, and metric measures. If it is being accessed from the USA, you will want the site to be in English, with prices in $ and non metric weights and measures. You may also have products which are only available in certain regions.

 

Quoting from the original CSCart documentation "A localization is a set of regional settings, including the region-specific currency, language and measures. A localization can then be used to control accessibility of products, shipping methods,credit card types, locations, etc."

 

My website uses localizations extensively for this purpose.

 

However, CSCart has quietly decided to cease supporting this valuable feature. Localizations still work and the code is still present, but localizations have been removed from the documentation and CSCart refuses to fix any bugs related to localizations.

See http://forum.cs-cart...-functionality/and http://forum.cs-cart...d-localization/

 

I don't understand why CSCart has made this decision but if they do remove localization capability from the code base, my website and any others that depend on it will cease to work. I will be forced to branch the code base and continue developing and maintaining myself. I certainly hope I never have to do this but CSCart may give me no choice.

 

The localization code in CSCart is elegantly and simply implemented and therefore very reliable and flexible. However, occasionally I have come across a few minor bugs. I have reported these bugs to CSCart - often together with simple fixes for the bugs, but CSCart refuses to include the fixes in the code base.

 

Therefore I plan to post the fixes on this thread to help others in the same position as me.

 

I am posting this in the Wishlist and Feature Requests forum in the hope that CSCart will reconsider reinstating this feature - or at least will give users like myself some working alternative to localizations.



 
  • camerojo
  • Advanced Member
  • Members
  • Join Date: 16-Nov 12
  • 84 posts

Posted 08 November 2015 - 06:32 AM #2

Turning On Localization Support

 

By default localization support is disabled.

 

To turn it on set the following in your configuration file - eg config.local.php

 

$config['tweaks']['disable_localizations'] = false;



 
  • camerojo
  • Advanced Member
  • Members
  • Join Date: 16-Nov 12
  • 84 posts

Posted 08 November 2015 - 06:38 AM #3

Fix bug where disabled locations still appear in manual shipping methods.

 

This has been reported here: http://forum.cs-cart...ipping-methods/

 

The bug report includes the fix which involves simply commenting out a couple of lines which look like a crude hack to force the code to ignore a condition related to localizations.

 

Here is a copy of the relevant part of the bug report:

 

...the bug is in this bit of code in function fn_get_available_destination

 $condition = '';
if (AREA == 'C') {
$condition .= fn_get_localizations_condition('localization');
if (!empty($condition)) {
$condition = db_quote('OR (1 ?p)', $condition);
}
}
$__dests = db_get_array("SELECT a.* FROM ?:destination_elements as a LEFT JOIN ?:destinations as b ON b.destination_id = a.destination_id WHERE b.status = 'A' ?p", $condition);


The bug fix is to remove that strange if (!empty(condition)) statement. By turning the AND into an OR it means that the WHERE b.status = 'A' clause in the SELECT is ignored if localization matches.



 
  • camerojo
  • Advanced Member
  • Members
  • Join Date: 16-Nov 12
  • 84 posts

Posted 08 November 2015 - 06:51 AM #4

Fix bug in manual shipping method configuration

 

This has been reported here: http://forum.cs-cart...d-localization/

 

Here is a copy of the relevant part of the bug report:

 

...the problem is in the fn_get_shipping_info method of fn.cart.php.

I would replace the following lines:

 $destinations = array();
if ($shipping['rate_calculation'] == 'M') {
$destinations = fn_get_destinations();
foreach ($destinations as $k => $v) {
if (!empty($shipping['localization'])) { // check available destinations, but skip default destination
$_s = fn_explode(',', $shipping['localization']);
$_l = fn_explode(',', $v['localization']);
if (!array_intersect($_s, $_l)) {
continue;
}
}
$destinations[$k] = array_merge($destinations[$k], fn_get_shipping_rate($shipping_id, $v['destination_id']));
}
} else {
...


with

 $destinations = array();
if ($shipping['rate_calculation'] == 'M') {
$alldestinations = fn_get_destinations();
foreach ($alldestinations as $k => $v) {
if (!empty($shipping['localization'])) { // check available destinations, but skip default destination
$_s = fn_explode(',', $shipping['localization']);
$_l = fn_explode(',', $v['localization']);
if (!array_intersect($_s, $_l)) {
continue;
}
}
$destinations[$k] = array_merge($alldestinations[$k], fn_get_shipping_rate($shipping_id, $v['destination_id']));
}
} else {
...


In other words I use the temporary variable $alldestinations and only add appropriate destinations (with matching localizations) to the $destinations variable



 
  • mancup
  • Member
  • Members
  • Join Date: 27-Dec 12
  • 33 posts

Posted 26 October 2017 - 09:14 AM #5

Hello,

 

I have v4.3.4 when I activate LOCALIZATIONS i cann ot go to my product pages.

Do I have to activate something else ?

 



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19690 posts

Posted 26 October 2017 - 01:43 PM #6

Hello,
 
I have v4.3.4 when I activate LOCALIZATIONS i cann ot go to my product pages.
Do I have to activate something else ?

 

Since this functionality is not supported anymore, it can completely brake the store. It is required to examine error on your server to fix it


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.