From 84d8ccfa2b4cc9b882acb2616b16fa923dadc43d Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Fri, 27 Sep 2013 10:25:37 +0200 Subject: [PATCH 1/4] // Fixed language code consistency --- classes/Language.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/classes/Language.php b/classes/Language.php index e90700112..ce3762ab2 100644 --- a/classes/Language.php +++ b/classes/Language.php @@ -691,6 +691,7 @@ class LanguageCore extends ObjectModel // Initialize the language $lang = new Language(); $lang->iso_code = $iso_code; + $lang->language_code = $iso_code; $lang->active = true; // If the language pack has not been provided, retrieve it from prestashop.com @@ -700,13 +701,15 @@ class LanguageCore extends ObjectModel // If a language pack has been found or provided, prefill the language object with the value if ($lang_pack) foreach (get_object_vars($lang_pack) as $key => $value) - $lang->$key = $value; + if ($key != 'iso_code' && isset(Language::$definition['fields'][$key])) + $lang->$key = $value; // Use the values given in parameters to override the data retrieved automatically if ($params_lang !== null && is_array($params_lang)) foreach ($params_lang as $key => $value) - $lang->$key = $value; - + if ($key != 'iso_code' && isset(Language::$definition['fields'][$key])) + $lang->$key = $value; + if (!$lang->add(true, false, $only_add)) return false; @@ -724,7 +727,7 @@ class LanguageCore extends ObjectModel } else Language::_copyNoneFlag((int)$lang->id); - + $files_copy = array( '/en.jpg', '/en-default-'.ImageType::getFormatedName('thickbox').'.jpg', @@ -734,7 +737,7 @@ class LanguageCore extends ObjectModel '/en-default-'.ImageType::getFormatedName('small').'.jpg', '/en-default-'.ImageType::getFormatedName('scene').'.jpg' ); - + foreach (array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_) as $to) foreach ($files_copy as $file) @copy(dirname(__FILE__).'/../img/l'.$file, $to.str_replace('/en', '/'.$iso_code, $file)); From 6d8cc454e1128498d6d2edf8ab835160020ea57d Mon Sep 17 00:00:00 2001 From: Fabio Chelly Date: Fri, 27 Sep 2013 11:27:58 +0200 Subject: [PATCH 2/4] [-] MO productcomments: prevents guests to add comments when guest comment is disabled in backoffice (cherry picked from commit 345d4cd) --- modules/productcomments/productcomments.tpl | 4 +++- themes/default/modules/productcomments/productcomments.tpl | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/productcomments/productcomments.tpl b/modules/productcomments/productcomments.tpl index f8fe9f111..0c5c3aecb 100644 --- a/modules/productcomments/productcomments.tpl +++ b/modules/productcomments/productcomments.tpl @@ -76,11 +76,13 @@ var moderation_active = {$moderation_active}; {/if} {/foreach} + {if (!$too_early AND ($logged OR $allow_guests))}

{l s='Write your review' mod='productcomments'} !

+ {/if} {else} - {if ($too_early == false AND ($logged OR $allow_guests))} + {if (!$too_early AND ($logged OR $allow_guests))}

{l s='Be the first to write your review' mod='productcomments'} !

diff --git a/themes/default/modules/productcomments/productcomments.tpl b/themes/default/modules/productcomments/productcomments.tpl index 3cb407777..bbd737670 100644 --- a/themes/default/modules/productcomments/productcomments.tpl +++ b/themes/default/modules/productcomments/productcomments.tpl @@ -76,11 +76,13 @@ var moderation_active = {$moderation_active}; {/if} {/foreach} + {if (!$too_early AND ($logged OR $allow_guests))}

{l s='Write your review' mod='productcomments'} !

+ {/if} {else} - {if ($too_early == false AND ($logged OR $allow_guests))} + {if (!$too_early AND ($logged OR $allow_guests))}

{l s='Be the first to write your review' mod='productcomments'} !

@@ -141,7 +143,7 @@ var moderation_active = {$moderation_active}; {/if}