diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index a03e40fab..f5132249d 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,161 +1,186 @@ -- adonis karavokyros -- aFolletete -- Agence CINS -- aKorczak -- Alexander Otchenashev -- anat -- Andrew -- aNiassy -- antoniofr -- AntonLejon -- Arnaud Lemercier -- Axome -- Benjamin PONGY -- BigZ -- bLeveque -- bMancone -- bumbu -- Burhan -- Caleydon Media -- cam.lafit -- Captain FLAM -- Captain-FLAM -- ccauw -- Cédric Mouleyre -- ChristopheBoucaut -- CINS -- cippest -- cmouleyre -- Corentin Delcourt -- Cosmin Hutanu -- Damien Metzger -- DamienMetzger -- Damon Skelhorn -- Daniel -- David Gasperoni -- Davy Rolink -- djfm -- dlage -- dMetzger -- (d)oekia -- Dragan Skrbic -- dreammeup -- DrySs -- DrÿSs -- DrÿSs' -- dSevere -- Edouard Gaulué -- emily-d -- Fabio Chelly -- fBrignoli -- fram -- Francois Gaillard -- François Gaillard -- Fran?s Gaillard -- fSerny -- Gabriel Schwardy -- gBrunier -- gCharmes -- gPoulain -- gr4devel -- Grégoire Bélorgey -- Gregory Roussac -- gRoussac -- Guillaume DELOINCE -- ha99y -- hAitmansour -- Ha!*!*y -- indesign47 -- inem0o -- ivancasasempere -- jBreux -- jeckyl -- jeromenadaud -- Jerome Nadaud -- Jérôme Nadaud -- jessylenne -- jmCollin -- jObregon -- Jonathan Danse -- joseantgv -- Julien -- Kevin Granger -- kpodemski -- Krystian Podemski -- lBrieu -- lCherifi -- ldecoker -- lLefevre -- LOIC ROSSET ltd -- makk1ntosh -- marcinsz101 -- Marco Cervellin -- matiasiglesias -- Mats Rynge -- MatthieuB -- Maxence -- mBertholino -- mDeflotte -- Michel Courtade -- Milow -- minic studio -- misthero -- mMarinetti -- montes -- nezenmoins -- Nicolas Sorosac -- Nils-Helge Garli Hegvik -- nPellicari -- nturato -- oleacorner -- Otto Nascarella -- Patanock -- PhpMadman -- Pierre -- Piotr Kaczor -- Piotr Mocko -- PrestaEdit -- prestarocket -- Prestaspirit -- pxls -- Raphaël Malié -- raulgundin -- Rémi Gaillard -- rGaillard -- Rimas Kudelis -- rMalie -- rMontagne -- romainberger -- root -- runningz -- sagaradonis -- Samy Rabih -- Sarah Lorenzini -- Seb -- Sébastien -- Sébastien Bocahu -- Seynaeve -- Shagshag -- sjousse -- sLorenzini -- smartdatasoft -- soufyan -- soware -- Staging -- sThiebaut -- Sylvain WITMEYER -- tDidierjean -- unknown -- vAugagneur -- vChabot -- Vincent Augagneur -- Vincent Schoener -- Vincent Terenti -- vinvin27 -- vKham -- vSchoener -- Xavier -- Xavier POITAU -- Yoozio -- zimmi1 + - adonis karavokyros + - aFolletete + - Agence CINS + - aKorczak + - Aleksander Palyan + - Alexander Otchenashev + - anat + - Andrew + - aNiassy + - antoniofr + - AntonLejon + - Arnaud Lemercier + - Axome + - Benjamin PONGY + - BigZ + - bLeveque + - bMancone + - bumbu + - Burhan + - Caleydon Media + - cam.lafit + - Captain FLAM + - Captain-FLAM + - ccauw + - cedricfontaine + - Cédric Mouleyre + - Chris + - ChristopheBoucaut + - CINS + - cippest + - cmouleyre + - Corentin Delcourt + - Cosmin Hutanu + - Damien Metzger + - DamienMetzger + - Damon Skelhorn + - Daniel + - Daniele Giachino + - David Gasperoni + - Davy Rolink + - Dinis Lage + - djfm + - dlage + - dMetzger + - (d)oekia + - Dragan Skrbic + - dreammeup + - DrySs + - DrÿSs + - DrÿSs' + - dSevere + - Edouard Gaulué + - emily-d + - Eric Le Lay + - Fabio Chelly + - fBrignoli + - fchellypresta + - fram + - Francois Gaillard + - François Gaillard + - Franois Gaillard + - fSerny + - Gabriel Schwardy + - Gaelle ITZKOVITZ + - gBrunier + - gCharmes + - gPoulain + - gr4devel + - Grégoire Bélorgey + - Gregory Roussac + - gRoussac + - Guillaume DELOINCE + - ha99y + - hAitmansour + - Ha!*!*y + - indesign47 + - inem0o + - ivancasasempere + - Jáchym Toušek + - Javsmile + - jBreux + - jeckyl + - jeromenadaud + - Jerome Nadaud + - Jérôme Nadaud + - jessylenne + - jmCollin + - jObregon + - Jonathan Danse + - joseantgv + - Julien + - Kevin Granger + - kiropowered + - kpodemski + - Krystian Podemski + - lBrieu + - lCherifi + - ldecoker + - lLefevre + - LOIC ROSSET ltd + - Madef + - Mainmich + - makk1ntosh + - marcinsz101 + - Marco Cervellin + - matiasiglesias + - Mats Rynge + - MatthieuB + - Maxence + - mBertholino + - mDeflotte + - Michel Courtade + - Mickael Desgranges + - Mikael Blotin + - Milow + - minic studio + - misthero + - mMarinetti + - montes + - MustangZhong + - nezenmoins + - Nicolas Sorosac + - Nils-Helge Garli Hegvik + - Nino Uzelac + - nPellicari + - nturato + - oleacorner + - Otto Nascarella + - Patanock + - PhpMadman + - Pierre + - Piotr Kaczor + - Piotr Moćko + - PrestaEdit + - PrestaLab + - PrestanceDesign + - prestarocket + - Prestaspirit + - pxls + - Raphaël Malié + - raulgundin + - Rémi Gaillard + - rGaillard + - Rimas Kudelis + - rMalie + - rMontagne + - romainberger + - root + - runningz + - sagaradonis + - Samy Rabih + - Sarah Lorenzini + - Seb + - Sébastien + - Sébastien Bocahu + - Seynaeve + - Shagshag + - sjousse + - sLorenzini + - smartdatasoft + - soufyan + - soware + - Staging + - sThiebaut + - Sylvain Gougouzian + - Sylvain WITMEYER + - tDidierjean + - thoma202 + - Tomasz Slominski + - Tom Panier + - tucoinfo + - unknown + - vAugagneur + - vChabot + - Vincent Augagneur + - Vincent Schoener + - Vincent Terenti + - vinvin27 + - vKham + - vSchoener + - Xavier + - Xavier POITAU + - Yoozio + - zimmi1 + - Zollner Robert diff --git a/admin-dev/themes/default/css/modules.css b/admin-dev/themes/default/css/modules.css new file mode 100644 index 000000000..4db7804bd --- /dev/null +++ b/admin-dev/themes/default/css/modules.css @@ -0,0 +1,84 @@ + +.path_bar {display:none;} +#notifs_icon_wrapper {float: left;position: relative;margin:15px 10px 0; width:90px;} +.notifs { float: left;position: relative;cursor: pointer;margin:0; padding:5px; width: 18px;height: 16px;} +#orders_notif {background: url('../img/notif_order.png') no-repeat center top;} +#customers_notif {background: url('../img/notif_customer.png') no-repeat center top;} +#messages_notif {background: url('../img/notif_message.png') no-repeat center top;} +#orders_notif.open_notifs, +#customers_notif.open_notifs, +#messages_notif.open_notifs { background-color: #FFFFFF;border: 1px solid #000000; position: relative; display: block; background-position:center bottom; } + +/*toolbarBox*/ +.toolbarBox { background-color: #F8F8F8; border: 1px solid #CCCCCC; margin-bottom:10px; padding: 10px 0; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px;} +.toolbarBox .pageTitle { margin-left:10px; line-height:48px} +.toolbarBox .pageTitle h3 {font-size: 2em; font-weight: bold; line-height: 48px; margin: 0; padding: 0} +.toolbarBox ul.cc_button {float:right;margin:0;padding:0} +.toolbarBox ul.cc_button li {color: #666666; float: left; height: 48px; list-style: none outside none; padding: 1px 1px 3px 4px; text-align: center} +.toolbarBox a.toolbar_btn { border-width: 1px;font-size:11px;cursor: pointer; display: block; float: left; padding: 1px 5px; white-space: nowrap; text-shadow: 0 1px 0 #ffffff} +.toolbarBox a.toolbar_btn:hover {} +.toolbarBox .toolbar_btn span{ display: block;float: none;height: 32px;margin: 0 auto;width: 32px} +.toolbarBox .process-icon-delete { background-image: url('../img/process-icon-delete.png')} +.toolbarBox .process-icon-duplicate { background-image: url('../img/process-icon-duplicate.png')} +.toolbarBox .process-icon-preview { background-image: url('../img/process-icon-preview.png')} +.toolbarBox .process-icon-stats { background-image: url('../img/process-icon-stats.png')} +.toolbarBox .process-icon-cancel { background-image: url('../img/process-icon-cancel.png')} +.toolbarBox .process-icon-new, .toolbarBox .process-icon-newAttributes{ background-image: url('../img/process-icon-new.png')} +.toolbarBox .process-icon-save, .toolbarBox .process-icon-save-settings { background-image: url('../img/process-icon-save.png')} +.toolbarBox .process-icon-save-and-stay { background-image: url('../img/process-icon-save-and-stay.png')} +.toolbarBox .process-icon-edit { background-image: url('../img/process-icon-edit.png')} +.toolbarBox .process-icon-back { background-image: url('../img/process-icon-back.png')} +.toolbarBox .process-icon-refresh-index { background-image: url('../img/process-icon-refresh-index.png')} +.toolbarBox .process-icon-refresh-cache { background-image: url('../img/process-icon-refresh-cache.png')} +.toolbarBox .process-icon-save-calendar { background-image: url('../img/process-icon-save-calendar.png')} +.toolbarBox .process-icon-new-module { background-image: url('../img/process-icon-new-module.png')} +.toolbarBox .process-icon-new-module-addon { background-image: url('../img/process-icon-new-module-addon.png')} + +div.fix-toolbar {border-bottom: 1px solid #E0E0E0;position:fixed;top:0;opacity:0.9;z-index:11} + + +/*FILTER MODULE*/ +.filter-module { background-color:#ebedf4; border:1px solid #c2c4d9; padding:10px; display:block; min-height:35px;} +.filter-module #filternameForm {float:left; margin-right:30px;} +.filter-module label {width:auto;} +.filter-module .select-filter { float:left;} +.filter-module .button-filter { float:right;} + +/*SIDEBAR*/ +.sidebar { position:relative; float:left; width:220px; display:inline;} +.sidebar h3 { background-color:#ebedf4; font-weight:bold; display:block; padding:5px;} +.sidebar .subHeadline { font-weight:bold; float:right; margin-top:-28px; margin-right:5px;} +.sidebar ul.categorieList {} +.sidebar ul.categorieList li { border-top:1px solid #ccc; position:relative; line-height:20px;} +.sidebar ul.categorieList li:first-child { border-top:none;} +.sidebar ul.categorieList li a {color:#3a6ea7;} +.sidebar ul.categorieList li div.categorieWidth { text-indent:5px; overflow:hidden;} +.sidebar ul.categorieList li div.count{ position:absolute; top:0; right:5px;} + +/*MODULECONTAINER*/ +#moduleContainer { margin-left:220px; padding:13px 0 0 20px;} +#moduleContainer .table tr th { height:40px;} +#moduleContainer .table tr td { font-size:12px; vertical-align:top; padding: 5px 7px 0; border-top:1px solid #ccc; border-bottom:none;} +#moduleContainer .table tr:first-child {border-top:1px solid #ccc} +#moduleContainer .table tr:hover { background-color:#FFF1B5;} +#moduleContainer .moduleDesc { font-size:12px; position:relative; margin-bottom:10px;} +#moduleContainer .moduleDesc h3 { color:#3A6EA7; margin:0;} +#moduleContainer .moduleDesc .metadata { float:left; display:block; margin:5px 0;} +#moduleContainer .moduleDesc .metadata dl { float:left; margin:0; padding-right:10px;} +#moduleContainer .moduleDesc .metadata dl dt, .moduleDesc .metadata dl dd { float:left; margin:0; padding:0;} +#moduleContainer .moduleDesc .metadata dl dd { padding-right:10px;} +#moduleContainer .moduleDesc .metadata dl dt { font-weight:bold; padding-right:5px;} +#moduleContainer .moduleDesc p.desc { color:#666; font-size:12px; display:block; clear:both;} +#moduleContainer .setup {background-color:#6db300; font-size:10px; color:#fff; text-transform:uppercase; position:relative; left:10px; padding:0px 4px; display: inline-block; border-radius:3px;} +#moduleContainer .setup.non-install { border: solid 1px #ec7000; background-color: #ffedb1; color: #ec7000} +#moduleContainer .setup.must-have { background-color: #ec7000;} +#moduleContainer .setup.off{ background-color:#ccc;} +#moduleContainer .row-actions-module span { padding-right:5px;} +#moduleContainer .row-actions-module span a { font-size:12px;} +#moduleContainer .button.uninstalled, +#moduleContainer .button.installed { float:right; display: inline-block; margin-top:15px; font-size:12px;} +#moduleContainer .button.updated { margin-top:15px; display: inline-block; font-size:12px;} +#list-action-button{width:175px} +#list-action-button li{margin-left:10px;display: inline;float: left;} +#moduleContainer .moduleName {font-size:12px; color:#3A6EA7;font-weight:bold;} +#moduleContainer .moduleFavDesc { font-family:Georgia; font-style:italic; color:#666;} \ No newline at end of file diff --git a/admin-dev/themes/default/template/controllers/groups/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/groups/helpers/form/form.tpl index 34ea84c6d..a85972979 100644 --- a/admin-dev/themes/default/template/controllers/groups/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/groups/helpers/form/form.tpl @@ -102,8 +102,7 @@ } else { - $('#group_discount_category_table').append(''+jsonData.catPath+'{l s='Discount:'}'+jsonData.discount+'{l s='%'} {l s='Delete'}'); - + $('#group_discount_category_table').append(''+jsonData.catPath+'{l s='Discount:'}' + ' ' + jsonData.discount+'{l s='%'} {l s='Delete'}'); var input_hidden = document.createElement("input"); input_hidden.setAttribute('type', 'hidden'); input_hidden.setAttribute('value', jsonData.discount); @@ -132,7 +131,7 @@ {foreach $input['values'] key=key item=category } {$category.path} - {l s='Discount: %d%%' sprintf=$category.reduction} + {l s='Discount: %.2f%%' sprintf=$category.reduction} {l s='Delete'} @@ -216,4 +215,4 @@ {else} {$smarty.block.parent} {/if} -{/block} \ No newline at end of file +{/block} diff --git a/admin-dev/themes/default/template/controllers/groups/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/groups/helpers/view/view.tpl index 974adaf28..8241dc621 100755 --- a/admin-dev/themes/default/template/controllers/groups/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/groups/helpers/view/view.tpl @@ -34,7 +34,7 @@
-

{l s='%d%%' sprintf=$group->reduction}

+

{l s='Discount: %.2f%%' sprintf=$group->reduction}

@@ -53,7 +53,7 @@
-

{l s='Current category discount'}

+

{l s='Current category discount'}

{if !$categorieReductions}
{l s='None'}
{else} @@ -68,7 +68,7 @@ {foreach $categorieReductions key=key item=category } {$category.path} - {l s='%d%%' sprintf=$category.reduction} + {l s='Discount: %.2f%%' sprintf=$category.reduction} {/foreach} @@ -84,4 +84,4 @@ {$customerList}
-{/block} \ No newline at end of file +{/block} diff --git a/admin-dev/themes/default/template/controllers/modules/js.tpl b/admin-dev/themes/default/template/controllers/modules/js.tpl index d7fe022a5..19d0935da 100644 --- a/admin-dev/themes/default/template/controllers/modules/js.tpl +++ b/admin-dev/themes/default/template/controllers/modules/js.tpl @@ -75,7 +75,7 @@ }); // Method to check / uncheck all modules checkbox - $('#checkme').click(function() + $('#moduleContainer').on("click", "#checkme", function() { if ($(this).attr("rel") == 'false') { @@ -308,8 +308,8 @@ catch(e){} return false; }); - - $('.toggle_favorite').live('click', function(event) + + $('#moduleContainer').on("click", ".toggle_favorite", function() { var el = $(this); var value_pref = el.data('value'); diff --git a/admin-dev/themes/default/template/controllers/products/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/products/helpers/form/form.tpl index 8bf2c6716..eb63cf057 100644 --- a/admin-dev/themes/default/template/controllers/products/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/products/helpers/form/form.tpl @@ -71,7 +71,6 @@ {/foreach}
- diff --git a/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl b/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl index f426c5e1a..fbf0f9414 100644 --- a/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl +++ b/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl @@ -58,7 +58,7 @@ $('#file_missing').hide(); $('#virtual_product_name').attr('value', fileName); $("#upload-confirmation .error").remove(); - $('#upload-confirmation div').find('span').remove() + $('#upload-confirmation div').find('span').remove(); $('#upload-confirmation div').prepend('{l s='The file'} "
'+fileName+'" {l s='has successfully been uploaded'}' + ''); $("#upload-confirmation").show(); diff --git a/admin-dev/themes/default/template/helpers/list/list_content.tpl b/admin-dev/themes/default/template/helpers/list/list_content.tpl index 28476ae27..15c6fa0ab 100644 --- a/admin-dev/themes/default/template/helpers/list/list_content.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_content.tpl @@ -51,6 +51,7 @@ {/if} class="{if !$no_link}pointer{/if} {if isset($params.position) && $order_by == 'position' && $order_way != 'DESC'} dragHandle{/if} + {if isset($params.class)} {$params.class}{/if} {if isset($params.align)} {$params.align}{/if}" {if (!isset($params.position) && !$no_link && !isset($params.remove_onclick))} onclick="document.location = '{$current_index}&{$identifier}={$tr.$identifier}{if $view}&view{else}&update{/if}{$table}&token={$token}'"> diff --git a/admin-dev/themes/default/template/helpers/list/list_header.tpl b/admin-dev/themes/default/template/helpers/list/list_header.tpl index a07a50887..a03ef58b9 100644 --- a/admin-dev/themes/default/template/helpers/list/list_header.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_header.tpl @@ -175,6 +175,7 @@ {/if} {/if} + {if $simple_header}
{if isset($title)}

{if isset($icon)} {/if}{if is_array($title)}{$title|end}{else}{$title}{/if}

{/if} @@ -247,7 +248,6 @@ -- {/if} - {* Filters (input, select, date or bool) *} {foreach $fields_display AS $key => $params} diff --git a/admin-dev/themes/default/template/toolbar.tpl b/admin-dev/themes/default/template/toolbar.tpl index fc8a6275d..3a68ec602 100644 --- a/admin-dev/themes/default/template/toolbar.tpl +++ b/admin-dev/themes/default/template/toolbar.tpl @@ -23,7 +23,7 @@ * International Registered Trademark & Property of PrestaShop SA *} -
+
{block name=toolbarBox}
    @@ -52,7 +52,7 @@ var modules_list_loaded = false; $(function() { //get reference on save link - btn_save = $('span[class~="process-icon-save"]').parent(); + btn_save = $('#{$table}_toolbar span[class~="process-icon-save"]').parent(); //get reference on form submit button btn_submit = $('#{$table}_form_submit_btn'); @@ -89,6 +89,9 @@ //submit the form {block name=formSubmit} btn_save.click(function() { + // Vars + var btn_submit = $('#{$table}_form_submit_btn'); + // Avoid double click if (submited) return false; diff --git a/classes/Address.php b/classes/Address.php index 10600c1cf..f74697445 100644 --- a/classes/Address.php +++ b/classes/Address.php @@ -264,13 +264,17 @@ class AddressCore extends ObjectModel if(!isset($id_address) || empty($id_address)) return false; - if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT c.`active` - FROM `'._DB_PREFIX_.'address` a - LEFT JOIN `'._DB_PREFIX_.'country` c ON c.`id_country` = a.`id_country` - WHERE a.`id_address` = '.(int)$id_address)) - return false; - return ($result['active']); + $cache_id = 'Address::isCountryActiveById_'.(int)$id_address; + if (!Cache::isStored($cache_id)) + { + $result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getvalue(' + SELECT c.`active` + FROM `'._DB_PREFIX_.'address` a + LEFT JOIN `'._DB_PREFIX_.'country` c ON c.`id_country` = a.`id_country` + WHERE a.`id_address` = '.(int)$id_address); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** @@ -324,12 +328,17 @@ class AddressCore extends ObjectModel { if (!$id_customer) return false; - - return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' - SELECT `id_address` - FROM `'._DB_PREFIX_.'address` - WHERE `id_customer` = '.(int)$id_customer.' AND `deleted` = 0'.($active ? ' AND `active` = 1' : '') - ); + $cache_id = 'Address::getFirstCustomerAddressId_'.(int)$id_customer.'-'.(bool)$active; + if (!Cache::isStored($cache_id)) + { + $result = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + SELECT `id_address` + FROM `'._DB_PREFIX_.'address` + WHERE `id_customer` = '.(int)$id_customer.' AND `deleted` = 0'.($active ? ' AND `active` = 1' : '') + ); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** @@ -379,5 +388,4 @@ class AddressCore extends ObjectModel $query->where('id_warehouse = 0'); return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); } -} - +} \ No newline at end of file diff --git a/classes/AddressFormat.php b/classes/AddressFormat.php index 0c9fc1183..bf288096f 100644 --- a/classes/AddressFormat.php +++ b/classes/AddressFormat.php @@ -99,6 +99,7 @@ class AddressFormatCore extends ObjectModel 'outstanding_allow_amount', 'call_prefix', 'definition', + 'debug_list' ); public static $forbiddenClassList = array( diff --git a/classes/Autoload.php b/classes/Autoload.php index 765a75d58..9d7a6ea28 100644 --- a/classes/Autoload.php +++ b/classes/Autoload.php @@ -137,25 +137,17 @@ class Autoload // Write classes index on disc to cache it $filename = $this->root_dir.Autoload::INDEX_FILE; - if ((file_exists($filename) && !is_writable($filename)) || !is_writable(dirname($filename))) + $filename_tmp = tempnam(dirname($filename), basename($filename.'.')); + if ($filename_tmp !== false && file_put_contents($filename_tmp, $content, LOCK_EX) !== false) { - header('HTTP/1.1 503 temporarily overloaded'); - // Cannot use PrestaShopException in this context - die('/cache/class_index.php is not writable, please give write permissions (chmod 666) on this file.'); - } - else - { - $filename_tmp = tempnam(dirname($filename), basename($filename.'.')); - if ($filename_tmp !== false && file_put_contents($filename_tmp, $content, LOCK_EX) !== false) - { - if (!@rename($filename_tmp, $filename)) - unlink($filename_tmp); - @chmod($filename, 0666); - } - // $filename_tmp couldn't be written. $filename should be there anyway (even if outdated), no need to die. + if (!rename($filename_tmp, $filename)) + unlink($filename_tmp); else - error_log('Cannot write temporary file '.$filename_tmp); - } + @chmod($filename, 0666); + } + // $filename_tmp couldn't be written. $filename should be there anyway (even if outdated), no need to die. + else + error_log('Cannot write temporary file '.$filename_tmp); $this->index = $classes; } diff --git a/classes/CMS.php b/classes/CMS.php index 13b7cac0b..ee2f28d30 100644 --- a/classes/CMS.php +++ b/classes/CMS.php @@ -190,7 +190,7 @@ class CMSCore extends ObjectModel return (Db::getInstance()->getValue($sql)); } - public static function getCMSPages($id_lang = null, $id_cms_category = null, $active = true) + public static function getCMSPages($id_lang = null, $id_cms_category = null, $active = true, $id_shop = null) { $sql = new DbQuery(); $sql->select('*'); @@ -198,6 +198,9 @@ class CMSCore extends ObjectModel if ($id_lang) $sql->innerJoin('cms_lang', 'l', 'c.id_cms = l.id_cms AND l.id_lang = '.(int)$id_lang); + if ($id_shop) + $sql->innerJoin('cms_shop', 'cs', 'c.id_cms = cs.id_cms AND cs.id_shop = '.(int)$id_shop); + if ($active) $sql->where('c.active = 1'); diff --git a/classes/Carrier.php b/classes/Carrier.php index f526eb953..f7a137a5e 100644 --- a/classes/Carrier.php +++ b/classes/Carrier.php @@ -277,17 +277,20 @@ class CarrierCore extends ObjectModel public function getMaxDeliveryPriceByWeight($id_zone) { - $sql = 'SELECT d.`price` - FROM `'._DB_PREFIX_.'delivery` d - INNER JOIN `'._DB_PREFIX_.'range_weight` w ON d.`id_range_weight` = w.`id_range_weight` - WHERE d.`id_zone` = '.(int)$id_zone.' - AND d.`id_carrier` = '.(int)$this->id.' - '.Carrier::sqlDeliveryRangeShop('range_weight').' - ORDER BY w.`delimiter2` DESC LIMIT 1'; - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); - if (!isset($result[0]['price'])) - return false; - return $result[0]['price']; + $cache_id = 'Carrier::getMaxDeliveryPriceByWeight_'.(int)$this->id.'-'.(int)$id_zone; + if (!Cache::isStored($cache_id)) + { + $sql = 'SELECT d.`price` + FROM `'._DB_PREFIX_.'delivery` d + INNER JOIN `'._DB_PREFIX_.'range_weight` w ON d.`id_range_weight` = w.`id_range_weight` + WHERE d.`id_zone` = '.(int)$id_zone.' + AND d.`id_carrier` = '.(int)$this->id.' + '.Carrier::sqlDeliveryRangeShop('range_weight').' + ORDER BY w.`delimiter2` DESC'; + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** @@ -357,17 +360,20 @@ class CarrierCore extends ObjectModel public function getMaxDeliveryPriceByPrice($id_zone) { - $sql = 'SELECT d.`price` - FROM `'._DB_PREFIX_.'delivery` d - INNER JOIN `'._DB_PREFIX_.'range_price` r ON d.`id_range_price` = r.`id_range_price` - WHERE d.`id_zone` = '.(int)$id_zone.' - AND d.`id_carrier` = '.(int)$this->id.' - '.Carrier::sqlDeliveryRangeShop('range_price').' - ORDER BY r.`delimiter2` DESC LIMIT 1'; - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); - if (!isset($result[0]['price'])) - return false; - return $result[0]['price']; + $cache_id = 'Carrier::getMaxDeliveryPriceByPrice_'.(int)$this->id.'-'.(int)$id_zone; + if (!Cache::isStored($cache_id)) + { + $sql = 'SELECT d.`price` + FROM `'._DB_PREFIX_.'delivery` d + INNER JOIN `'._DB_PREFIX_.'range_price` r ON d.`id_range_price` = r.`id_range_price` + WHERE d.`id_zone` = '.(int)$id_zone.' + AND d.`id_carrier` = '.(int)$this->id.' + '.Carrier::sqlDeliveryRangeShop('range_price').' + ORDER BY r.`delimiter2` DESC'; + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** @@ -440,11 +446,17 @@ class CarrierCore extends ObjectModel } $sql .= ' GROUP BY c.`id_carrier` ORDER BY c.`position` ASC'; - $carriers = Db::getInstance()->executeS($sql); + + $cache_id = 'Carrier::getCarriers_'.md5($sql); + if (!Cache::isStored($cache_id)) + { + $carriers = Db::getInstance()->executeS($sql); + Cache::store($cache_id, $carriers); + } + $carriers = Cache::retrieve($cache_id); foreach ($carriers as $key => $carrier) if ($carrier['name'] == '0') $carriers[$key]['name'] = Configuration::get('PS_SHOP_NAME'); - return $carriers; } @@ -1184,7 +1196,14 @@ class CarrierCore extends ObjectModel $query->where('pc.id_product = '.(int)$product->id); $query->where('pc.id_shop = '.(int)$id_shop); - $carriers_for_product = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); + $cache_id = 'Carrier::getAvailableCarrierList_'.(int)$product->id.'-'.(int)$id_shop; + if (!Cache::isStored($cache_id)) + { + $carriers_for_product = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); + Cache::store($cache_id, $carriers_for_product); + } + $carriers_for_product = Cache::retrieve($cache_id); + $carrier_list = array(); if (!empty($carriers_for_product)) { diff --git a/classes/Cart.php b/classes/Cart.php index f38015171..4c678c978 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -325,7 +325,7 @@ class CartCore extends ObjectModel if (!CartRule::isFeatureActive() || !$this->id) return array(); - $cache_key = 'Cart::getCartRules'.$this->id.'-'.$filter; + $cache_key = 'Cart::getCartRules_'.$this->id.'-'.$filter; if (!Cache::isStored($cache_key)) { $result = Db::getInstance()->executeS(' @@ -368,12 +368,16 @@ class CartCore extends ObjectModel { if (!CartRule::isFeatureActive()) return 0; - - return Db::getInstance()->getValue(' - SELECT COUNT(*) - FROM `'._DB_PREFIX_.'cart_cart_rule` - WHERE `id_cart_rule` = '.(int)$id_cart_rule.' AND `id_cart` = '.(int)$this->id - ); + $cache_id = 'Cart::getDiscountsCustomer_'.(int)$this->id.'-'.(int)$id_cart_rule; + if (!Cache::isStored($cache_id)) + { + $result = (int)Db::getInstance()->getValue(' + SELECT COUNT(*) + FROM `'._DB_PREFIX_.'cart_cart_rule` + WHERE `id_cart_rule` = '.(int)$id_cart_rule.' AND `id_cart` = '.(int)$this->id); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } public function getLastProduct() @@ -632,14 +636,19 @@ class CartCore extends ObjectModel if (!isset($row['pai_id_image']) || $row['pai_id_image'] == 0) { - $row2 = Db::getInstance()->getRow(' - SELECT image_shop.`id_image` id_image, il.`legend` - FROM `'._DB_PREFIX_.'image` i - JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (i.id_image = image_shop.id_image AND image_shop.cover=1 AND image_shop.id_shop='.(int)$row['id_shop'].') - LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$this->id_lang.') - WHERE i.`id_product` = '.(int)$row['id_product'].' AND image_shop.`cover` = 1' - ); - + $cache_id = 'Cart::getProducts_'.'-pai_id_image-'.(int)$row['id_product'].'-'.(int)$this->id_lang.'-'.(int)$row['id_shop']; + if (!Cache::isStored($cache_id)) + { + $row2 = Db::getInstance()->getRow(' + SELECT image_shop.`id_image` id_image, il.`legend` + FROM `'._DB_PREFIX_.'image` i + JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (i.id_image = image_shop.id_image AND image_shop.cover=1 AND image_shop.id_shop='.(int)$row['id_shop'].') + LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$this->id_lang.') + WHERE i.`id_product` = '.(int)$row['id_product'].' AND image_shop.`cover` = 1' + ); + Cache::store($cache_id, $row2); + } + $row2 = Cache::retrieve($cache_id); if (!$row2) $row2 = array('id_image' => false, 'legend' => false); else @@ -727,7 +736,7 @@ class CartCore extends ObjectModel * * @result integer Products quantity */ - public function nbProducts() + public function nbProducts() { if (!$this->id) return 0; @@ -1078,9 +1087,9 @@ class CartCore extends ObjectModel ); $id_customization = Db::getInstance()->Insert_ID(); } - + $query = 'INSERT INTO `'._DB_PREFIX_.'customized_data` (`id_customization`, `type`, `index`, `value`) - VALUES ('.(int)$id_customization.', '.(int)$type.', '.(int)$index.', \''.pSql($field).'\')'; + VALUES ('.(int)$id_customization.', '.(int)$type.', '.(int)$index.', \''.pSQL($field).'\')'; if (!Db::getInstance()->execute($query)) return false; @@ -1094,7 +1103,13 @@ class CartCore extends ObjectModel */ public function orderExists() { - return (bool)Db::getInstance()->getValue('SELECT count(*) FROM `'._DB_PREFIX_.'orders` WHERE `id_cart` = '.(int)$this->id); + $cache_id = 'Cart::orderExists_'.(int)$this->id; + if (!Cache::isStored($cache_id)) + { + $result = (bool)Db::getInstance()->getValue('SELECT count(*) FROM `'._DB_PREFIX_.'orders` WHERE `id_cart` = '.(int)$this->id); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** @@ -2277,18 +2292,23 @@ class CartCore extends ObjectModel public function getAddressCollection() { $collection = array(); - $result = Db::getInstance()->executeS( - 'SELECT DISTINCT `id_address_delivery` - FROM `'._DB_PREFIX_.'cart_product` - WHERE id_cart = '.(int)$this->id - ); + $cache_id = 'Cart::getAddressCollection'.(int)$this->id; + if (!Cache::isStored($cache_id)) + { + $result = Db::getInstance()->executeS( + 'SELECT DISTINCT `id_address_delivery` + FROM `'._DB_PREFIX_.'cart_product` + WHERE id_cart = '.(int)$this->id + ); + Cache::store($cache_id, $result); + } + $result = Cache::retrieve($cache_id); $result[] = array('id_address_delivery' => (int)$this->id_address_delivery); foreach ($result as $row) if ((int)$row['id_address_delivery'] != 0) $collection[(int)$row['id_address_delivery']] = new Address((int)$row['id_address_delivery']); - return $collection; } @@ -3038,7 +3058,6 @@ class CartCore extends ObjectModel */ public function addTextFieldToProduct($id_product, $index, $type, $text_value) { - $text_value = str_replace(array("\n", "\r"), '', nl2br($text_value)); if (!_PS_MAGIC_QUOTES_GPC_){ $text_value = str_replace('\\', '\\\\', $text_value); $text_value = str_replace('\'', '\\\'', $text_value); @@ -3466,10 +3485,14 @@ class CartCore extends ObjectModel ) WHERE `id_cart` = '.(int)$this->id.' '.(Configuration::get('PS_ALLOW_MULTISHIPPING') ? ' AND `id_shop` = '.(int)$this->id_shop : ''); - - $result = Db::getInstance()->execute($sql); - if ($result) - $emptyCache = true; + + $cache_id = 'Cart::setNoMultishipping'.(int)$this->id.'-'.(int)$this->id_shop; + if (!Cache::isStored($cache_id)) + { + if ($result = (bool)Db::getInstance()->execute($sql)) + $emptyCache = true; + Cache::store($cache_id, $result); + } if (Customization::isFeatureActive()) Db::getInstance()->execute(' diff --git a/classes/CartRule.php b/classes/CartRule.php index 1890bda2d..0461d53e7 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -254,7 +254,8 @@ class CartRuleCore extends ObjectModel } else $cart_rule['quantity_for_user'] = 0; - + unset($cart_rule); + foreach ($result as $cart_rule) if ($cart_rule['shop_restriction']) { diff --git a/classes/Category.php b/classes/Category.php index d73bb2f4c..a4c5eb00e 100644 --- a/classes/Category.php +++ b/classes/Category.php @@ -706,9 +706,9 @@ class CategoryCore extends ObjectModel * @param boolean $active return only active categories * @return array categories */ - public static function getHomeCategories($id_lang, $active = true) + public static function getHomeCategories($id_lang, $active = true, $id_shop = false) { - return self::getChildren(Configuration::get('PS_HOME_CATEGORY'), $id_lang, $active); + return self::getChildren(Configuration::get('PS_HOME_CATEGORY'), $id_lang, $active, $id_shop); } public static function getRootCategory($id_lang = null, Shop $shop = null) @@ -744,16 +744,22 @@ class CategoryCore extends ObjectModel if (!Validate::isBool($active)) die(Tools::displayError()); - $query = 'SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, category_shop.`id_shop` - FROM `'._DB_PREFIX_.'category` c - LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').') - '.Shop::addSqlAssociation('category', 'c').' - WHERE `id_lang` = '.(int)$id_lang.' - AND c.`id_parent` = '.(int)$id_parent.' - '.($active ? 'AND `active` = 1' : '').' - GROUP BY c.`id_category` - ORDER BY category_shop.`position` ASC'; - return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); + $cache_id = 'Category::getChildren_'.(int)$id_parent.'-'.(int)$id_lang.'-'.(bool)$active.'-'.(int)$id_shop; + if (!Cache::isStored($cache_id)) + { + $query = 'SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, category_shop.`id_shop` + FROM `'._DB_PREFIX_.'category` c + LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').') + '.Shop::addSqlAssociation('category', 'c').' + WHERE `id_lang` = '.(int)$id_lang.' + AND c.`id_parent` = '.(int)$id_parent.' + '.($active ? 'AND `active` = 1' : '').' + GROUP BY c.`id_category` + ORDER BY category_shop.`position` ASC'; + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** @@ -1048,14 +1054,20 @@ class CategoryCore extends ObjectModel public function getGroups() { $groups = array(); - $result = Db::getInstance()->executeS(' - SELECT cg.`id_group` - FROM '._DB_PREFIX_.'category_group cg - WHERE cg.`id_category` = '.(int)$this->id - ); - foreach ($result as $group) - $groups[] = $group['id_group']; - return $groups; + $cache_id = 'Category::getGroups_'.(int)$this->id; + if (!Cache::isStored($cache_id)) + { + $result = Db::getInstance()->executeS(' + SELECT cg.`id_group` + FROM '._DB_PREFIX_.'category_group cg + WHERE cg.`id_category` = '.(int)$this->id + ); + $groups = array(); + foreach ($result as $group) + $groups[] = $group['id_group']; + Cache::store($cache_id, $groups); + } + return Cache::retrieve($cache_id); } public function addGroupsIfNoExist($id_group) @@ -1076,24 +1088,23 @@ class CategoryCore extends ObjectModel */ public function checkAccess($id_customer) { - if (!$id_customer) + $cache_id = 'Category::checkAccess_'.(int)$this->id.'-'.$id_customer.(!$id_customer ? '-'.(int)Group::getCurrent()->id : ''); + if (!Cache::isStored($cache_id)) { - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' + if (!$id_customer) + $result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT ctg.`id_group` FROM '._DB_PREFIX_.'category_group ctg - WHERE ctg.`id_category` = '.(int)$this->id.' AND ctg.`id_group` = '.(int)Group::getCurrent()->id.' - '); - } else { - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' + WHERE ctg.`id_category` = '.(int)$this->id.' AND ctg.`id_group` = '.(int)Group::getCurrent()->id); + else + $result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT ctg.`id_group` FROM '._DB_PREFIX_.'category_group ctg INNER JOIN '._DB_PREFIX_.'customer_group cg on (cg.`id_group` = ctg.`id_group` AND cg.`id_customer` = '.(int)$id_customer.') - WHERE ctg.`id_category` = '.(int)$this->id - ); + WHERE ctg.`id_category` = '.(int)$this->id); + Cache::store($cache_id, $result); } - if ($result && isset($result['id_group']) && $result['id_group']) - return true; - return false; + return Cache::retrieve($cache_id); } /** @@ -1239,12 +1250,16 @@ class CategoryCore extends ObjectModel */ public static function getInterval($id) { - $sql = 'SELECT nleft, nright, level_depth - FROM '._DB_PREFIX_.'category - WHERE id_category = '.(int)$id; - if (!$result = Db::getInstance()->getRow($sql)) - return false; - return $result; + $cache_id = 'Category::getInterval_'.(int)$id; + if (!Cache::isStored($cache_id)) + { + $sql = 'SELECT nleft, nright, level_depth + FROM '._DB_PREFIX_.'category + WHERE id_category = '.(int)$id; + $result = Db::getInstance()->getRow($sql); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** @@ -1426,11 +1441,17 @@ class CategoryCore extends ObjectModel public static function getCategoriesWithoutParent() { - return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' - SELECT DISTINCT c.* - FROM `'._DB_PREFIX_.'category` c - LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.(int)Context::getContext()->language->id.') - WHERE `level_depth` = 1'); + $cache_id = 'Category::getCategoriesWithoutParent_'.(int)Context::getContext()->language->id; + if (!Cache::isStored($cache_id)) + { + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + SELECT DISTINCT c.* + FROM `'._DB_PREFIX_.'category` c + LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.(int)Context::getContext()->language->id.') + WHERE `level_depth` = 1'); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } public function isRootCategoryForAShop() @@ -1449,12 +1470,17 @@ class CategoryCore extends ObjectModel public static function getTopCategory($id_lang = null) { if (is_null($id_lang)) - $id_lang = Context::getContext()->language->id; - $id_category = Db::getInstance()->getValue(' - SELECT `id_category` - FROM `'._DB_PREFIX_.'category` - WHERE `id_parent` = 0'); - return new Category($id_category, $id_lang); + $id_lang = (int)Context::getContext()->language->id; + $cache_id = 'Category::getTopCategory_'.(int)$id_lang; + if (!Cache::isStored($cache_id)) + { + $id_category = (int)Db::getInstance()->getValue(' + SELECT `id_category` + FROM `'._DB_PREFIX_.'category` + WHERE `id_parent` = 0'); + Cache::store($cache_id, new Category($id_category, $id_lang)); + } + return Cache::retrieve($cache_id); } public function addPosition($position, $id_shop = null) diff --git a/classes/Currency.php b/classes/Currency.php index 3280ec189..d92660542 100644 --- a/classes/Currency.php +++ b/classes/Currency.php @@ -296,10 +296,16 @@ class CurrencyCore extends ObjectModel */ public static function getIdByIsoCode($iso_code, $id_shop = 0) { - $query = Currency::getIdByQuery($id_shop); - $query->where('iso_code = \''.pSQL($iso_code).'\''); - - return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query->build()); + $cache_id = 'Currency::getIdByIsoCode_'.pSQL($iso_code).'-'.(int)$id_shop; + if (!Cache::isStored($cache_id)) + { + $query = Currency::getIdByQuery($id_shop); + $query->where('iso_code = \''.pSQL($iso_code).'\''); + + $result = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query->build()); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** diff --git a/classes/Customer.php b/classes/Customer.php index 431d217e6..8191d3ee6 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -362,15 +362,18 @@ class CustomerCore extends ObjectModel { if (!Validate::isUnsignedId($id_customer)) return true; - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT `id_customer` - FROM `'._DB_PREFIX_.'customer` - WHERE `id_customer` = \''.(int)$id_customer.'\' - AND active = 1 - AND `deleted` = 0'); - if (isset($result['id_customer'])) - return false; - return true; + $cache_id = 'Customer::isBanned_'.(int)$id_customer; + if (!Cache::isStored($cache_id)) + { + $result = (bool)!Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' + SELECT `id_customer` + FROM `'._DB_PREFIX_.'customer` + WHERE `id_customer` = \''.(int)$id_customer.'\' + AND active = 1 + AND `deleted` = 0'); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** @@ -413,7 +416,7 @@ class CustomerCore extends ObjectModel public static function customerHasAddress($id_customer, $id_address) { $key = (int)$id_customer.'-'.(int)$id_address; - if (!array_key_exists($id_address, self::$_customerHasAddress)) + if (!array_key_exists($key, self::$_customerHasAddress)) { self::$_customerHasAddress[$key] = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT `id_address` @@ -439,15 +442,22 @@ class CustomerCore extends ObjectModel */ public function getAddresses($id_lang) { - $sql = 'SELECT DISTINCT a.*, cl.`name` AS country, s.name AS state, s.iso_code AS state_iso - FROM `'._DB_PREFIX_.'address` a - LEFT JOIN `'._DB_PREFIX_.'country` c ON (a.`id_country` = c.`id_country`) - LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country`) - LEFT JOIN `'._DB_PREFIX_.'state` s ON (s.`id_state` = a.`id_state`) - '.(Context::getContext()->shop->getGroup()->share_order ? '' : Shop::addSqlAssociation('country', 'c')).' - WHERE `id_lang` = '.(int)$id_lang.' AND `id_customer` = '.(int)$this->id.' AND a.`deleted` = 0'; + $share_order = (bool)Context::getContext()->shop->getGroup()->share_order; + $cache_id = 'Customer::getAddresses'.(int)$this->id.'-'.(int)$id_lang.'-'.$share_order; + if (!Cache::isStored($cache_id)) + { + $sql = 'SELECT DISTINCT a.*, cl.`name` AS country, s.name AS state, s.iso_code AS state_iso + FROM `'._DB_PREFIX_.'address` a + LEFT JOIN `'._DB_PREFIX_.'country` c ON (a.`id_country` = c.`id_country`) + LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country`) + LEFT JOIN `'._DB_PREFIX_.'state` s ON (s.`id_state` = a.`id_state`) + '.($share_order ? '' : Shop::addSqlAssociation('country', 'c')).' + WHERE `id_lang` = '.(int)$id_lang.' AND `id_customer` = '.(int)$this->id.' AND a.`deleted` = 0'; - return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** @@ -476,12 +486,17 @@ class CustomerCore extends ObjectModel { if (!Validate::isUnsignedId($id_customer) || !Validate::isMd5($passwd)) die (Tools::displayError()); - - $sql = 'SELECT `id_customer` - FROM `'._DB_PREFIX_.'customer` - WHERE `id_customer` = '.$id_customer.' + $cache_id = 'Customer::checkPassword'.(int)$id_customer.'-'.$passwd; + if (!Cache::isStored($cache_id)) + { + $sql = 'SELECT `id_customer` + FROM `'._DB_PREFIX_.'customer` + WHERE `id_customer` = '.$id_customer.' AND `passwd` = \''.$passwd.'\''; - return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); + $result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** @@ -574,12 +589,16 @@ class CustomerCore extends ObjectModel public static function customerIdExistsStatic($id_customer) { - $row = Db::getInstance()->getRow(' - SELECT `id_customer` - FROM '._DB_PREFIX_.'customer c - WHERE c.`id_customer` = '.(int)$id_customer); - - return isset($row['id_customer']); + $cache_id = 'Customer::customerIdExistsStatic'.(int)$id_customer; + if (!Cache::isStored($cache_id)) + { + $result = (int)Db::getInstance()->getValue(' + SELECT `id_customer` + FROM '._DB_PREFIX_.'customer c + WHERE c.`id_customer` = '.(int)$id_customer); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** diff --git a/classes/FileUploader.php b/classes/FileUploader.php index 9c3758244..695217189 100755 --- a/classes/FileUploader.php +++ b/classes/FileUploader.php @@ -105,8 +105,10 @@ class QqUploadedFileForm $legends = Tools::getValue('legend'); if (is_array($legends)) foreach ($legends as $key => $legend) - if (!empty($legend)) + if (!empty($legend) && Validate::isGenericName($legend)) $image->legend[(int)$key] = $legend; + else + return array('error' => sprintf(Tools::displayError('Error on image legend "%1s." is not a valid legend.'), Tools::safeOutput($legend))); if (!Image::getCover($image->id_product)) $image->cover = 1; else @@ -192,8 +194,10 @@ class QqUploadedFileXhr $legends = Tools::getValue('legend'); if (is_array($legends)) foreach ($legends as $key => $legend) - if (!empty($legend)) + if (!empty($legend) && Validate::isGenericName($legend)) $image->legend[(int)$key] = $legend; + else + return array('error' => sprintf(Tools::displayError('Error on image legend "%1s." is not a valid legend.'), Tools::safeOutput($legend))); if (!Image::getCover($image->id_product)) $image->cover = 1; else diff --git a/classes/Group.php b/classes/Group.php index 056fb73cd..7a64e1359 100644 --- a/classes/Group.php +++ b/classes/Group.php @@ -301,12 +301,21 @@ class GroupCore extends ObjectModel public static function getCurrent() { static $groups = array(); + $customer = Context::getContext()->customer; if (Validate::isLoadedObject($customer)) + { $id_group = (int)$customer->id_default_group; + $group = new Group((int)$id_group); + if (!$group->isAssociatedToShop(Context::getContext()->shop->id)) + $group = new Group((int)Configuration::get('PS_CUSTOMER_GROUP')); + } else $id_group = (int)Configuration::get('PS_UNIDENTIFIED_GROUP'); - + + if (!isset($groups[$id_group]) && isset($group)) + $groups[$id_group] = $group; + if (!isset($groups[$id_group])) $groups[$id_group] = new Group($id_group); diff --git a/classes/Hook.php b/classes/Hook.php index c233d99e1..339d5ff38 100644 --- a/classes/Hook.php +++ b/classes/Hook.php @@ -326,7 +326,10 @@ class HookCore extends ObjectModel if ($frontend) { $sql->leftJoin('module_group', 'mg', 'mg.`id_module` = m.`id_module`'); - $sql->where('mg.`id_group` IN ('.implode(', ', $groups).')'); + if (Validate::isLoadedObject($context->shop)) + $sql->where('mg.id_shop = '.((int)$context->shop->id).' AND mg.`id_group` IN ('.implode(', ', $groups).')'); + else + $sql->where('mg.`id_group` IN ('.implode(', ', $groups).')'); $sql->groupBy('hm.id_hook, hm.id_module'); } diff --git a/classes/Language.php b/classes/Language.php index be53bf8f5..45fd98408 100644 --- a/classes/Language.php +++ b/classes/Language.php @@ -619,6 +619,35 @@ class LanguageCore extends ObjectModel return Db::getInstance()->getValue('SELECT `language_code` FROM `'._DB_PREFIX_.'lang` WHERE `iso_code` = \''.pSQL(strtolower($iso_code)).'\''); } + public static function getLanguageByIETFCode($code) + { + if (!Validate::isLanguageCode($code)) + die(sprintf(Tools::displayError('Fatal error: IETF code %s is not correct'), $code)); + + // $code is in the form of 'xx-YY' where xx is the language code + // and 'YY' a country code identifying a variant of the language. + $lang_country = explode('-', $code); + // Get the language component of the code + $lang = $lang_country[0]; + + // Find the id_lang of the language. + // We look for anything with the correct language code + // and sort on equality with the exact IETF code wanted. + // That way using only one query we get either the exact wanted language + // or a close match. + $id_lang = Db::getInstance()->getValue( + 'SELECT `id_lang` FROM ' + .'`'._DB_PREFIX_.'lang` WHERE LEFT(`language_code`,2) = \''.pSQL($lang).'\' ' + .'ORDER BY language_code = \''.pSQL($code).'\' DESC' + ); + + // Instantiate the Language object if we found it. + if ($id_lang) + return new Language($id_lang); + else + return false; + } + /** * Return array (id_lang, iso_code) * diff --git a/classes/Link.php b/classes/Link.php index cb207e6db..b2e4f0776 100644 --- a/classes/Link.php +++ b/classes/Link.php @@ -423,6 +423,15 @@ class LinkCore */ public function getPageLink($controller, $ssl = null, $id_lang = null, $request = null, $request_url_encode = false, $id_shop = null) { + + //If $controller contains '&' char, it means that $controller contains request data and must be parsed first + $p = strpos($controller, '&'); + if ($p !== false) { + $request = substr($controller, $p + 1); + $request_url_encode = false; + $controller = substr($controller, 0, $p); + } + $controller = Tools::strReplaceFirst('.php', '', $controller); if (!$id_lang) $id_lang = (int)Context::getContext()->language->id; @@ -501,6 +510,7 @@ class LinkCore public function goPage($url, $p) { + $url = rtrim(str_replace('?&', '?', $url), '?'); return $url.($p == 1 ? '' : (!strstr($url, '?') ? '?' : '&').'p='.(int)$p); } diff --git a/classes/LocalizationPack.php b/classes/LocalizationPack.php index 87b90967c..9d7449835 100644 --- a/classes/LocalizationPack.php +++ b/classes/LocalizationPack.php @@ -64,6 +64,7 @@ class LocalizationPackCore if ($install_mode && $res && isset($this->iso_currency)) { + Cache::clean('Currency::getIdByIsoCode_*'); $res &= Configuration::updateValue('PS_CURRENCY_DEFAULT', (int)Currency::getIdByIsoCode($this->iso_currency)); Currency::refreshCurrencies(); } diff --git a/classes/Media.php b/classes/Media.php index bc8257c76..fc042320d 100755 --- a/classes/Media.php +++ b/classes/Media.php @@ -37,9 +37,10 @@ class MediaCore 'ui.selectable' => array('fileName' => 'jquery.ui.selectable.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true), 'ui.sortable' => array('fileName' => 'jquery.ui.sortable.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true), 'ui.accordion' => array('fileName' => 'jquery.ui.accordion.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), - 'ui.autocomplete' => array('fileName' => 'jquery.ui.autocomplete.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true), + 'ui.autocomplete' => array('fileName' => 'jquery.ui.autocomplete.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position', 'ui.menu'), 'theme' => true), 'ui.button' => array('fileName' => 'jquery.ui.button.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), 'ui.dialog' => array('fileName' => 'jquery.ui.dialog.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position','ui.button'), 'theme' => true), + 'ui.menu' => array('fileName' => 'jquery.ui.menu.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true), 'ui.slider' => array('fileName' => 'jquery.ui.slider.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true), 'ui.tabs' => array('fileName' => 'jquery.ui.tabs.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), 'ui.datepicker' => array('fileName' => 'jquery.ui.datepicker.min.js', 'dependencies' => array('ui.core'), 'theme' => true), @@ -109,7 +110,7 @@ class MediaCore // If the string is too big preg_replace return an error // In this case, we don't compress the content - if (preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR) + if (function_exists('preg_last_error') && preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR) { if (_PS_MODE_DEV_) error_log('ERROR: PREG_BACKTRACK_LIMIT_ERROR in function packJSinHTML'); diff --git a/classes/Meta.php b/classes/Meta.php index 4e911fe72..1612812b1 100644 --- a/classes/Meta.php +++ b/classes/Meta.php @@ -277,24 +277,31 @@ class MetaCore extends ObjectModel FROM `'._DB_PREFIX_.'category_lang` cl WHERE cl.`id_lang` = '.(int)$id_lang.' AND cl.`id_category` = '.(int)$id_category.Shop::addSqlRestrictionOnLang('cl'); - if ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql)) + + $cache_id = 'Meta::getCategoryMetas'.(int)$id_category.'-'.(int)$id_lang; + if (!Cache::isStored($cache_id)) { - if (empty($row['meta_description'])) - $row['meta_description'] = strip_tags($row['description']); - - // Paginate title - if (!empty($row['meta_title'])) - $row['meta_title'] = $title.$row['meta_title'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); + if ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql)) + { + if (empty($row['meta_description'])) + $row['meta_description'] = strip_tags($row['description']); + + // Paginate title + if (!empty($row['meta_title'])) + $row['meta_title'] = $title.$row['meta_title'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); + else + $row['meta_title'] = $row['name'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); + + if (!empty($title)) + $row['meta_title'] = $title.(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); + + $result = Meta::completeMetaTags($row, $row['name']); + } else - $row['meta_title'] = $row['name'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); - - if (!empty($title)) - $row['meta_title'] = $title.(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); - - return Meta::completeMetaTags($row, $row['name']); + $result = Meta::getHomeMetas($id_lang, $page_name); + Cache::store($cache_id, $result); } - - return Meta::getHomeMetas($id_lang, $page_name); + return Cache::retrieve($cache_id); } /** diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index 0c70cbf3c..783cd6abf 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -191,7 +191,7 @@ abstract class ObjectModelCore if ($id) { // Load object from database if object id is present - $cache_id = 'objectmodel_'.$this->def['classname'].'_'.(int)$id.'_'.(int)$id_shop.'_'.(int)$id_lang; + $cache_id = 'objectmodel_'.$this->def['classname'].'_'.(int)$id.'_'.(int)$this->id_shop.'_'.(int)$id_lang; if (!Cache::isStored($cache_id)) { $sql = new DbQuery(); @@ -1234,11 +1234,16 @@ abstract class ObjectModelCore if ($id_shop === null) $id_shop = Context::getContext()->shop->id; - $sql = 'SELECT id_shop - FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'_shop` - WHERE `'.$this->def['primary'].'` = '.(int)$this->id.' - AND id_shop = '.(int)$id_shop; - return (bool)Db::getInstance()->getValue($sql); + $cache_id = 'objectmodel_shop_'.$this->def['classname'].'_'.(int)$this->id.'-'.(int)$id_shop; + if (!Cache::isStored($cache_id)) + { + $sql = 'SELECT id_shop + FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'_shop` + WHERE `'.$this->def['primary'].'` = '.(int)$this->id.' + AND id_shop = '.(int)$id_shop; + Cache::store($cache_id, (bool)Db::getInstance()->getValue($sql)); + } + return Cache::retrieve($cache_id); } /** diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 68bec3226..f8585a69d 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -378,7 +378,8 @@ abstract class PaymentModuleCore extends Module $customization_text .= sprintf(Tools::displayError('%d image(s)'), count($customization['datas'][Product::CUSTOMIZE_FILE])).'
    '; $customization_text .= '---
    '; } - $customization_text = rtrim($customization_text, '---
    '); + + $customization_text = Tools::rtrimString($customization_text, '---
    '); $customization_quantity = (int)$product['customization_quantity']; $products_list .= diff --git a/classes/Product.php b/classes/Product.php index cd8e85b53..98fd2099e 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -229,7 +229,13 @@ class ProductCore extends ObjectModel protected static $_prices = array(); protected static $_pricesLevel2 = array(); protected static $_incat = array(); + + /** + * @since 1.5.6.1 + * @var array $_cart_quantity is deprecated since 1.5.6.1 + */ protected static $_cart_quantity = array(); + protected static $_tax_rules_group = array(); protected static $_cacheFeatures = array(); protected static $_frontFeaturesCache = array(); @@ -2443,13 +2449,18 @@ class ProductCore extends ObjectModel { if (!$context) $context = Context::getContext(); - - $sql = 'SELECT image_shop.`id_image` - FROM `'._DB_PREFIX_.'image` i - '.Shop::addSqlAssociation('image', 'i').' - WHERE i.`id_product` = '.(int)$id_product.' - AND image_shop.`cover` = 1'; - return Db::getInstance()->getRow($sql); + $cache_id = 'Product::getOrderStates_'.(int)$id_product.'-'.(int)$context->shop->id; + if (!Cache::isStored($cache_id)) + { + $sql = 'SELECT image_shop.`id_image` + FROM `'._DB_PREFIX_.'image` i + '.Shop::addSqlAssociation('image', 'i').' + WHERE i.`id_product` = '.(int)$id_product.' + AND image_shop.`cover` = 1'; + $result = Db::getInstance()->getRow($sql); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** @@ -2511,15 +2522,17 @@ class ProductCore extends ObjectModel $cart_quantity = 0; if ((int)$id_cart) { - $condition = ''; - $cache_name = (int)$id_cart.'_'.(int)$id_product; - if (!isset(self::$_cart_quantity[$cache_name]) || self::$_cart_quantity[$cache_name] != (int)$quantity) - self::$_cart_quantity[$cache_name] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' - SELECT SUM(`quantity`) + $cache_id = 'Product::getPriceStatic_'.(int)$id_product.'-'.(int)$id_cart; + if (!Cache::isStored($cache_id)) + { + $sql = 'SELECT SUM(`quantity`) FROM `'._DB_PREFIX_.'cart_product` WHERE `id_product` = '.(int)$id_product.' - AND `id_cart` = '.(int)$id_cart); - $cart_quantity = self::$_cart_quantity[$cache_name]; + AND `id_cart` = '.(int)$id_cart; + $cart_quantity = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); + Cache::store($cache_id, $cart_quantity); + } + $cart_quantity = Cache::retrieve($cache_id); } $id_currency = (int)Validate::isLoadedObject($context->currency) ? $context->currency->id : Configuration::get('PS_CURRENCY_DEFAULT'); @@ -4345,22 +4358,27 @@ class ProductCore extends ObjectModel if (!Group::isFeatureActive()) return true; - if (!$id_customer) - return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' - SELECT ctg.`id_group` - FROM `'._DB_PREFIX_.'category_product` cp - INNER JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = cp.`id_category`) - WHERE cp.`id_product` = '.(int)$this->id.' AND ctg.`id_group` ='.(int)Group::getCurrent()->id); - else - return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' - SELECT cg.`id_group` - FROM `'._DB_PREFIX_.'category_product` cp - INNER JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = cp.`id_category`) - INNER JOIN `'._DB_PREFIX_.'customer_group` cg ON (cg.`id_group` = ctg.`id_group`) - WHERE cp.`id_product` = '.(int)$this->id.' AND cg.`id_customer` = '.(int)$id_customer); + $cache_id = 'Product::checkAccess_'.(int)$this->id.'-'.(int)$id_customer.(!$id_customer ? '-'.(int)Group::getCurrent()->id : ''); + if (!Cache::isStored($cache_id)) + { + if (!$id_customer) + $result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + SELECT ctg.`id_group` + FROM `'._DB_PREFIX_.'category_product` cp + INNER JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = cp.`id_category`) + WHERE cp.`id_product` = '.(int)$this->id.' AND ctg.`id_group` = '.(int)Group::getCurrent()->id); + else + $result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + SELECT cg.`id_group` + FROM `'._DB_PREFIX_.'category_product` cp + INNER JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = cp.`id_category`) + INNER JOIN `'._DB_PREFIX_.'customer_group` cg ON (cg.`id_group` = ctg.`id_group`) + WHERE cp.`id_product` = '.(int)$this->id.' AND cg.`id_customer` = '.(int)$id_customer); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } - /** * Add a stock movement for current product * @@ -4917,8 +4935,12 @@ class ProductCore extends ObjectModel */ public static function getAttributesParams($id_product, $id_product_attribute) { + $id_lang = (int)Context::getContext()->language->id; + $id_shop = (int)Context::getContext()->shop->id; + $cache_id = 'Product::getAttributesParams_'.(int)$id_product.'-'.(int)$id_product_attribute.'-'.(int)$id_lang.'-'.(int)$id_shop; + // if blocklayered module is installed we check if user has set custom attribute name - if (Module::isInstalled('blocklayered')) + if (Module::isInstalled('blocklayered') && Module::isEnabled('blocklayered')) { $nb_custom_values = Db::getInstance()->executeS(' SELECT DISTINCT la.`id_attribute`, la.`url_name` as `name` @@ -4929,7 +4951,7 @@ class ProductCore extends ObjectModel ON (pac.`id_product_attribute` = pa.`id_product_attribute`) '.Shop::addSqlAssociation('product_attribute', 'pa').' LEFT JOIN `'._DB_PREFIX_.'layered_indexable_attribute_lang_value` la - ON (la.`id_attribute` = a.`id_attribute` AND la.`id_lang` = '.(int)Context::getContext()->language->id.') + ON (la.`id_attribute` = a.`id_attribute` AND la.`id_lang` = '.(int)$id_lang.') WHERE la.`url_name` IS NOT NULL AND la.`url_name` != \'\' AND pa.`id_product` = '.(int)$id_product.' AND pac.`id_product_attribute` = '.(int)$id_product_attribute); @@ -4947,7 +4969,7 @@ class ProductCore extends ObjectModel LEFT JOIN `'._DB_PREFIX_.'attribute` a ON (a.`id_attribute_group` = g.`id_attribute_group`) WHERE a.`id_attribute` = '.(int)$attribute['id_attribute'].' - AND g.`id_lang` = '.(int)Context::getContext()->language->id.' + AND g.`id_lang` = '.(int)$id_lang.' AND g.`url_name` IS NOT NULL AND g.`url_name` != \'\''); if (empty($group)) { @@ -4957,7 +4979,7 @@ class ProductCore extends ObjectModel LEFT JOIN `'._DB_PREFIX_.'attribute` a ON (a.`id_attribute_group` = g.`id_attribute_group`) WHERE a.`id_attribute` = '.(int)$attribute['id_attribute'].' - AND g.`id_lang` = '.(int)Context::getContext()->language->id.' + AND g.`id_lang` = '.(int)$id_lang.' AND g.`name` IS NOT NULL'); } $result[] = array_merge($attribute, $group[0]); @@ -4966,9 +4988,9 @@ class ProductCore extends ObjectModel SELECT DISTINCT a.`id_attribute_group`, al.`name`, agl.`name` as `group` FROM `'._DB_PREFIX_.'attribute` a LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al - ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)Context::getContext()->language->id.') + ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.') LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl - ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)Context::getContext()->language->id.') + ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$id_lang.') LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (a.`id_attribute` = pac.`id_attribute`) LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa @@ -4977,45 +4999,30 @@ class ProductCore extends ObjectModel WHERE pa.`id_product` = '.(int)$id_product.' AND pac.id_product_attribute = '.(int)$id_product_attribute.' AND a.`id_attribute` NOT IN('.implode(', ', $tab_id_attribute).')'); - $result = array_merge($values_not_custom, $result); - } - else - { - $result = Db::getInstance()->executeS(' - SELECT al.`name`, agl.`name` as `group` - FROM `'._DB_PREFIX_.'attribute` a - LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al - ON (al.`id_attribute` = a.`id_attribute` AND al.`id_lang` = '.(int)Context::getContext()->language->id.') - LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac - ON (pac.`id_attribute` = a.`id_attribute`) - LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa - ON (pa.`id_product_attribute` = pac.`id_product_attribute`) - '.Shop::addSqlAssociation('product_attribute', 'pa').' - LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl - ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)Context::getContext()->language->id.') - WHERE pa.`id_product` = '.(int)$id_product.' - AND pac.`id_product_attribute` = '.(int)$id_product_attribute.' - AND agl.`id_lang` = '.(int)Context::getContext()->language->id); + return array_merge($values_not_custom, $result); } } - else + + if (!Cache::isStored($cache_id)) { $result = Db::getInstance()->executeS(' SELECT al.`name`, agl.`name` as `group` FROM `'._DB_PREFIX_.'attribute` a LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al - ON (al.`id_attribute` = a.`id_attribute` AND al.`id_lang` = '.(int)Context::getContext()->language->id.') + ON (al.`id_attribute` = a.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.') LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_attribute` = a.`id_attribute`) LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.`id_product_attribute` = pac.`id_product_attribute`) '.Shop::addSqlAssociation('product_attribute', 'pa').' LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl - ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)Context::getContext()->language->id.') + ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$id_lang.') WHERE pa.`id_product` = '.(int)$id_product.' AND pac.`id_product_attribute` = '.(int)$id_product_attribute.' - AND agl.`id_lang` = '.(int)Context::getContext()->language->id); + AND agl.`id_lang` = '.(int)$id_lang); + Cache::store($cache_id, $result); } + $result = Cache::retrieve($cache_id); return $result; } @@ -5315,7 +5322,10 @@ class ProductCore extends ObjectModel WHERE id_product='.(int)$this->id.Shop::addSqlRestriction() ); else + { + $this->setFieldsToUpdate(array('advanced_stock_management' => true)); $this->save(); + } } /** diff --git a/classes/ProductSale.php b/classes/ProductSale.php index 44627f159..d24400f5d 100644 --- a/classes/ProductSale.php +++ b/classes/ProductSale.php @@ -91,41 +91,40 @@ class ProductSaleCore foreach ($products as $product) $ids[$product['id_product']] = 1; $ids = array_keys($ids); + $ids = array_filter($ids); sort($ids); $ids = count($ids) > 0 ? implode(',', $ids) : 'NULL'; - // Main query - if ($order_by == 'date_add') - $sql = ' - SELECT - p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, - pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, - pl.`meta_keywords`, pl.`meta_title`, pl.`name`, - m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer, - MAX(image_shop.`id_image`) id_image, il.`legend`, - ps.`quantity` AS sales, t.`rate`, pl.`meta_keywords`, pl.`meta_title`, pl.`meta_description`, - DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.$interval.' DAY)) > 0 AS new - FROM `'._DB_PREFIX_.'product_sale` ps - LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product` - '.Shop::addSqlAssociation('product', 'p', false).' - LEFT JOIN `'._DB_PREFIX_.'product_lang` pl - ON p.`id_product` = pl.`id_product` - AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').' - LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'. - Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').' - LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.') - LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`) - LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`) - AND tr.`id_country` = '.(int)Context::getContext()->country->id.' - AND tr.`id_state` = 0 - LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`) - '.Product::sqlStock('p').' - WHERE product_shop.`active` = 1 - AND p.`visibility` != \'none\' - AND p.`id_product` IN ('.$ids.') - GROUP BY product_shop.id_product - ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).' - LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products; + //Main query + $sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, + pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, + pl.`meta_keywords`, pl.`meta_title`, pl.`name`, + m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer, + MAX(image_shop.`id_image`) id_image, il.`legend`, + ps.`quantity` AS sales, t.`rate`, pl.`meta_keywords`, pl.`meta_title`, pl.`meta_description`, + DATEDIFF(p.`date_add`, DATE_SUB(NOW(), + INTERVAL '.$interval.' DAY)) > 0 AS new + FROM `'._DB_PREFIX_.'product_sale` ps + LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product` + '.Shop::addSqlAssociation('product', 'p', false).' + LEFT JOIN `'._DB_PREFIX_.'product_lang` pl + ON p.`id_product` = pl.`id_product` + AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').' + LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'. + Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').' + LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.') + LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`) + LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`) + AND tr.`id_country` = '.(int)Context::getContext()->country->id.' + AND tr.`id_state` = 0 + LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`) + '.Product::sqlStock('p').' + WHERE product_shop.`active` = 1 + AND p.`visibility` != \'none\' + AND p.`id_product` IN ('.$ids.') + GROUP BY product_shop.id_product + ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).' + LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); @@ -170,6 +169,7 @@ class ProductSaleCore $ids[$product['id_product']] = 1; $ids = array_keys($ids); sort($ids); + $ids = array_filter($ids); $ids = count($ids) > 0 ? implode(',', $ids) : 'NULL'; //Main query diff --git a/classes/State.php b/classes/State.php index e818c07a5..205868a81 100644 --- a/classes/State.php +++ b/classes/State.php @@ -80,13 +80,19 @@ class StateCore extends ObjectModel */ public static function getNameById($id_state) { - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT `name` - FROM `'._DB_PREFIX_.'state` - WHERE `id_state` = '.(int)$id_state - ); - - return $result['name']; + if (!$id_state) + return false; + $cache_id = 'State::getNameById_'.(int)$id_state; + if (!Cache::isStored($cache_id)) + { + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + SELECT `name` + FROM `'._DB_PREFIX_.'state` + WHERE `id_state` = '.(int)$id_state + ); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** @@ -97,13 +103,19 @@ class StateCore extends ObjectModel */ public static function getIdByName($state) { - $result = Db::getInstance()->getValue(' - SELECT `id_state` - FROM `'._DB_PREFIX_.'state` - WHERE `name` LIKE \''.pSQL($state).'\' - '); - - return (int)$result; + if (empty($state)) + return false; + $cache_id = 'State::getNameById_'.pSQL($state); + if (!Cache::isStored($cache_id)) + { + $result = (int)Db::getInstance()->getValue(' + SELECT `id_state` + FROM `'._DB_PREFIX_.'state` + WHERE `name` LIKE \''.pSQL($state).'\' + '); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** diff --git a/classes/Tab.php b/classes/Tab.php index add391536..a0bc246aa 100644 --- a/classes/Tab.php +++ b/classes/Tab.php @@ -190,14 +190,20 @@ class TabCore extends ObjectModel */ public static function getTab($id_lang, $id_tab) { - /* Tabs selection */ - return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT * - FROM `'._DB_PREFIX_.'tab` t - LEFT JOIN `'._DB_PREFIX_.'tab_lang` tl - ON (t.`id_tab` = tl.`id_tab` AND tl.`id_lang` = '.(int)$id_lang.') - WHERE t.`id_tab` = '.(int)$id_tab - ); + $cache_id = 'Tab::getTab_'.(int)$id_lang.'-'.(int)$id_tab; + if (!Cache::isStored($cache_id)) + { + /* Tabs selection */ + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' + SELECT * + FROM `'._DB_PREFIX_.'tab` t + LEFT JOIN `'._DB_PREFIX_.'tab_lang` tl + ON (t.`id_tab` = tl.`id_tab` AND tl.`id_lang` = '.(int)$id_lang.') + WHERE t.`id_tab` = '.(int)$id_tab + ); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** diff --git a/classes/Tag.php b/classes/Tag.php index ae5146959..522f547d6 100644 --- a/classes/Tag.php +++ b/classes/Tag.php @@ -105,7 +105,7 @@ class TagCore extends ObjectModel { if (!Validate::isGenericName($tag)) return false; - $tag = trim(substr($tag, 0, self::$definition['fields']['name']['size'])); + $tag = trim(Tools::substr($tag, 0, self::$definition['fields']['name']['size'])); $tag_obj = new Tag(null, $tag, (int)$id_lang); /* Tag does not exist in database */ diff --git a/classes/Tools.php b/classes/Tools.php index 44bd53e46..547a3fb66 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -346,17 +346,12 @@ class ToolsCore /* Automatically detect language if not already defined, detect_language is set in Cookie::update */ if ((!$cookie->id_lang || isset($cookie->detect_language)) && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { - $array = explode(',', Tools::strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])); - if (Tools::strlen($array[0]) > 2) + $array = explode(',', Tools::strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])); + $string = $array[0]; + + if (Validate::isLanguageCode($string)) { - $tab = explode('-', $array[0]); - $string = $tab[0]; - } - else - $string = $array[0]; - if (Validate::isLanguageIsoCode($string)) - { - $lang = new Language(Language::getIdByIso($string)); + $lang = Language::getLanguageByIETFCode($string); if (Validate::isLoadedObject($lang) && $lang->active && $lang->isAssociatedToShop()) { Context::getContext()->language = $lang; @@ -364,7 +359,7 @@ class ToolsCore } } } - + if (isset($cookie->detect_language)) unset($cookie->detect_language); @@ -374,7 +369,7 @@ class ToolsCore $iso = Language::getIsoById((int)$cookie->id_lang); @include_once(_PS_THEME_DIR_.'lang/'.$iso.'.php'); - + return $iso; } @@ -672,10 +667,8 @@ class ToolsCore public static function htmlentitiesUTF8($string, $type = ENT_QUOTES) { if (is_array($string)) - { - $string = array_map(array('Tools', 'htmlentitiesUTF8'), $string); - return (string)array_shift($string); - } + return array_map(array('Tools', 'htmlentitiesUTF8'), $string); + return htmlentities((string)$string, $type, 'utf-8'); } @@ -691,9 +684,10 @@ class ToolsCore public static function safePostVars() { - if (!is_array($_POST)) - return array(); - $_POST = array_map(array('Tools', 'htmlentitiesUTF8'), $_POST); + if (!isset($_POST) || !is_array($_POST)) + $_POST = array(); + else + $_POST = array_map(array('Tools', 'htmlentitiesUTF8'), $_POST); } /** @@ -1222,6 +1216,129 @@ class ToolsCore return (utf8_encode(substr($str, 0, $max_length - Tools::strlen($suffix)).$suffix)); } + /*Copied from CakePHP String utility file*/ + public static function truncateString($text, $length = 120, $options = array()) + { + $default = array( + 'ellipsis' => '...', 'exact' => true, 'html' => true + ); + + $options = array_merge($default, $options); + extract($options); + + if ($html) + { + if (Tools::strlen(preg_replace('/<.*?>/', '', $text)) <= $length) + return $text; + + $totalLength = Tools::strlen(strip_tags($ellipsis)); + $openTags = array(); + $truncate = ''; + preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER); + + foreach ($tags as $tag) + { + if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/s', $tag[2])) + { + if (preg_match('/<[\w]+[^>]*>/s', $tag[0])) + array_unshift($openTags, $tag[2]); + elseif (preg_match('/<\/([\w]+)[^>]*>/s', $tag[0], $closeTag)) + { + $pos = array_search($closeTag[1], $openTags); + if ($pos !== false) + array_splice($openTags, $pos, 1); + } + } + $truncate .= $tag[1]; + $contentLength = Tools::strlen(preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i', ' ', $tag[3])); + + if ($contentLength + $totalLength > $length) + { + $left = $length - $totalLength; + $entitiesLength = 0; + + if (preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i', $tag[3], $entities, PREG_OFFSET_CAPTURE)) + { + foreach ($entities[0] as $entity) + { + if ($entity[1] + 1 - $entitiesLength <= $left) + { + $left--; + $entitiesLength += Tools::strlen($entity[0]); + } + else + break; + } + } + + $truncate .= Tools::substr($tag[3], 0, $left + $entitiesLength); + break; + } + else + { + $truncate .= $tag[3]; + $totalLength += $contentLength; + } + + if ($totalLength >= $length) + break; + } + } + else + { + if (Tools::strlen($text) <= $length) + return $text; + + $truncate = Tools::substr($text, 0, $length - Tools::strlen($ellipsis)); + } + + if (!$exact) + { + $spacepos = mb_strrpos($truncate, ' '); + if ($html) + { + $truncateCheck = Tools::substr($truncate, 0, $spacepos); + $lastOpenTag = Tools::strrpos($truncateCheck, '<'); + $lastCloseTag = Tools::strrpos($truncateCheck, '>'); + + if ($lastOpenTag > $lastCloseTag) + { + preg_match_all('/<[\w]+[^>]*>/s', $truncate, $lastTagMatches); + $lastTag = array_pop($lastTagMatches[0]); + $spacepos = Tools::strrpos($truncate, $lastTag) + Tools::strlen($lastTag); + } + + $bits = Tools::substr($truncate, $spacepos); + preg_match_all('/<\/([a-z]+)>/', $bits, $droppedTags, PREG_SET_ORDER); + + if (!empty($droppedTags)) + { + if (!empty($openTags)) + { + foreach ($droppedTags as $closingTag) + if (!in_array($closingTag[1], $openTags)) + array_unshift($openTags, $closingTag[1]); + } + else + { + foreach ($droppedTags as $closingTag) + $openTags[] = $closingTag[1]; + } + } + } + + $truncate = Tools::substr($truncate, 0, $spacepos); + } + + $truncate .= $ellipsis; + + if ($html) + foreach ($openTags as $tag) + $truncate .= ''; + + return $truncate; + } + /** * Generate date form * @@ -1320,6 +1437,13 @@ class ToolsCore return substr($str, $start, ($length === false ? Tools::strlen($str) : (int)$length)); } + public static function strrpos($str, $find, $offset = 0, $encoding = 'utf-8') + { + if (function_exists('mb_strrpos')) + return mb_strrpos($str, $find, $offset, $encoding); + return strrpos($str, $find, $offset); + } + public static function ucfirst($str) { return Tools::strtoupper(Tools::substr($str, 0, 1)).Tools::substr($str, 1); @@ -2645,6 +2769,20 @@ exit; usleep(300); } } + + /** + * Delete a substring from another one starting from the right + * @param string $str + * @param string $str_search + * @return string + */ + public static function rtrimString($str, $str_search) + { + $length_str = strlen($str_search); + if (strlen($str) >= $length_str && substr($str, -$length_str) == $str_search) + $str = substr($str, 0, -$length_str); + return $str; + } } /** diff --git a/classes/Validate.php b/classes/Validate.php index a3083572d..bb44f1167 100644 --- a/classes/Validate.php +++ b/classes/Validate.php @@ -44,7 +44,7 @@ class ValidateCore */ public static function isEmail($email) { - return !empty($email) && preg_match(Tools::cleanNonUnicodeSupport('/^[a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]+[.a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]*@[a-z\p{L}0-9]+[._a-z\p{L}0-9-]*\.[a-z0-9]+$/ui'), $email); + return !empty($email) && preg_match(Tools::cleanNonUnicodeSupport('/^[a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]+[.a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]*@[a-z\p{L}0-9]+[._a-z\p{L}0-9-]*\.[a-z\p{L}0-9]+$/ui'), $email); } /** @@ -1072,4 +1072,4 @@ class ValidateCore { return (preg_match('/^['.Configuration::get('PS_INVOICE_PREFIX', Context::getContext()->language->id).']*([0-9]+)?/i', $id)); } -} \ No newline at end of file +} diff --git a/classes/Zone.php b/classes/Zone.php index 699a90e52..1d39ad7b2 100644 --- a/classes/Zone.php +++ b/classes/Zone.php @@ -54,12 +54,18 @@ class ZoneCore extends ObjectModel */ public static function getZones($active = false) { - return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' - SELECT * - FROM `'._DB_PREFIX_.'zone` - '.($active ? 'WHERE active = 1' : '').' - ORDER BY `name` ASC - '); + $cache_id = 'Zone::getZones_'.(bool)$active; + if (!Cache::isStored($cache_id)) + { + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + SELECT * + FROM `'._DB_PREFIX_.'zone` + '.($active ? 'WHERE active = 1' : '').' + ORDER BY `name` ASC + '); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** diff --git a/classes/cache/CacheMemcache.php b/classes/cache/CacheMemcache.php index 8c4445a7f..a795ed6a1 100755 --- a/classes/cache/CacheMemcache.php +++ b/classes/cache/CacheMemcache.php @@ -153,6 +153,8 @@ class CacheMemcacheCore extends Cache */ protected function _writeKeys() { + if (!$this->is_connected) + return false; $this->memcache->set(_COOKIE_IV_, $this->keys); } diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 04bf06874..2fbd5e8f3 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -1707,12 +1707,14 @@ class AdminControllerCore extends Controller if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 86400)) file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native')); + libxml_use_internal_errors(true); $country_module_list = file_get_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST); - if (!empty($country_module_list) && $country_module_list_xml = simplexml_load_string($country_module_list)) + if (!empty($country_module_list) && is_string($country_module_list) && $country_module_list_xml = simplexml_load_string($country_module_list)) { $country_module_list_array = array(); - foreach ($country_module_list_xml->module as $k => $m) - $country_module_list_array[] = (string)$m->name; + if (is_array($country_module_list_xml->module)) + foreach ($country_module_list_xml->module as $k => $m) + $country_module_list_array[] = (string)$m->name; $this->tab_modules_list['slider_list'] = array_intersect($this->tab_modules_list['slider_list'], $country_module_list_array); } @@ -2557,7 +2559,7 @@ class AdminControllerCore extends Controller $cookie = $this->context->cookie; $this->allow_employee_form_lang = (int)Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG'); if ($this->allow_employee_form_lang && !$cookie->employee_form_lang) - $cookie->employee_form_lang = (int)$this->context->language->id; + $cookie->employee_form_lang = (int)Configuration::get('PS_LANG_DEFAULT'); $lang_exists = false; $this->_languages = Language::getLanguages(false); @@ -2565,7 +2567,7 @@ class AdminControllerCore extends Controller if (isset($cookie->employee_form_lang) && $cookie->employee_form_lang == $lang['id_lang']) $lang_exists = true; - $this->default_form_language = $lang_exists ? (int)$cookie->employee_form_lang : (int)$this->context->language->id; + $this->default_form_language = $lang_exists ? (int)$cookie->employee_form_lang : (int)Configuration::get('PS_LANG_DEFAULT'); foreach ($this->_languages as $k => $language) $this->_languages[$k]['is_default'] = ((int)($language['id_lang'] == $this->default_form_language)); diff --git a/classes/controller/Controller.php b/classes/controller/Controller.php index af4861b19..6593eef52 100644 --- a/classes/controller/Controller.php +++ b/classes/controller/Controller.php @@ -175,8 +175,8 @@ abstract class ControllerCore // then using displayAjax[action] if ($this->ajax) { - $action = Tools::getValue('action'); - if (!empty($action) && method_exists($this, 'displayAjax'.Tools::toCamelCase($action, true))) + $action = Tools::toCamelCase(Tools::getValue('action'), true); + if (!empty($action) && method_exists($this, 'displayAjax'.$action)) $this->{'displayAjax'.$action}(); elseif (method_exists($this, 'displayAjax')) $this->displayAjax(); @@ -367,4 +367,4 @@ abstract class ControllerCore Tools::restoreCacheSettings(); return $res; } -} \ No newline at end of file +} diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index 5771606de..eea4a1bf1 100644 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -865,7 +865,7 @@ class FrontControllerCore extends Controller if (!is_numeric(Tools::getValue('p', 1)) || Tools::getValue('p', 1) < 0) Tools::redirect(self::$link->getPaginationLink(false, false, $this->n, false, 1, false)); - $current_url = tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']); + $current_url = Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']); //delete parameter page $current_url = preg_replace('/(\?)?(&)?p=\d+/', '$1', $current_url); @@ -934,7 +934,7 @@ class FrontControllerCore extends Controller $ips = array_map('trim', $ips); if (is_array($ips) && count($ips)) foreach ($ips as $ip) - if (!empty($ip) && strpos($user_ip, $ip) === 0) + if (!empty($ip) && preg_match('/^'.$ip.'.*/', $user_ip)) $allowed = true; return $allowed; } @@ -1199,4 +1199,4 @@ class FrontControllerCore extends Controller { return Product::getColorsListCacheId($id_product); } -} \ No newline at end of file +} diff --git a/classes/db/Db.php b/classes/db/Db.php index 4060e85bc..0d829a433 100755 --- a/classes/db/Db.php +++ b/classes/db/Db.php @@ -523,13 +523,13 @@ abstract class DbCore $this->last_cached = true; return $result; } - $this->result = $this->query($sql); if (!$this->result) return false; - $this->last_cached = false; $result = $this->nextRow($this->result); + if (is_null($result)) + $result = false; if ($use_cache && $this->is_cache_enabled) Cache::getInstance()->setQuery($sql, $result); return $result; diff --git a/classes/module/Module.php b/classes/module/Module.php index 350cdfe5d..b712c97f7 100644 --- a/classes/module/Module.php +++ b/classes/module/Module.php @@ -1271,7 +1271,9 @@ abstract class ModuleCore $modules = scandir(_PS_MODULE_DIR_); foreach ($modules as $name) { - if (is_dir(_PS_MODULE_DIR_.$name) && Tools::file_exists_cache(_PS_MODULE_DIR_.$name.'/'.$name.'.php')) + if (is_file(_PS_MODULE_DIR_.$name)) + continue; + elseif (is_dir(_PS_MODULE_DIR_.$name.DIRECTORY_SEPARATOR) && Tools::file_exists_cache(_PS_MODULE_DIR_.$name.'/'.$name.'.php')) { if (!Validate::isModuleName($name)) throw new PrestaShopException(sprintf('Module %s is not a valid module name', $name)); @@ -1879,7 +1881,13 @@ abstract class ModuleCore */ public static function getModuleIdByName($name) { - return Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = "'.pSQL($name).'"'); + $cache_id = 'Module::getModuleIdByName_'.pSQL($name); + if (!Cache::isStored($cache_id)) + { + $result = (int)Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = "'.pSQL($name).'"'); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** diff --git a/classes/order/Order.php b/classes/order/Order.php index fcc9f4a4f..7e72ee35f 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -721,11 +721,17 @@ class OrderCore extends ObjectModel public static function getDiscountsCustomer($id_customer, $id_cart_rule) { - return Db::getInstance()->getValue(' - SELECT COUNT(*) FROM `'._DB_PREFIX_.'orders` o - LEFT JOIN '._DB_PREFIX_.'order_cart_rule ocr ON (ocr.id_order = o.id_order) - WHERE o.id_customer = '.(int)$id_customer.' - AND ocr.id_cart_rule = '.(int)$id_cart_rule); + $cache_id = 'Order::getDiscountsCustomer_'.(int)$id_customer.'-'.(int)$id_cart_rule; + if (!Cache::isStored($cache_id)) + { + $result = (int)Db::getInstance()->getValue(' + SELECT COUNT(*) FROM `'._DB_PREFIX_.'orders` o + LEFT JOIN '._DB_PREFIX_.'order_cart_rule ocr ON (ocr.id_order = o.id_order) + WHERE o.id_customer = '.(int)$id_customer.' + AND ocr.id_cart_rule = '.(int)$id_cart_rule); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** diff --git a/classes/order/OrderState.php b/classes/order/OrderState.php index 7cc1d5375..19dddb875 100644 --- a/classes/order/OrderState.php +++ b/classes/order/OrderState.php @@ -112,12 +112,18 @@ class OrderStateCore extends ObjectModel */ public static function getOrderStates($id_lang) { - return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' - SELECT * - FROM `'._DB_PREFIX_.'order_state` os - LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$id_lang.') - WHERE deleted = 0 - ORDER BY `name` ASC'); + $cache_id = 'OrderState::getOrderStates_'.(int)$id_lang; + if (!Cache::isStored($cache_id)) + { + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + SELECT * + FROM `'._DB_PREFIX_.'order_state` os + LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$id_lang.') + WHERE deleted = 0 + ORDER BY `name` ASC'); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php index 98ae61c53..ee7dddcf7 100644 --- a/classes/shop/Shop.php +++ b/classes/shop/Shop.php @@ -187,14 +187,19 @@ class ShopCore extends ObjectModel public function setUrl() { - $row = Db::getInstance()->getRow(' - SELECT su.physical_uri, su.virtual_uri, su.domain, su.domain_ssl, t.id_theme, t.name, t.directory - FROM '._DB_PREFIX_.'shop s - LEFT JOIN '._DB_PREFIX_.'shop_url su ON (s.id_shop = su.id_shop) - LEFT JOIN '._DB_PREFIX_.'theme t ON (t.id_theme = s.id_theme) - WHERE s.id_shop = '.(int)$this->id.' - AND s.active = 1 AND s.deleted = 0 AND su.main = 1'); - + $cache_id = 'Shop::setUrl_'.(int)$this->id; + if (!Cache::isStored($cache_id)) + { + $row = Db::getInstance()->getRow(' + SELECT su.physical_uri, su.virtual_uri, su.domain, su.domain_ssl, t.id_theme, t.name, t.directory + FROM '._DB_PREFIX_.'shop s + LEFT JOIN '._DB_PREFIX_.'shop_url su ON (s.id_shop = su.id_shop) + LEFT JOIN '._DB_PREFIX_.'theme t ON (t.id_theme = s.id_theme) + WHERE s.id_shop = '.(int)$this->id.' + AND s.active = 1 AND s.deleted = 0 AND su.main = 1'); + Cache::store($cache_id, $row); + } + $row = Cache::retrieve($cache_id); if (!$row) return false; diff --git a/classes/stock/StockAvailable.php b/classes/stock/StockAvailable.php index 62f6a0548..d544dec5d 100644 --- a/classes/stock/StockAvailable.php +++ b/classes/stock/StockAvailable.php @@ -53,6 +53,8 @@ class StockAvailableCore extends ObjectModel /** @var bool determine if a product is out of stock - it was previously in Product class */ public $out_of_stock = false; + protected static $cache_quantity_available; + /** * @see ObjectModel::$definition */ @@ -343,18 +345,23 @@ class StockAvailableCore extends ObjectModel if ($id_product_attribute === null) $id_product_attribute = 0; - $query = new DbQuery(); - $query->select('SUM(quantity)'); - $query->from('stock_available'); + $key = (int)$id_product.'-'.(int)$id_product_attribute.'-'.(int)$id_shop; + if (!isset(self::$cache_quantity_available[$key])) + { + $query = new DbQuery(); + $query->select('SUM(quantity)'); + $query->from('stock_available'); + + // if null, it's a product without attributes + if ($id_product !== null) + $query->where('id_product = '.(int)$id_product); + + $query->where('id_product_attribute = '.(int)$id_product_attribute); + $query = StockAvailable::addSqlShopRestriction($query, $id_shop); - // if null, it's a product without attributes - if ($id_product !== null) - $query->where('id_product = '.(int)$id_product); - - $query->where('id_product_attribute = '.(int)$id_product_attribute); - $query = StockAvailable::addSqlShopRestriction($query, $id_shop); - - return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); + self::$cache_quantity_available[$key] = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); + } + return self::$cache_quantity_available[$key]; } /** diff --git a/classes/tax/TaxRule.php b/classes/tax/TaxRule.php index e59a2ddb9..b41d61fa1 100644 --- a/classes/tax/TaxRule.php +++ b/classes/tax/TaxRule.php @@ -124,9 +124,13 @@ class TaxRuleCore extends ObjectModel */ public static function isTaxInUse($id_tax) { - return Db::getInstance()->getValue(' - SELECT COUNT(*) FROM `'._DB_PREFIX_.'tax_rule` WHERE `id_tax` = '.(int)$id_tax - ); + $cache_id = 'TaxRule::isTaxInUse_'.(int)$id_tax; + if (!Cache::isStored($cache_id)) + { + $result = (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'tax_rule` WHERE `id_tax` = '.(int)$id_tax); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } diff --git a/classes/tax/TaxRulesTaxManager.php b/classes/tax/TaxRulesTaxManager.php index ba6b07456..98047c69c 100644 --- a/classes/tax/TaxRulesTaxManager.php +++ b/classes/tax/TaxRulesTaxManager.php @@ -33,9 +33,6 @@ class TaxRulesTaxManagerCore implements TaxManagerInterface public $type; public $tax_calculator; - protected static $cache_tax_calculator; - - /** * * @param Address $address @@ -80,7 +77,8 @@ class TaxRulesTaxManagerCore implements TaxManagerInterface if (!empty($this->address->postcode)) $postcode = $this->address->postcode; - if (!isset(self::$cache_tax_calculator[(int)$this->address->id_country.'-'.$postcode.'-'.$this->type])) + $cache_id = (int)$this->address->id_country.'-'.(int)$this->address->id_state.'-'.$postcode.'-'.(int)$this->type; + if (!Cache::isStored($cache_id)) { $rows = Db::getInstance()->executeS(' SELECT * @@ -110,11 +108,8 @@ class TaxRulesTaxManagerCore implements TaxManagerInterface if ($row['behavior'] == 0) break; } - - self::$cache_tax_calculator[(int)$this->address->id_country.'-'.$postcode.'-'.$this->type] = new TaxCalculator($taxes, $behavior); + Cache::store($cache_id, new TaxCalculator($taxes, $behavior)); } - - return self::$cache_tax_calculator[(int)$this->address->id_country.'-'.$postcode.'-'.$this->type]; + return Cache::retrieve($cache_id); } } - diff --git a/classes/webservice/WebserviceSpecificManagementImages.php b/classes/webservice/WebserviceSpecificManagementImages.php index dd6401e5a..8d9fd1626 100755 --- a/classes/webservice/WebserviceSpecificManagementImages.php +++ b/classes/webservice/WebserviceSpecificManagementImages.php @@ -845,11 +845,13 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage $imaged = imagegif($destImage, $newPath); break; case 'png': - $imaged = imagepng($destImage, $newPath, 7); + $quality = (Configuration::get('PS_PNG_QUALITY') === false ? 7 : Configuration::get('PS_PNG_QUALITY')); + $imaged = imagepng($destImage, $newPath, (int)$quality); break; case 'jpeg': default: - $imaged = imagejpeg($destImage, $newPath, 90); + $quality = (Configuration::get('PS_JPEG_QUALITY') === false ? 90 : Configuration::get('PS_JPEG_QUALITY')); + $imaged = imagejpeg($destImage, $newPath, (int)$quality); break; } imagedestroy($destImage); diff --git a/config/defines_uri.inc.php b/config/defines_uri.inc.php index 34cbae33b..7744e9cdd 100644 --- a/config/defines_uri.inc.php +++ b/config/defines_uri.inc.php @@ -38,13 +38,14 @@ if (file_exists(_PS_THEME_DIR_.'mobile/')) { define('_PS_THEME_MOBILE_DIR_', _PS_THEME_DIR_.'mobile/'); define('_THEME_MOBILE_DIR_', _THEMES_DIR_._THEME_NAME_.'/mobile/'); - define('_PS_THEME_MOBILE_OVERRIDE_DIR_', _PS_THEME_MOBILE_DIR_.'override/'); } else { define('_PS_THEME_MOBILE_DIR_', _PS_ROOT_DIR_.'/themes/default/mobile/'); define('_THEME_MOBILE_DIR_', __PS_BASE_URI__.'themes/default/mobile/'); } +define('_PS_THEME_MOBILE_OVERRIDE_DIR_', _PS_THEME_MOBILE_DIR_.'override/'); + define('_THEME_MOBILE_IMG_DIR_', _THEME_MOBILE_DIR_.'img/'); define('_THEME_MOBILE_CSS_DIR_', _THEME_MOBILE_DIR_.'css/'); define('_THEME_MOBILE_JS_DIR_', _THEME_MOBILE_DIR_.'js/'); diff --git a/controllers/admin/AdminCartRulesController.php b/controllers/admin/AdminCartRulesController.php index cef27a879..6689f023f 100644 --- a/controllers/admin/AdminCartRulesController.php +++ b/controllers/admin/AdminCartRulesController.php @@ -143,6 +143,8 @@ class AdminCartRulesControllerCore extends AdminController $this->errors[] = Tools::displayError('Reduction amount cannot be lower than zero.'); if (Tools::getValue('code') && ($same_code = (int)CartRule::getIdByCode(Tools::getValue('code'))) && $same_code != Tools::getValue('id_cart_rule')) $this->errors[] = sprintf(Tools::displayError('This cart rule code is already used (conflict with cart rule %d)'), $same_code); + if (Tools::getValue('apply_discount') == 'off' && !Tools::getValue('free_shipping') && !Tools::getValue('free_gift')) + $this->errors[] = Tools::displayError('An action is required for this cart rule.'); } return parent::postProcess(); diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php index efc682ac8..2feec12bc 100644 --- a/controllers/admin/AdminCustomerThreadsController.php +++ b/controllers/admin/AdminCustomerThreadsController.php @@ -309,12 +309,15 @@ class AdminCustomerThreadsControllerCore extends AdminController $cm = new CustomerMessage(); $cm->id_employee = (int)$this->context->employee->id; $cm->id_customer_thread = (int)Tools::getValue('id_customer_thread'); - $cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']); + $cm->ip_address = ip2long(Tools::getRemoteAddr()); $current_employee = $this->context->employee; $id_employee = (int)Tools::getValue('id_employee_forward'); $employee = new Employee($id_employee); $email = Tools::getValue('email'); - if ($id_employee && $employee && Validate::isLoadedObject($employee)) + $message = Tools::getValue('message_forward'); + if (($error = $cm->validateField('message', $message, null, array(), true)) !== true) + $this->errors[] = $error; + elseif ($id_employee && $employee && Validate::isLoadedObject($employee)) { $params = array( '{messages}' => Tools::nl2br(stripslashes($output)), @@ -333,7 +336,7 @@ class AdminCustomerThreadsControllerCore extends AdminController null, null, _PS_MAIL_DIR_, true)) { $cm->private = 1; - $cm->message = $this->l('Message forwarded to').' '.$employee->firstname.' '.$employee->lastname."\n".$this->l('Comment:').' '.$_POST['message_forward']; + $cm->message = $this->l('Message forwarded to').' '.$employee->firstname.' '.$employee->lastname."\n".$this->l('Comment:').' '.$message; $cm->add(); } } @@ -352,7 +355,7 @@ class AdminCustomerThreadsControllerCore extends AdminController $current_employee->email, $current_employee->firstname.' '.$current_employee->lastname, null, null, _PS_MAIL_DIR_, true)) { - $cm->message = $this->l('Message forwarded to').' '.$email."\n".$this->l('Comment:').' '.$_POST['message_forward']; + $cm->message = $this->l('Message forwarded to').' '.$email."\n".$this->l('Comment:').' '.$message; $cm->add(); } } @@ -368,10 +371,11 @@ class AdminCustomerThreadsControllerCore extends AdminController $cm = new CustomerMessage(); $cm->id_employee = (int)$this->context->employee->id; $cm->id_customer_thread = $ct->id; - + $cm->ip_address = ip2long(Tools::getRemoteAddr()); $cm->message = Tools::getValue('reply_message'); - $cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']); - if (isset($_FILES) && !empty($_FILES['joinFile']['name']) && $_FILES['joinFile']['error'] != 0) + if (($error = $cm->validateField('message', $cm->message, null, array(), true)) !== true) + $this->errors[] = $error; + elseif (isset($_FILES) && !empty($_FILES['joinFile']['name']) && $_FILES['joinFile']['error'] != 0) $this->errors[] = Tools::displayError('An error occurred during the file upload process.'); elseif ($cm->add()) { diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 051f5135a..a78b13e07 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -2019,7 +2019,7 @@ class AdminImportControllerCore extends AdminController $myGroup = new Group(); $myGroup->name = Array($id_lang => $group); if ($id_lang != $default_language_id) - $myGroup->name = array_merge($myGroup->name, array($default_language_id => $group)); + $myGroup->name = $myGroup->name + array($default_language_id => $group); $myGroup->price_display_method = 1; $myGroup->add(); if (Validate::isLoadedObject($myGroup)) diff --git a/controllers/admin/AdminLocalizationController.php b/controllers/admin/AdminLocalizationController.php index 889bf6854..d22128131 100644 --- a/controllers/admin/AdminLocalizationController.php +++ b/controllers/admin/AdminLocalizationController.php @@ -142,8 +142,10 @@ class AdminLocalizationControllerCore extends AdminController if (Validate::isFileName(Tools::getValue('iso_localization_pack'))) { - - $pack = @Tools::file_get_contents('http://api.prestashop.com/localization/'.$version.'/'.Tools::getValue('iso_localization_pack').'.xml'); + if (Tools::getValue('download_updated_pack') == '1') + $pack = @Tools::file_get_contents('http://api.prestashop.com/localization/'.$version.'/'.Tools::getValue('iso_localization_pack').'.xml'); + else + $pack = false; if (!$pack && !($pack = @Tools::file_get_contents(_PS_ROOT_DIR_.'/localization/'.Tools::getValue('iso_localization_pack').'.xml'))) $this->errors[] = Tools::displayError('Cannot load the localization pack.'); @@ -266,6 +268,26 @@ class AdminLocalizationControllerCore extends AdminController 'id' => 'id', 'name' => 'name' ) + ), + array( + 'type' => 'radio', + 'label' => $this->l('Download pack data'), + 'desc' => $this->l('If set to yes then the localization pack will be downloaded from prestashop.com. Otherwise the local xml file found in the localization folder of your PrestaShop installation will be used.'), + 'name' => 'download_updated_pack', + 'class' => 't', + 'is_bool'=> true, + 'values' => array( + array( + 'id' => 'download_updated_pack_yes', + 'value' => 1, + 'label' => $this->l('Yes') + ), + array( + 'id' => 'download_updated_pack_no', + 'value' => 0, + 'label' => $this->l('No') + ) + ) ) ), 'submit' => array( @@ -280,7 +302,8 @@ class AdminLocalizationControllerCore extends AdminController 'selection[]_taxes' => true, 'selection[]_currencies' => true, 'selection[]_languages' => true, - 'selection[]_units' => true + 'selection[]_units' => true, + 'download_updated_pack' => 1 ); $this->show_toolbar = false; diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 415d00ed3..c121de902 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -897,7 +897,7 @@ class AdminOrdersControllerCore extends AdminController Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token); } else - $this->errors[] = Tools::displayErrror('This address can\'t be loaded'); + $this->errors[] = Tools::displayError('This address can\'t be loaded'); } else $this->errors[] = Tools::displayError('You do not have permission to edit this.'); diff --git a/controllers/admin/AdminPPreferencesController.php b/controllers/admin/AdminPPreferencesController.php index 3e39e6150..f8f64cbc5 100644 --- a/controllers/admin/AdminPPreferencesController.php +++ b/controllers/admin/AdminPPreferencesController.php @@ -188,6 +188,14 @@ class AdminPPreferencesControllerCore extends AdminController ), 'identifier' => 'id' ) + 'PS_DISPLAY_DISCOUNT_PRICE' => array( + 'title' => $this->l('Display discounted price'), + 'desc' => $this->l('Instead of showing the discount (-5%) it will instead show the new price with the discount applied'), + 'validation' => 'isBool', + 'cast' => 'intval', + 'required' => false, + 'type' => 'bool' + ), ) ), 'stock' => array( diff --git a/controllers/admin/AdminPerformanceController.php b/controllers/admin/AdminPerformanceController.php index 494031e49..37927a154 100644 --- a/controllers/admin/AdminPerformanceController.php +++ b/controllers/admin/AdminPerformanceController.php @@ -793,7 +793,7 @@ class AdminPerformanceControllerCore extends AdminController { $new_settings = $prev_settings = file_get_contents(_PS_ROOT_DIR_.'/config/settings.inc.php'); $cache_active = (bool)Tools::getValue('cache_active'); - + if ($caching_system = Tools::getValue('caching_system')) { $new_settings = preg_replace( @@ -807,7 +807,6 @@ class AdminPerformanceControllerCore extends AdminController $cache_active = false; $this->errors[] = Tools::displayError('The caching system is missing.'); } - if ($cache_active) { if ($caching_system == 'CacheMemcache' && !extension_loaded('memcache')) @@ -912,5 +911,4 @@ class AdminPerformanceControllerCore extends AdminController } die; } - } diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 388a552c2..8ef5b8806 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2688,6 +2688,10 @@ class AdminProductsControllerCore extends AdminController $product_supplier->id_product = $product->id; $product_supplier->id_product_attribute = 0; $product_supplier->id_supplier = $id; + if ($this->context->currency->id) + $product_supplier->id_currency = (int)$this->context->currency->id; + else + $product_supplier->id_currency = (int)Configuration::get('PS_CURRENCY_DEFAULT'); $product_supplier->save(); $associated_suppliers[] = $product_supplier; diff --git a/controllers/admin/AdminShopController.php b/controllers/admin/AdminShopController.php index cf94d0943..1fcea5901 100755 --- a/controllers/admin/AdminShopController.php +++ b/controllers/admin/AdminShopController.php @@ -148,7 +148,7 @@ class AdminShopControllerCore extends AdminController { parent::initContent(); - $this->addJqueryPlugin('cookie-plugin'); + $this->addJqueryPlugin('cooki-plugin'); $this->addJqueryPlugin('jstree'); $this->addCSS(_PS_JS_DIR_.'jquery/plugins/jstree/themes/classic/style.css'); diff --git a/controllers/admin/AdminShopGroupController.php b/controllers/admin/AdminShopGroupController.php index b890f8eb8..d7a680032 100644 --- a/controllers/admin/AdminShopGroupController.php +++ b/controllers/admin/AdminShopGroupController.php @@ -109,7 +109,7 @@ class AdminShopGroupControllerCore extends AdminController ); } - $this->addJqueryPlugin('cookie-plugin'); + $this->addJqueryPlugin('cooki-plugin'); $this->addJqueryPlugin('jstree'); $this->addCSS(_PS_JS_DIR_.'jquery/plugins/jstree/themes/classic/style.css'); diff --git a/controllers/admin/AdminShopUrlController.php b/controllers/admin/AdminShopUrlController.php index 54af8b48c..9eba3f435 100644 --- a/controllers/admin/AdminShopUrlController.php +++ b/controllers/admin/AdminShopUrlController.php @@ -289,7 +289,7 @@ class AdminShopUrlControllerCore extends AdminController { parent::initContent(); - $this->addJqueryPlugin('cookie-plugin'); + $this->addJqueryPlugin('cooki-plugin'); $this->addJqueryPlugin('jstree'); $this->addCSS(_PS_JS_DIR_.'jquery/plugins/jstree/themes/classic/style.css'); diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 0c664eaa5..7d8bfd3e6 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -89,12 +89,15 @@ class AuthControllerCore extends FrontController $this->context->smarty->assign('newsletter', 1); - $back = Tools::getValue('back'); - $key = Tools::safeOutput(Tools::getValue('key')); - if (!empty($key)) - $back .= (strpos($back, '?') !== false ? '&' : '?').'key='.$key; - if (!empty($back)) - $this->context->smarty->assign('back', Tools::safeOutput(Tools::secureReferrer($back))); + if ($back = Tools::safeOutput(Tools::getValue('back'))) + { + $key = Tools::safeOutput(Tools::getValue('key')); + if (!empty($key)) + $back .= (strpos($back, '?') !== false ? '&' : '?').'key='.$key; + if ($back == Tools::secureReferrer(Tools::getValue('back'))) + $this->context->smarty->assign('back', html_entity_decode($back)); + $this->context->smarty->assign('back', $back); + } if (Tools::getValue('display_guest_checkout')) { diff --git a/controllers/front/CategoryController.php b/controllers/front/CategoryController.php index e6480cdb6..3b8fd070e 100644 --- a/controllers/front/CategoryController.php +++ b/controllers/front/CategoryController.php @@ -116,6 +116,7 @@ class CategoryControllerCore extends FrontController $this->context->smarty->assign(array( 'category' => $this->category, + 'description_short' => Tools::truncateString($this->category->description), 'products' => (isset($this->cat_products) && $this->cat_products) ? $this->cat_products : null, 'id_category' => (int)$this->category->id, 'id_category_parent' => (int)$this->category->id_parent, diff --git a/controllers/front/CmsController.php b/controllers/front/CmsController.php index a62047b02..2c9793ec4 100644 --- a/controllers/front/CmsController.php +++ b/controllers/front/CmsController.php @@ -30,12 +30,13 @@ class CmsControllerCore extends FrontController public $assignCase; public $cms; public $cms_category; + public $ssl = false; public function canonicalRedirection($canonicalURL = '') { if (Tools::getValue('live_edit')) return ; - if (Validate::isLoadedObject($this->cms) && ($canonicalURL = $this->context->link->getCMSLink($this->cms))) + if (Validate::isLoadedObject($this->cms) && ($canonicalURL = $this->context->link->getCMSLink($this->cms, $this->cms->link_rewrite, $this->ssl))) parent::canonicalRedirection($canonicalURL); else if (Validate::isLoadedObject($this->cms_category) && ($canonicalURL = $this->context->link->getCMSCategoryLink($this->cms_category))) parent::canonicalRedirection($canonicalURL); @@ -47,13 +48,16 @@ class CmsControllerCore extends FrontController */ public function init() { - parent::init(); - if ($id_cms = (int)Tools::getValue('id_cms')) $this->cms = new CMS($id_cms, $this->context->language->id); else if ($id_cms_category = (int)Tools::getValue('id_cms_category')) $this->cms_category = new CMSCategory($id_cms_category, $this->context->language->id); + if (Configuration::get('PS_SSL_ENABLED') && Tools::getValue('content_only') && Tools::getValue('id_cms') == (int)Configuration::get('PS_CONDITIONS_CMS_ID') && Validate::isLoadedObject($this->cms)) + $this->ssl = true; + + parent::init(); + $this->canonicalRedirection(); // assignCase (1 = CMS page, 2 = CMS category) @@ -120,7 +124,7 @@ class CmsControllerCore extends FrontController 'category' => $this->cms_category, //for backward compatibility 'cms_category' => $this->cms_category, 'sub_category' => $this->cms_category->getSubCategories($this->context->language->id), - 'cms_pages' => CMS::getCMSPages($this->context->language->id, (int)($this->cms_category->id) ), + 'cms_pages' => CMS::getCMSPages($this->context->language->id, (int)($this->cms_category->id), true, (int)$this->context->shop->id), 'path' => ($this->cms_category->id !== 1) ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '', )); } diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index 8d3e5689e..c127fa46a 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -147,7 +147,7 @@ class ContactControllerCore extends FrontController $cm->message = $message; if (isset($fileAttachment['rename']) && !empty($fileAttachment['rename']) && rename($fileAttachment['tmp_name'], _PS_MODULE_DIR_.'../upload/'.basename($fileAttachment['rename']))) $cm->file_name = $fileAttachment['rename']; - $cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']); + $cm->ip_address = ip2long(Tools::getRemoteAddr()); $cm->user_agent = $_SERVER['HTTP_USER_AGENT']; if (!$cm->add()) $this->errors[] = Tools::displayError('An error occurred while sending the message.'); diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index 2b03955a6..7bde212a6 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -529,8 +529,8 @@ class OrderOpcControllerCore extends ParentOrderController $minimalPurchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency); if ($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimalPurchase) return '

    '.sprintf( - Tools::displayError('A minimum purchase total of %s is required in order to validate your order.'), - Tools::displayPrice($minimalPurchase, $currency) + Tools::displayError('A minimum purchase total of %1s (tax excl.) is required in order to validate your order, current purchase total is %2s (tax excl.).'), + Tools::displayPrice($minimal_purchase, $currency), Tools::displayPrice($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS), $currency) ).'

    '; /* Bypass payment step if total is 0 */ diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php index 6fa902bdc..e0672255e 100644 --- a/controllers/front/ParentOrderController.php +++ b/controllers/front/ParentOrderController.php @@ -415,6 +415,17 @@ class ParentOrderControllerCore extends FrontController if (key($customerAddresses) != 0) $customerAddresses = array_values($customerAddresses); + if (!count($customerAddresses)) + { + $bad_delivery = false; + if (($bad_delivery = (bool)!Address::isCountryActiveById((int)$this->context->cart->id_address_delivery)) || (!Address::isCountryActiveById((int)$this->context->cart->id_address_invoice))) + { + $back_url = $this->context->link->getPageLink('order', true, (int)$this->context->language->id, array('step' => Tools::getValue('step'), 'multi-shipping' => (int)Tools::getValue('multi-shipping'))); + $params = array('multi-shipping' => (int)Tools::getValue('multi-shipping'), 'id_address' => ($bad_delivery ? (int)$this->context->cart->id_address_delivery : (int)$this->context->cart->id_address_invoice), 'back' => $back_url); + Tools::redirect($this->context->link->getPageLink('address', true, (int)$this->context->language->id, $params)); + } + } + $this->context->smarty->assign(array( 'addresses' => $customerAddresses, 'formatedAddressFieldsValuesList' => $formatedAddressFieldsValuesList)); @@ -465,16 +476,6 @@ class ParentOrderControllerCore extends FrontController $address = new Address($this->context->cart->id_address_delivery); $id_zone = Address::getZoneById($address->id); $bad_delivery = false; - if (($bad_delivery = (bool)!Address::isCountryActiveById((int)$this->context->cart->id_address_delivery)) || (!Address::isCountryActiveById((int)$this->context->cart->id_address_invoice))) - { - if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1 && Dispatcher::getInstance()->getController() != 'order-opc') - { - $back_url = $this->context->link->getPageLink('order', true, (int)$this->context->language->id, array('step' => Tools::getValue('step'), 'multi-shipping' => (int)Tools::getValue('multi-shipping'))); - $params = array('multi-shipping' => (int)Tools::getValue('multi-shipping'), 'id_address' => ($bad_delivery ? (int)$this->context->cart->id_address_delivery : (int)$this->context->cart->id_address_invoice), 'back' => $back_url); - Tools::redirect($this->context->link->getPageLink('address', true, (int)$this->context->language->id, $params)); - } - Tools::redirect('index.php?controller=order&step=1'); - } $carriers = $this->context->cart->simulateCarriersOutput(); $checked = $this->context->cart->simulateCarrierSelectedOutput(); $delivery_option_list = $this->context->cart->getDeliveryOptionList(); @@ -510,7 +511,7 @@ class ParentOrderControllerCore extends FrontController // TOS $cms = new CMS(Configuration::get('PS_CONDITIONS_CMS_ID'), $this->context->language->id); - $this->link_conditions = $this->context->link->getCMSLink($cms, $cms->link_rewrite); + $this->link_conditions = $this->context->link->getCMSLink($cms, $cms->link_rewrite, (bool)Configuration::get('PS_SSL_ENABLED')); if (!strpos($this->link_conditions, '?')) $this->link_conditions .= '?content_only=1'; else diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 8e7092fd6..a1fb28ee7 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -551,7 +551,7 @@ class ProductControllerCore extends FrontController $path = Tools::getPath((int)$this->context->shop->id_category, $this->product->name); $this->context->smarty->assign('path', $path); - $this->context->smarty->assign('categories', Category::getHomeCategories($this->context->language->id)); + $this->context->smarty->assign('categories', Category::getHomeCategories($this->context->language->id, true, (int)$this->context->shop->id)); $this->context->smarty->assign(array('HOOK_PRODUCT_FOOTER' => Hook::exec('displayFooterProduct', array('product' => $this->product, 'category' => $this->category)))); } diff --git a/controllers/front/StoresController.php b/controllers/front/StoresController.php index ac10c1dc1..33bc1d3d2 100644 --- a/controllers/front/StoresController.php +++ b/controllers/front/StoresController.php @@ -279,6 +279,6 @@ class StoresControllerCore extends FrontController if (!Configuration::get('PS_STORES_SIMPLIFIED')) $this->addJS(_THEME_JS_DIR_.'stores.js'); $default_country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT')); - $this->addJS('http://maps.google.com/maps/api/js?sensor=true&region='.substr($default_country->iso_code, 0, 2)); + $this->addJS('http'.((Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) ? 's' : '').'://maps.google.com/maps/api/js?sensor=true&region='.substr($default_country->iso_code, 0, 2)); } } diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 9cc74bcff..514993ed2 100755 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -23,6 +23,225 @@ International Registred Trademark & Property of PrestaShop SA Release Notes for PrestaShop 1.5 -------------------------------- +#################################### +# v1.5.6.1 - (2013-11-18) # +#################################### + + Fixed bugs: + + [-] Project : missing ui.menu in jquery_ui_dependencies. + + [-] FO : Fix bug #PSCFV-11043, bad cache id from module template + [-] FO : Missing sup for DNI field + [-] FO : Fix bug #PSCFV-10911, doubles in cart rules highlight + [-] FO : Bad value for back when controller name is sent + [-] FO : FixBug #PSCFV-9291 - Ecotax increment display price in product combination + [-] FO : fix contact-form id_order input when customer is not logged + [-] Fo : Call Gmaps on https if required + [-] FO : Wordwrap on prices in history + [-] FO : Fixed errors when calculating most selled products from footer link + [-] FO : #PSCFV-10978 firstname displayed instead of lastname in invoice address + [-] FO : Customized meesage with carriage return follow up #962 + [-] FO : getTaxCalculator bad cache key again // sorry about that + [-] FO : getTaxCalculator bad cache key + [-] FO : Prevents warning in safePostVars when $_POST has been unset + [-] FO : in multistore payment module restrictions by customer group was not applied to specific shop + [-] FO : Fix bug #PSCFV-10892, getCMSPages by id_shop thnaks @jd440 + [-] FO : FixBug Categories description + [-] FO : Fix bug #PSCFV-10889 wrong color when oos product + [-] FO : CustomerMessage ip_address to string + [-] FO : Fix bug #PSCFV-10851, no shop restriction in vouchers display in cart + [-] FO: fixed bug #PSCFV-10654 - TinyMCE editor: List of products by manufacturer, products by supplier - Long description is not hidden. + [-] FO: Fix bug #PSCFV-10623 blocknewproducts shows products when PS_NB_DAYS_NEW_PRODUCT == 0 + [-] FO: Fix bug #PSCFV-10230, Blockspecials still caching when files cache limit is 0 + [-] FO: Fix bug #PSCFV-10625 Js error on carriers step if AjaxCart disabled + [-] FO : Follow up https://github.com/PrestaShop/PrestaShop/pull/879 + [-] FO: removed width on message product select Limiting select could make the user think the select is not working if they click to much to the left on bigger screens + [-] FO : Prevent fatal error on getUniqReference when order not loaded + [-] FO: Don't auto detect language if it not associated to the shop #PSCFV-10273 + [-] FO : Could not redirect back to url in adress.php + [-] FO : $back value twice escaped + [-] FO : #PSCFV-10640 again, bad assignement + [-] Fo : Fix bug #PSCFV-10640, redirect loop when country address is not among active countries in OPC + [-] FO : Fix bug #PSCFV-10688, bad priceDisplay in order-carrier + [-] FO : Fix #PSCFV-10690 again, change just on directories + [-] FO : Fix bug #PSCFV-10690 could not index a category beacause of robot.txt + [-] FO : Copuld not load datepicker in trackingfront stats.php + [-] FO : Fix bug #PSCFV-10497 cart_block hooked on column disappearing + [-] FO : Fix bug #PSCFV-10606 could not have correct taxCalculationMethod when vat number in customer address + + [-] BO : Fix bug #PNM-1594, selected value error in helper list + [-] BO: product price was changed on changing to advanced stock management #PSCFV-10996 + [-] BO : Fix warning when no memcached servers + [-] BO : Fix #PSCFV-11016 typo + [-] BO : Model return html error messagae instead of json while image uploading + [-] BO : Product final price can not be hidden on loading tab, report of https://github.com/PrestaShop/PrestaShop/commit/6c6c3b240ee2249b7f99be1a112905cd0edbee46 + [-] BO : test on xml string follow up https://github.com/PrestaShop/PrestaShop/pull/690#issuecomment-28542506 + [-] BO : 406 when mod_security follow up https://github.com/PrestaShop/PrestaShop/commit/034e6a7e7f391e3a8861248db45a4a376b19633c + [-] BO : AdminImport, execption when creating groups + [-] BO : Fix bug #PSCFV-10990 bad version comparison for ps_versions_compliancy + [-] BO : Fix bug #PSCFV-10982 reduction group truncated + [-] BO : Could not check all modules after ajax call + [-] BO : Fix css bug #PSCFV-10899, fixed fix-toolbar z-index + [-] BO : Fix bug #PSCFV-10932, ranges input disabled on load + [-] BO : getCMSPages to associated shop in cmscontroller + [-] BO : Fix bug #PSCFV-10666 product_supllier currency set to 0 + [-] BO : Fix bug #PSCFV-10937, bad escaping for var product_prices in prices.tpl + [-] BO : Cart was not using order reference, corrected syntax + [-] BO : Cart was not using order reference + [-] BO : Could not change image position + [-] BO: Fix from name when replying to customer threads + [-] BO : Do not enable rewrite url for index + [-] BO: Fix empty group list on changing opt or newsletter on customers listing + [-] BO : AdminImport withdraw separator changed in js + [-] BO : AdminImport wrong group by default + [-] BO : FixBug #PSCFV-10882 - Add json encode and decode smarty modifier via tools class + [-] Bo : AdminImport customer group default + [-] BO : Fix bug #PSCFV-10872 AdminImport could not import supllier orders + [-] BO: fix the checkbox of shop activation on modules configuration + [-] BO : Adminimport default customers group + [-] BO : tagify call twice if field is not translatable + [-] BO : Stats are empty when no conversion rate + [-] BO : Order-follow displayed order id instead of order reference + [-] BO : hide stmp options when selecting never send emails + [-] BO : FixBug #PSCFV-10866 - Tagify system not working + [-] BO : FixBug #PSCFV-9319 - display only valid order id + [-] BO : Do not delete other default jpg when _deleteOldImages and type defined + [-] BO : AdminImport, fix bug from https://github.com/indesign47/PrestaShop/commit/84454bbc1c7a315e232245c5e43b300b8f153473#commitcomment-4418502 + [-] BO : Fix bug #10689, could not set image legend in back office + [-] BO : Fixed bug PSCFV-9910 using basic queries to prevent locking errors + [-] BO : Fix bug #PSCFV-10718 AdminAttachments old file not deleted on update + [-] BO : FixBug #PSCFV-10600 - Unmatched Boundary with mod_security + [-] BO : fix #PSCFV-10728, prices incorrectly formatted when creating new order from BO + [-] BO : FIx bug #PSCFV-10736 again, fixing query when product is not in base + [-] BO : FIx bug #PSCFV-10736, could not load a product given from getBoughtProducts + [-] BO : Fix bug #PSCFV-10790, Customer group names not exploded + [-] BO: product listing should call Product::getPriceStatic() with the product default shop in the context when it is not a shop context + [-] BO: Synchronize stock available after receipt supply order items #PSCFV-10724 + [-] BO : Fix bug #PSCFV-10638, Admin Import by reference moves products to home category + [-] BO : Fix bug #PSCFV-7907 AdminImport, add custom field to features + [-] BO : Fix bug #PSCFV-10767, could not retrieve feature value when product IDs not forced + [-] BO : Fix bug #PSCFV-10607 one upload name + [-] BO : wrong csv files name + [-] BO : Report of https://github.com/PrestaShop/PrestaShop/commit/fd86a29c5c369ec5da0f91bbe97c584a00d02d0d + [-] BO: Default country should be overriden in the context in multishop + [-] BO : Fix bug #PSCFV-10709 rename root category with slashes in it + [-] BO : Could not order by reserved words like 'key' + [-] BO : AdminImport, wrong default separators + [-] BO : Fix bug #PSCFV-10692, AdminImport bad utf8 cars for subst + [-] BO : Fix #PSCFV-10678 warning in chrome + [-] BO : FixBug #PSCFV-10671 - remove htmlentities on customer message + [-] BO : Could not insert referrer id_connections_source can not be null + [-] Bo : Could not update mailalert 2.5 with id_lang missing + [-] Bo : Could not update mailarler 2.5 with id_mlang + [-] BO: Fixbug #PSCFV-10671 - Double htmlentities. + [-] BO : AdminImport, fix Group searchByName + [-] BO : Adminimport, id_specific key_price not defined + [-] BO : FixBug - Remove second email in recipient + [-] BO : Fix bug #PSCFV-10660, could not delete csv file on NT + [-] BO : FixBug #PSCFV-9957 - Duplicate order invoice number + [-] BO : fixed bug #PSCFV-10637 PS_CARRIER_DEFAULT is not updated after edit default carrier + [-] BO : AdminImport no default value for separators + [-] BO : pass correct typed parameter to setCurrency + + [-] Classes : Hook - Installer & context shop id + [-] Classes : Modules listing and case insensitive + + [-] Core: Group::getCurrent() return the default customer group of the shop if default customer group is not associated to shop + [-] CORE : invalid method name in displayAjax method of Controller action + [-] CORE : Fix bug #PSCFV-10901 warnings on htmlentities + [-] CORE : Currency conversion rate can not be 0 + [-] CORE : SetEnv in if statement + [-] CORE : SetEnv not available on all config // @todo curl request on dummy .htacces + [-] CORE : Fix bug #PSCFV-10687 again, #PSCFV-10752 replaceAccentedChars() // sorry for that + [-] CORE : error_get_last > PHP 5.1 + [-] Core: Out of stock status should be setted after the first order history + [-] Core: Product::getPriceStatic called with 1 quantity return the specific price for 1 qty if called with id_cart = 0 + [-] CORE : Fix bug #PSCFV-10687 bad conversion for accentuated Y and W, thanks @mike15 + [-] CORE : $smarty->compile_check is not set to false, thanks @prestamodule + + [-] MO : Referralprogram Prevent Exception when badly configured + [-] MO : Missinag closing href + [-] MO :Fixed #PNM-1654 (Loyalty module) by using most expensive attribute instead of default one + [-] MO : Mailalert was not using order reference + [-] MO : Blocklayered follow up https://github.com/PrestaShop/PrestaShop/commit/a6e67b078e067445eef358e907649e843a1dc26a#commitcomment-4538556 + [-] MO : Fixed #PNM-1600 by modifying getPageLink() + [-] MO : Blockcategories last_visited_category must not be cached + [-] MO : Could not translate in transit mail, revert from https://github.com/viger-creator/PrestaShop/commit/3213b5dffb266ddb0639b94f72babd892328ffa2 + [-] MO : mailalert - Fix deprecated warning on displayDate + [-] MO : Blockwishlist no product image when id_product_attribute is defined, thanks @Broceliande + [-] MO : Fix NetworkError 404 Not Found on admin in blocklayered.php These files not exists : - /js/jquery/jquery-ui-1.8.10.custom.min.js - /css/jquery-ui-1.8.10.custom.css + [-] MO : Fix bug #PSCFV-10841, blockcart hides on product page when last product is removed from cart + [-] MO : Fixbug #PSCFV-10679 dateofdelivery PDF invoice array and array + [-] MO : Fixed bug PNM-1431 - referralprogram Lack the % sign + [-] MO : Fix bug #PSCFV-10787, cms associated to all shops + [-] MO : if customer is logged we do not recreate it + [-] MO : Fix bug #PSCFV-10775, could not upload .jpeg in TinyMCE + [-] MO : ScrollTo not loaded + [-] MO : Trackingfront, could not load employee stats date + + [-] WS: Fix bug #PSCFV-10970 use configuration for uploaded images quality + [-] WS: Fix stockavailables list when stock is shared between shops #PSCFV-10793 + [-] WS: Fix #PSCFV-10672 order by ID for non multishop entities + + Improved/changed features: + + [*] FO : DNI can be not required + [*] FO : Fix #PSCFV-8715 add product.attributes in carrier tpl + [*] FO : set at least a class to body + [*] FO : addTextFieldToProduct without Line feed, follow up https://github.com/PrestaShop/PrestaShop/pull/962#issuecomment-28294571 + [*] FO : https on TOS in fancybox, follow up https://github.com/PrestaShop/PrestaShop/pull/956 + [*] FO : Redirect to address.tpl when !Address::isCountryActiveById + [*] FO : Cache on getDiscountsCustomer, follow up https://github.com/PrestaShop/PrestaShop/pull/960 + [*] FO : Set cache for StockAvailable::getQuantityAvailableByProduct + [*] FO : Added posibilty to display new price instead of quantity discount + [*] FO: Follow up https://github.com/PrestaShop/PrestaShop/commit/e86c56172dad2892d5c7e7dbb0908b0f4ffbaae0 + [*] FO: Can not establish purchase total when tax incl. + [*] FO : Fix bug #PSCFV-10689 handle image legend + [*] FO: Removed missplaced on mobile theme + + [*] BO : AdminPerformances Hide warnings message when not necessary + [*] BO : add class on TD in standard List Back office : Add a class on TD in list created by getList() In fields_list array of AdminController, we can add a new parameter('class') example : 'name' => array( 'title' => $this->l('Name'), 'width' => 150, 'class' => 'ma_classe', 'filter_key' => 'b!name' ), This parameter can be used for javascript effect, ... Thanks. + [*] BO : New import csv files + [*] BO : Manual merge of https://github.com/PrestaShop/PrestaShop/pull/891 1/2 + [*] BO : AdminProducts find smallest images + [*] BO : improved unicode characters replacement in URLs (Russian and Ukrainian characters added) + [*] BO : AdminImport add img manufacturers-suppliers + [*] BO : AdminImport add img suppliers + [*] BO : AdminImport add img manufacturers + [*] BO : chmod 664 to config.xml file + [*] BO : Adding a title tag to display the module name on hover like PS 1.4 + + [*] CORE : Remove duplicate SQL queries + [*] CORE : Profiling hide non doubles + [*] CORE : Cache store for isAssociatedToShop::isAssociatedToShop + [*] CORE : Manual merge of https://github.com/PrestaShop/PrestaShop/ thanks @kpodemski + [*] CORE: Add phone_mobile to address format I honestly do not know why you decided by default to show only the first field of the phone :) Users often ask me why they don't see their mobile phone on orders in BO. + + [*] MO : Remove calls to isRegisteredInHook in crossselling and productscategory + [*] MO : New modules version since 1.5.6.0 + [*] MO: blocksharefb optimization + [*] MO: productcomments optimization + + [*] LO : Fix PSCFV-10876: use IETF code to set language of shop, not 'iso' code, allows to distinguish between chinese variants etc. + [*] LO : Added states to Spanish localization pack + [*] LO : Fixed a few bugs with currency formats in Back-Office orders + [*] LO : set correct currency format for CHF + + Added Features: + + [+] BO : Add debug mode system + [+] BO : AdminImport add entity Alias + + [+] CORE : Fixed cache_id + + [+] MO : Blockcart - Add error handler on ajax function + + Deprecated methods: + + [~] BO : Export DeliverySlip The dates range wasn't using the correct sql fields. + + #################################### # v1.5.6.0 - (2013-10-07) # #################################### diff --git a/docs/csv_import/addresses_import.csv b/docs/csv_import/addresses_import.csv index 60f603f4a..ff241ada0 100644 --- a/docs/csv_import/addresses_import.csv +++ b/docs/csv_import/addresses_import.csv @@ -1,4 +1,17 @@ -"id";"Alias*";"Active (0/1)";"Customer e-mail*";"Customer ID";"Manufacturer";"Supplier";"Company";"Lastname*";"Firstname*";"Address 1*";"Address 2";"Postcode* / Zipcode*";"City*";"Country*";"State";"Other";"Phone";"Mobile Phone";"VAT number" -1;"My Adress";1;"pub@prestashop.com";1;;;;"Doe";"John";"16, Main street";"2nd floor";75000;"PARIS ";"France";;;140138844;; -2;"My work";1;"pub@prestashop.com";1;;;"My Company";"Doe";"John";"535, Baker street";;13000;"Marseile";"France";;;235445588;; -3;"My work";0;;;"Apple Computer, Inc";;;"Jobs";"Steve";"1 Infinite Loop";;95014;"CUPERTINO";"United States";"California";;"(800) 275-2273";; +id;Alias*;Active (0/1);Customer e-mail*;Customer ID;Manufacturer;Supplier;Company;Lastname*;Firstname*;Address 1*;Address 2;Zipcode*;City*;Country*;State;Other;Phone;Mobile Phone;VAT number +1;Peter.Pan / New York;1;Peter.Pan@prestashop.com;;;;;Pan;Peter;360W, 42nd Street;;12001;New York;United States;New York;;01 02 03 04 05;06 02 03 04 05; +2;Wendy.Moira.Darling / New York;1;Wendy.Moira.Darling@prestashop.com;;;;;Darling;Wendy Moira;360W, 42nd Street;;12001;New York;United States;New York;;01 02 03 04 05;06 02 03 04 05; +3;Wendy.Moira.Darling / London;1;Wendy.Moira.Darling@prestashop.com;;;;;Darling;Wendy Moira;Lansdowne road 50 London;Kensington;W11;London;United Kingdom;;;01 02 03 04 05;06 02 03 04 05; +4;Tiger.Lily / Arizona;1;Tiger.Lily@prestashop.com;;;;;Lily;Tiger;Brackin Ranch Road;;86001;Flagstaff;United States;Arizona;;01 02 03 04 05;06 02 03 04 05; +5;Tiger.Lily / Le Chesnay;1;Tiger.Lily@prestashop.com;;;;;Lily;Tiger;53 passage des pas sages;;78150;Le Chesnay;France;;;01 02 03 04 05;06 02 03 04 05; +6;James.Hook / Home;1;James.Hook@prestashop.com;;;;;Hook;James;Mass Gravesite;P.O. Box 007;2101;Cayman Brac;Cayman Islands;;;01 02 03 04 05;06 02 03 04 05; +7;James Hook / Pro;1;James.Hook@prestashop.com;;;;Räuber Schätze GmBH;Hook;James;12 Leipziger Platz;;13505;Berlin;Germany;;;01 02 03 04 05;06 02 03 04 05; +8;Tinker.Bell / Napaiiri;1;Tinker.Bell@prestashop.com;;;;Santa Clauss Inc.;Bell;Tinker;Tähtikuja 1;;96930;Napapiiri;Finland;;;01 02 03 04 05;06 02 03 04 05; +9;Smee / Fiji;1;Bob.Smee@prestashop.com;;;;;Smee;Bob;Cross Island rd 321;Vanua Levu;;Savusavu;Fiji;;;01 02 03 04 05;06 02 03 04 05; +10;Smee / Portland;1;Bob.Smee@prestashop.com;;;;Lattice Semiconductor;Smee;Bob;5555 NE Moore Ct;;97124;Hillsboro;United States;Oregon;;01 02 03 04 05;06 02 03 04 05; +11;Tictac Crocodile / Home;1;Tictac.Crocodile@prestashop.com;;;;;Crocodile;Tictac;Old State Rd 4A;Saddlebunch keys;33040;Bay Point;United States;Florida;Beware the Shark :);01 02 03 04 05;06 02 03 04 05; +12;Apple / address1;1;;;Apple;;;Doe;John;1–6 Infinite Loop;;95014;Cupertino;United States;California;;01 02 03 04 05;06 02 03 04 05; +13;Shure / address1;1;;;Shure;;;Non-Doe;John;5800W Touhy Avenue;;60714;Niles;United States;Illinois;;01 02 03 04 05;06 02 03 04 05; +14;Shure / address2;1;;;Shure;;;Schuss-mayer;Kurt;Jakob-Dieffenbacher-Str. 12;;75031;Eppingen;Germany;;;01 02 03 04 05;06 02 03 04 05; +15;UPS / address1;1;;;;U.P.S;;Austin;Steve;55NE Glenlake Parkway;;30328;Atlanta;United States;Georgia;;01 02 03 04 05;06 02 03 04 05; +16;FedEX / address1;1;;;;FedEX;;Noland;Chuck;3640 Hacks Cross Rd;;32125;Memphis;United States;Tennessee;;01 02 03 04 05;06 02 03 04 05; diff --git a/docs/csv_import/alias_import.csv b/docs/csv_import/alias_import.csv index b64a435be..77007ea6a 100644 --- a/docs/csv_import/alias_import.csv +++ b/docs/csv_import/alias_import.csv @@ -1,3 +1,5 @@ -id;Alias *;Search *;Active (0/1) -3;microsft,micro;microsoft;1 -4;adbe,adaub;adobe;1 +id;Alias *;Search *;Active (0/1) +1;ano, anno, nona;nano;1 +2;ipdo, idop, podi;ipod;1 +3;McBook, Mbcook;MacBook;1 +4;Blekin;Belkin;1 diff --git a/docs/csv_import/categories_import.csv b/docs/csv_import/categories_import.csv index 300974a3e..96024f6e5 100644 --- a/docs/csv_import/categories_import.csv +++ b/docs/csv_import/categories_import.csv @@ -1,4 +1,4 @@ -id;Active (0/1);Name*;Parent Category;Root category (0/1);Description;Meta-title;Meta-keywords;Meta-description;URL rewritten;Image URL;ID ou nom de la boutique -10;1;iPods;Home;0;Now that you can buy movies from the iTunes Store and sync them to your iPod, the whole world is your theater.;;;;music-ipods;http://yourlinktotheimage.com/img1000.jpg;1 -11;1;Accessories;Home;0;Wonderful accessories for your iPod;;;;accessories-ipod;http://yourlinktotheimage.com/img1001.jpg;1 -12;1;Laptops;Home;0;The latest Intel processor, a bigger hard drive, plenty of memory, and even more new features all fit inside just one liberating inch. The new Mac laptops have the performance, power, and connectivity of a desktop computer. Without the desk part.;Apple laptops;Apple laptops MacBook Air;Powerful and chic Apple laptops;laptops;http://yourlinktotheimage.com/img1002.jpg;1 \ No newline at end of file +ID;Active (0/1);Name *;Parent category;Root category (0/1) ;Description;Meta title;Meta keywords;Meta description;URL rewritten;Image URL +10;1;iPods;Home;0;Now that you can buy movies from the iTunes Store and sync them to your iPod, the whole world is your theater.;Meta title-iPods;Meta keywords-iPods;Meta description-iPods;music-ipods;http://yourlinktotheimage.com/img1000.jpg +11;1;Accessories;Home;0;Wonderful accessories for your iPod;Meta title-Accessories;Meta keywords-Accessories;Meta description-Accessories;accessories-ipod;http://yourlinktotheimage.com/img1001.jpg +12;1;Laptops;Home;0;The latest Intel processor, a bigger hard drive, plenty of memory, and even more new features all fit inside just one liberating inch. The new Mac laptops have the performance, power, and connectivity of a desktop computer. Without the desk part.;Meta title-Laptops;Meta keywords-Laptops;Meta description-Laptops;laptops;http://yourlinktotheimage.com/img1002.jpg diff --git a/docs/csv_import/combinations_import.csv b/docs/csv_import/combinations_import.csv index aa0b6853a..e8373297b 100644 --- a/docs/csv_import/combinations_import.csv +++ b/docs/csv_import/combinations_import.csv @@ -1,4 +1,28 @@ -Id_product*;Group*;Attribute*;Supplier_reference;Reference;Ean13;Upc;Wholesale price;Impact on price;Ecotax;Quantity;Minimal quantity;Impact on weight;Default (0 = No, 1 = Yes);Image position;Image URL;Delete existing images (0 = No, 1 = Yes);ID / Name of shop -1;Capacity:select:0, Color:color:1;16Go:0, Bleu:1;Ref suppplier 1;Ref 1;1234567891234;123456789123;0;None;0.000000;10;1;None;0;1;http://youdomain.com/img.jpg;0;1 -1;Capacity:select:0, Color:color:1;16Go:0, Red:1;Ref suppplier 2;Ref 2;1234567891235;123456789124;0;None;0.000000;10;1;None;0;2;http://youdomain.com/img.jpg;0;1 - +Product ID*;Attribute (Name:Type:Position)*;Value (Value:Position)*;Supplier reference;Reference;EAN13;UPC;Wholesale price;Impact on price;Ecotax;Quantity;Minimal quantity;Impact on weight;Default (0 = No, 1 = Yes);Image position;Image URL;Delete existing images (0 = No, 1 = Yes);ID / Name of shop  +1;Color:color:0, Disk space:select:1;Blue:0, 16GB:1;RF-Nano-Blue-16GB;RP-Nano-Blue-16GB;0000080446392;;100;40;;10;1;0;0;1;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Blue:0, 8GB:1;RF-Nano-Blue-8GB;RP-Nano-Blue-8GB;0000080446393;;80;0;;10;1;0;0;2;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Yellow:0, 16GB:1;RF-Nano-Yellow-16GB;RP-Nano-Yellow-16GB;0000080446394;;100;40;;10;1;0;0;3;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Yellow:0, 8GB:1;RF-Nano-Yellow-8GB;RP-Nano-Yellow-8GB;0000080446395;;80;0;;10;1;0;1;4;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Metal:0, 16GB:1;RF-Nano-Metal-16GB;RP-Nano-Metal-16GB;0000080446396;;100;40;;10;1;0;0;5;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Metal:0, 8GB:1;RF-Nano-Metal-8GB;RP-Nano-Metal-8GB;0000080446397;;80;0;;10;1;0;0;6;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Black:0, 16GB:1;RF-Nano-Black-16GB;RP-Nano-Black-16GB;0000080446398;;100;40;;10;1;0;0;7;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Black:0, 8GB:1;RF-Nano-Black-8GB;RP-Nano-Black-8GB;0000080446399;;80;0;;10;1;0;0;8;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Orange:0, 16GB:1;RF-Nano-Orange-16GB;RP-Nano-Orange-16GB;0000080446400;;100;40;;10;1;0;0;9;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Orange:0, 8GB:1;RF-Nano-Orange-8GB;RP-Nano-Orange-8GB;0000080446401;;80;0;;10;1;0;0;10;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Pink:0, 16GB:1;RF-Nano-Pink-16GB;RP-Nano-Pink-16GB;0000080446402;;100;40;;10;1;0;0;11;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Pink:0, 8GB:1;RF-Nano-Pink-8GB;RP-Nano-Pink-8GB;0000080446403;;80;0;;10;1;0;0;12;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Green:0, 16GB:1;RF-Nano-Green-16GB;RP-Nano-Green-16GB;0000080446404;;100;40;;10;1;0;0;13;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Green:0, 8GB:1;RF-Nano-Green-8GB;RP-Nano-Green-8GB;0000080446405;;80;0;;10;1;0;0;14;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Purple:0, 16GB:1;RF-Nano-Purple-16GB;RP-Nano-Purple-16GB;0000080446406;;100;40;;10;1;0;0;15;http://youdomain.com/img.jpg;1; +1;Color:color:0, Disk space:select:1;Purple:0, 8GB:1;RF-Nano-Purple-8GB;RP-Nano-Purple-8GB;0000080446407;;80;0;;10;1;0;0;16;http://youdomain.com/img.jpg;1; +2;Color:color:0;Metal:0;RF-Shuffle-Metal;RP-Shuffle-Metal;0685387080038;;40;0;;12;1;0;1;1;http://youdomain.com/img.jpg;1; +2;Color:color:0;Blue:0;RF-Shuffle-Blue;RP-Shuffle-Blue;0685387080039;;40;0;;12;1;0;0;2;http://youdomain.com/img.jpg;1; +2;Color:color:0;Pink:0;RF-Shuffle-Pink;RP-Shuffle-Pink;0685387080040;;40;0;;12;1;0;0;3;http://youdomain.com/img.jpg;1; +2;Color:color:0;Green:0;RF-Shuffle-Green;RP-Shuffle-Green;0685387080041;;40;0;;12;1;0;0;4;http://youdomain.com/img.jpg;1; +3;Color:color:0, Disk space:select:1, ICU:select:2;Metal:0, 80GB Parallel ATA Drive @ 4200 rpm:1, 1.60GHz Intel Core 2 Duo:2;RF-MacBookAir80GB-1.6MHz;RP-MacBookAir80GB-1.6MHz;0123456791230;;0;750;;10;1;0;0;1;http://youdomain.com/img.jpg;1; +3;Color:color:0, Disk space:select:1, ICU:select:2;Metal:0, 80GB Parallel ATA Drive @ 4200 rpm:1, 1.80GHz Intel Core 2 Duo:2;RF-MacBookAir80GB-1.6MHz;RP-MacBookAir80GB-1.6MHz;0123456791230;;0;0;;10;1;0;1;2;http://youdomain.com/img.jpg;1; +3;Color:color:0, Disk space:select:1, ICU:select:2;Metal:0, Optional 64GB solid-state drive:1, 1.60GHz Intel Core 2 Duo:2;RF-MacBookAir64GB-1.8MHz;RP-MacBookAir64GB-1.8MHz;0123456791230;;0;225;;10;1;0;0;3;http://youdomain.com/img.jpg;1; +3;Color:color:0, Disk space:select:1, ICU:select:2;Metal:0, Optional 64GB solid-state drive:1, 1.60GHz Intel Core 2 Duo:2;RF-MacBookAir64GB-1.8MHz;RP-MacBookAir64GB-1.8MHz;0123456791230;;0;975;;10;1;0;0;4;http://youdomain.com/img.jpg;1; +5;Disk space:select:1;8GB:0;RF-IpodTouch8GB;RP-IpodTouch8GB;8456123645123;;200;0;;10;1;0;1;1;http://youdomain.com/img.jpg;1; +5;Disk space:select:1;16GB:0;RF-IpodTouch16GB;RP-IpodTouch16GB;8456123645124;;250;75;;10;1;0;0;2;http://youdomain.com/img.jpg;1; +5;Disk space:select:1;32GB:0;RF-IpodTouch32GB;RP-IpodTouch32GB;8456123645125;;300;150;;10;1;0;0;3;http://youdomain.com/img.jpg;1; diff --git a/docs/csv_import/customers_import.csv b/docs/csv_import/customers_import.csv index 8f839bc8e..362fe9560 100644 --- a/docs/csv_import/customers_import.csv +++ b/docs/csv_import/customers_import.csv @@ -1,3 +1,10 @@ -id;Active (0/1);Gender ID (Mr=1, Ms=2, else 9);E-mail*;Password*;Birthday;Lastname*;Firstname*;Newletter (0/1);Opt-in (0/1);Groups (x,y,z...);Default group ID;ID / Name of shop -1;1;1;johndoe@prestashop.com;#res152EDRF;1987-09-21;Doe;John;1;1;1,2;1;1 -2;1;2;mariedoe@prestashop.com;58@ret26#;1986-10-14;Doe;Marie;0;1;1,3;3;1 \ No newline at end of file +ID;Active (0/1);Titles ID (Mr = 1, Ms = 2, else 0);Email *;Password *;Birthday (yyyy-mm-dd);Last Name *;First Name *;Newsletter (0/1);Opt-in (0/1);Groups (x,y,z...);Default group ID +1;1;1;Peter.Pan@prestashop.com;123456789;1987-04-02;Pan;Peter;1;0;Customer;Customer +2;1;2;Wendy.Moira.Darling@prestashop.com;123456789;1989-11-12;Darling;Wendy Moira;1;0;Customer;Customer +3;1;2;Tiger.Lily@prestashop.com;123456789;1982-02-28;Lily;Tiger;1;0;Customer;Customer +4;1;1;James.Hook@prestashop.com;123456789;1952-12-04;Hook;James;0;1;Customer, Carribean;Carribean +5;1;2;Tinker.Bell@prestashop.com;123456789;1900-01-01;Bell;Tinker;1;1;Customer;Customer +6;1;1;Bob.Smee@prestashop.com;123456789;1971-10-21;Smee;Bob;1;1;Customer;Customer +7;1;1;Tictac.Crocodile@prestashop.com;123456789;1991-09-27;Crocodile;Tictac;0;0;Customer, Carribean;Carribean +8;1;1;Jack.Banning@prestashop.com;123456789;2003-07-05;Banning;Jack;0;0;Kids;Kids +9;0;2;Maggie.Banning@prestashop.com;123456789;2006-02-27;Banning;Maggie;0;0;Kids;Kids diff --git a/docs/csv_import/manufacturers_import.csv b/docs/csv_import/manufacturers_import.csv index 2e4ef5d24..4749d81b3 100644 --- a/docs/csv_import/manufacturers_import.csv +++ b/docs/csv_import/manufacturers_import.csv @@ -1,3 +1,63 @@ -id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description;Image URL -1;1;Apple Computer, Inc;;;;;http://youdomain.com/img.jpg -2;1;Shure Incorporated;;;;;http://youdomain.com/img.jpg +ID;Active (0/1);Name *;Description;Short description;Meta title;Meta keywords;Meta description +1;1;Apple;"

    The company was founded on April 1, 1976, and incorporated as Apple Computer, Inc. on January 3, 1977.The word ""Computer"" was removed from its name on January 9, 2007, the same day Steve Jobs introduced the iPhone, reflecting its shifted focus towards consumer electronics.

    Apple is the world's second-largest information technology company by revenue after Samsung Electronics, and the world's third-largest mobile phone maker after Samsung and Nokia.Fortune magazine named Apple the most admired company in the United States in 2008, and in the world from 2008 to 2012. However, the company has received criticism for its contractors' labor practices, and for Apple's own environmental and business practices.

    As of May 2013, Apple maintains 408 retail stores in fourteen countries as well as the online Apple Store and iTunes Store, the latter of which is the world's largest music retailer. Apple is the largest publicly traded corporation in the world by market capitalization, with an estimated value of US$415 billion as of March 2013. As of Sept 29 2012, the company had 72,800 permanent full-time employees and 3,300 temporary full-time employees worldwide. Its worldwide annual revenue in 2012 totalled $156 billion. In May 2013, Apple entered the top ten of the Fortune 500 list of companies for the first time, rising 11 places above its 2012 ranking to take the sixth position.

    +

    +

    (For more, go to the original article on Wikipedia)

    ";"

    +
    +
    +

    +

    Apple Inc., formerly Apple Computer, Inc., is an American multinational corporation headquartered in Cupertino, California that designs, develops, and sells consumer electronics, computer software and personal computers.

    ";MetaTitle-Apple;MetaKeywords-Apple;Meta description-Apple +2;1;Shure;"


    +

    Company history

    +

    Shure was founded by Sidney N. Shure in 1925 as ""The Shure Radio Company"", selling radio parts kits in the days before complete manufactured radios were available. The company's office was located at 19 South Wells Street in downtown Chicago, Illinois. The following year, Shure published its first direct mail catalog, which was one of only six radio parts catalogs in the United States at the time. By 1928, the company had grown to over 75 employees, and Sidney's brother, Samuel J. Shure, joined the company, which was renamed Shure Brothers Company. The company moved into new offices at 335 West Madison Street in Chicago. In 1929, with the advent of the Great Depression and the increased availability of factory-built radios, Shure Brothers Company was forced to greatly reduce their staff and became the exclusive US distributor of a small microphone manufacturer. In 1930, Samuel J. Shure left the company.

    +

    In 1931, Shure and engineer Ralph Glover began development of the first Shure microphone, and the following year, the Model 33N Two-Button Carbon Microphone was introduced, making Shure one of only four microphone manufacturers in the U.S.. Shure's first condenser microphone, crystal microphone, and microphone suspension support system (for which they received their first patent) were all introduced that same decade. In 1939, Shure introduced the Model 55 Unidyne Microphone, which went on to become one of the world's most recognized microphones.

    +

    In 1941, Shure was contracted by the United States armed forces to supply microphones during World War II, and by the following year, the T-17B was the microphone most widely used by the U.S. Army and Navy. Shure also manufactured throat, headset, and oxygen mask microphones, and adopted the United States Military Standard for all Shure microphones.

    +

    By the mid-1940s, Shure was also manufacturing and supplying phonograph cartridges to major phonograph manufacturers including Philco, RCA, Emerson, Magnavox, Admiral, and Motorola, and was the largest producer of phonograph cartridges in the U.S. at that time. Among Shure's innovations in phonograph cartridge design was Ralph Glover and Ben Bauer's ""needle-tilt"" principle for minimizing record wear while improving sound reproduction, and Jim Kogen's engineering concept of ""trackability."" Shure produced the first phonograph cartridge capable of playing both long-playing and 78 rpm records, the first cartridge with tracking force of only one gram, and the first cartridge meeting the requirements of stereo recording. At the peak of Shure's phonograph cartridge production, the company was producing approximately 28,000 cartridges per day, with 25,000 of those coming from a Shure phonograph cartridge plant in Phoenix, Arizona. After the introduction of compact discs in the 1980s reduced the demand for phonograph cartridges, Shure closed the Phoenix facility but continued manufacturing phonograph cartridges, and continues to manufacture them today.

    +

    Shure also developed and produced products for medical applications. In 1937, their 66A piezoelectric stethophone was designed to accurately reproduce chest sounds, and in the early 1960s, the SP-5, SP-5S and SP-6 stethoscope pickups were produced. Shure also produced hearing aid cartridges used in hearing aid products from manufacturers like Maico, Telex, Dictograph, Otarian, Vocalite, and Trimm.

    +

    In 1956, Shure moved its corporate headquarters to Hartrey Avenue in Evanston, Illinois, where it remained for 47 years. Beginning in the 1956, Shure manufactured magnetic tape recording heads and two years later, the company announced it was ready to mass-produce 4-ch recording heads. By 1964, however, Shure announced it would no longer produce tape recording heads due to increased competition.

    +

    In 1953, Shure introduced their first wireless microphone system for performers, and in 1959, they introduced the Unidyne III Microphone, which was the predecessor to the SM57, which would be introduced, along with the SM58, six years later. Shure also produced portable equipment for broadcast field recording like Vocal Master, the M67 Portable Mixer, and the FP31 Portable Mixer. In 1990, Shure entered the wireless microphone market with the L-Series.

    +

    In 1981, James Kogen, Executive Vice President, Operations, was promoted to President and General Manager of Shure. In 1995, Sidney N. Shure died at the age of 93, and Rose L. Shure was elected Chairman of the Board of Directors. In 1996, James Kogen retired; Santo (Sandy) LaMantia, Vice President of Engineering, was named President and CEO. Shure Brothers Incorporated was officially renamed Shure Incorporated in 1999.

    +

    In 2001, Shure acquired the Popper Stopper brand of studio pop filters from Middle Atlantic Products Inc. The following year, Shure adopted hearing conservation as the company’s corporate cause and established the Shure Bid for Hearing program. In 2003, Shure moved into new corporate headquarters in Niles, Illinois, into a building designed by architect Helmut Jahn which was originally the headquarters of HA•LO Industries. The 65,000-square-foot (6,000 m2) Technology Annex designed by Krueck and Sexton Architects, opened in 2005, houses Shure's Performance Listening Center. In 2008, Shure celebrated the opening of The S.N. Shure Theater and Interactive Display at their corporate headquarters.

    +

    International offices

    +
      +
    • 1991: Shure Europe GmbH opened in Heilbronn, Germany to provide sales, service and support to Shure distribution centers in 34 European countries.
    • +
    • 1999: Shure Asia Limited is opened in Hong Kong to serve Distribution Centers and distributors throughout Asia and the Pacific Rim.
    • +
    • 2002: Shure Distribution GmbH established as a subsidiary of Shure Europe GmbH, to handle direct sales with Shure dealers in Germany.
    • +
    • 2003: HW International, Shure's United Kingdom Distribution Center, acquired and renamed Shure Distribution UK.
    • +
    • 2005: Sales and marketing office opened in Shanghai, China.
    • +
    • 2006: Sales and marketing office opened in Tokyo, Japan.
    • +
    • 2010: New subsidiary formed in the Netherlands
    • +
    +

    Production facility expansion

    +
      +
    • 1982: Manufacturing facility opened in Wheeling, Illinois
    • +
    • 1983: Phonograph cartridge manufacturing facility opened in Agua Prieta, Mexico
    • +
    • 1984: Wired microphone manufacturing facility opened in Juarez, Mexico
    • +
    • 1989: Juarez, Mexico facility expanded
    • +
    • 1994: Agua Prieta facility expanded in 1994
    • +
    • 2005: Manufacturing facility opened in Suzhou, China
    • +
    +


    +

    (For more, go to the original article on Wikipedia)

    ";"

    +

    +

    +

    Shure Incorporated is an American corporation originally founded by Sidney N. Shure in Chicago, Illinois in 1925 as a supplier of radio parts kits. The company became a consumer and professional audio-electronics manufacturer of microphones, wireless microphone systems, phonograph cartridges, discussion systems, mixers, and digital signal processing.

    +

    The company also produces listening products, including headphones, high-end earbuds and personal monitor systems.

    ";MetaTitle-Shure;MetaKeywords-Shure;Meta description-Shure +3;1;Sony;"


    +

    History

    +

    Sony found its beginning in the wake of World War II. In 1946, Masaru Ibuka started an electronics shop in a bomb-damaged department store building in Tokyo. The company had $530 in capital and a total of eight employees. The next year, he was joined by his colleague, Akio Morita, and they founded a company called Tokyo Tsushin Kogyo (Tokyo Telecommunications Engineering Corporation). The company built Japan's first tape recorder, called the Type-G. In 1958 the company name was changed to Sony.

    +

    In the early 1950s, Ibuka traveled in the United States and heard about Bell Labs' invention of the...

    +

    (For more, go to the original article on Wikipedia)

    ";"

    +

    +

    +


    +

    Sony Corporation, commonly referred to as Sony, is a Japanese multinational conglomerate corporation headquartered in Konan Minato, Tokyo, Japan. Its diversified business is primarily focused on the electronics, game, entertainment and financial services sectors. The company is one of the leading manufacturers of electronic products for the consumer and professional markets. Sony is ranked 87th on the 2012 list of Fortune Global 500.

    ";MetaTitle-Sony;MetaKeywords-Sony;Meta description-Sony +4;1;Samsung;"

    Samsung was founded by Lee Byung-chul in 1938 as a trading company. Over the next three decades the group diversified into areas including food processing, textiles, insurance, securities and retail. Samsung entered the electronics industry in the late 1960s and the construction and shipbuilding industries in the mid-1970s; these areas would drive its subsequent growth. Following Lee's death in 1987, Samsung was separated into four business groups – Samsung Group, Shinsegae Group, CJ Group and Hansol Group. Since the 1990s Samsung has increasingly globalized its activities, and electronics, particularly mobile phones and semiconductors, have become its most important source of income.

    +

    Notable Samsung industrial subsidiaries include Samsung Electronics (the world's largest information technology company measured by 2012 revenues, and 4th in market value), Samsung Heavy Industries (the world's 2nd-largest shipbuilder measured by 2010 revenues), and Samsung Engineering and Samsung C&T (respectively the world's 13th and 36th-largest construction companies). Other notable subsidiaries include Samsung Life Insurance (the world's 14th-largest life insurance company), Samsung Everland (operator of Everland Resort, the oldest theme park in South Korea), Samsung Techwin (an aerospace, surveillance and defense company) and Cheil Worldwide (the world's 16th-largest advertising agency measured by 2011 revenues).

    +

    Samsung has a powerful influence on South Korea's economic development, politics, media and culture, and has been a major driving force behind the ""Miracle on the Han River"". Its affiliate companies produce around a fifth of South Korea's total exports. Samsung's revenue was equal to 17% of the South Korea's $1,082 billion GDP.

    +

    In 2013, Samsung began construction on building the world's largest ...

    +

    (For more, go to the original article on Wikipedia)

    ";"


    +
    +
    +
    +


    +

    Samsung Group is a South Korean multinational conglomerate company headquartered in Samsung Town, Seoul. It comprises numerous subsidiaries and affiliated businesses, most of them united under the Samsung brand, and is the largest South Korean chaebol (business conglomerate).

    ";MetaTitle-Samsung;MetaKeywords-Samsung;Meta description-Samsung diff --git a/docs/csv_import/products_import.csv b/docs/csv_import/products_import.csv index 2952a2f05..2757ec186 100644 --- a/docs/csv_import/products_import.csv +++ b/docs/csv_import/products_import.csv @@ -1,3 +1,8 @@ -ID;Active (0/1);Name*;Categories (x,y,z,…);Price tax excl. Or Price tax excl;Tax rules id;Wholesale price;On sale (0/1);Discount amount;Discount percent;Discount from (yyy-mm-dd);Discount to (yyy-mm-dd);Reference #;Supplier reference #;Supplier;Manufacturer;EAN13;UPC;Ecotax;Width;Height;Depth;Weight;Quantity;Minimum quantity;Visibility;Additional shipping cost;Unity;Unity price ratio;Short description;Description;Tags (x,y,z,...);Meta-title;Meta-keywords;Meta-description;URL rewritten;Text when in-stock;Text if back-order allowed;Available for order (0 = No, 1 = Yes);Product available date;Product creation date;Show price (0 = No, 1 = Yes);Image URLs (x,y,z,...);Delete existing images (0 = No, 1 = Yes);Feature (Name:Value:Position);Available online only (0 = No, 1 = Yes);Condition (new,used,refurbished);Customizable;File fields;Text fields;Out of stock;Advanced stock management;ID / Name of shop -1;1;iPod Nano;Home, iPods;49;1;40;0;;;;;92458844;54778855;AppleStore;Apple Computer, Inc;5605055055056;560505505555;0;1;2;3;0.5;800;1;both;0.00;;0.00;New design. New features. Now i….;Curved ahead of the curve. For those about to rock, we give you nine amazing colors. But that's only part of the story. Feel the curved, all-aluminum and glass de...;apple, ipod, nano;Meta title;Meta keywords;Meta description;ipod-nano;In stock;Out stock;1;;;1;http://youdomain.com/img.jpg, http://yourdomain.com/img1.jpg;0;Music:Rock:1;0;new;0;0;0;2;0;1 -2;1;iPod shuffle;Home, iPods;66.05;1;50;0;;;;;92458845;54778855;AppleStore;Apple Computer, Inc;5605055055057;560505505556;0;1;2;3;0.5;800;1;both;0.00;;0.00;iPod shuffle, the world’s most wearabl….;You want listen to music;ipod, shuffle;Meta title;Meta keywords;Meta description;ipod-shuffle;In stock;Out stock;1;;;1;http://youdomain.com/img25.jpg, http://yourdomain.com/img30.jpg;0;Music:Blues:2;0;new;0;0;0;2;0;1 +ID;Active (0/1);Name *;Categories (x,y,z...);Price tax excluded or Price tax included;Tax rules ID;Wholesale price;On sale (0/1);Discount amount;Discount percent;Discount from (yyyy-mm-dd);Discount to (yyyy-mm-dd);Reference #;Supplier reference #;Supplier;Manufacturer;EAN13;UPC;Ecotax;;;;Weight;Quantity;;;;;;Short description;Description;Tags (x,y,z...);Meta title;Meta keywords;Meta description;URL rewritten;Text when in stock;Text when backorder allowed;Available for order (0 = No, 1 = Yes);Product available date;Product creation date;Show price (0 = No, 1 = Yes);Image URLs (x,y,z...);Delete existing images (0 = No, 1 = Yes);Feature(Name:Value:Position);Available online only (0 = No, 1 = Yes);Condition;Customizable (0 = No, 1 = Yes);Uploadable files (0 = No, 1 = Yes);Text fields (0 = No, 1 = Yes);Out_of_stock;Advanced stock management;ID / Name of shop  +1;1;iPod Nano;iPods;100;1;80;1;;5.5;2013-06-01;2018-12-31;RP-demo_1;RF-demo_1;Applestore;Apple;1234567890123;;1;0.6;0.2;0.4;0.068357;160;1;;;;;

    New design.

    ;

    New design.

    ;apple, ipod, nano;Meta title-Nano;Meta keywords-Nano;Meta description-Nano;iPod-Nano;In Stock;Current supply. Ordering availlable;1;2013-03-01;2013-01-01;1;http://localhost/prestashop_1.5.6.0/img/p/1/5/15.jpg;0;;0;new;0;0;0;0;0; +2;1;iPod shuffle;iPods;60;1;40;1;;;2013-06-01;2018-12-31;RP-demo_2;RF-demo_2;Applestore;Apple;1234567890123;;1;0.1;0.1;0.1;0.027563;120;1;both;;;;

    New design.

    ;

    New design.

    ;ipod, shuffle;Meta title-Shuffle;Meta keywords-Shuffle;Meta description-Shuffle;iPod-shuffle;In Stock;Current supply. Ordering availlable;1;2013-03-01;2013-01-02;1;http://localhost/prestashop_1.5.6.0/img/p/2/3/23.jpg;0;;0;new;0;0;0;0;0; +3;1;MacBook Air;Laptops;1500;1;1000;1;100;;2013-06-01;2018-12-31;RP-demo_3;RF-demo_3;Applestore;Apple;1234567890123;;2;1.31;0.3;1;2.976846;400;1;catalog;;;;

    New design.

    ;

    New design.

    ;MacBook, Air;Meta title-McBookAir;Meta keywords-McBookAir;Meta description-McBookAir;MacBook-Air;In Stock;Current supply. Ordering availlable;1;2013-03-01;2013-01-03;1;http://localhost/prestashop_1.5.6.0/img/p/1/1.jpg;1;;0;new;0;0;0;0;0; +4;1;MacBook;Laptops;1150;1;750;1;;;2013-06-01;2018-12-31;RP-demo_4;RF-demo_4;Applestore;Apple;1234567890123;;2;1.31;0.3;1;4.454244;75;1;search;;;;

    New design.

    ;

    New design.

    ;MacBook, Pro;Meta title-McBookPro;Meta keywords-McBookPro;Meta description-McBookPro;MacBook;In Stock;Current supply. Ordering availlable;1;2013-03-01;2013-01-04;1;http://localhost/prestashop_1.5.6.0/img/p/6/6.jpg;1;;0;new;0;0;0;0;0; +5;1;iPod touch;iPods;240;1;150;1;;;2013-06-01;2018-12-31;RP-demo_5;RF-demo_5;Applestore;Apple;1234567890123;;1;0.6;0.2;0.4;0.194046;120;1;none;;;;

    New design.

    ;

    New design.

    ;Ipod touch;Meta title-IpodTouch;Meta keywords-IpodTouch;Meta description-IpodTouch;iPod-touch;In Stock;Current supply. Ordering availlable;1;2013-03-01;2013-01-05;1;http://localhost/prestashop_1.5.6.0/img/p/7/7.jpg;0;;1;used;0;0;0;0;0; +6;1;Belkin Leather Folio for iPod nano - Black / Chocolate;Accessories;25;1;150;1;;;2013-06-01;2018-12-31;RP-demo_6;RF-demo_6;Nippon Electronic Import;Belkin;1234567890123;;0;0.6;0.2;0.4;0.038588;25;1;;20;;;

    New design.

    ;

    New design.

    ;Folio, leather;Meta title-BelkinLeatherFolio;Meta keywords-BelkinLeatherFolio;Meta description-BelkinLeatherFolio;Belkin-Leather-Folio-for-iPod-nano---Black-Chocolate;In Stock;Current supply. Ordering availlable;1;2013-03-01;2013-01-06;1;http://localhost/prestashop_1.5.6.0/img/p/1/3/13.jpg;0;;1;refurbished;0;0;0;0;0; +7;1;Shure SE210 Sound-Isolating Earphones for iPod and iPhone;Accessories;125;2;80;1;;;2013-06-01;2018-12-31;RP-demo_7;RF-demo_7;Shure Online Store;Shure;1234567890123;;0;0.1;0.1;0.1;0.040793;15;1;;;;;

    New design.

    ;

    New design.

    ;Headphones;Meta title-ShureEarphones;Meta keywords-ShureEarphones;Meta description-ShureEarphones;Shure-SE210-Sound-Isolating-Earphones-for-iPod-and-iPhone;In Stock;Current supply. Ordering availlable;1;2013-03-01;2013-01-07;1;http://localhost/prestashop_1.5.6.0/img/p/1/4/14.jpg;0;;1;new;0;0;0;0;0; diff --git a/docs/csv_import/suppliers_import.csv b/docs/csv_import/suppliers_import.csv index c02561686..e69397b22 100644 --- a/docs/csv_import/suppliers_import.csv +++ b/docs/csv_import/suppliers_import.csv @@ -1,3 +1,4 @@ -id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description;Image URL -1;1;Applestore;;;;;http://youdomain.com/img.jpg -2;1;Shure Online Store;;;;;http://youdomain.com/img.jpg +ID;Active (0/1);Name *;Description;Short description;Meta title;Meta keywords;Meta description +1;1;Applestore;

    The Apple Store is a chain of retail stores owned and operated by Apple Inc., dealing in computers and consumer electronics. The stores sell Macintosh personal computers, software, iPods, iPads, iPhones, third-party accessories, and other consumer electronics such as Apple TV. Some high profile stores feature a Theatre for presentations and workshops and a Studio for training with Apple products; all stores offer a Genius Bar for technical support and repairs, as well as free workshops available to the public. Under the leadership of Ron Johnson, the former Senior Vice President of Retail Operations, the Apple Stores have, according to an article in the New York Times, been responsible for "[turning] the boring computer sales floor into a sleek playroom filled with gadgets".

    ;;Meta title-Applestore;Meta keywords-Applestore;Meta description-Applestore +2;1;Shure Online Store;

    - No description -

    ;;Meta title-Shure Online Store;Meta keywords-Shure Online Store;Meta description-Shure Online Store +3;1;Nippon Electronic Import;

    - No description -

    ;;Meta title-Nippon Electronic Import;Meta keywords-Nippon Electronic Import;Meta description-Nippon Electronic Import diff --git a/docs/csv_import/supply_orders_details_import.csv b/docs/csv_import/supply_orders_details_import.csv index c5a99dca8..73b3bcd70 100644 --- a/docs/csv_import/supply_orders_details_import.csv +++ b/docs/csv_import/supply_orders_details_import.csv @@ -1,17 +1,21 @@ -"Supply Order Reference *";"Product ID *";"Product Attribute ID";"Unit Price (te) *";"Quantity Expected *";"Discount Rate";"Tax Rate" -"ref import demo";1;25;110;10;10;19,6 -"ref import demo";1;26;111;11;1;19,6 -"ref import demo";1;27;112;12;;19,6 -"ref import demo";1;28;113;13;3;19,6 -"ref import demo";1;29;114;14;;19,6 -"ref import demo";1;30;115;15;5;19,6 -"ref import demo";1;31;116;16;;19,6 -"ref import demo";1;32;117;17;7;19,6 -"ref import demo";1;33;118;18;;19,6 -"ref import demo";1;34;119;19;9;19,6 -"ref import demo";1;35;120;20;;19,6 -"ref import demo";1;39;121;21;11;19,6 -"ref import demo";1;40;122;22;;19,6 -"ref import demo";1;41;123;23;13;19,6 -"ref import demo";1;42;124;24;;19,6 -"ref import demo";6;;1000;28;18;19,6 +Supply Order Reference *;Product ID *;Product Attribute ID;Unit Price (tax excl.)*;Quantity Expected *;Discount Rate;Tax Rate +Ref Apple 01;1;1;100;25;0;19,6 +Ref Apple 01;1;2;80;25;0;19,6 +Ref Apple 01;1;3;100;25;0;19,6 +Ref Apple 01;1;4;80;25;0;19,6 +Ref Apple 01;1;5;100;25;0;19,6 +Ref Apple 01;1;6;80;25;0;19,6 +Ref Apple 01;1;7;100;25;0;19,6 +Ref Apple 01;1;8;80;25;0;19,6 +Ref Apple 01;1;9;100;25;0;19,6 +Ref Apple 01;1;10;80;25;0;19,6 +Ref Apple 01;1;11;100;25;0;19,6 +Ref Apple 01;1;12;80;25;0;19,6 +Ref Apple 01;1;13;100;25;0;19,6 +Ref Apple 01;1;14;80;25;0;19,6 +Ref Apple 01;1;15;100;25;0;19,6 +Ref Apple 01;1;16;80;25;0;19,6 +Ref Apple 01;2;17;40;25;0;19,6 +Ref Apple 01;2;18;40;25;0;19,6 +Ref Apple 01;2;19;40;25;0;19,6 +Ref Apple 01;2;20;40;25;0;19,6 diff --git a/docs/csv_import/supply_orders_import.csv b/docs/csv_import/supply_orders_import.csv index 6050f8575..7102de3df 100644 --- a/docs/csv_import/supply_orders_import.csv +++ b/docs/csv_import/supply_orders_import.csv @@ -1,2 +1,5 @@ -"ID";"Supplier ID *";"Lang ID";"Warehouse ID*";"Currency ID";"Supply Order Reference *";"Expected Delivery Date *";"Discount Rate";"Template" -;1;1;1;;"ref import demo";"2015-12-24";; +ID;Supplier ID *;Lang ID;Warehouse ID *;Currency ID *;Supply Order Reference *;Delivery Date (Y-M-D)*;Discount Rate;Template +1;1;1;1;1;Ref Apple 01;2013-11-01;; +2;3;1;1;1;Nippon Electronic Import;2013-11-01;; +3;2;1;1;1;Shure Online Store;2013-11-01;; +4;1;1;2;2;Ref Apple 02;2013-11-01;; diff --git a/docs/readme_de.txt b/docs/readme_de.txt index 87be3bcf3..d1dd67ed0 100755 --- a/docs/readme_de.txt +++ b/docs/readme_de.txt @@ -21,8 +21,8 @@ needs please refer to http://www.prestashop.com for more information. @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) International Registered Trademark & Property of PrestaShop SA -NAME: Prestashop 1.5.6.0 -VERSION: 1.5.6.0 +NAME: Prestashop 1.5.6.1 +VERSION: 1.5.6.1 VORBEREITUNG =========== diff --git a/docs/readme_en.txt b/docs/readme_en.txt index 385f01d04..51d559119 100755 --- a/docs/readme_en.txt +++ b/docs/readme_en.txt @@ -21,8 +21,8 @@ needs please refer to http://www.prestashop.com for more information. @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) International Registered Trademark & Property of PrestaShop SA -NAME: Prestashop 1.5.6.0 -VERSION: 1.5.6.0 +NAME: Prestashop 1.5.6.1 +VERSION: 1.5.6.1 PREPARATION =========== diff --git a/docs/readme_es.txt b/docs/readme_es.txt index 51c52b1c3..ca8d1df62 100755 --- a/docs/readme_es.txt +++ b/docs/readme_es.txt @@ -21,8 +21,8 @@ needs please refer to http://www.prestashop.com for more information. @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) International Registered Trademark & Property of PrestaShop SA -NAME: Prestashop 1.5.6.0 -VERSION: 1.5.6.0 +NAME: Prestashop 1.5.6.1 +VERSION: 1.5.6.1 PREPARACI�N =========== diff --git a/docs/readme_fr.txt b/docs/readme_fr.txt index 4fd3accf0..6574f4749 100755 --- a/docs/readme_fr.txt +++ b/docs/readme_fr.txt @@ -21,8 +21,8 @@ needs please refer to http://www.prestashop.com for more information. @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) International Registered Trademark & Property of PrestaShop SA -NAME: Prestashop 1.5.6.0 -VERSION: 1.5.6.0 +NAME: Prestashop 1.5.6.1 +VERSION: 1.5.6.1 PREPARATION =========== diff --git a/docs/readme_it.txt b/docs/readme_it.txt index 3238253a7..ea648e2d7 100755 --- a/docs/readme_it.txt +++ b/docs/readme_it.txt @@ -21,8 +21,8 @@ needs please refer to http://www.prestashop.com for more information. @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) International Registered Trademark & Property of PrestaShop SA -NAME: Prestashop 1.5.6.0 -VERSION: 1.5.6.0 +NAME: Prestashop 1.5.6.1 +VERSION: 1.5.6.1 PREPARAZIONE =========== diff --git a/install-dev/classes/languages.php b/install-dev/classes/languages.php index 760954e59..9ab7cf9d0 100644 --- a/install-dev/classes/languages.php +++ b/install-dev/classes/languages.php @@ -136,7 +136,10 @@ class InstallLanguages } $args[0] = $translation; - return call_user_func_array('sprintf', $args); + if(count($args) > 1) + return call_user_func_array('sprintf', $args); + else + return $translation; } /** @@ -210,4 +213,4 @@ function ps_usort_languages($a, $b) if ($aname == $bname) return 0; return ($aname < $bname) ? -1 : 1; -} \ No newline at end of file +} diff --git a/install-dev/classes/session.php b/install-dev/classes/session.php index a8eabefc5..98d866e5f 100644 --- a/install-dev/classes/session.php +++ b/install-dev/classes/session.php @@ -45,7 +45,7 @@ class InstallSession session_name('install_'.md5($_SERVER['HTTP_HOST'])); $session_started = session_start(); if (!($session_started) - || (!isset($_SESSION['session_mode']) && (isset($_POST['submitNext']) || isset($_POST['submitPrevious']) || isset($_POST['language'])))) + || (!isset($_SESSION['session_mode']) && (isset($_GET['_']) || isset($_POST['submitNext']) || isset($_POST['submitPrevious']) || isset($_POST['language'])))) { InstallSession::$_cookie_mode = true; InstallSession::$_cookie = new Cookie('ps_install', null, time() + 7200, null, true); diff --git a/install-dev/fixtures/apple/data/product_supplier.xml b/install-dev/fixtures/apple/data/product_supplier.xml index 59c4ce5ab..27b34a75f 100644 --- a/install-dev/fixtures/apple/data/product_supplier.xml +++ b/install-dev/fixtures/apple/data/product_supplier.xml @@ -8,39 +8,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/install-dev/upgrade/php/add_module_to_hook.php b/install-dev/upgrade/php/add_module_to_hook.php index fabd39cfa..673f120f8 100644 --- a/install-dev/upgrade/php/add_module_to_hook.php +++ b/install-dev/upgrade/php/add_module_to_hook.php @@ -38,22 +38,25 @@ function add_module_to_hook($module_name, $hook_name) $id_hook = Db::getInstance()->getValue('SELECT `id_hook` FROM `'._DB_PREFIX_.'hook` WHERE `name` = "'.$hook_name.'"'); if(!$id_hook) { - $res &= Db::getInstance()->execute(' + if (!Db::getInstance()->execute(' INSERT IGNORE INTO `'._DB_PREFIX_.'hook` (`name`, `title`) - VALUES ("'.pSQL($hook_name).'", "'.pSQL($hook_name).'")'); - $id_hook = Db::getInstance()->Insert_ID(); + VALUES ("'.pSQL($hook_name).'", "'.pSQL($hook_name).'")')) + $res = false; + else + $id_hook = Db::getInstance()->Insert_ID(); } if ((int)$id_hook > 0) { - $res &= Db::getInstance()->execute(' + if (!Db::getInstance()->execute(' INSERT IGNORE INTO `'._DB_PREFIX_.'hook_module` (`id_module`, `id_hook`, `position`) VALUES ( '.(int)$id_module.', '.(int)$id_hook.', (SELECT IFNULL( (SELECT max_position from (SELECT MAX(position)+1 as max_position FROM `'._DB_PREFIX_.'hook_module` WHERE `id_hook` = '.(int)$id_hook.') AS max_position), 1)) - )'); + )')) + $res = false; } } return $res; diff --git a/install-dev/upgrade/php/create_multistore.php b/install-dev/upgrade/php/create_multistore.php index d0ecbf7b8..0d5b0325d 100755 --- a/install-dev/upgrade/php/create_multistore.php +++ b/install-dev/upgrade/php/create_multistore.php @@ -41,10 +41,10 @@ function create_multistore() // @todo generate __PS_BASE_URI__ using $_SERVER['REQUEST_URI'], just in case return false; } - $all_themes_dir = _PS_ROOT_DIR_.'/themes'; + $all_themes_dir = _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.'themes'; $themes = scandir($all_themes_dir); foreach ($themes AS $theme) - if (is_dir($all_themes_dir.'/'.$theme) + if (is_dir($all_themes_dir.DIRECTORY_SEPARATOR.$theme.DIRECTORY_SEPARATOR) && $theme[0] != '.' && $theme != 'prestashop') { @@ -73,8 +73,8 @@ function create_multistore() $shop_domain_ssl = create_multistore_getHttpHost(); } - $_PS_DIRECTORY_ = trim(str_replace(' ', '%20', $INSTALLER__PS_BASE_URI), '/'); - $_PS_DIRECTORY_ = ($_PS_DIRECTORY_) ? '/'.$_PS_DIRECTORY_.'/' : '/'; + $_PS_DIRECTORY_ = trim(str_replace(' ', '%20', $INSTALLER__PS_BASE_URI), DIRECTORY_SEPARATOR); + $_PS_DIRECTORY_ = ($_PS_DIRECTORY_) ? '/'.$_PS_DIRECTORY_.DIRECTORY_SEPARATOR : DIRECTORY_SEPARATOR; $res &= Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'shop_url` (`id_shop`, `domain`, `domain_ssl`, `physical_uri`, `virtual_uri`, `main`, `active`) VALUES(1, \''.pSQL($shop_domain).'\', \''.pSQL($shop_domain_ssl).'\', \''.pSQL($_PS_DIRECTORY_).'\', \'\', 1, 1)'); diff --git a/install-dev/upgrade/php/deactivate_custom_modules.php b/install-dev/upgrade/php/deactivate_custom_modules.php index 81467c137..08b326c40 100644 --- a/install-dev/upgrade/php/deactivate_custom_modules.php +++ b/install-dev/upgrade/php/deactivate_custom_modules.php @@ -31,7 +31,7 @@ function deactivate_custom_modules() $modules = scandir(_PS_MODULE_DIR_); foreach ($modules AS $name) { - if (is_dir(_PS_MODULE_DIR_.$name) && file_exists(_PS_MODULE_DIR_.$name.'/'.$name.'.php')) + if (is_dir(_PS_MODULE_DIR_.$name.'/') && file_exists(_PS_MODULE_DIR_.$name.'/'.$name.'.php')) { if (!preg_match('/^[a-zA-Z0-9_-]+$/', $name)) die(Tools::displayError().' (Module '.$name.')'); diff --git a/install-dev/upgrade/php/update_customer_default_group.php b/install-dev/upgrade/php/update_customer_default_group.php index 75b31562d..ba85f1ac1 100644 --- a/install-dev/upgrade/php/update_customer_default_group.php +++ b/install-dev/upgrade/php/update_customer_default_group.php @@ -68,7 +68,7 @@ function update_customer_default_group() if($result && file_exists($filename_old)) { unlink($filename_old); - chmod($filename, 0664); + @chmod($filename, 0664); } } return $result; diff --git a/install-dev/upgrade/sql/1.5.6.1.sql b/install-dev/upgrade/sql/1.5.6.1.sql index a05adbdf0..f657cb087 100644 --- a/install-dev/upgrade/sql/1.5.6.1.sql +++ b/install-dev/upgrade/sql/1.5.6.1.sql @@ -7,3 +7,7 @@ ALTER TABLE `PREFIX_currency` CHANGE `conversion_rate` `conversion_rate` DECIMAL UPDATE `PREFIX_orders` SET conversion_rate = 1 WHERE conversion_rate = 0; ALTER TABLE `PREFIX_cms` ADD `indexation` tinyint(1) UNSIGNED NULL DEFAULT '1' AFTER `active`; + +/* PHP:update_order_messages(); */; + +ALTER TABLE `PREFIX_group_reduction` CHANGE `reduction` `reduction` DECIMAL( 4, 4 ) NOT NULL; \ No newline at end of file diff --git a/js/jquery/plugins/jquery.cookie-plugin.js b/js/jquery/plugins/jquery.cooki-plugin.js similarity index 100% rename from js/jquery/plugins/jquery.cookie-plugin.js rename to js/jquery/plugins/jquery.cooki-plugin.js diff --git a/localization/es.xml b/localization/es.xml index 8f321d36b..fb2f0038f 100644 --- a/localization/es.xml +++ b/localization/es.xml @@ -170,4 +170,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/localization/gr.xml b/localization/gr.xml index 474ffc12e..3918f377b 100644 --- a/localization/gr.xml +++ b/localization/gr.xml @@ -201,4 +201,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/blockcart/blockcart-json.tpl b/modules/blockcart/blockcart-json.tpl index 9ef08b026..eef27b7ae 100644 --- a/modules/blockcart/blockcart-json.tpl +++ b/modules/blockcart/blockcart-json.tpl @@ -62,8 +62,8 @@ {foreach from=$datas key='index' item='data' name='datas'} {ldelim} "index": {$index}, - "value": "{$data.value|addslashes|replace: '\\\'':'\''}", - "truncatedValue": "{$data.value|truncate:28:'...'|addslashes|replace: '\\\'':'\''}" + "value": "{Tools::nl2br($data.value|addslashes|replace: '\\\'':'\'')}", + "truncatedValue": "{Tools::nl2br($data.value|truncate:28:'...'|addslashes|replace: '\\\'':'\'')}" {rdelim}{if !$smarty.foreach.datas.last},{/if} {/foreach}] {rdelim}{if !$smarty.foreach.customization.last},{/if} diff --git a/modules/blockcart/blockcart.php b/modules/blockcart/blockcart.php index 84f2a275d..3f870a793 100644 --- a/modules/blockcart/blockcart.php +++ b/modules/blockcart/blockcart.php @@ -303,4 +303,4 @@ class BlockCart extends Module 'PS_BLOCK_CART_XSELL_LIMIT' => Tools::getValue('PS_BLOCK_CART_XSELL_LIMIT', Configuration::get('PS_BLOCK_CART_XSELL_LIMIT')) ); } -} \ No newline at end of file +} diff --git a/modules/blocklayered/blocklayered.js b/modules/blocklayered/blocklayered.js index 0edae4fd8..e1ec5b2de 100644 --- a/modules/blocklayered/blocklayered.js +++ b/modules/blocklayered/blocklayered.js @@ -230,12 +230,11 @@ function initLayered() function paginationButton() { $('#pagination a').not(':hidden').each(function () { - if ($(this).attr('href').search(/&|\?p=/) == -1) { - var page = 1; - } - else { - var page = $(this).attr('href').replace(/^.*[&|\?]p=(\d+).*$/, '$1'); - } + if ($(this).attr('href').search(/[&|\?]p=/) == -1) + var page = 1; + else + var page = $(this).attr('href').replace(/^.*[&|\?]p=(\d+).*$/, '$1'); + var location = window.location.href.replace(/#.*$/, ''); $(this).attr('href', location+current_friendly_url.replace(/\/page-(\d+)/, '')+'/page-'+page); }); diff --git a/modules/blocksearch/blocksearch-top.tpl b/modules/blocksearch/blocksearch-top.tpl index 83b247f89..078d2631b 100644 --- a/modules/blocksearch/blocksearch-top.tpl +++ b/modules/blocksearch/blocksearch-top.tpl @@ -29,7 +29,7 @@ - +
{else} @@ -41,7 +41,7 @@ - +

diff --git a/modules/blocksearch/blocksearch.php b/modules/blocksearch/blocksearch.php index 0d8ffbb8a..e703f3dbe 100644 --- a/modules/blocksearch/blocksearch.php +++ b/modules/blocksearch/blocksearch.php @@ -33,7 +33,7 @@ class BlockSearch extends Module { $this->name = 'blocksearch'; $this->tab = 'search_filter'; - $this->version = 1.2; + $this->version = 1.3; $this->author = 'PrestaShop'; $this->need_instance = 0; @@ -53,6 +53,7 @@ class BlockSearch extends Module public function hookdisplayMobileTopSiteMap($params) { $this->smarty->assign(array('hook_mobile' => true, 'instantsearch' => false)); + $params['hook_mobile'] = true; return $this->hookTop($params); } @@ -80,24 +81,32 @@ public function hookDisplayMobileHeader($params) public function hookRightColumn($params) { - if (Tools::getValue('search_query') || !$this->isCached('blocksearch.tpl', $this->getCacheId())) { $this->calculHookCommon($params); - $this->smarty->assign('blocksearch_type', 'block'); + $this->smarty->assign(array( + 'blocksearch_type' => 'block', + 'search_query' => (string)Tools::getValue('search_query') + ) + ); } return $this->display(__FILE__, 'blocksearch.tpl', Tools::getValue('search_query') ? null : $this->getCacheId()); } public function hookTop($params) { - if (Tools::getValue('search_query') || !$this->isCached('blocksearch-top.tpl', $this->getCacheId('blocksearch-top'))) + $key = $this->getCacheId('blocksearch-top'.((!isset($params['hook_mobile']) || !$params['hook_mobile']) ? '' : '-hook_mobile')); + if (Tools::getValue('search_query') || !$this->isCached('blocksearch-top.tpl', $key)) { $this->calculHookCommon($params); - $this->smarty->assign('blocksearch_type', 'top'); + $this->smarty->assign(array( + 'blocksearch_type' => 'top', + 'search_query' => (string)Tools::getValue('search_query') + ) + ); + } - - return $this->display(__FILE__, 'blocksearch-top.tpl', Tools::getValue('search_query') ? null : $this->getCacheId('blocksearch-top')); + return $this->display(__FILE__, 'blocksearch-top.tpl', Tools::getValue('search_query') ? null : $key); } /** diff --git a/modules/blocksearch/blocksearch.tpl b/modules/blocksearch/blocksearch.tpl index ce9b45f74..4d89e8a99 100644 --- a/modules/blocksearch/blocksearch.tpl +++ b/modules/blocksearch/blocksearch.tpl @@ -32,7 +32,7 @@ - +

diff --git a/modules/blocksearch/config.xml b/modules/blocksearch/config.xml index 882cc7552..fb3f8def4 100755 --- a/modules/blocksearch/config.xml +++ b/modules/blocksearch/config.xml @@ -2,7 +2,7 @@ blocksearch - + diff --git a/modules/blocksharefb/blocksharefb.php b/modules/blocksharefb/blocksharefb.php index 123d6f4e7..2f4b5d3a1 100644 --- a/modules/blocksharefb/blocksharefb.php +++ b/modules/blocksharefb/blocksharefb.php @@ -37,7 +37,7 @@ class blocksharefb extends Module $this->tab = 'front_office_features'; else $this->tab = 'Blocks'; - $this->version = '1.0'; + $this->version = '1.1'; parent::__construct(); diff --git a/modules/blocksharefb/config.xml b/modules/blocksharefb/config.xml index d58744cbe..5f86b28b9 100644 --- a/modules/blocksharefb/config.xml +++ b/modules/blocksharefb/config.xml @@ -2,7 +2,7 @@ blocksharefb - + diff --git a/modules/blockspecials/blockspecials.php b/modules/blockspecials/blockspecials.php index a20970835..e89351433 100644 --- a/modules/blockspecials/blockspecials.php +++ b/modules/blockspecials/blockspecials.php @@ -36,7 +36,7 @@ class BlockSpecials extends Module { $this->name = 'blockspecials'; $this->tab = 'pricing_promotion'; - $this->version = '0.9'; + $this->version = '1.0'; $this->author = 'PrestaShop'; $this->need_instance = 0; diff --git a/modules/blockspecials/config.xml b/modules/blockspecials/config.xml index 1241b4f2f..613f0cc76 100755 --- a/modules/blockspecials/config.xml +++ b/modules/blockspecials/config.xml @@ -2,7 +2,7 @@ blockspecials - + diff --git a/modules/blocktopmenu/blocktopmenu.php b/modules/blocktopmenu/blocktopmenu.php index 324c65b77..74252a3f7 100644 --- a/modules/blocktopmenu/blocktopmenu.php +++ b/modules/blocktopmenu/blocktopmenu.php @@ -52,7 +52,7 @@ class Blocktopmenu extends Module { $this->name = 'blocktopmenu'; $this->tab = 'front_office_features'; - $this->version = 1.6; + $this->version = 1.7; $this->author = 'PrestaShop'; $this->bootstrap = true; @@ -337,7 +337,7 @@ class Blocktopmenu extends Module switch (substr($item, 0, strlen($value[1]))) { case 'CAT': - $this->getCategory((int)$id); + $this->getCategory($id, $id_lang, $id_shop); break; case 'PRD': @@ -452,9 +452,7 @@ class Blocktopmenu extends Module if (isset($children) && count($children)) foreach ($children as $child) - { $this->getCategoryOption((int)$child['id_category'], (int)$id_lang, (int)$child['id_shop']); - } } private function getCategory($id_category, $id_lang = false, $id_shop = false) diff --git a/modules/blocktopmenu/config.xml b/modules/blocktopmenu/config.xml index 0b21e24e8..beaa60bf5 100644 --- a/modules/blocktopmenu/config.xml +++ b/modules/blocktopmenu/config.xml @@ -2,7 +2,7 @@ blocktopmenu - + diff --git a/modules/blockwishlist/WishList.php b/modules/blockwishlist/WishList.php index 7ab58cc44..23e57cdbe 100644 --- a/modules/blockwishlist/WishList.php +++ b/modules/blockwishlist/WishList.php @@ -171,6 +171,8 @@ class WishList extends ObjectModel */ public static function getByIdCustomer($id_customer) { + if (!Validate::isUnsignedId($id_customer)) + die (Tools::displayError()); if (Shop::getContextShopID()) $shop_restriction = 'AND id_shop = '.(int)Shop::getContextShopID(); elseif (Shop::getContextShopGroupID()) @@ -178,14 +180,18 @@ class WishList extends ObjectModel else $shop_restriction = ''; - if (!Validate::isUnsignedId($id_customer)) - die (Tools::displayError()); - return (Db::getInstance()->executeS(' - SELECT w.`id_wishlist`, w.`name`, w.`token`, w.`date_add`, w.`date_upd`, w.`counter` - FROM `'._DB_PREFIX_.'wishlist` w - WHERE `id_customer` = '.(int)($id_customer).' - '.$shop_restriction.' - ORDER BY w.`name` ASC')); + $cache_id = 'WhishList::getByIdCustomer_'.(int)$id_customer.'-'.(int)Shop::getContextShopID().'-'.(int)Shop::getContextShopGroupID(); + if (!Cache::isStored($cache_id)) + { + $result = Db::getInstance()->executeS(' + SELECT w.`id_wishlist`, w.`name`, w.`token`, w.`date_add`, w.`date_upd`, w.`counter` + FROM `'._DB_PREFIX_.'wishlist` w + WHERE `id_customer` = '.(int)($id_customer).' + '.$shop_restriction.' + ORDER BY w.`name` ASC'); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } public static function refreshWishList($id_wishlist) diff --git a/modules/blockwishlist/js/ajax-wishlist.js b/modules/blockwishlist/js/ajax-wishlist.js index 8642ce759..8e748dd9a 100644 --- a/modules/blockwishlist/js/ajax-wishlist.js +++ b/modules/blockwishlist/js/ajax-wishlist.js @@ -58,7 +58,7 @@ function WishlistCart(id, action, id_product, id_product_attribute, quantity) if($('#' + id).length != 0) { $('#' + id).slideUp('normal'); - document.getElementById(id).innerHTML = data; + $('#' + id).html(data); $('#' + id).slideDown('normal'); } } @@ -81,7 +81,7 @@ function WishlistChangeDefault(id, id_wishlist) success: function(data) { $('#' + id).slideUp('normal'); - document.getElementById(id).innerHTML = data; + $('#' + id).html(data); $('#' + id).slideDown('normal'); } }); @@ -147,7 +147,7 @@ function WishlistManage(id, id_wishlist) success: function(data) { $('#' + id).hide(); - document.getElementById(id).innerHTML = data; + $('#' + id).html(data); $('#' + id).fadeIn('slow'); } }); diff --git a/modules/crossselling/config.xml b/modules/crossselling/config.xml index 59e2ea5ab..12360562f 100755 --- a/modules/crossselling/config.xml +++ b/modules/crossselling/config.xml @@ -2,7 +2,7 @@ crossselling - + diff --git a/modules/crossselling/crossselling.php b/modules/crossselling/crossselling.php index 83a5167fc..5f386cb09 100755 --- a/modules/crossselling/crossselling.php +++ b/modules/crossselling/crossselling.php @@ -35,7 +35,7 @@ class CrossSelling extends Module { $this->name = 'crossselling'; $this->tab = 'front_office_features'; - $this->version = 0.7; + $this->version = 0.8; $this->author = 'PrestaShop'; $this->need_instance = 0; @@ -44,9 +44,6 @@ class CrossSelling extends Module $this->displayName = $this->l('Cross Selling'); $this->description = $this->l('Customers who bought this product also bought:'); - - if (!$this->isRegisteredInHook('header')) - $this->registerHook('header'); } public function install() diff --git a/modules/crossselling/upgrade/install-0.8.php b/modules/crossselling/upgrade/install-0.8.php new file mode 100644 index 000000000..1ee79f5e5 --- /dev/null +++ b/modules/crossselling/upgrade/install-0.8.php @@ -0,0 +1,11 @@ +isRegisteredInHook('header')) + return $object->registerHook('header'); + return true; +} diff --git a/modules/dateofdelivery/config.xml b/modules/dateofdelivery/config.xml index 3529e0e83..9fb0e47c3 100755 --- a/modules/dateofdelivery/config.xml +++ b/modules/dateofdelivery/config.xml @@ -2,7 +2,7 @@ dateofdelivery - + diff --git a/modules/dateofdelivery/dateofdelivery.php b/modules/dateofdelivery/dateofdelivery.php index 5b209f604..d54b2ed68 100644 --- a/modules/dateofdelivery/dateofdelivery.php +++ b/modules/dateofdelivery/dateofdelivery.php @@ -35,7 +35,7 @@ class DateOfDelivery extends Module { $this->name = 'dateofdelivery'; $this->tab = 'shipping_logistics'; - $this->version = '1.1'; + $this->version = '1.2'; $this->author = 'PrestaShop'; $this->need_instance = 0; diff --git a/modules/feeder/config.xml b/modules/feeder/config.xml index 2c1c39d1c..58ba3ce4a 100755 --- a/modules/feeder/config.xml +++ b/modules/feeder/config.xml @@ -2,7 +2,7 @@ feeder - + diff --git a/modules/feeder/feeder.php b/modules/feeder/feeder.php index ab3734f0d..6382a0637 100644 --- a/modules/feeder/feeder.php +++ b/modules/feeder/feeder.php @@ -35,7 +35,7 @@ class Feeder extends Module { $this->name = 'feeder'; $this->tab = 'front_office_features'; - $this->version = 0.3; + $this->version = 0.4; $this->author = 'PrestaShop'; $this->need_instance = 0; diff --git a/modules/homefeatured/homefeatured.php b/modules/homefeatured/homefeatured.php index 12aaf2a98..12bb6177f 100644 --- a/modules/homefeatured/homefeatured.php +++ b/modules/homefeatured/homefeatured.php @@ -111,7 +111,7 @@ class HomeFeatured extends Module { $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id); $nb = (int)Configuration::get('HOME_FEATURED_NBR'); - $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8)); + $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), "position"); $this->smarty->assign(array( 'products' => $products, diff --git a/modules/homeslider/config.xml b/modules/homeslider/config.xml index ec5f98008..1a559ea17 100644 --- a/modules/homeslider/config.xml +++ b/modules/homeslider/config.xml @@ -2,7 +2,7 @@ homeslider - + diff --git a/modules/homeslider/homeslider.php b/modules/homeslider/homeslider.php index b7cff3d6c..13211641a 100644 --- a/modules/homeslider/homeslider.php +++ b/modules/homeslider/homeslider.php @@ -42,7 +42,7 @@ class HomeSlider extends Module { $this->name = 'homeslider'; $this->tab = 'front_office_features'; - $this->version = '1.2.1'; + $this->version = '1.2.2'; $this->author = 'PrestaShop'; $this->need_instance = 0; $this->secure_key = Tools::encrypt($this->name); diff --git a/modules/loyalty/LoyaltyModule.php b/modules/loyalty/LoyaltyModule.php index cb2c51974..7dc030a2b 100644 --- a/modules/loyalty/LoyaltyModule.php +++ b/modules/loyalty/LoyaltyModule.php @@ -101,9 +101,9 @@ class LoyaltyModule extends ObjectModel { $cartProductsNew['id_product'] = (int)$newProduct->id; if ($taxesEnabled == PS_TAX_EXC) - $cartProductsNew['price'] = number_format($newProduct->getPrice(false, (int)$newProduct->getDefaultIdProductAttribute()), 2, '.', ''); + $cartProductsNew['price'] = number_format($newProduct->getPrice(false, (int)$newProduct->getIdProductAttributeMostExpensive()), 2, '.', ''); else - $cartProductsNew['price_wt'] = number_format($newProduct->getPrice(true, (int)$newProduct->getDefaultIdProductAttribute()), 2, '.', ''); + $cartProductsNew['price_wt'] = number_format($newProduct->getPrice(true, (int)$newProduct->getIdProductAttributeMostExpensive()), 2, '.', ''); $cartProductsNew['cart_quantity'] = 1; $cartProducts[] = $cartProductsNew; } diff --git a/modules/loyalty/config.xml b/modules/loyalty/config.xml index c98ec49f5..eed08a452 100755 --- a/modules/loyalty/config.xml +++ b/modules/loyalty/config.xml @@ -2,7 +2,7 @@ loyalty - + diff --git a/modules/loyalty/loyalty.php b/modules/loyalty/loyalty.php index 80a622e14..79b74bc59 100644 --- a/modules/loyalty/loyalty.php +++ b/modules/loyalty/loyalty.php @@ -42,7 +42,7 @@ class Loyalty extends Module { $this->name = 'loyalty'; $this->tab = 'pricing_promotion'; - $this->version = '1.8'; + $this->version = '1.9'; $this->author = 'PrestaShop'; $this->need_instance = 0; @@ -278,7 +278,7 @@ class Loyalty extends Module $points = (int)LoyaltyModule::getNbPointsByPrice( $product->getPrice( Product::getTaxCalculationMethod() == PS_TAX_EXC ? false : true, - (int)$product->getDefaultIdProductAttribute() + (int)$product->getIdProductAttributeMostExpensive() ) ); diff --git a/modules/loyalty/views/templates/hook/product.tpl b/modules/loyalty/views/templates/hook/product.tpl index 63cd24db3..36d6c55ac 100644 --- a/modules/loyalty/views/templates/hook/product.tpl +++ b/modules/loyalty/views/templates/hook/product.tpl @@ -39,7 +39,7 @@ $(document).ready(function() { if (typeof(productPrice) == 'undefined' || typeof(productPriceWithoutReduction) == 'undefined') return; - var points = Math.round(productPrice / point_rate); + var points = {$points}; var total_points = points_in_cart + points; var voucher = total_points * point_value; if (!none_award && productPriceWithoutReduction != productPrice) { diff --git a/modules/mailalerts/config.xml b/modules/mailalerts/config.xml index 98984a992..699578ed4 100755 --- a/modules/mailalerts/config.xml +++ b/modules/mailalerts/config.xml @@ -2,7 +2,7 @@ mailalerts - + diff --git a/modules/mailalerts/mailalerts.php b/modules/mailalerts/mailalerts.php index 438fcae69..b50f0d4b8 100644 --- a/modules/mailalerts/mailalerts.php +++ b/modules/mailalerts/mailalerts.php @@ -46,7 +46,7 @@ class MailAlerts extends Module { $this->name = 'mailalerts'; $this->tab = 'administration'; - $this->version = '2.7'; + $this->version = '2.8'; $this->author = 'PrestaShop'; $this->need_instance = 0; @@ -256,7 +256,7 @@ class MailAlerts extends Module $customization_text .= '---
'; } - $customization_text = rtrim($customization_text, '---
'); + $customization_text = Tools::rtrimString($customization_text, '---
'); } $items_table .= @@ -321,7 +321,7 @@ class MailAlerts extends Module '{invoice_state}' => $invoice->id_state ? $invoice_state->name : '', '{invoice_phone}' => $invoice->phone ? $invoice->phone : $invoice->phone_mobile, '{invoice_other}' => $invoice->other, - '{order_name}' => sprintf('%06d', $order->id), + '{order_name}' => $order->reference, '{shop_name}' => $configuration['PS_SHOP_NAME'], '{date}' => $order_date_text, '{carrier}' => (($carrier->name == '0') ? $configuration['PS_SHOP_NAME'] : $carrier->name), diff --git a/modules/productcomments/ProductComment.php b/modules/productcomments/ProductComment.php index cb7aa8994..5887357b8 100644 --- a/modules/productcomments/ProductComment.php +++ b/modules/productcomments/ProductComment.php @@ -97,18 +97,24 @@ class ProductComment extends ObjectModel if ($n != null && $n <= 0) $n = 5; - return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' - SELECT pc.`id_product_comment`, - (SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_usefulness` pcu WHERE pcu.`id_product_comment` = pc.`id_product_comment` AND pcu.`usefulness` = 1) as total_useful, - (SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_usefulness` pcu WHERE pcu.`id_product_comment` = pc.`id_product_comment`) as total_advice, '. - ((int)$id_customer ? '(SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_usefulness` pcuc WHERE pcuc.`id_product_comment` = pc.`id_product_comment` AND pcuc.id_customer = '.(int)$id_customer.') as customer_advice, ' : ''). - ((int)$id_customer ? '(SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_report` pcrc WHERE pcrc.`id_product_comment` = pc.`id_product_comment` AND pcrc.id_customer = '.(int)$id_customer.') as customer_report, ' : '').' - IF(c.id_customer, CONCAT(c.`firstname`, \' \', LEFT(c.`lastname`, 1)), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pc.title - FROM `'._DB_PREFIX_.'product_comment` pc - LEFT JOIN `'._DB_PREFIX_.'customer` c ON c.`id_customer` = pc.`id_customer` - WHERE pc.`id_product` = '.(int)($id_product).($validate == '1' ? ' AND pc.`validate` = 1' : '').' - ORDER BY pc.`date_add` DESC - '.($n ? 'LIMIT '.(int)(($p - 1) * $n).', '.(int)($n) : '')); + $cache_id = 'ProductComment::getByProduct_'.(int)$id_product.'-'.(int)$p.'-'.(int)$n.'-'.(int)$id_customer.'-'.(bool)$validate; + if (!Cache::isStored($cache_id)) + { + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + SELECT pc.`id_product_comment`, + (SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_usefulness` pcu WHERE pcu.`id_product_comment` = pc.`id_product_comment` AND pcu.`usefulness` = 1) as total_useful, + (SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_usefulness` pcu WHERE pcu.`id_product_comment` = pc.`id_product_comment`) as total_advice, '. + ((int)$id_customer ? '(SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_usefulness` pcuc WHERE pcuc.`id_product_comment` = pc.`id_product_comment` AND pcuc.id_customer = '.(int)$id_customer.') as customer_advice, ' : ''). + ((int)$id_customer ? '(SELECT count(*) FROM `'._DB_PREFIX_.'product_comment_report` pcrc WHERE pcrc.`id_product_comment` = pc.`id_product_comment` AND pcrc.id_customer = '.(int)$id_customer.') as customer_report, ' : '').' + IF(c.id_customer, CONCAT(c.`firstname`, \' \', LEFT(c.`lastname`, 1)), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pc.title + FROM `'._DB_PREFIX_.'product_comment` pc + LEFT JOIN `'._DB_PREFIX_.'customer` c ON c.`id_customer` = pc.`id_customer` + WHERE pc.`id_product` = '.(int)($id_product).($validate == '1' ? ' AND pc.`validate` = 1' : '').' + ORDER BY pc.`date_add` DESC + '.($n ? 'LIMIT '.(int)(($p - 1) * $n).', '.(int)($n) : '')); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** @@ -118,18 +124,24 @@ class ProductComment extends ObjectModel */ public static function getByCustomer($id_product, $id_customer, $get_last = false, $id_guest = false) { - $results = Db::getInstance()->executeS(' - SELECT * - FROM `'._DB_PREFIX_.'product_comment` pc - WHERE pc.`id_product` = '.(int)$id_product.' - AND '.(!$id_guest ? 'pc.`id_customer` = '.(int)$id_customer : 'pc.`id_guest` = '.(int)$id_guest).' - ORDER BY pc.`date_add` DESC ' - .($get_last ? 'LIMIT 1' : '') - ); + $cache_id = 'ProductComment::getByCustomer_'.(int)$id_product.'-'.(int)$id_customer.'-'.(bool)$get_last.'-'.(int)$id_guest; + if (!Cache::isStored($cache_id)) + { + $results = Db::getInstance()->executeS(' + SELECT * + FROM `'._DB_PREFIX_.'product_comment` pc + WHERE pc.`id_product` = '.(int)$id_product.' + AND '.(!$id_guest ? 'pc.`id_customer` = '.(int)$id_customer : 'pc.`id_guest` = '.(int)$id_guest).' + ORDER BY pc.`date_add` DESC ' + .($get_last ? 'LIMIT 1' : '') + ); - if ($get_last) - $results = array_shift($results); - return $results; + if ($get_last && count($results)) + $results = array_shift($results); + + Cache::store($cache_id, $results); + } + return Cache::retrieve($cache_id); } /** @@ -202,12 +214,16 @@ class ProductComment extends ObjectModel if (!Validate::isUnsignedId($id_product)) die(Tools::displayError()); $validate = (int)Configuration::get('PRODUCT_COMMENTS_MODERATE'); - if (($result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT COUNT(`id_product_comment`) AS "nbr" - FROM `'._DB_PREFIX_.'product_comment` pc - WHERE `id_product` = '.(int)($id_product).($validate == '1' ? ' AND `validate` = 1' : ''))) === false) - return false; - return (int)($result['nbr']); + $cache_id = 'ProductComment::getCommentNumber_'.(int)$id_product.'-'.$validate; + if (!Cache::isStored($cache_id)) + { + $result = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + SELECT COUNT(`id_product_comment`) AS "nbr" + FROM `'._DB_PREFIX_.'product_comment` pc + WHERE `id_product` = '.(int)($id_product).($validate == '1' ? ' AND `validate` = 1' : '')); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** diff --git a/modules/productcomments/ProductCommentCriterion.php b/modules/productcomments/ProductCommentCriterion.php index dc8f668ba..e46775c0c 100644 --- a/modules/productcomments/ProductCommentCriterion.php +++ b/modules/productcomments/ProductCommentCriterion.php @@ -159,26 +159,33 @@ class ProductCommentCriterion extends ObjectModel $table = '_shop'; $alias = 'ps'; } - return Db::getInstance()->executeS(' - SELECT pcc.`id_product_comment_criterion`, pccl.`name` - FROM `'._DB_PREFIX_.'product_comment_criterion` pcc - LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_lang` pccl - ON (pcc.id_product_comment_criterion = pccl.id_product_comment_criterion) - LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_product` pccp - ON (pcc.`id_product_comment_criterion` = pccp.`id_product_comment_criterion` AND pccp.`id_product` = '.(int)$id_product.') - LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_category` pccc - ON (pcc.`id_product_comment_criterion` = pccc.`id_product_comment_criterion`) - LEFT JOIN `'._DB_PREFIX_.'product'.$table.'` '.$alias.' - ON ('.$alias.'.id_category_default = pccc.id_category AND '.$alias.'.id_product = '.(int)$id_product.') - WHERE pccl.`id_lang` = '.(int)($id_lang).' - AND ( - pccp.id_product IS NOT NULL - OR ps.id_product IS NOT NULL - OR pcc.id_product_comment_criterion_type = 1 - ) - AND pcc.active = 1 - GROUP BY pcc.id_product_comment_criterion - '); + + $cache_id = 'ProductCommentCriterion::getByProduct_'.(int)$id_product.'-'.(int)$id_lang; + if (!Cache::isStored($cache_id)) + { + $result = Db::getInstance()->executeS(' + SELECT pcc.`id_product_comment_criterion`, pccl.`name` + FROM `'._DB_PREFIX_.'product_comment_criterion` pcc + LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_lang` pccl + ON (pcc.id_product_comment_criterion = pccl.id_product_comment_criterion) + LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_product` pccp + ON (pcc.`id_product_comment_criterion` = pccp.`id_product_comment_criterion` AND pccp.`id_product` = '.(int)$id_product.') + LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_category` pccc + ON (pcc.`id_product_comment_criterion` = pccc.`id_product_comment_criterion`) + LEFT JOIN `'._DB_PREFIX_.'product'.$table.'` '.$alias.' + ON ('.$alias.'.id_category_default = pccc.id_category AND '.$alias.'.id_product = '.(int)$id_product.') + WHERE pccl.`id_lang` = '.(int)($id_lang).' + AND ( + pccp.id_product IS NOT NULL + OR ps.id_product IS NOT NULL + OR pcc.id_product_comment_criterion_type = 1 + ) + AND pcc.active = 1 + GROUP BY pcc.id_product_comment_criterion + '); + Cache::store($cache_id, $result); + } + return Cache::retrieve($cache_id); } /** diff --git a/modules/productcomments/productcomments.php b/modules/productcomments/productcomments.php index 0537f4e19..c85d40741 100644 --- a/modules/productcomments/productcomments.php +++ b/modules/productcomments/productcomments.php @@ -684,11 +684,14 @@ class ProductComments extends Module { require_once(dirname(__FILE__).'/ProductComment.php'); require_once(dirname(__FILE__).'/ProductCommentCriterion.php'); + + $average = ProductComment::getAverageGrade((int)Tools::getValue('id_product')); $this->context->smarty->assign(array( 'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'), 'comments' => ProductComment::getByProduct((int)(Tools::getValue('id_product'))), 'criterions' => ProductCommentCriterion::getByProduct((int)(Tools::getValue('id_product')), $this->context->language->id), + 'averageTotal' => round($average['grade']), 'nbComments' => (int)(ProductComment::getCommentNumber((int)(Tools::getValue('id_product')))) )); diff --git a/modules/productcomments/productcomments.tpl b/modules/productcomments/productcomments.tpl index 710b6665c..4a49c07fb 100644 --- a/modules/productcomments/productcomments.tpl +++ b/modules/productcomments/productcomments.tpl @@ -93,11 +93,13 @@ var moderation_active = {$moderation_active};
+{if isset($product) && $product}

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

+ {if isset($product) && $product}
{$product->name|escape:html:'UTF-8'}
@@ -105,7 +107,7 @@ var moderation_active = {$moderation_active}; {$product->description_short}
- + {/if}

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

@@ -156,3 +158,4 @@ var moderation_active = {$moderation_active};
+{/if} \ No newline at end of file diff --git a/modules/productscategory/config.xml b/modules/productscategory/config.xml index 8464b4ebc..b6292606c 100755 --- a/modules/productscategory/config.xml +++ b/modules/productscategory/config.xml @@ -2,7 +2,7 @@ productscategory - + diff --git a/modules/productscategory/productscategory.php b/modules/productscategory/productscategory.php index 336800463..31375a55f 100644 --- a/modules/productscategory/productscategory.php +++ b/modules/productscategory/productscategory.php @@ -34,7 +34,7 @@ class productsCategory extends Module public function __construct() { $this->name = 'productscategory'; - $this->version = '1.4'; + $this->version = '1.5'; $this->author = 'PrestaShop'; $this->tab = 'front_office_features'; $this->need_instance = 0; @@ -44,9 +44,6 @@ class productsCategory extends Module $this->displayName = $this->l('Products Category'); $this->description = $this->l('Display products of the same category on the product page.'); - - if (!$this->isRegisteredInHook('header')) - $this->registerHook('header'); } public function install() diff --git a/modules/productscategory/upgrade/install-1.5.php b/modules/productscategory/upgrade/install-1.5.php new file mode 100644 index 000000000..96e31c4c9 --- /dev/null +++ b/modules/productscategory/upgrade/install-1.5.php @@ -0,0 +1,11 @@ +isRegisteredInHook('header')) + return $object->registerHook('header'); + return true; +} diff --git a/modules/pscleaner/config.xml b/modules/pscleaner/config.xml index d1f03fa8f..cd7990d3b 100644 --- a/modules/pscleaner/config.xml +++ b/modules/pscleaner/config.xml @@ -2,7 +2,7 @@ pscleaner - + diff --git a/modules/pscleaner/pscleaner.php b/modules/pscleaner/pscleaner.php index 27d8c7810..a3ee9d3af 100644 --- a/modules/pscleaner/pscleaner.php +++ b/modules/pscleaner/pscleaner.php @@ -34,7 +34,7 @@ class PSCleaner extends Module { $this->name = 'pscleaner'; $this->tab = 'administration'; - $this->version = '0.9'; + $this->version = '1.0'; $this->author = 'PrestaShop'; $this->need_instance = 0; diff --git a/modules/referralprogram/ReferralProgramModule.php b/modules/referralprogram/ReferralProgramModule.php index af7197d69..47ad866e8 100644 --- a/modules/referralprogram/ReferralProgramModule.php +++ b/modules/referralprogram/ReferralProgramModule.php @@ -93,6 +93,8 @@ class ReferralProgramModule extends ObjectModel $cartRule->date_to = date('Y-m-d H:i:s', time() + 31536000); // + 1 year $cartRule->code = $this->getDiscountPrefix().Tools::passwdGen(6); $cartRule->name = Configuration::getInt('REFERRAL_DISCOUNT_DESCRIPTION'); + if (empty($cartRule->name)) + $cartRule->name = 'Referral reward'; $cartRule->id_customer = (int)$id_customer; $cartRule->reduction_currency = (int)$id_currency; diff --git a/modules/referralprogram/config.xml b/modules/referralprogram/config.xml index d32cbdc64..82fa274d4 100755 --- a/modules/referralprogram/config.xml +++ b/modules/referralprogram/config.xml @@ -2,7 +2,7 @@ referralprogram - + diff --git a/modules/referralprogram/referralprogram.php b/modules/referralprogram/referralprogram.php index 42a3faf72..641e54340 100644 --- a/modules/referralprogram/referralprogram.php +++ b/modules/referralprogram/referralprogram.php @@ -33,7 +33,7 @@ class ReferralProgram extends Module { $this->name = 'referralprogram'; $this->tab = 'advertising_marketing'; - $this->version = '1.5.1'; + $this->version = '1.5.2'; $this->author = 'PrestaShop'; $this->bootstrap = true; diff --git a/modules/trackingfront/config.xml b/modules/trackingfront/config.xml index e56c2711a..8ac15e3e7 100755 --- a/modules/trackingfront/config.xml +++ b/modules/trackingfront/config.xml @@ -2,7 +2,7 @@ trackingfront - + diff --git a/modules/trackingfront/trackingfront.php b/modules/trackingfront/trackingfront.php index 89067df3e..06038f5e0 100644 --- a/modules/trackingfront/trackingfront.php +++ b/modules/trackingfront/trackingfront.php @@ -33,7 +33,7 @@ class TrackingFront extends Module { $this->name = 'trackingfront'; $this->tab = 'shipping_logistics'; - $this->version = 1.0; + $this->version = 1.1; $this->author = 'PrestaShop'; $this->need_instance = 0; diff --git a/modules/watermark/config.xml b/modules/watermark/config.xml index 2e27d8aa6..9aca6ed0d 100755 --- a/modules/watermark/config.xml +++ b/modules/watermark/config.xml @@ -2,7 +2,7 @@ watermark - + diff --git a/modules/watermark/watermark.php b/modules/watermark/watermark.php index 66cff24dd..3ae514b39 100644 --- a/modules/watermark/watermark.php +++ b/modules/watermark/watermark.php @@ -43,7 +43,7 @@ class Watermark extends Module { $this->name = 'watermark'; $this->tab = 'administration'; - $this->version = '0.3'; + $this->version = '0.4'; $this->author = 'PrestaShop'; $this->bootstrap = true; @@ -301,7 +301,7 @@ RewriteRule [0-9/]+/[0-9]+\\.jpg$ - [F] ), array( 'type' => 'text', - 'label' => $this->l('Watermark transparency (0-100)'), + 'label' => $this->l('Watermark transparency (1-100)'), 'name' => 'transparency', 'class' => 'fixed-width-md', ), @@ -427,4 +427,4 @@ RewriteRule [0-9/]+/[0-9]+\\.jpg$ - [F] return $config_fields; } -} \ No newline at end of file +} diff --git a/pdf/invoice.tpl b/pdf/invoice.tpl index 918cdb15d..3fd3f0773 100755 --- a/pdf/invoice.tpl +++ b/pdf/invoice.tpl @@ -133,11 +133,11 @@ {$order_detail.product_name} {if !$tax_excluded_display} - + {displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_excl} {/if} - + {if $tax_excluded_display} {displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_excl} {else} @@ -154,7 +154,7 @@ {/if} {$order_detail.product_quantity} - + {if $tax_excluded_display} {displayPrice currency=$order->id_currency price=$order_detail.total_price_tax_excl} {else} diff --git a/themes/default/address.tpl b/themes/default/address.tpl new file mode 100644 index 000000000..177e83c3c --- /dev/null +++ b/themes/default/address.tpl @@ -0,0 +1,252 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + + +{capture name=path}{l s='Your addresses'}{/capture} +{include file="$tpl_dir./breadcrumb.tpl"} + +

{l s='Your addresses'}

+ +

+{if isset($id_address) && (isset($smarty.post.alias) || isset($address->alias))} + {l s='Modify address'} + {if isset($smarty.post.alias)} + "{$smarty.post.alias}" + {else} + {if isset($address->alias)}"{$address->alias|escape:'html'}"{/if} + {/if} +{else} + {l s='To add a new address, please fill out the form below.'} +{/if} +

+ +{include file="$tpl_dir./errors.tpl"} + +

* {l s='Required field'}

+ + +
+

{if isset($id_address)}{l s='Your address'}{else}{l s='New address'}{/if}

+ {assign var="stateExist" value=false} + {assign var="postCodeExist" value=false} + {assign var="dniExist" value=false} + {foreach from=$ordered_adr_fields item=field_name} + {if $field_name eq 'dni'} + {assign var="dniExist" value=true} +

+ + + {l s='DNI / NIF / NIE'} +

+ {/if} + {if $field_name eq 'company'} +

+ + +

+ {/if} + {if $field_name eq 'vat_number'} +
+
+

+ + +

+
+
+ {/if} + {if $field_name eq 'firstname'} +

+ + +

+ {/if} + {if $field_name eq 'lastname'} +

+ + +

+ {/if} + {if $field_name eq 'address1'} +

+ + +

+ {/if} + {if $field_name eq 'address2'} +

+ + +

+ {/if} + {if $field_name eq 'postcode'} + {assign var="postCodeExist" value=true} +

+ + +

+ {/if} + {if $field_name eq 'city'} +

+ + +

+ {* + if customer hasn't update his layout address, country has to be verified + but it's deprecated + *} + {/if} + {if $field_name eq 'Country:name' || $field_name eq 'country'} +

+ + +

+ {if $vatnumber_ajax_call} + + {/if} + {/if} + {if $field_name eq 'State:name'} + {assign var="stateExist" value=true} +

+ + +

+ {/if} + {/foreach} + {if !$postCodeExist} + + {/if} + {if !$stateExist} +

+ + +

+ {/if} + {if !$dniExist} +

+ + + {l s='DNI / NIF / NIE'} +

+ {/if} +

+ + +

+ {if isset($one_phone_at_least) && $one_phone_at_least} +

{l s='You must register at least one phone number.'}

+ {/if} +

+ + +

+

+ + +

+

+ + +

+
+

+ {if isset($id_address)}{/if} + {if isset($back)}{/if} + {if isset($mod)}{/if} + {if isset($select_address)}{/if} + + +

+ diff --git a/themes/default/authentication.tpl b/themes/default/authentication.tpl new file mode 100644 index 000000000..545000879 --- /dev/null +++ b/themes/default/authentication.tpl @@ -0,0 +1,741 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{capture name=path} + {if !isset($email_create)}{l s='Authentication'}{else} + {l s='Authentication'} + {$navigationPipe}{l s='Create your account'} + {/if} +{/capture} + {include file="$tpl_dir./breadcrumb.tpl"} + + + +

{if !isset($email_create)}{l s='Authentication'}{else}{l s='Create an account'}{/if}

+{if !isset($back) || $back != 'my-account'}{assign var='current_step' value='login'}{include file="$tpl_dir./order-steps.tpl"}{/if} +{include file="$tpl_dir./errors.tpl"} +{assign var='stateExist' value=false} +{assign var="postCodeExist" value=false} +{assign var="dniExist" value=false} +{if !isset($email_create)} + + +
+
+

{l s='Create an account'}

+
+

{l s='Please enter your email address to create an account.'}

+ +

+ + +

+

+ {if isset($back)}{/if} + + +

+
+
+
+ +
+
+

{l s='Already registered?'}

+
+

+ + +

+

+ + +

+

{l s='Forgot your password?'}

+

+ {if isset($back)}{/if} + +

+
+
+
+ + {if isset($inOrderProcess) && $inOrderProcess && $PS_GUEST_CHECKOUT_ENABLED} +
+
+

{l s='Instant checkout'}

+
+ +

+ + +

+

+ {l s='Title'} + {foreach from=$genders key=k item=gender} + id} checked="checked"{/if} /> + + {/foreach} +

+

+ + + +

+

+ + + +

+

+ {l s='Date of Birth'} + + {* + {l s='January'} + {l s='February'} + {l s='March'} + {l s='April'} + {l s='May'} + {l s='June'} + {l s='July'} + {l s='August'} + {l s='September'} + {l s='October'} + {l s='November'} + {l s='December'} + *} + + +

+ {if isset($newsletter) && $newsletter} +

+ + +

+

+ + +

+ {/if} +

{l s='Delivery address'}

+ {foreach from=$dlv_all_fields item=field_name} + {if $field_name eq "company" && $b2b_enable} +

+ + +

+ {elseif $field_name eq "vat_number"} + + {elseif $field_name eq "dni"} + {assign var='dniExist' value=true} +

+ + + {l s='DNI / NIF / NIE'} +

+ {elseif $field_name eq "address1"} +

+ + +

+ {elseif $field_name eq "postcode"} + {assign var='postCodeExist' value=true} +

+ + +

+ {elseif $field_name eq "city"} +

+ + +

+ + {elseif $field_name eq "Country:name" || $field_name eq "country"} +

+ + +

+ {elseif $field_name eq "State:name"} + {assign var='stateExist' value=true} +

+ + +

+ {/if} + {/foreach} + {if $postCodeExist eq false} + + {/if} + {if $stateExist eq false} + + {/if} + {if $dniExist eq false} +

+ + + {l s='DNI / NIF / NIE'} +

+ {/if} +

+ + +

+ + +

+ + +

+ +
+
+ {$HOOK_CREATE_ACCOUNT_FORM} +

+ *{l s='Required field'} + + +

+
+ {/if} +{else} + +
+ {$HOOK_CREATE_ACCOUNT_TOP} + + {if $b2b_enable} + + {/if} + {if isset($PS_REGISTRATION_PROCESS_TYPE) && $PS_REGISTRATION_PROCESS_TYPE} + + + {/if} + {$HOOK_CREATE_ACCOUNT_FORM} +

+ + + {if isset($back)}{/if} + + *{l s='Required field'} +

+
+{/if} diff --git a/themes/default/category.tpl b/themes/default/category.tpl new file mode 100644 index 000000000..415e79f64 --- /dev/null +++ b/themes/default/category.tpl @@ -0,0 +1,120 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{include file="$tpl_dir./breadcrumb.tpl"} +{include file="$tpl_dir./errors.tpl"} + +{if isset($category)} + {if $category->id AND $category->active} +

+ {strip} + {$category->name|escape:'htmlall':'UTF-8'} + {if isset($categoryNameComplement)} + {$categoryNameComplement|escape:'htmlall':'UTF-8'} + {/if} + {/strip} +

+ +
+ {include file="$tpl_dir./category-count.tpl"} +
+ + {if $scenes || $category->description || $category->id_image} +
+ {if $scenes} + + {include file="$tpl_dir./scenes.tpl" scenes=$scenes} + {else} + + {if $category->id_image} +
+ {$category->name|escape:'htmlall':'UTF-8'} +
+ {/if} + {/if} + + {if $category->description} +
+ {if strlen($category->description) > 120} +
{$description_short}
+ + {l s='More'} + {else} +
{$category->description}
+ {/if} +
+ {/if} +
+ {/if} + {if isset($subcategories)} + +
+

{l s='Subcategories'}

+ +
+
+ {/if} + + {if $products} +
+ {include file="$tpl_dir./pagination.tpl"} +
+ {include file="./product-sort.tpl"} + {include file="./product-compare.tpl"} + {include file="./nbr-product-page.tpl"} +
+
+ + {include file="./product-list.tpl" products=$products} + +
+
+ {include file="./product-sort.tpl" paginationId='bottom'} + {include file="./product-compare.tpl" paginationId='bottom'} + {include file="./nbr-product-page.tpl" paginationId='bottom'} +
+ {include file="./pagination.tpl" paginationId='bottom'} +
+ {/if} + {elseif $category->id} +

{l s='This category is currently unavailable.'}

+ {/if} +{/if} diff --git a/themes/default/contact-form.tpl b/themes/default/contact-form.tpl new file mode 100644 index 000000000..6fb91cf25 --- /dev/null +++ b/themes/default/contact-form.tpl @@ -0,0 +1,132 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{capture name=path}{l s='Contact'}{/capture} +{include file="$tpl_dir./breadcrumb.tpl"} + +

{l s='Customer service'} - {if isset($customerThread) && $customerThread}{l s='Your reply'}{else}{l s='Contact us'}{/if}

+ +{if isset($confirmation)} +

{l s='Your message has been successfully sent to our team.'}

+ +{elseif isset($alreadySent)} +

{l s='Your message has already been sent.'}

+ +{else} +

{l s='For questions about an order or for more information about our products'}.

+ {include file="$tpl_dir./errors.tpl"} +
+
+

{l s='send a message'}

+

+ + {if isset($customerThread.id_contact)} + {foreach from=$contacts item=contact} + {if $contact.id_contact == $customerThread.id_contact} + + + {/if} + {/foreach} +

+ {else} + +

+

 

+ {foreach from=$contacts item=contact} + + {/foreach} + {/if} +

+ + {if isset($customerThread.email)} + + {else} + + {/if} +

+ {if !$PS_CATALOG_MODE} + {if (!isset($customerThread.id_order) || $customerThread.id_order > 0)} +

+ + {if !isset($customerThread.id_order) && isset($isLogged) && $isLogged == 1} + + {elseif !isset($customerThread.id_order) && empty($isLogged)} + + {elseif $customerThread.id_order|intval > 0} + + {/if} +

+ {/if} + {if isset($isLogged) && $isLogged} +

+ + {if !isset($customerThread.id_product)} + {foreach from=$orderedProductList key=id_order item=products name=products} + + {/foreach} + {elseif $customerThread.id_product > 0} + + {/if} +

+ {/if} + {/if} + {if $fileupload == 1} +

+ + + +

+ {/if} +

+ + +

+

+ +

+
+
+{/if} diff --git a/themes/default/css/history.css b/themes/default/css/history.css new file mode 100644 index 000000000..bbf7b8bb1 --- /dev/null +++ b/themes/default/css/history.css @@ -0,0 +1,71 @@ +#history #left_column {display:none} +#history #center_column{width:757px} +#history #center_column h1{margin-top:20px} +#history #center_column .title_block { + margin:20px 0; + padding:15px 20px; + background:#ccc +} +#history #center_column .title_block input { + position: relative; + top: -8px; + float:right; +} + +.info-order { + margin-bottom:20px; +} +.info-order p {padding-bottom:10px} +.info-order p .icon { + position:relative; + top:2px; + left:0 +} +#order-list { + margin-bottom:20px; + width:100%; + border:1px solid #999; + border-bottom:none +} +#order-list th { + padding:14px 12px; + color:#fff; + text-transform:uppercase; + text-shadow:0 1px 0 #000; + background:url(../img/bg_table_th.png) repeat-x 0 0 #999 +} +#order-list tr.alternate_item {background-color: #f3f3f3} +#order-list td { + padding:12px; + border-right:1px solid #e9e9e9; + border-bottom:1px solid #e9e9e9; + font-weight:bold; + font-size:12px; + vertical-align:top +} +#order-list td .price, #order-detail-content tbody .price { + white-space: nowrap; +} +#order-list td.history_detail {border-right:none;} + +#order-list .last_item td {border-bottom:1px solid #999} + +.adresses_bloc {margin-bottom:20px} +.adresses_bloc .item {margin-right:60px} + +.detail_step_by_step {width:100%} +.detail_step_by_step tr.last_item td {border-bottom:1px solid #999} + +#order-detail-content table {width:100%} +#order-detail-content table .order_qte_input {display:none} +#order-detail-content table tr.totalprice td {border-bottom:1px solid #999} +#order-detail-content table tr:nth-child(even) {background:#f3f3f3;} + +#sendOrderMessage {margin-bottom:20px} +#sendOrderMessage p {padding-bottom:10px} + +#returnOrderMessage .textarea textarea, +#sendOrderMessage .textarea textarea { + width:100%; + border:1px solid #999 +} \ No newline at end of file diff --git a/themes/default/header.tpl b/themes/default/header.tpl new file mode 100644 index 000000000..19c6a248c --- /dev/null +++ b/themes/default/header.tpl @@ -0,0 +1,94 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + + + + + + + {$meta_title|escape:'htmlall':'UTF-8'} +{if isset($meta_description) AND $meta_description} + +{/if} +{if isset($meta_keywords) AND $meta_keywords} + +{/if} + + + + + + + +{if isset($css_files)} + {foreach from=$css_files key=css_uri item=media} + + {/foreach} +{/if} +{if isset($js_files)} + {foreach from=$js_files item=js_uri} + + {/foreach} +{/if} + {$HOOK_HEADER} + + + + {if !$content_only} + {if isset($restricted_country_mode) && $restricted_country_mode} +
+

{l s='You cannot place a new order from your country.'} {$geolocation_country}

+
+ {/if} +
+ + + + +
+ +
+ {$HOOK_LEFT_COLUMN} +
+ + +
+ {/if} diff --git a/themes/default/js/cart-summary.js b/themes/default/js/cart-summary.js new file mode 100644 index 000000000..87a95b2a3 --- /dev/null +++ b/themes/default/js/cart-summary.js @@ -0,0 +1,876 @@ +/* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +$(document).ready(function() +{ + $('.cart_quantity_up').unbind('click').live('click', function(){upQuantity($(this).attr('id').replace('cart_quantity_up_', '')); return false;}); + $('.cart_quantity_down').unbind('click').live('click', function(){downQuantity($(this).attr('id').replace('cart_quantity_down_', '')); return false;}); + $('.cart_quantity_delete' ).unbind('click').live('click', function(){deleteProductFromSummary($(this).attr('id')); return false;}); + $('.cart_quantity_input').typeWatch({highlight: true, wait: 600, captureLength: 0, callback: function(val) { updateQty(val, true, this.el);}}); + $('.cart_address_delivery').live('change', function(){changeAddressDelivery($(this));}); + cleanSelectAddressDelivery(); +}); + +function cleanSelectAddressDelivery() +{ + if (window.ajaxCart !== undefined) + { + //Removing "Ship to an other address" from the address delivery select option if there is not enought address + $.each($('.cart_address_delivery'), function(it, item) + { + var options = $(item).find('option'); + var address_count = 0; + + var ids = $(item).attr('id').split('_'); + var id_product = ids[3]; + var id_product_attribute = ids[4]; + var id_address_delivery = ids[5]; + + $.each(options, function(i) { + if ($(options[i]).val() > 0 + && ($('#product_' + id_product + '_' + id_product_attribute + '_0_' + $(options[i]).val()).length == 0 // Check the address is not already used for a similare products + || id_address_delivery == $(options[i]).val() + ) + ) + address_count++; + }); + + // Need at least two address to allow skipping products to multiple address + if (address_count < 2) + $($(item).find('option[value=-2]')).remove(); + else if($($(item).find('option[value=-2]')).length == 0) + $(item).append($('')); + }); + } +} + +function changeAddressDelivery(obj) +{ + var ids = obj.attr('id').split('_'); + var id_product = ids[3]; + var id_product_attribute = ids[4]; + var old_id_address_delivery = ids[5]; + var new_id_address_delivery = obj.val(); + + if (new_id_address_delivery == old_id_address_delivery) + return; + + if (new_id_address_delivery > 0) // Change the delivery address + { + $.ajax({ + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), + async: true, + cache: false, + dataType: 'json', + data: 'controller=cart&ajax=true&changeAddressDelivery=1&summary=1&id_product=' + id_product + + '&id_product_attribute='+id_product_attribute + + '&old_id_address_delivery='+old_id_address_delivery + + '&new_id_address_delivery='+new_id_address_delivery + + '&token='+static_token + + '&allow_refresh=1', + success: function(jsonData) + { + if (typeof(jsonData.hasErrors) != 'undefined' && jsonData.hasErrors) + { + alert(jsonData.error); + // Reset the old address + $('#select_address_delivery_' + id_product + '_' + id_product_attribute + '_' + old_id_address_delivery).val(old_id_address_delivery); + } + else + { + // The product exist + if ($('#product_' + id_product + '_' + id_product_attribute + '_0_' + new_id_address_delivery).length) + { + updateCartSummary(jsonData.summary); + if (window.ajaxCart != undefined) + ajaxCart.updateCart(jsonData); + updateCustomizedDatas(jsonData.customizedDatas); + updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART); + updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA); + if (typeof(getCarrierListAndUpdate) !== 'undefined') + getCarrierListAndUpdate(); + + // @todo reverse the remove order + // This effect remove the current line, but it's better to remove the other one, and refresshing this one + $('#product_' + id_product + '_' + id_product_attribute + '_0_' + old_id_address_delivery).remove(); + + // @todo improve customization upgrading + $('.product_' + id_product + '_' + id_product_attribute + '_0_' + old_id_address_delivery).remove(); + } + if (window.ajaxCart != undefined) + ajaxCart.updateCart(jsonData); + updateAddressId(id_product, id_product_attribute, old_id_address_delivery, new_id_address_delivery); + cleanSelectAddressDelivery(); + } + } + }); + } + else if (new_id_address_delivery == -1) // Adding a new address + window.location = $($('.address_add a')[0]).attr('href'); + else if (new_id_address_delivery == -2) // Add a new line for this product + { + // This test is will not usefull in the future + if (old_id_address_delivery == 0) + { + alert(txtSelectAnAddressFirst); + return false; + } + + // Get new address to deliver + var id_address_delivery = 0; + var options = $('#select_address_delivery_' + id_product + '_' + id_product_attribute + '_' + old_id_address_delivery + ' option'); + $.each(options, function(i) { + // Check the address is not already used for a similare products + if ($(options[i]).val() > 0 && $(options[i]).val() !== old_id_address_delivery && $('#product_' + id_product + '_' + id_product_attribute + '_0_' + $(options[i]).val()).length == 0) + { + id_address_delivery = $(options[i]).val(); + return false; + } + }); + + $.ajax({ + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), + async: true, + cache: false, + dataType: 'json', + context: obj, + data: 'controller=cart' + + '&ajax=true&duplicate=true&summary=true' + + '&id_product='+id_product + + '&id_product_attribute='+id_product_attribute + + '&id_address_delivery='+old_id_address_delivery + + '&new_id_address_delivery='+id_address_delivery + + '&token='+static_token + + '&allow_refresh=1', + success: function(jsonData) + { + if (jsonData.error) + { + alert(jsonData.reason); + return; + } + + var line = $('#product_' + id_product + '_' + id_product_attribute + '_0_' + old_id_address_delivery); + var new_line = line.clone(); + updateAddressId(id_product, id_product_attribute, old_id_address_delivery, id_address_delivery, new_line); + line.after(new_line); + new_line.find('input[name=quantity_' + id_product + '_' + id_product_attribute + '_0_' + old_id_address_delivery + '_hidden]') + .val(1); + new_line.find('.cart_quantity_input') + .val(1); + $('#select_address_delivery_' + id_product + '_' + id_product_attribute + '_' + old_id_address_delivery).val(old_id_address_delivery); + $('#select_address_delivery_' + id_product + '_' + id_product_attribute + '_' + id_address_delivery).val(id_address_delivery); + + + cleanSelectAddressDelivery(); + + updateCartSummary(jsonData.summary); + if (window.ajaxCart !== undefined) + ajaxCart.updateCart(jsonData); + } + }); + } + return true; +} + +function updateAddressId(id_product, id_product_attribute, old_id_address_delivery, id_address_delivery, line) +{ + if (typeof(line) == 'undefined' || line.length == 0) + line = $('#cart_summary tr[id^=product_' + id_product + '_' + id_product_attribute + '_0_], #cart_summary tr[id^=product_' + id_product + '_' + id_product_attribute + '_nocustom_]'); + + $('.product_customization_for_' + id_product + '_' + id_product_attribute + '_' + old_id_address_delivery).each(function(){ + $(this).attr('id', $(this).attr('id').replace(/_\d+$/, '_' + id_address_delivery)).removeClass('product_customization_for_' + id_product + '_' + id_product_attribute + '_' + old_id_address_delivery + ' address_' + old_id_address_delivery).addClass('product_customization_for_' + id_product + '_' + id_product_attribute + '_' + id_address_delivery + ' address_' + id_address_delivery); + $(this).find('input[name^=quantity_]').each(function(){ + if (typeof($(this).attr('name')) != 'undefined') + $(this).attr('name', $(this).attr('name').replace(/_\d+(_hidden|)$/, '_' + id_address_delivery)); + }); + $(this).find('a').each(function(){ + if (typeof($(this).attr('href')) != 'undefined') + $(this).attr('href', $(this).attr('href').replace(/id_address_delivery=\d+/, 'id_address_delivery=' + id_address_delivery)); + }); + }); + + line.attr('id', line.attr('id').replace(/_\d+$/, '_' + id_address_delivery)).removeClass('address_' + old_id_address_delivery).addClass('address_' + id_address_delivery).find('span[id^=cart_quantity_custom_], span[id^=total_product_price_], input[name^=quantity_], .cart_quantity_down, .cart_quantity_up, .cart_quantity_delete').each(function(){ + + if (typeof($(this).attr('name')) != 'undefined') + $(this).attr('name', $(this).attr('name').replace(/_\d+(_hidden|)$/, '_' + id_address_delivery)); + if (typeof($(this).attr('id')) != 'undefined') + $(this).attr('id', $(this).attr('id').replace(/_\d+$/, '_' + id_address_delivery)); + if (typeof($(this).attr('href')) != 'undefined') + $(this).attr('href', $(this).attr('href').replace(/id_address_delivery=\d+/, 'id_address_delivery=' + id_address_delivery)); + }); + + line.find('#select_address_delivery_' + id_product + '_' + id_product_attribute + '_' + old_id_address_delivery).attr('id', 'select_address_delivery_' + id_product + '_' + id_product_attribute + '_' + id_address_delivery); + + if (window.ajaxCart !== undefined) + { + $('#cart_block_list dd, #cart_block_list dt').each(function(){ + if (typeof($(this).attr('id')) != 'undefined') + $(this).attr('id', $(this).attr('id').replace(/_\d+$/, '_' + id_address_delivery)); + }); + } +} + +function updateQty(val, cart, el) +{ + var prefix = ""; + + if (typeof(cart) == 'undefined' || cart) + prefix = '#order-detail-content '; + else + prefix = '#fancybox-content '; + + var id = $(el).attr('name'); + + var exp = new RegExp("^[0-9]+$"); + + if (exp.test(val) == true) + { + var hidden = $(prefix + 'input[name=' + id + '_hidden]').val(); + var input = $(prefix + 'input[name=' + id + ']').val(); + var QtyToUp = parseInt(input) - parseInt(hidden); + + if (parseInt(QtyToUp) > 0) + upQuantity(id.replace('quantity_', ''), QtyToUp); + else if(parseInt(QtyToUp) < 0) + downQuantity(id.replace('quantity_', ''), QtyToUp); + } + else + $(prefix + 'input[name=' + id + ']').val($(prefix + 'input[name=' + id + '_hidden]').val()); + + if (typeof(getCarrierListAndUpdate) !== 'undefined') + getCarrierListAndUpdate(); +} + +function deleteProductFromSummary(id) +{ + var customizationId = 0; + var productId = 0; + var productAttributeId = 0; + var id_address_delivery = 0; + var ids = 0; + ids = id.split('_'); + productId = parseInt(ids[0]); + if (typeof(ids[1]) !== 'undefined') + productAttributeId = parseInt(ids[1]); + if (typeof(ids[2]) !== 'undefined' && ids[2] !== 'nocustom') + customizationId = parseInt(ids[2]); + if (typeof(ids[3]) !== 'undefined') + id_address_delivery = parseInt(ids[3]); + $.ajax({ + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), + async: true, + cache: false, + dataType: 'json', + data: 'controller=cart' + + '&ajax=true&delete=true&summary=true' + + '&id_product='+productId + + '&ipa='+productAttributeId + + '&id_address_delivery='+id_address_delivery + + ((customizationId !== 0) ? '&id_customization=' + customizationId : '') + + '&token=' + static_token + + '&allow_refresh=1', + success: function(jsonData) + { + if (jsonData.hasError) + { + var errors = ''; + for(var error in jsonData.errors) + //IE6 bug fix + if (error !== 'indexOf') + errors += jsonData.errors[error] + "\n"; + } + else + { + if (jsonData.refresh) + location.reload(); + if (parseInt(jsonData.summary.products.length) == 0) + { + if (typeof(orderProcess) == 'undefined' || orderProcess !== 'order-opc') + document.location.href = document.location.href; // redirection + else + { + $('#center_column').children().each(function() { + if ($(this).attr('id') !== 'emptyCartWarning' && $(this).attr('class') !== 'breadcrumb' && $(this).attr('id') !== 'cart_title') + { + $(this).fadeOut('slow', function () { + $(this).remove(); + }); + } + }); + $('#summary_products_label').remove(); + $('#emptyCartWarning').fadeIn('slow'); + } + } + else + { + $('#product_' + id).fadeOut('slow', function() { + $(this).remove(); + cleanSelectAddressDelivery(); + if (!customizationId) + refreshOddRow(); + }); + var exist = false; + for (i=0;i 0)) + exist = true; + } + // if all customization removed => delete product line + if (!exist && customizationId) + $('#product_' + productId + '_' + productAttributeId + '_0_' + id_address_delivery).fadeOut('slow', function() { + $(this).remove(); + var line = $('#product_' + productId + '_' + productAttributeId + '_nocustom_' + id_address_delivery); + if (line.length > 0) + { + line.find('input[name^=quantity_], .cart_quantity_down, .cart_quantity_up, .cart_quantity_delete').each(function(){ + if (typeof($(this).attr('name')) != 'undefined') + $(this).attr('name', $(this).attr('name').replace(/nocustom/, '0')); + if (typeof($(this).attr('id')) != 'undefined') + $(this).attr('id', $(this).attr('id').replace(/nocustom/, '0')); + }); + line.find('span[id^=total_product_price_]').each(function(){ + $(this).attr('id', $(this).attr('id').replace(/_nocustom/, '')); + }); + line.attr('id', line.attr('id').replace(/nocustom/, '0')); + } + refreshOddRow(); + }); + } + updateCartSummary(jsonData.summary); + if (window.ajaxCart != undefined) + ajaxCart.updateCart(jsonData); + updateCustomizedDatas(jsonData.customizedDatas); + updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART); + updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA); + if (typeof(getCarrierListAndUpdate) !== 'undefined' && jsonData.summary.products.length > 0) + getCarrierListAndUpdate(); + if (typeof(updatePaymentMethodsDisplay) !== 'undefined') + updatePaymentMethodsDisplay(); + } + }, + error: function(XMLHttpRequest, textStatus, errorThrown) { + if (textStatus !== 'abort') + alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus); + } + }); +} + +function refreshOddRow() +{ + var odd_class = 'odd'; + var even_class = 'even'; + $.each($('.cart_item'), function(i, it) + { + if (i == 0) // First item + { + if ($(this).hasClass('even')) + { + odd_class = 'even'; + even_class = 'odd'; + } + $(this).addClass('first_item'); + } + if(i % 2) + $(this).removeClass(odd_class).addClass(even_class); + else + $(this).removeClass(even_class).addClass(odd_class); + }); + $('.cart_item:last-child, .customization:last-child').addClass('last_item'); +} + +function upQuantity(id, qty) +{ + if (typeof(qty) == 'undefined' || !qty) + qty = 1; + var customizationId = 0; + var productId = 0; + var productAttributeId = 0; + var id_address_delivery = 0; + var ids = 0; + ids = id.split('_'); + productId = parseInt(ids[0]); + if (typeof(ids[1]) !== 'undefined') + productAttributeId = parseInt(ids[1]); + if (typeof(ids[2]) !== 'undefined' && ids[2] !== 'nocustom') + customizationId = parseInt(ids[2]); + if (typeof(ids[3]) !== 'undefined') + id_address_delivery = parseInt(ids[3]); + + $.ajax({ + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), + async: true, + cache: false, + dataType: 'json', + data: 'controller=cart' + + '&ajax=true' + + '&add=true' + + '&getproductprice=true' + + '&summary=true' + + '&id_product=' + productId + + '&ipa=' + productAttributeId + + '&id_address_delivery=' + id_address_delivery + + ((customizationId !== 0) ? '&id_customization=' + customizationId : '') + + '&qty=' + qty + + '&token=' + static_token + + '&allow_refresh=1', + success: function(jsonData) + { + if (jsonData.hasError) + { + var errors = ''; + for(var error in jsonData.errors) + //IE6 bug fix + if(error !== 'indexOf') + errors += $('
').html(jsonData.errors[error]).text() + "\n"; + alert(errors); + $('input[name=quantity_'+ id +']').val($('input[name=quantity_'+ id +'_hidden]').val()); + } + else + { + if (jsonData.refresh) + location.reload(); + updateCartSummary(jsonData.summary); + if (window.ajaxCart != undefined) + ajaxCart.updateCart(jsonData); + if (customizationId !== 0) + updateCustomizedDatas(jsonData.customizedDatas); + updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART); + updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA); + if (typeof(getCarrierListAndUpdate) !== 'undefined') + getCarrierListAndUpdate(); + if (typeof(updatePaymentMethodsDisplay) !== 'undefined') + updatePaymentMethodsDisplay(); + } + }, + error: function(XMLHttpRequest, textStatus, errorThrown) { + if (textStatus !== 'abort') + alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus); + } + }); +} + +function downQuantity(id, qty) +{ + var val = $('input[name=quantity_' + id + ']').val(); + var newVal = val; + if(typeof(qty) == 'undefined' || !qty) + { + qty = 1; + newVal = val - 1; + } + else if (qty < 0) + qty = -qty; + + var customizationId = 0; + var productId = 0; + var productAttributeId = 0; + var id_address_delivery = 0; + var ids = 0; + + ids = id.split('_'); + productId = parseInt(ids[0]); + if (typeof(ids[1]) !== 'undefined') + productAttributeId = parseInt(ids[1]); + if (typeof(ids[2]) !== 'undefined' && ids[2] !== 'nocustom') + customizationId = parseInt(ids[2]); + if (typeof(ids[3]) !== 'undefined') + id_address_delivery = parseInt(ids[3]); + + if (newVal > 0 || $('#product_' + id + '_gift').length) + { + $.ajax({ + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), + async: true, + cache: false, + dataType: 'json', + data: 'controller=cart' + + '&ajax=true' + + '&add=true' + + '&getproductprice=true' + + '&summary=true' + + '&id_product='+productId + + '&ipa='+productAttributeId + + '&id_address_delivery='+id_address_delivery + + '&op=down' + + ((customizationId !== 0) ? '&id_customization='+customizationId : '') + + '&qty='+qty + + '&token='+static_token + + '&allow_refresh=1', + success: function(jsonData) + { + if (jsonData.hasError) + { + var errors = ''; + for(var error in jsonData.errors) + //IE6 bug fix + if(error !== 'indexOf') + errors += $('
').html(jsonData.errors[error]).text() + "\n"; + alert(errors); + $('input[name=quantity_' + id + ']').val($('input[name=quantity_' + id + '_hidden]').val()); + } + else + { + if (jsonData.refresh) + location.reload(); + updateCartSummary(jsonData.summary); + if (window.ajaxCart !== undefined) + ajaxCart.updateCart(jsonData); + if (customizationId !== 0) + updateCustomizedDatas(jsonData.customizedDatas); + updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART); + updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA); + + if (newVal == 0) + $('#product_' + id).hide(); + + if (typeof(getCarrierListAndUpdate) !== 'undefined') + getCarrierListAndUpdate(); + if (typeof(updatePaymentMethodsDisplay) !== 'undefined') + updatePaymentMethodsDisplay(); + } + }, + error: function(XMLHttpRequest, textStatus, errorThrown) { + if (textStatus !== 'abort') + alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus); + } + }); + + } + else + { + deleteProductFromSummary(id); + } +} + +function updateCartSummary(json) +{ + var i; + var nbrProducts = 0; + var product_list = new Array(); + + if (typeof json == 'undefined') + return; + + $('div.error').fadeOut(); + + for (i=0;i product_list[i].price) + initial_price_text = '' + initial_price + '
'; + + var key_for_blockcart = product_list[i].id_product + '_' + product_list[i].id_product_attribute + '_' + product_list[i].id_address_delivery; + var key_for_blockcart_nocustom = product_list[i].id_product + '_' + product_list[i].id_product_attribute + '_' + ((product_list[i].id_customization && product_list[i].quantity_without_customization != product_list[i].quantity)? 'nocustom' : '0') + '_' + product_list[i].id_address_delivery; + + if (priceDisplayMethod !== 0) + { + $('#product_price_' + key_for_blockcart).html(initial_price_text + current_price); + if (typeof(product_list[i].customizationQuantityTotal) !== 'undefined' && product_list[i].customizationQuantityTotal > 0) + $('#total_product_price_' + key_for_blockcart).html(formatCurrency(product_list[i].total_customization, currencyFormat, currencySign, currencyBlank)); + else + $('#total_product_price_' + key_for_blockcart).html(formatCurrency(product_list[i].total, currencyFormat, currencySign, currencyBlank)); + if (product_list[i].quantity_without_customization != product_list[i].quantity) + $('#total_product_price_' + key_for_blockcart_nocustom).html(formatCurrency(product_list[i].total, currencyFormat, currencySign, currencyBlank)); + } + else + { + $('#product_price_' + key_for_blockcart).html(initial_price_text + current_price); + if (typeof(product_list[i].customizationQuantityTotal) !== 'undefined' && product_list[i].customizationQuantityTotal > 0) + $('#total_product_price_' + key_for_blockcart).html(formatCurrency(product_list[i].total_customization_wt, currencyFormat, currencySign, currencyBlank)); + else + $('#total_product_price_' + key_for_blockcart).html(formatCurrency(product_list[i].total_wt, currencyFormat, currencySign, currencyBlank)); + if (product_list[i].quantity_without_customization != product_list[i].quantity) + $('#total_product_price_' + key_for_blockcart_nocustom).html(formatCurrency(product_list[i].total_wt, currencyFormat, currencySign, currencyBlank)); + } + + $('input[name=quantity_' + key_for_blockcart_nocustom + ']').val(product_list[i].id_customization? product_list[i].quantity_without_customization : product_list[i].cart_quantity); + $('input[name=quantity_' + key_for_blockcart_nocustom + '_hidden]').val(product_list[i].id_customization? product_list[i].quantity_without_customization : product_list[i].cart_quantity); + + if (typeof(product_list[i].customizationQuantityTotal) !== 'undefined' && product_list[i].customizationQuantityTotal > 0) + $('#cart_quantity_custom_' + key_for_blockcart).html(product_list[i].customizationQuantityTotal); + nbrProducts += parseInt(product_list[i].quantity); + } + + // Update discounts + if (json.discounts.length == 0) + { + $('.cart_discount').each(function(){$(this).remove();}); + $('.cart_total_voucher').remove(); + } + else + { + if ($('.cart_discount').length == 0) + location.reload(); + + if (priceDisplayMethod !== 0) + $('#total_discount').html('-' + formatCurrency(json.total_discounts_tax_exc, currencyFormat, currencySign, currencyBlank)); + else + $('#total_discount').html('-' + formatCurrency(json.total_discounts, currencyFormat, currencySign, currencyBlank)); + + $('.cart_discount').each(function(){ + var idElmt = $(this).attr('id').replace('cart_discount_',''); + var toDelete = true; + + for (i=0;i 0) + { + if (priceDisplayMethod !== 0) + { + $('#cart_block_shipping_cost').html(formatCurrency(json.total_shipping_tax_exc, currencyFormat, currencySign, currencyBlank)); + $('#cart_block_wrapping_cost').html(formatCurrency(json.total_wrapping_tax_exc, currencyFormat, currencySign, currencyBlank)); + $('#cart_block_total').html(formatCurrency(json.total_price_without_tax, currencyFormat, currencySign, currencyBlank)); + } + else + { + $('#cart_block_shipping_cost').html(formatCurrency(json.total_shipping, currencyFormat, currencySign, currencyBlank)); + $('#cart_block_wrapping_cost').html(formatCurrency(json.total_wrapping, currencyFormat, currencySign, currencyBlank)); + $('#cart_block_total').html(formatCurrency(json.total_price, currencyFormat, currencySign, currencyBlank)); + } + } + else + { + if (json.carrier.id == null) + { + $('#cart_block_shipping_cost').hide(); + $('#cart_block_shipping_cost').next().hide(); + } + } + + $('#cart_block_tax_cost').html(formatCurrency(json.total_tax, currencyFormat, currencySign, currencyBlank)); + $('.ajax_cart_quantity').html(nbrProducts); + + // Cart summary + $('#summary_products_quantity').html(nbrProducts + ' ' + (nbrProducts > 1 ? txtProducts : txtProduct)); + if (priceDisplayMethod !== 0) + $('#total_product').html(formatCurrency(json.total_products, currencyFormat, currencySign, currencyBlank)); + else + $('#total_product').html(formatCurrency(json.total_products_wt, currencyFormat, currencySign, currencyBlank)); + $('#total_price').html(formatCurrency(json.total_price, currencyFormat, currencySign, currencyBlank)); + $('#total_price_without_tax').html(formatCurrency(json.total_price_without_tax, currencyFormat, currencySign, currencyBlank)); + $('#total_tax').html(formatCurrency(json.total_tax, currencyFormat, currencySign, currencyBlank)); + + $('.cart_total_delivery').show(); + if (json.total_shipping > 0) + { + if (priceDisplayMethod !== 0) + $('#total_shipping').html(formatCurrency(json.total_shipping_tax_exc, currencyFormat, currencySign, currencyBlank)); + else + $('#total_shipping').html(formatCurrency(json.total_shipping, currencyFormat, currencySign, currencyBlank)); + } + else + { + if (json.carrier.id != null) + $('#total_shipping').html(freeShippingTranslation); + else + $('.cart_total_delivery').hide(); + } + + if (json.free_ship > 0 && !json.is_virtual_cart) + { + $('.cart_free_shipping').fadeIn(); + $('#free_shipping').html(formatCurrency(json.free_ship, currencyFormat, currencySign, currencyBlank)); + } + else + $('.cart_free_shipping').hide(); + + if (json.total_wrapping > 0) + { + $('#total_wrapping').html(formatCurrency(json.total_wrapping, currencyFormat, currencySign, currencyBlank)); + $('#total_wrapping').parent().show(); + } + else + { + $('#total_wrapping').html(formatCurrency(json.total_wrapping, currencyFormat, currencySign, currencyBlank)); + $('#total_wrapping').parent().hide(); + } +} + +function updateCustomizedDatas(json) +{ + for(var i in json) + for(var j in json[i]) + for(var k in json[i][j]) + for(var l in json[i][j][k]) + { + var quantity = json[i][j][k][l]['quantity']; + $('input[name=quantity_' + i + '_' + j + '_' + l + '_' + k + '_hidden]').val(quantity); + $('input[name=quantity_' + i + '_' + j + '_' + l + '_' + k + ']').val(quantity); + } +} + +function updateHookShoppingCart(html) +{ + $('#HOOK_SHOPPING_CART').html(html); +} + +function updateHookShoppingCartExtra(html) +{ + $('#HOOK_SHOPPING_CART_EXTRA').html(html); +} +function refreshDeliveryOptions() +{ + $.each($('.delivery_option_radio'), function() { + if ($(this).prop('checked')) + { + if ($(this).parent().find('.delivery_option_carrier.not-displayable').length == 0) + $(this).parent().find('.delivery_option_carrier').show(); + var carrier_id_list = $(this).val().split(','); + carrier_id_list.pop(); + var it = this; + $(carrier_id_list).each(function() { + $(it).parent().find('input[value="' + this.toString() + '"]').change(); + }); + } + else + $(this).parent().find('.delivery_option_carrier').hide(); + }); +} +$(document).ready(function() { + + refreshDeliveryOptions(); + + $('.delivery_option_radio').live('change', function() { + refreshDeliveryOptions(); + }); + + $('#allow_seperated_package').live('click', function() { + $.ajax({ + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), + async: true, + cache: false, + data: 'controller=cart&ajax=true&allowSeperatedPackage=true&value=' + + ($(this).prop('checked') ? '1' : '0') + + '&token='+static_token + + '&allow_refresh=1', + success: function(jsonData) + { + if (typeof(getCarrierListAndUpdate) !== 'undefined') + getCarrierListAndUpdate(); + } + }); + }); + + $('#gift').checkboxChange(function() { $('#gift_div').show('slow'); }, function() { $('#gift_div').hide('slow'); }); + + $('#enable-multishipping').checkboxChange( + function() { + $('.standard-checkout').hide(0); + $('.multishipping-checkout').show(0); + }, + function() { + $('.standard-checkout').show(0); + $('.multishipping-checkout').hide(0); + } + ); +}); + +function updateExtraCarrier(id_delivery_option, id_address) +{ + var url = ""; + + if(typeof(orderOpcUrl) !== 'undefined') + url = orderOpcUrl; + else + url = orderUrl; + + $.ajax({ + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: url + '?rand=' + new Date().getTime(), + async: true, + cache: false, + dataType : "json", + data: 'ajax=true' + + '&method=updateExtraCarrier' + + '&id_address='+id_address + + '&id_delivery_option='+id_delivery_option + + '&token='+static_token + + '&allow_refresh=1', + success: function(jsonData) + { + $('#HOOK_EXTRACARRIER_' + id_address).html(jsonData['content']); + } + }); +} diff --git a/themes/default/js/product.js b/themes/default/js/product.js new file mode 100644 index 000000000..0d93b0ff0 --- /dev/null +++ b/themes/default/js/product.js @@ -0,0 +1,741 @@ +/* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + + +//global variables +var combinations = []; +var selectedCombination = []; +var globalQuantity = 0; +var colors = []; + +//check if a function exists +function function_exists(function_name) +{ + if (typeof function_name == 'string') + return (typeof window[function_name] == 'function'); + return (function_name instanceof Function); +} + +//execute oosHook js code +function oosHookJsCode() +{ + for (var i = 0; i < oosHookJsCodeFunctions.length; i++) + { + if (function_exists(oosHookJsCodeFunctions[i])) + setTimeout(oosHookJsCodeFunctions[i] + '()', 0); + } +} + +//add a combination of attributes in the global JS sytem +function addCombination(idCombination, arrayOfIdAttributes, quantity, price, ecotax, id_image, reference, unit_price, minimal_quantity, available_date, combination_specific_price) +{ + globalQuantity += quantity; + + var combination = []; + combination['idCombination'] = idCombination; + combination['quantity'] = quantity; + combination['idsAttributes'] = arrayOfIdAttributes; + combination['price'] = price; + combination['ecotax'] = ecotax; + combination['image'] = id_image; + combination['reference'] = reference; + combination['unit_price'] = unit_price; + combination['minimal_quantity'] = minimal_quantity; + combination['available_date'] = []; + combination['available_date'] = available_date; + combination['specific_price'] = []; + combination['specific_price'] = combination_specific_price; + combinations.push(combination); +} + +// search the combinations' case of attributes and update displaying of availability, prices, ecotax, and image +function findCombination(firstTime) +{ + $('#minimal_quantity_wanted_p').fadeOut(); + $('#quantity_wanted').val(1); + //create a temporary 'choice' array containing the choices of the customer + var choice = []; + $('#attributes select, #attributes input[type=hidden], #attributes input[type=radio]:checked').each(function(){ + choice.push($(this).val()); + }); + + //testing every combination to find the conbination's attributes' case of the user + for (var combination = 0; combination < combinations.length; ++combination) + { + //verify if this combinaison is the same that the user's choice + var combinationMatchForm = true; + $.each(combinations[combination]['idsAttributes'], function(key, value) + { + if (!in_array(value, choice)) + combinationMatchForm = false; + }); + + if (combinationMatchForm) + { + if (combinations[combination]['minimal_quantity'] > 1) + { + $('#minimal_quantity_label').html(combinations[combination]['minimal_quantity']); + $('#minimal_quantity_wanted_p').fadeIn(); + $('#quantity_wanted').val(combinations[combination]['minimal_quantity']); + $('#quantity_wanted').bind('keyup', function() {checkMinimalQuantity(combinations[combination]['minimal_quantity']);}); + } + //combination of the user has been found in our specifications of combinations (created in back office) + selectedCombination['unavailable'] = false; + selectedCombination['reference'] = combinations[combination]['reference']; + $('#idCombination').val(combinations[combination]['idCombination']); + + //get the data of product with these attributes + quantityAvailable = combinations[combination]['quantity']; + selectedCombination['price'] = combinations[combination]['price']; + selectedCombination['unit_price'] = combinations[combination]['unit_price']; + selectedCombination['specific_price'] = combinations[combination]['specific_price']; + if (combinations[combination]['ecotax']) + selectedCombination['ecotax'] = combinations[combination]['ecotax']; + else + selectedCombination['ecotax'] = default_eco_tax; + + //show the large image in relation to the selected combination + if (combinations[combination]['image'] && combinations[combination]['image'] != -1) + displayImage($('#thumb_' + combinations[combination]['image']).parent()); + + //show discounts values according to the selected combination + if (combinations[combination]['idCombination'] && combinations[combination]['idCombination'] > 0) + displayDiscounts(combinations[combination]['idCombination']); + + //get available_date for combination product + selectedCombination['available_date'] = combinations[combination]['available_date']; + + //update the display + updateDisplay(); + + if(typeof(firstTime) != 'undefined' && firstTime) + refreshProductImages(0); + else + refreshProductImages(combinations[combination]['idCombination']); + //leave the function because combination has been found + return; + } + } + //this combination doesn't exist (not created in back office) + selectedCombination['unavailable'] = true; + if (typeof(selectedCombination['available_date']) != 'undefined') + delete selectedCombination['available_date']; + updateDisplay(); +} + +//update display of the availability of the product AND the prices of the product +function updateDisplay() +{ + var productPriceDisplay = productPrice; + var productPriceWithoutReductionDisplay = productPriceWithoutReduction; + + if (!selectedCombination['unavailable'] && quantityAvailable > 0 && productAvailableForOrder == 1) + { + //show the choice of quantities + $('#quantity_wanted_p:hidden').show('slow'); + + //show the "add to cart" button ONLY if it was hidden + $('#add_to_cart:hidden').fadeIn(600); + + //hide the hook out of stock + $('#oosHook').hide(); + + $('#availability_date').fadeOut(); + + //availability value management + if (availableNowValue != '') + { + //update the availability statut of the product + $('#availability_value').removeClass('warning_inline'); + $('#availability_value').text(availableNowValue); + if(stock_management == 1) + $('#availability_statut:hidden').show(); + } + else + $('#availability_statut:visible').hide(); + + //'last quantities' message management + if (!allowBuyWhenOutOfStock) + { + if (quantityAvailable <= maxQuantityToAllowDisplayOfLastQuantityMessage) + $('#last_quantities').show('slow'); + else + $('#last_quantities').hide('slow'); + } + + if (quantitiesDisplayAllowed) + { + $('#pQuantityAvailable:hidden').show('slow'); + $('#quantityAvailable').text(quantityAvailable); + + if (quantityAvailable < 2) // we have 1 or less product in stock and need to show "item" instead of "items" + { + $('#quantityAvailableTxt').show(); + $('#quantityAvailableTxtMultiple').hide(); + } + else + { + $('#quantityAvailableTxt').hide(); + $('#quantityAvailableTxtMultiple').show(); + } + } + } + else + { + //show the hook out of stock + if (productAvailableForOrder == 1) + { + $('#oosHook').show(); + if ($('#oosHook').length > 0 && function_exists('oosHookJsCode')) + oosHookJsCode(); + } + + //hide 'last quantities' message if it was previously visible + $('#last_quantities:visible').hide('slow'); + + //hide the quantity of pieces if it was previously visible + $('#pQuantityAvailable:visible').hide('slow'); + + //hide the choice of quantities + if (!allowBuyWhenOutOfStock) + $('#quantity_wanted_p:visible').hide('slow'); + + //display that the product is unavailable with theses attributes + if (!selectedCombination['unavailable']) + $('#availability_value').text(doesntExistNoMore + (globalQuantity > 0 ? ' ' + doesntExistNoMoreBut : '')).addClass('warning_inline'); + else + { + $('#availability_value').text(doesntExist).addClass('warning_inline'); + $('#oosHook').hide(); + } + if(stock_management == 1 && !allowBuyWhenOutOfStock) + $('#availability_statut:hidden').show(); + + if (typeof(selectedCombination['available_date']) != 'undefined' && selectedCombination['available_date']['date'].length != 0) + { + var available_date = selectedCombination['available_date']['date']; + var tab_date = available_date.split('-'); + var time_available = new Date(tab_date[0], tab_date[1], tab_date[2]); + time_available.setMonth(time_available.getMonth()-1); + var now = new Date(); + if (now.getTime() < time_available.getTime() && $('#availability_date_value').text() != selectedCombination['available_date']['date_formatted']) + { + $('#availability_date').fadeOut('normal', function(){ + $('#availability_date_value').text(selectedCombination['available_date']['date_formatted']); + $(this).fadeIn(); + }); + } + else if(now.getTime() < time_available.getTime()) + $('#availability_date').fadeIn(); + } + else + $('#availability_date').fadeOut(); + + //show the 'add to cart' button ONLY IF it's possible to buy when out of stock AND if it was previously invisible + if (allowBuyWhenOutOfStock && !selectedCombination['unavailable'] && productAvailableForOrder == 1) + { + $('#add_to_cart:hidden').fadeIn(600); + + if (availableLaterValue != '') + { + $('#availability_value').text(availableLaterValue); + if(stock_management == 1) + $('#availability_statut:hidden').show('slow'); + } + else + $('#availability_statut:visible').hide('slow'); + } + else + { + $('#add_to_cart:visible').fadeOut(600); + if(stock_management == 1) + $('#availability_statut:hidden').show('slow'); + } + + if (productAvailableForOrder == 0) + $('#availability_statut:visible').hide(); + } + + if (selectedCombination['reference'] || productReference) + { + if (selectedCombination['reference']) + $('#product_reference span').text(selectedCombination['reference']); + else if (productReference) + $('#product_reference span').text(productReference); + $('#product_reference:hidden').show('slow'); + } + else + $('#product_reference:visible').hide('slow'); + + //update display of the the prices in relation to tax, discount, ecotax, and currency criteria + if (!selectedCombination['unavailable'] && productShowPrice == 1) + { + var priceTaxExclWithoutGroupReduction = ''; + + // retrieve price without group_reduction in order to compute the group reduction after + // the specific price discount (done in the JS in order to keep backward compatibility) + priceTaxExclWithoutGroupReduction = ps_round(productPriceTaxExcluded, 6) * (1 / group_reduction); + + var tax = (taxRate / 100) + 1; + var taxExclPrice = priceTaxExclWithoutGroupReduction + (selectedCombination['price'] * currencyRate); + + if (selectedCombination.specific_price && selectedCombination.specific_price['id_product_attribute']) + { + if (selectedCombination.specific_price['price'] && selectedCombination.specific_price['price'] >=0) + var taxExclPrice = (specific_currency ? selectedCombination.specific_price['price'] : selectedCombination.specific_price['price'] * currencyRate); + else + var taxExclPrice = productBasePriceTaxExcluded * currencyRate + (selectedCombination['price'] * currencyRate); + } + else if (product_specific_price.price && product_specific_price.price >= 0) + var taxExclPrice = (specific_currency ? product_specific_price.price : product_specific_price.price * currencyRate) + (selectedCombination['price'] * currencyRate); + + if (!displayPrice && !noTaxForThisProduct) + productPriceDisplay = ps_round(taxExclPrice * tax, 2); // Need to be global => no var + else + productPriceDisplay = ps_round(taxExclPrice, 2); // Need to be global => no var + + productPriceWithoutReductionDisplay = productPriceDisplay * group_reduction; + var reduction = 0; + if (selectedCombination['specific_price'].reduction_price || selectedCombination['specific_price'].reduction_percent) + { + reduction_price = (specific_currency ? selectedCombination['specific_price'].reduction_price : selectedCombination['specific_price'].reduction_price * currencyRate); + reduction = productPriceDisplay * (parseFloat(selectedCombination['specific_price'].reduction_percent) / 100) + reduction_price; + if (reduction_price && (displayPrice || noTaxForThisProduct)) + reduction = ps_round(reduction / tax, 6); + + } + else if (product_specific_price && product_specific_price.reduction && !selectedCombination.specific_price) + { + if (product_specific_price.reduction_type == 'amount') + reduction_price = (specific_currency ? product_specific_price.reduction : product_specific_price.reduction * currencyRate); + else + reduction_price = 0; + + if (product_specific_price.reduction_type == 'percentage') + reduction_percent = productPriceDisplay * parseFloat(product_specific_price.reduction); + + reduction = reduction_price + reduction_percent; + if (reduction_price && (displayPrice || noTaxForThisProduct)) + reduction = ps_round(reduction / tax, 6); + } + + if (selectedCombination.specific_price) + { + if (selectedCombination['specific_price'] && selectedCombination['specific_price'].reduction_type == 'percentage') + { + $('#reduction_amount').hide(); + $('#reduction_percent_display').html('-' + parseFloat(selectedCombination['specific_price'].reduction_percent) + '%'); + $('#reduction_percent').show(); + } else if (selectedCombination['specific_price'].reduction_type == 'amount' && selectedCombination['specific_price'].reduction_price != 0) { + $('#reduction_amount_display').html('-' + formatCurrency(reduction_price, currencyFormat, currencySign, currencyBlank)); + $('#reduction_percent').hide(); + $('#reduction_amount').show(); + } else { + $('#reduction_percent').hide(); + $('#reduction_amount').hide(); + } + } + + if (product_specific_price['reduction_type'] != '' || selectedCombination['specific_price'].reduction_type != '') + $('#discount_reduced_price,#old_price').show(); + else + $('#discount_reduced_price,#old_price').hide(); + if ((product_specific_price['reduction_type'] == 'percentage' && selectedCombination['specific_price'].reduction_type == 'percentage') || selectedCombination['specific_price'].reduction_type == 'percentage') + $('#reduction_percent').show(); + else + $('#reduction_percent').hide(); + if (product_specific_price['price'] || (selectedCombination.specific_price && selectedCombination.specific_price['price'])) + $('#not_impacted_by_discount').show(); + else + $('#not_impacted_by_discount').hide(); + + productPriceDisplay -= reduction; + productPriceDisplay = ps_round(productPriceDisplay * group_reduction, 2); + + var ecotaxAmount = !displayPrice ? ps_round(selectedCombination['ecotax'] * (1 + ecotaxTax_rate / 100), 2) : selectedCombination['ecotax']; + + if (ecotaxAmount != default_eco_tax) + productPriceDisplay += ecotaxAmount - default_eco_tax; + else + productPriceDisplay += ecotaxAmount; + + if (ecotaxAmount != default_eco_tax) + productPriceWithoutReductionDisplay += ecotaxAmount - default_eco_tax; + else + productPriceWithoutReductionDisplay += ecotaxAmount; + + var our_price = ''; + if (productPriceDisplay > 0) { + our_price = formatCurrency(productPriceDisplay, currencyFormat, currencySign, currencyBlank); + } else { + our_price = formatCurrency(0, currencyFormat, currencySign, currencyBlank); + } + $('#our_price_display').text(our_price); + $('#old_price_display').text(formatCurrency(productPriceWithoutReductionDisplay, currencyFormat, currencySign, currencyBlank)); + + if (productPriceWithoutReductionDisplay > productPriceDisplay) + $('#old_price,#old_price_display,#old_price_display_taxes').show(); + else + $('#old_price,#old_price_display,#old_price_display_taxes').hide(); + // Special feature: "Display product price tax excluded on product page" + var productPricePretaxed = ''; + if (!noTaxForThisProduct) + productPricePretaxed = productPriceDisplay / tax; + else + productPricePretaxed = productPriceDisplay; + $('#pretaxe_price_display').text(formatCurrency(productPricePretaxed, currencyFormat, currencySign, currencyBlank)); + // Unit price + productUnitPriceRatio = parseFloat(productUnitPriceRatio); + if (productUnitPriceRatio > 0 ) + { + newUnitPrice = (productPriceDisplay / parseFloat(productUnitPriceRatio)) + selectedCombination['unit_price']; + $('#unit_price_display').text(formatCurrency(newUnitPrice, currencyFormat, currencySign, currencyBlank)); + } + + // Ecotax + ecotaxAmount = !displayPrice ? ps_round(selectedCombination['ecotax'] * (1 + ecotaxTax_rate / 100), 2) : selectedCombination['ecotax']; + $('#ecotax_price_display').text(formatCurrency(ecotaxAmount, currencyFormat, currencySign, currencyBlank)); + } +} + +//update display of the large image +function displayImage(domAAroundImgThumb, no_animation) +{ + if (typeof(no_animation) == 'undefined') + no_animation = false; + if (domAAroundImgThumb.prop('href')) + { + var new_src = domAAroundImgThumb.prop('href').replace('thickbox', 'large'); + var new_title = domAAroundImgThumb.prop('title'); + var new_href = domAAroundImgThumb.prop('href'); + if ($('#bigpic').prop('src') != new_src) + { + $('#bigpic').prop({ + 'src' : new_src, + 'alt' : new_title, + 'title' : new_title + }).load(function(){ + if (typeof(jqZoomEnabled) != 'undefined' && jqZoomEnabled) + $(this).prop('rel', new_href); + }); + } + $('#views_block li a').removeClass('shown'); + $(domAAroundImgThumb).addClass('shown'); + } +} + +//update display of the discounts table +function displayDiscounts(combination) +{ + $('#quantityDiscount tbody tr').each(function() { + if (($(this).attr('id') != 'quantityDiscount_0') && + ($(this).attr('id') != 'quantityDiscount_' + combination) && + ($(this).attr('id') != 'noQuantityDiscount')) + $(this).fadeOut('slow'); + }); + + if ($('#quantityDiscount_' + combination+',.quantityDiscount_' + combination).length != 0) + { + $('#quantityDiscount_' + combination+',.quantityDiscount_' + combination).show(); + $('#noQuantityDiscount').hide(); + } + else + $('#noQuantityDiscount').show(); +} + +// Serialscroll exclude option bug ? +function serialScrollFixLock(event, targeted, scrolled, items, position) +{ + serialScrollNbImages = $('#thumbs_list li:visible').length; + serialScrollNbImagesDisplayed = 3; + + var leftArrow = position == 0 ? true : false; + var rightArrow = position + serialScrollNbImagesDisplayed >= serialScrollNbImages ? true : false; + + $('#view_scroll_left').css('cursor', leftArrow ? 'default' : 'pointer').css('display', leftArrow ? 'none' : 'block').fadeTo(0, leftArrow ? 0 : 1); + $('#view_scroll_right').css('cursor', rightArrow ? 'default' : 'pointer').fadeTo(0, rightArrow ? 0 : 1).css('display', rightArrow ? 'none' : 'block'); + return true; +} + +// Change the current product images regarding the combination selected +function refreshProductImages(id_product_attribute) +{ + $('#thumbs_list_frame').scrollTo('li:eq(0)', 700, {axis:'x'}); + + id_product_attribute = parseInt(id_product_attribute); + + if (id_product_attribute > 0 && typeof(combinationImages) != 'undefined' && typeof(combinationImages[id_product_attribute]) != 'undefined') + { + $('#thumbs_list li').hide(); + $('#thumbs_list').trigger('goto', 0); + for (var i = 0; i < combinationImages[id_product_attribute].length; i++) + $('#thumbnail_' + parseInt(combinationImages[id_product_attribute][i])).show(); + if (parseInt($('#thumbs_list_frame >li:visible').length) < parseInt($('#thumbs_list_frame >li').length)) + $('#wrapResetImages').show('slow'); + else + $('#wrapResetImages').hide('slow'); + } + else + { + $('#thumbs_list li').show(); + if (parseInt($('#thumbs_list_frame >li').length) == parseInt($('#thumbs_list_frame >li:visible').length)) + $('#wrapResetImages').hide('slow'); + } + + var thumb_width = $('#thumbs_list_frame >li').width() + parseInt($('#thumbs_list_frame >li').css('marginRight')); + $('#thumbs_list_frame').width((parseInt((thumb_width) * $('#thumbs_list_frame >li').length)) + 'px'); + $('#thumbs_list').trigger('goto', 0); + serialScrollFixLock('', '', '', '', 0);// SerialScroll Bug on goto 0 ? +} + +//To do after loading HTML +$(document).ready(function() +{ + //init the serialScroll for thumbs + $('#thumbs_list').serialScroll({ + items:'li:visible', + prev:'#view_scroll_left', + next:'#view_scroll_right', + axis:'x', + offset:0, + start:0, + stop:true, + onBefore:serialScrollFixLock, + duration:700, + step: 2, + lazy: true, + lock: false, + force:false, + cycle:false + }); + + $('#thumbs_list').trigger('goto', 1);// SerialScroll Bug on goto 0 ? + $('#thumbs_list').trigger('goto', 0); + + //hover 'other views' images management + $('#views_block li a').hover( + function(){displayImage($(this));}, + function(){} + ); + + //set jqZoom parameters if needed + if (typeof(jqZoomEnabled) != 'undefined' && jqZoomEnabled) + { + $('#bigpic').attr('rel', $('#bigpic').attr('src').replace('large', 'thickbox')); + $('img.jqzoom').jqueryzoom({ + xzoom: 200, //zooming div default width(default width value is 200) + yzoom: 200, //zooming div default width(default height value is 200) + offset: 21 //zooming div default offset(default offset value is 10) + //position: "right" //zooming div position(default position value is "right") + }); + } + //add a link on the span 'view full size' and on the big image + $('#view_full_size, #image-block img').click(function(){ + $('#views_block .shown').click(); + }); + + //catch the click on the "more infos" button at the top of the page + $('#short_description_block .button').click(function(){ + $('#more_info_tab_more_info').click(); + $.scrollTo( '#more_info_tabs', 1200 ); + }); + + // Hide the customization submit button and display some message + $('#customizedDatas input').click(function() { + $('#customizedDatas input').hide(); + $('#ajax-loader').fadeIn(); + $('#customizedDatas').append(uploading_in_progress); + }); + + original_url = window.location + ''; + first_url_check = true; + checkUrl(); + initLocationChange(); + + //init the price in relation of the selected attributes + if (typeof productHasAttributes != 'undefined' && productHasAttributes) + findCombination(true); + else if (typeof productHasAttributes != 'undefined' && !productHasAttributes) + refreshProductImages(0); + + $('#resetImages').click(function() { + refreshProductImages(0); + }); + + $('.thickbox').fancybox({ + 'hideOnContentClick': true, + 'transitionIn' : 'elastic', + 'transitionOut' : 'elastic' + }); +}); + +function saveCustomization() +{ + $('#quantityBackup').val($('#quantity_wanted').val()); + customAction = $('#customizationForm').attr('action'); + $('body select[id^="group_"]').each(function() { + customAction = customAction.replace(new RegExp(this.id + '=\\d+'), this.id +'=' + this.value); + }); + $('#customizationForm').attr('action', customAction); + $('#customizationForm').submit(); +} + +function submitPublishProduct(url, redirect, token) +{ + var id_product = $('#admin-action-product-id').val(); + + $.ajaxSetup({async: false}); + $.post(url + '/index.php', { + action:'publishProduct', + id_product: id_product, + status: 1, + redirect: redirect, + ajax: 1, + tab: 'AdminProducts', + token: token + }, + function(data) + { + if (data.indexOf('error') === -1) + document.location.href = data; + } + ); + return true; +} + +function checkMinimalQuantity(minimal_quantity) +{ + if ($('#quantity_wanted').val() < minimal_quantity) + { + $('#quantity_wanted').css('border', '1px solid red'); + $('#minimal_quantity_wanted_p').css('color', 'red'); + } + else + { + $('#quantity_wanted').css('border', '1px solid #BDC2C9'); + $('#minimal_quantity_wanted_p').css('color', '#374853'); + } +} + +function colorPickerClick(elt) +{ + id_attribute = $(elt).attr('id').replace('color_', ''); + $(elt).parent().parent().children().removeClass('selected'); + $(elt).fadeTo('fast', 1, function(){ + $(this).fadeTo('fast', 0, function(){ + $(this).fadeTo('fast', 1, function(){ + $(this).parent().addClass('selected'); + }); + }); + }); + $(elt).parent().parent().parent().children('.color_pick_hidden,#color_pick_hidden').val(id_attribute); + findCombination(false); +} + + +function getProductAttribute() +{ + // get product attribute id + product_attribute_id = $('#idCombination').val(); + product_id = $('#product_page_product_id').val(); + + // get every attributes values + request = ''; + //create a temporary 'tab_attributes' array containing the choices of the customer + var tab_attributes = []; + $('#attributes select, #attributes input[type=hidden], #attributes input[type=radio]:checked').each(function(){ + tab_attributes.push($(this).val()); + }); + + // build new request + for (var i in attributesCombinations) + for (var a in tab_attributes) + if (attributesCombinations[i]['id_attribute'] === tab_attributes[a]) + request += '/'+attributesCombinations[i]['group'] + '-' + attributesCombinations[i]['attribute']; + request = request.replace(request.substring(0, 1), '#/'); + url = window.location + ''; + + // redirection + if (url.indexOf('#') != -1) + url = url.substring(0, url.indexOf('#')); + + // set ipa to the customization form + $('#customizationForm').attr('action', $('#customizationForm').attr('action') + request); + window.location = url + request; +} + +function initLocationChange(time) +{ + if(!time) time = 500; + setInterval(checkUrl, time); +} + +function checkUrl() +{ + if (original_url != window.location || first_url_check) + { + first_url_check = false; + url = window.location + ''; + // if we need to load a specific combination + if (url.indexOf('#/') != -1) + { + // get the params to fill from a "normal" url + params = url.substring(url.indexOf('#') + 1, url.length); + tabParams = params.split('/'); + tabValues = []; + if (tabParams[0] == '') + tabParams.shift(); + for (var i in tabParams) + tabValues.push(tabParams[i].split('-')); + product_id = $('#product_page_product_id').val(); + // fill html with values + $('.color_pick').removeClass('selected'); + $('.color_pick').parent().parent().children().removeClass('selected'); + count = 0; + for (var z in tabValues) + for (var a in attributesCombinations) + if (attributesCombinations[a]['group'] === decodeURIComponent(tabValues[z][0]) + && attributesCombinations[a]['attribute'] === tabValues[z][1]) + { + count++; + // add class 'selected' to the selected color + $('#color_' + attributesCombinations[a]['id_attribute']).addClass('selected'); + $('#color_' + attributesCombinations[a]['id_attribute']).parent().addClass('selected'); + $('input:radio[value=' + attributesCombinations[a]['id_attribute'] + ']').attr('checked', true); + $('input:hidden[name=group_' + attributesCombinations[a]['id_attribute_group'] + ']').val(attributesCombinations[a]['id_attribute']); + $('select[name=group_' + attributesCombinations[a]['id_attribute_group'] + ']').val(attributesCombinations[a]['id_attribute']); + } + // find combination + if (count >= 0) + { + findCombination(false); + original_url = url; + } + // no combination found = removing attributes from url + else + window.location = url.substring(0, url.indexOf('#')); + } + } +} diff --git a/themes/default/mobile/order-detail.tpl b/themes/default/mobile/order-detail.tpl new file mode 100644 index 000000000..e6234555d --- /dev/null +++ b/themes/default/mobile/order-detail.tpl @@ -0,0 +1,297 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{capture assign='page_title'}{l s='Order'} {l s='#'}{$order->id|string_format:"%06d"}{/capture} +{include file='./page-title.tpl'} + +
+ +
+ {assign var='type_order' value="order"} + {if isset($opc) && $opc} + {assign var='type_order' value="order-opc"} + {/if} + id|intval}")|escape:'html'}" title="{l s='Reorder'}" data-ajax="false"> + {l s='Reorder'} + +
+
+ +
+

{l s='Order #%s - placed on' sprintf=$order->id|string_format:"%06d"} {dateFormat date=$order->date_add full=0}

+ + +
    + {if $carrier->id}
  • {l s='Carrier'} {if $carrier->name == "0"}{$shop_name|escape:'htmlall':'UTF-8'}{else}{$carrier->name|escape:'htmlall':'UTF-8'}{/if}
  • {/if} +
  • {l s='Payment method'} {$order->payment|escape:'htmlall':'UTF-8'}
  • + {if $invoice AND $invoiceAllowed} +
  • + + {l s='Download your invoice as a PDF file.'} +
  • + {/if} + {if $order->recyclable} +
  •  {l s='You have given permission to receive your order in recycled packaging.'}
  • + {/if} + {if $order->gift} +
  •  {l s='You have requested gift wrapping for this order.'}
  • +
  • {l s='Message'} {$order->gift_message|nl2br}
  • + {/if} +
+ +{if count($order_history)} +

{l s='Follow your order\'s status step-by-step'}

+
    + {foreach from=$order_history item=state name="orderStates"} +
  • + {$state.ostate_name|escape:'htmlall':'UTF-8'} + {dateFormat date=$state.date_add full=1} +
  • + {/foreach} +
+{/if} + + +{* > TO CHECK ==========================*} +{if isset($followup)} +

{l s='Click the following link to track the delivery of your order'}

+{$followup|escape:'htmlall':'UTF-8'} +{/if} +{* / TO CHECK ==========================*} + +

{l s='Addresses'}

+
+ +{* > TO CHECK ==========================*} +{if $invoice AND $invoiceAllowed} +

+ + {if $is_guest} + id}&secure_key=$order->secure_key")|escape:'html'}" >{l s='Download your invoice as a PDF file.'} + {else} + id}")|escape:'html'}" >{l s='Download your invoice as a PDF file.'} + {/if} +

+{/if} + +{if $order->recyclable && isset($isRecyclable) && $isRecyclable} +

 {l s='You have given permission to receive your order in recycled packaging.'}

+{/if} +{if $order->gift} +

 {l s='You have requested gift wrapping for this order.'}

+

{l s='Message'} {$order->gift_message|nl2br}

+{/if} +{* / TO CHECK ==========================*} + +
    + {if !$order->isVirtual()} +
  • {l s='Invoice'}
  • +
  • + {foreach from=$inv_adr_fields name=inv_loop item=field_item} + {if $field_item eq "company" && isset($address_invoice->company)}

    {$address_invoice->company|escape:'htmlall':'UTF-8'}

    + {elseif $field_item eq "address2" && $address_invoice->address2}

    {$address_invoice->address2|escape:'htmlall':'UTF-8'}

    + {elseif $field_item eq "phone_mobile" && $address_invoice->phone_mobile}

    {$address_invoice->phone_mobile|escape:'htmlall':'UTF-8'}

    + {else} + {assign var=address_words value=" "|explode:$field_item} +

    {foreach from=$address_words item=word_item name="word_loop"}{if !$smarty.foreach.word_loop.first} {/if}{$invoiceAddressFormatedValues[$word_item|replace:',':'']|escape:'htmlall':'UTF-8'}{/foreach}

    + {/if} + {/foreach} +
  • + {/if} +
  • {l s='Delivery'}
  • +
  • + {foreach from=$dlv_adr_fields name=dlv_loop item=field_item} + {if $field_item eq "company" && isset($address_delivery->company)}

    {$address_delivery->company|escape:'htmlall':'UTF-8'}

    + {elseif $field_item eq "address2" && $address_delivery->address2}

    {$address_delivery->address2|escape:'htmlall':'UTF-8'}

    + {elseif $field_item eq "phone_mobile" && $address_delivery->phone_mobile}

    {$address_delivery->phone_mobile|escape:'htmlall':'UTF-8'}

    + {else} + {assign var=address_words value=" "|explode:$field_item} +

    {foreach from=$address_words item=word_item name="word_loop"}{if !$smarty.foreach.word_loop.first} {/if}{$deliveryAddressFormatedValues[$word_item|replace:',':'']|escape:'htmlall':'UTF-8'}{/foreach}

    + {/if} + {/foreach} +
  • +
+
+ + +

{l s='Order details'}

+{* > TO CHECK ==========================*} +{*$HOOK_ORDERDETAILDISPLAYED*} +{* / TO CHECK ==========================*} +{if $return_allowed}

{l s='If you wish to return one or more products, please mark the corresponding boxes and provide an explanation for the return. When complete, click the button below.'}

{/if} +{if !$is_guest}
{/if} +
    +{foreach from=$products item=product name=products} + {if !isset($product.deleted)} + {assign var='productId' value=$product.product_id} + {assign var='productAttributeId' value=$product.product_attribute_id} + {if isset($product.customizedDatas)} + {assign var='productQuantity' value=$product.product_quantity-$product.customizationQuantityTotal} + {else} + {assign var='productQuantity' value=$product.product_quantity} + {/if} + {include file="./order-detail-product-li.tpl"} + {/if} +{/foreach} +{* > TO CHECK ==========================*} +{foreach from=$discounts item=discount} +
  • +

    {$discount.name|escape:'htmlall':'UTF-8'}

    +

    {l s='Voucher'} {$discount.name|escape:'htmlall':'UTF-8'}

    +

    1

    +

     

    +

    {if $discount.value != 0.00}{l s='-'}{/if}{convertPriceWithCurrency price=$discount.value currency=$currency}

    + {if $return_allowed} +

     

    + {/if} +
  • +{/foreach} +{* / TO CHECK ==========================*} + {if $priceDisplay && $use_tax} +
  • + {l s='Total products (tax excl.)'} {displayWtPriceWithCurrency price=$order->getTotalProductsWithoutTaxes() currency=$currency} +
  • + {/if} +
  • + {l s='Total products'} {if $use_tax}{l s='(tax incl.)'}{/if}: {displayWtPriceWithCurrency price=$order->getTotalProductsWithTaxes() currency=$currency} +
  • + {if $order->total_discounts > 0} +
  • + {l s='Total vouchers:'} {displayWtPriceWithCurrency price=$order->total_discounts currency=$currency convert=1} +
  • + {/if} + {if $order->total_wrapping > 0} +
  • + {l s='Total gift wrapping cost:'} {displayWtPriceWithCurrency price=$order->total_wrapping currency=$currency} +
  • + {/if} +
  • + {l s='Total shipping'} {if $use_tax}{l s='(tax incl.)'}{/if}: {displayWtPriceWithCurrency price=$order->total_shipping currency=$currency} +
  • +
  • + {l s='Total'} {displayWtPriceWithCurrency price=$order->total_paid currency=$currency} +
  • +
+ + +{if $order->getShipping()|count > 0} +

{l s='Carrier'}

+
    + {foreach from=$order->getShipping() item=line} +
  • +

    {$line.carrier_name}

    +

    {l s='Weight'} {$line.weight|string_format:"%.3f"} {Configuration::get('PS_WEIGHT_UNIT')}

    +

    {l s='Shipping cost'} {if $order->getTaxCalculationMethod() == $smarty.const.PS_TAX_INC}{displayPrice price=$line.shipping_cost_tax_incl currency=$currency->id}{else}{displayPrice price=$line.shipping_cost_tax_excl currency=$currency->id}{/if}

    +

    {l s='Tracking number'} {if $line.url && $line.tracking_number}{$line.tracking_number}{elseif $line.tracking_number != ''}{$line.tracking_number}{else}----{/if}

    + {$line.date_add} +
  • + {/foreach} +
+{/if} + +{* > TO CHECK ==========================*} +{if !$is_guest} + {if $return_allowed} +
+

{l s='Merchandise return'}

+

{l s='If you wish to return one or more products, please mark the corresponding boxes and provide an explanation for the return. When complete, click the button below.'}

+
+ +
+
+ + +
+
+
+ {/if} +
+ + {if count($messages)} +

{l s='Messages'}

+
+ + + + + + + + + {foreach from=$messages item=message name="messageList"} + + + + + {/foreach} + +
{l s='From'}{l s='Message'}
+ {if isset($message.ename) && $message.ename} + {$message.efirstname|escape:'htmlall':'UTF-8'} {$message.elastname|escape:'htmlall':'UTF-8'} + {elseif $message.clastname} + {$message.cfirstname|escape:'htmlall':'UTF-8'} {$message.clastname|escape:'htmlall':'UTF-8'} + {else} + {$shop_name|escape:'htmlall':'UTF-8'} + {/if} +
+ {dateFormat date=$message.date_add full=1} +
{$message.message|nl2br}
+
+ {/if} + {if isset($errors) && $errors} +
+

{if $errors|@count > 1}{l s='There are %d errors' sprintf=$errors|@count}{else}{l s='There is %d error' sprintf=$errors|@count}{/if} :

+
    + {foreach from=$errors key=k item=error} +
  1. {$error}
  2. + {/foreach} +
+
+ {/if} + {* / TO CHECK ==========================*} +
+

{l s='Add a message'}

+

{l s='If you would like to add a comment about your order, please write it in the field below.'}

+
+ + +
+
+ +
+ + +
+{else} +

 {l s='You cannot return merchandise with a guest account'}

+{/if} +
diff --git a/themes/default/modules/blocksearch/blocksearch.tpl b/themes/default/modules/blocksearch/blocksearch.tpl new file mode 100644 index 000000000..e4d2cc745 --- /dev/null +++ b/themes/default/modules/blocksearch/blocksearch.tpl @@ -0,0 +1,41 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + +
+

{l s='Search' mod='blocksearch'}

+ +
+{include file="$self/blocksearch-instantsearch.tpl"} + diff --git a/themes/default/modules/productcomments/productcomments.tpl b/themes/default/modules/productcomments/productcomments.tpl new file mode 100644 index 000000000..6560f5c5a --- /dev/null +++ b/themes/default/modules/productcomments/productcomments.tpl @@ -0,0 +1,160 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + +
+
+ {if $comments} + {foreach from=$comments item=comment} + {if $comment.content} +
+
+ {l s='Grade' mod='productcomments'}  +
+ {section name="i" start=0 loop=5 step=1} + {if $comment.grade le $smarty.section.i.index} +
+ {else} +
+ {/if} + {/section} +
+
+ {$comment.customer_name|escape:'html':'UTF-8'}
+ {dateFormat date=$comment.date_add|escape:'html':'UTF-8' full=0} +
+
+
+

{$comment.title}

+

{$comment.content|escape:'html':'UTF-8'|nl2br}

+
    + {if $comment.total_advice > 0} +
  • {l s='%1$d out of %2$d people found this review useful.' sprintf=[$comment.total_useful,$comment.total_advice] mod='productcomments'}
  • + {/if} + {if $logged == 1} + {if !$comment.customer_advice} +
  • {l s='Was this comment useful to you?' mod='productcomments'}
  • + {/if} + {if !$comment.customer_report} +
  • {l s='Report abuse' mod='productcomments'}
  • + {/if} + {/if} +
+
+
+ {/if} + {/foreach} + {if (!$too_early AND ($logged OR $allow_guests))} +

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

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

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

+ {else} +

{l s='No customer comments for the moment.' mod='productcomments'}

+ {/if} + {/if} +
+
+{if isset($product) && $product} + +
+
+
+

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

+ {if isset($product) && $product} +
+ {$product->name|escape:html:'UTF-8'} +
+

{$product->name}

+ {$product->description_short} +
+
+ {/if} +
+

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

+ + + + {if $criterions|@count > 0} +
    + {foreach from=$criterions item='criterion'} +
  • + +
    + + + + + +
    +
    +
  • + {/foreach} +
+ {/if} + + + + + + + + {if $allow_guests == true && $logged == 0} + + + {/if} + + +
+
+
+
+ +{/if} \ No newline at end of file diff --git a/themes/default/order-carrier.tpl b/themes/default/order-carrier.tpl new file mode 100644 index 000000000..af59cfe69 --- /dev/null +++ b/themes/default/order-carrier.tpl @@ -0,0 +1,314 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +{if !$opc} + +{else} + +{/if} + +{if isset($virtual_cart) && !$virtual_cart && $giftAllowed && $cart->gift == 1} + +{/if} + +{if !$opc} + {capture name=path}{l s='Shipping:'}{/capture} + {include file="$tpl_dir./breadcrumb.tpl"} +{/if} + +{if !$opc} +
+{else} +
+{/if} + +{if !$opc} +

{l s='Shipping:'}

+{else} +

2 {l s='Delivery methods'}

+{/if} + +{if !$opc} + {assign var='current_step' value='shipping'} + {include file="$tpl_dir./order-steps.tpl"} + + {include file="$tpl_dir./errors.tpl"} + +
+{else} +
+ +{/if} + +
+ +{if isset($virtual_cart) && $virtual_cart} + +{else} +

{l s='Choose your delivery method'}

+ +
+ {if isset($carriers) && isset($HOOK_BEFORECARRIER)} + {$HOOK_BEFORECARRIER} + {/if} +
+ {if isset($isVirtualCart) && $isVirtualCart} +

{l s='No carrier is needed for this order.'}

+ {else} + {if $recyclablePackAllowed} +

+ + +

+ {/if} +
+ {if isset($delivery_option_list)} + {foreach $delivery_option_list as $id_address => $option_list} +

+ {if isset($address_collection[$id_address])} + {l s='Choose a shipping option for this address:'} {$address_collection[$id_address]->alias} + {else} + {l s='Choose a shipping option'} + {/if} +

+
+ {foreach $option_list as $key => $option} +
+ + +
+ {/foreach} +
+
{if isset($HOOK_EXTRACARRIER_ADDR) && isset($HOOK_EXTRACARRIER_ADDR.$id_address)}{$HOOK_EXTRACARRIER_ADDR.$id_address}{/if}
+ {foreachelse} +

+ {foreach $cart->getDeliveryAddressesWithoutCarriers(true) as $address} + {if empty($address->alias)} + {l s='No carriers available.'} + {else} + {l s='No carriers available for the address "%s".' sprintf=$address->alias} + {/if} + {if !$address@last} +
+ {/if} + {foreachelse} + {l s='No carriers available.'} + {/foreach} +

+ {/foreach} + {/if} + +
+ + + {if $giftAllowed} +

{l s='Gift'}

+

+ gift == 1}checked="checked"{/if} autocomplete="off"/> + +
+       + {if $gift_wrapping_price > 0} + ({l s='Additional cost of'} + + {if $priceDisplay == 1}{convertPrice price=$total_wrapping_tax_exc_cost}{else}{convertPrice price=$total_wrapping_cost}{/if} + + {if $use_taxes}{if $priceDisplay == 1} {l s='(tax excl.)'}{else} {l s='(tax incl.)'}{/if}{/if}) + {/if} +

+

+ + +

+ {/if} + {/if} +{/if} + +{if $conditions AND $cms_id} +

{l s='Terms of service'}

+

+ + {l s='(Read the Terms of Service)'} +

+ +{/if} +
+ +{if !$opc} +

+ + + {if !$is_guest} + {if $back} + « {l s='Previous'} + {else} + « {l s='Previous'} + {/if} + {else} + « {l s='Previous'} + {/if} + {if isset($virtual_cart) && $virtual_cart || (isset($delivery_option_list) && !empty($delivery_option_list))} + + {/if} +

+ +{else} +

{l s='Leave a message'}

+
+

{l s='If you would like to add a comment about your order, please write it in the field below.'}

+

+
+
+{/if} +
diff --git a/themes/default/order-detail.tpl b/themes/default/order-detail.tpl new file mode 100644 index 000000000..67c002556 --- /dev/null +++ b/themes/default/order-detail.tpl @@ -0,0 +1,427 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +{if isset($order)} +
+
+ +

+ + {l s='Order Reference %s - placed on' sprintf=$order->getUniqReference()} {dateFormat date=$order->date_add full=0} +

+
+
+ +
+{if $carrier->id}

{l s='Carrier'} {if $carrier->name == "0"}{$shop_name|escape:'htmlall':'UTF-8'}{else}{$carrier->name|escape:'htmlall':'UTF-8'}{/if}

{/if} +

{l s='Payment method'} {$order->payment|escape:'htmlall':'UTF-8'}

+{if $invoice AND $invoiceAllowed} +

+ + {l s='Download your invoice as a PDF file.'} +

+{/if} +{if $order->recyclable} +

 {l s='You have given permission to receive your order in recycled packaging.'}

+{/if} +{if $order->gift} +

 {l s='You have requested gift wrapping for this order.'}

+

{l s='Message'} {$order->gift_message|nl2br}

+{/if} +
+ +{if count($order_history)} +

{l s='Follow your order\'s status step-by-step'}

+
+ + + + + + + + + {foreach from=$order_history item=state name="orderStates"} + + + + + {/foreach} + +
{l s='Date'}{l s='Status'}
{dateFormat date=$state.date_add full=1}{$state.ostate_name|escape:'htmlall':'UTF-8'}
+
+{/if} + +{if isset($followup)} +

{l s='Click the following link to track the delivery of your order'}

+{$followup|escape:'htmlall':'UTF-8'} +{/if} + +
+
+
    +
  • {l s='Billing'}
  • + {foreach from=$inv_adr_fields name=inv_loop item=field_item} + {if $field_item eq "company" && isset($address_invoice->company)}
  • {$address_invoice->company|escape:'htmlall':'UTF-8'}
  • + {elseif $field_item eq "address2" && $address_invoice->address2}
  • {$address_invoice->address2|escape:'htmlall':'UTF-8'}
  • + {elseif $field_item eq "phone_mobile" && $address_invoice->phone_mobile}
  • {$address_invoice->phone_mobile|escape:'htmlall':'UTF-8'}
  • + {else} + {assign var=address_words value=" "|explode:$field_item} +
  • {foreach from=$address_words item=word_item name="word_loop"}{if !$smarty.foreach.word_loop.first} {/if}{$invoiceAddressFormatedValues[$word_item|replace:',':'']|escape:'htmlall':'UTF-8'}{/foreach}
  • + {/if} + + {/foreach} +
+
    isVirtual()}style="display:none;"{/if}> +
  • {l s='Delivery'}
  • + {foreach from=$dlv_adr_fields name=dlv_loop item=field_item} + {if $field_item eq "company" && isset($address_delivery->company)}
  • {$address_delivery->company|escape:'htmlall':'UTF-8'}
  • + {elseif $field_item eq "address2" && $address_delivery->address2}
  • {$address_delivery->address2|escape:'htmlall':'UTF-8'}
  • + {elseif $field_item eq "phone_mobile" && $address_delivery->phone_mobile}
  • {$address_delivery->phone_mobile|escape:'htmlall':'UTF-8'}
  • + {else} + {assign var=address_words value=" "|explode:$field_item} +
  • {foreach from=$address_words item=word_item name="word_loop"}{if !$smarty.foreach.word_loop.first} {/if}{$deliveryAddressFormatedValues[$word_item|replace:',':'']|escape:'htmlall':'UTF-8'}{/foreach}
  • + {/if} + {/foreach} +
+
+{$HOOK_ORDERDETAILDISPLAYED} +{if !$is_guest}
{/if} +
+ + + + {if $return_allowed}{/if} + + + + {if $order->hasProductReturned()} + + {/if} + + + + + + {if $priceDisplay && $use_tax} + + + + {/if} + + + + {if $order->total_discounts > 0} + + + + {/if} + {if $order->total_wrapping > 0} + + + + {/if} + + + + + + + + + {foreach from=$products item=product name=products} + {if !isset($product.deleted)} + {assign var='productId' value=$product.product_id} + {assign var='productAttributeId' value=$product.product_attribute_id} + {if isset($product.customizedDatas)} + {assign var='productQuantity' value=$product.product_quantity-$product.customizationQuantityTotal} + {else} + {assign var='productQuantity' value=$product.product_quantity} + {/if} + + {if isset($product.customizedDatas)} + + {if $return_allowed}{/if} + + + + {if $order->hasProductReturned()} + + {/if} + + + + {foreach $product.customizedDatas as $customizationPerAddress} + {foreach $customizationPerAddress as $customizationId => $customization} + + {if $return_allowed}{/if} + + + + + {/foreach} + {/foreach} + {/if} + + {if $product.product_quantity > $product.customizationQuantityTotal} + + {if $return_allowed}{/if} + + + + {if $order->hasProductReturned()} + + {/if} + + + + {/if} + {/if} + {/foreach} + {foreach from=$discounts item=discount} + + + + + + + {if $return_allowed} + + {/if} + + {/foreach} + +
{l s='Reference'}{l s='Product'}{l s='Quantity'}{l s='Returned'}{l s='Unit price'}{l s='Total price'}
+ {l s='Total products (tax excl.)'} {displayWtPriceWithCurrency price=$order->getTotalProductsWithoutTaxes() currency=$currency} +
+ {l s='Total products'} {if $use_tax}{l s='(tax incl.)'}{/if}: {displayWtPriceWithCurrency price=$order->getTotalProductsWithTaxes() currency=$currency} +
+ {l s='Total vouchers:'} {displayWtPriceWithCurrency price=$order->total_discounts currency=$currency convert=1} +
+ {l s='Total gift wrapping cost:'} {displayWtPriceWithCurrency price=$order->total_wrapping currency=$currency} +
+ {l s='Total shipping'} {if $use_tax}{l s='(tax incl.)'}{/if}: {displayWtPriceWithCurrency price=$order->total_shipping currency=$currency} +
+ {l s='Total'} {displayWtPriceWithCurrency price=$order->total_paid currency=$currency} +
+ + + {$product['qty_returned']} + + + + +
+ {foreach from=$customization.datas key='type' item='datas'} + {if $type == $CUSTOMIZE_FILE} +
    + {foreach from=$datas item='data'} +
  • + {/foreach} +
+ {elseif $type == $CUSTOMIZE_TEXTFIELD} +
    {counter start=0 print=false} + {foreach from=$datas item='data'} + {assign var='customizationFieldName' value="Text #"|cat:$data.id_customization_field} +
  • {$data.name|default:$customizationFieldName} : {$data.value}
  • + {/foreach} +
+ {/if} + {/foreach} +
+ +
+ + + {$product['qty_returned']} + + + + +
{$discount.name|escape:'htmlall':'UTF-8'}{l s='Voucher'} {$discount.name|escape:'htmlall':'UTF-8'}1 {if $discount.value != 0.00}-{/if}{convertPriceWithCurrency price=$discount.value currency=$currency} 
+
+ {if $return_allowed} +
+

{l s='Merchandise return'}

+

{l s='If you wish to return one or more products, please mark the corresponding boxes and provide an explanation for the return. When complete, click the button below.'}

+

+ +

+

+ + +

+
+
+ {/if} +
+
+{if $order->getShipping()|count > 0} + + + + + + + + + + + + {foreach from=$order->getShipping() item=line} + + + + + + + + {/foreach} + +
{l s='Date'}{l s='Carrier'}{l s='Weight'}{l s='Shipping cost'}{l s='Tracking number'}
{dateFormat date=$line.date_add full=0}{$line.carrier_name}{if $line.weight > 0}{$line.weight|string_format:"%.3f"} {Configuration::get('PS_WEIGHT_UNIT')}{else}-{/if}{if $order->getTaxCalculationMethod() == $smarty.const.PS_TAX_INC}{displayPrice price=$line.shipping_cost_tax_incl currency=$currency->id}{else}{displayPrice price=$line.shipping_cost_tax_excl currency=$currency->id}{/if} + {if $line.tracking_number}{if $line.url && $line.tracking_number}{$line.tracking_number}{else}{$line.tracking_number}{/if}{else}-{/if} +
+{/if} +
+
+{if !$is_guest} + {if count($messages)} +

{l s='Messages'}

+
+ + + + + + + + + {foreach from=$messages item=message name="messageList"} + + + + + {/foreach} + +
{l s='From'}{l s='Message'}
+ {if isset($message.elastname) && $message.elastname} + {$message.efirstname|escape:'htmlall':'UTF-8'} {$message.elastname|escape:'htmlall':'UTF-8'} + {elseif $message.clastname} + {$message.cfirstname|escape:'htmlall':'UTF-8'} {$message.clastname|escape:'htmlall':'UTF-8'} + {else} + {$shop_name|escape:'htmlall':'UTF-8'} + {/if} +
+ {dateFormat date=$message.date_add full=1} +
{$message.message|escape:'htmlall':'UTF-8'|nl2br}
+
+ {/if} + {if isset($errors) && $errors} +
+

{if $errors|@count > 1}{l s='There are %d errors' sprintf=$errors|@count}{else}{l s='There is %d error' sprintf=$errors|@count}{/if}

+
    + {foreach from=$errors key=k item=error} +
  1. {$error}
  2. + {/foreach} +
+
+ {/if} + {if isset($message_confirmation) && $message_confirmation} +

+ {l s='Message successfully sent'} +

+ {/if} +
+

{l s='Add a message'}

+

{l s='If you would like to add a comment about your order, please write it in the field below.'}

+

+ + +

+

+ +

+

+ + +

+
+{else} +

 {l s='You cannot return merchandise with a guest account'}

+{/if} +{/if} \ No newline at end of file diff --git a/themes/default/order-opc-new-account.tpl b/themes/default/order-opc-new-account.tpl new file mode 100644 index 000000000..7d452cb38 --- /dev/null +++ b/themes/default/order-opc-new-account.tpl @@ -0,0 +1,428 @@ +
+ +

1 {l s='Account'}

+
+
+

{l s='Already registered?'}

+

» {l s='Click here'}

+ +
+
+
+
+

{l s='New Customer'}

+
+
+

{l s='Instant Checkout'}

+

+ +

+
+ +
+

{l s='Create your account today and enjoy:'}

+
    +
  • {l s='Personalized and secure access'}
  • +
  • {l s='A fast and easy check out process'}
  • +
  • {l s='Separate billing and shipping addresses'}
  • +
+

+ +

+
+
+
+
+ {$HOOK_CREATE_ACCOUNT_TOP} + + + + + + + + + +

+ + +

+

+ + + {l s='(five characters min.)'} +

+

+ {l s='Title'} + {foreach from=$genders key=k item=gender} + id_gender}checked="checked"{/if} /> + + {/foreach} +

+

+ + +

+

+ + +

+

+ {l s='Date of Birth'} + + {* + {l s='January'} + {l s='February'} + {l s='March'} + {l s='April'} + {l s='May'} + {l s='June'} + {l s='July'} + {l s='August'} + {l s='September'} + {l s='October'} + {l s='November'} + {l s='December'} + *} + + +

+ {if isset($newsletter) && $newsletter} +

+ + +

+

+ + +

+ {/if} +

{l s='Delivery address'}

+ {$stateExist = false} + {$postCodeExist = false} + {$dniExist = false} + {foreach from=$dlv_all_fields item=field_name} + {if $field_name eq "company" && $b2b_enable} +

+ + +

+ {elseif $field_name eq "vat_number"} + + {elseif $field_name eq "dni"} + {assign var='dniExist' value=true} +

+ + + {l s='DNI / NIF / NIE'} +

+ {elseif $field_name eq "firstname"} +

+ + +

+ {elseif $field_name eq "lastname"} +

+ + +

+ {elseif $field_name eq "address1"} +

+ + +

+ {elseif $field_name eq "address2"} +

+ + +

+ {elseif $field_name eq "postcode"} + {$postCodeExist = true} +

+ + +

+ {elseif $field_name eq "city"} +

+ + +

+ {elseif $field_name eq "country" || $field_name eq "Country:name"} +

+ + +

+ {elseif $field_name eq "state" || $field_name eq 'State:name'} + {$stateExist = true} + + {/if} + {/foreach} + {if !$postCodeExist} + + {/if} + {if !$stateExist} + + {/if} + {if !$dniExist} +

+ + + {l s='DNI / NIF / NIE'} +

+ {/if} +

+ + +

+ {if isset($one_phone_at_least) && $one_phone_at_least} +

{l s='You must register at least one phone number.'}

+ {/if} +

+ + +

+

+ + +

+ + +

+ + +

+ +
+ {assign var=stateExist value=false} + {assign var=postCodeExist value=false} + {assign var=dniExist value=false} +

{l s='Invoice address'}

+ {foreach from=$inv_all_fields item=field_name} + {if $field_name eq "company" && $b2b_enable} +

+ + +

+ {elseif $field_name eq "vat_number"} + + {elseif $field_name eq "dni"} + {assign var='dniExist' value=true} +

+ + + {l s='DNI / NIF / NIE'} +

+ {elseif $field_name eq "firstname"} +

+ + +

+ {elseif $field_name eq "lastname"} +

+ + +

+ {elseif $field_name eq "address1"} +

+ + +

+ {elseif $field_name eq "address2"} +

+ + +

+ {elseif $field_name eq "postcode"} + {$postCodeExist = true} +

+ + +

+ {elseif $field_name eq "city"} +

+ + +

+ {elseif $field_name eq "country" || $field_name eq "Country:name"} +

+ + +

+ {elseif $field_name eq "state" || $field_name eq 'State:name'} + {$stateExist = true} + + {/if} + {/foreach} + {if !$postCodeExist} + + {/if} + {if !$stateExist} + + {/if} + {if !$dniExist} +

+ + + {l s='DNI / NIF / NIE'} +

+ {/if} +

+ + +

+ {if isset($one_phone_at_least) && $one_phone_at_least} +

{l s='You must register at least one phone number.'}

+ {/if} +

+ + +

+

+ + +

+ +
+ {$HOOK_CREATE_ACCOUNT_FORM} +

+ +

+ +

+ *{l s='Required field'} +

+ +
+
+
+
+
diff --git a/themes/default/product.tpl b/themes/default/product.tpl new file mode 100644 index 000000000..9c3c0e6da --- /dev/null +++ b/themes/default/product.tpl @@ -0,0 +1,647 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{include file="$tpl_dir./errors.tpl"} +{if $errors|@count == 0} + + +{include file="$tpl_dir./breadcrumb.tpl"} +
+ + {if isset($adminActionDisplay) && $adminActionDisplay} +
+

{l s='This product is not visible to your customers.'} + + + +

+

+

+
+ {/if} + + {if isset($confirmation) && $confirmation} +

+ {$confirmation} +

+ {/if} + + +
+ +
+ {if $have_image} + + {if !empty($cover.legend)}{$cover.legend|escape:'htmlall':'UTF-8'}{else}{$product->name|escape:'htmlall':'UTF-8'}{/if} + {l s='Maximize'} + + {else} + + + {l s='Maximize'} + + {/if} +
+ {if isset($images) && count($images) > 0} + +
+ {if isset($images) && count($images) > 3}{/if} +
+
    + {if isset($images)} + {foreach from=$images item=image name=thumbnails} + {assign var=imageIds value="`$product->id`-`$image.id_image`"} + {if !empty($image.legend)} + {assign var=imageTitlte value=$image.legend|escape:'htmlall':'UTF-8'} + {else} + {assign var=imageTitlte value=$product->name|escape:'htmlall':'UTF-8'} + {/if} +
  • + + {$imageTitlte} + +
  • + {/foreach} + {/if} +
+
+ {if isset($images) && count($images) > 3}{l s='Next'}{/if} +
+ {/if} + {if isset($images) && count($images) > 1}

{/if} + + +
+ + +
+

{$product->name|escape:'htmlall':'UTF-8'}

+ + {if $product->description_short OR $packItems|@count > 0} +
+ {if $product->description_short} +
{$product->description_short}
+ {/if} + {if $product->description} +

{l s='More details'}

+ {/if} + {if $packItems|@count > 0} +
+

{l s='Pack content'}

+ {foreach from=$packItems item=packItem} +
+ {$packItem.pack_quantity} x {$packItem.name|escape:'htmlall':'UTF-8'} +

{$packItem.description_short}

+
+ {/foreach} +
+ {/if} +
+ {/if} + + {*{if isset($colors) && $colors} + +
+

{l s='Pick a color:' js=1}

+
+ +
+
+ {/if}*} + + {if ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)} + +
quantity > 0}class="hidden"{/if} action="{$link->getPageLink('cart')|escape:'html'}" method="post"> + + + + +
+ {if isset($groups)} + +
+
+ {foreach from=$groups key=id_attribute_group item=group} + {if $group.attributes|@count} +
+ + {assign var="groupName" value="group_$id_attribute_group"} +
+ {if ($group.group_type == 'select')} + + {elseif ($group.group_type == 'color')} + + + {elseif ($group.group_type == 'radio')} +
    + {foreach from=$group.attributes key=id_attribute item=group_attribute} +
  • + + {$group_attribute|escape:'htmlall':'UTF-8'} +
  • + {/foreach} +
+ {/if} +
+
+ {/if} + {/foreach} +
+ {/if} +

reference}style="display: none;"{/if}> + + {$product->reference|escape:'htmlall':'UTF-8'} +

+ + +

quantity <= 0) OR $virtual OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}> + + minimal_quantity > 1}onkeyup="checkMinimalQuantity({$product->minimal_quantity});"{/if} /> +

+ + +

minimal_quantity <= 1 OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}> + {l s='This product is not sold individually. You must select at least'} {$product->minimal_quantity} {l s='quantity for this product.'} +

+ {if $product->minimal_quantity > 1} + + {/if} + + +

quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product->quantity > 0 && !$product->available_now) OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}> + {l s='Availability:'} + quantity <= 0} class="warning_inline"{/if}>{if $product->quantity <= 0}{if $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if} +

+

quantity > 0) OR !$product->available_for_order OR $PS_CATALOG_MODE OR !isset($product->available_date) OR $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}> + {l s='Availability date:'} + {dateFormat date=$product->available_date full=false} +

+ + {if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)} +

quantity <= 0} style="display: none;"{/if}> + {$product->quantity|intval} + quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='Item in stock'} + quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='Items in stock'} +

+ {/if} + + +
quantity > 0} style="display: none;"{/if}> + {$HOOK_PRODUCT_OOS} +
+ +

quantity > $last_qties OR $product->quantity <= 0) OR $allow_oosp OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none"{/if} >{l s='Warning: Last items in stock!'}

+
+ +
+ + {if $product->show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE} + + {if $product->online_only} +

{l s='Online only'}

+ {/if} + +
+

+ {if $priceDisplay >= 0 && $priceDisplay <= 2} + {convertPrice price=$productPrice} + + {/if} +

+ + {if $product->on_sale} + {l s='On sale'} + {l s='On sale!'} + {elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutReduction > $productPrice} + {l s='Reduced price!'} + {/if} + {if $priceDisplay == 2} +
+ {convertPrice price=$product->getPrice(false, $smarty.const.NULL)} {l s='tax excl.'} + {/if} +
+

specificPrice OR $product->specificPrice.reduction_type != 'percentage'} style="display:none;"{/if}>{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100}%{/if}

+

specificPrice OR $product->specificPrice.reduction_type != 'amount' || $product->specificPrice.reduction|intval ==0} style="display:none"{/if}> + + {if $product->specificPrice AND $product->specificPrice.reduction_type == 'amount' AND $product->specificPrice.reduction|intval !=0} + -{convertPrice price=$productPriceWithoutReduction-$productPrice|floatval} + {/if} + +

+

specificPrice || !$product->specificPrice.reduction} class="hidden"{/if}> + {if $priceDisplay >= 0 && $priceDisplay <= 2} + {if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction}{/if} + + {/if} +

+ {if $packItems|@count && $productPrice < $product->getNoPackPrice()} +

{l s='Instead of'} {convertPrice price=$product->getNoPackPrice()}

+
+ {/if} + {if $product->ecotax != 0} +

{l s='Include'} {if $priceDisplay == 2}{$ecotax_tax_exc|convertAndFormatPrice}{else}{$ecotax_tax_inc|convertAndFormatPrice}{/if} {l s='For green tax'} + {if $product->specificPrice AND $product->specificPrice.reduction} +
{l s='(not impacted by the discount)'} + {/if} +

+ {/if} + {if !empty($product->unity) && $product->unit_price_ratio > 0.000000} + {math equation="pprice / punit_price" pprice=$productPrice punit_price=$product->unit_price_ratio assign=unit_price} +

{convertPrice price=$unit_price} {l s='per'} {$product->unity|escape:'htmlall':'UTF-8'}

+ {/if} + {*close if for show price*} + {/if} +

quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}style="display:none"{/if} class="buttons_bottom_block"> + + +

+ {if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if} + +
+
+
+ {/if} + {if isset($HOOK_EXTRA_RIGHT) && $HOOK_EXTRA_RIGHT}{$HOOK_EXTRA_RIGHT}{/if} +
+
+ +{if (isset($quantity_discounts) && count($quantity_discounts) > 0)} + + +
+ + + + + + + + + + {foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'} + + + + + + {/foreach} + +
{l s='Product'}{l s='From (qty)'}{if Configuration::get('PS_DISPLAY_DISCOUNT_PRICE')}{l s='Price'}{else}{l s='Discount'}{/if}
+ {if (isset($quantity_discount.attributes) && ($quantity_discount.attributes))} + {$product->getProductName($quantity_discount.id_product, $quantity_discount.id_product_attribute)} + {else} + {$product->getProductName($quantity_discount.id_product)} + {/if} + {$quantity_discount.quantity|intval} + {if $quantity_discount.price >= 0 OR $quantity_discount.reduction_type == 'amount'} + {if Configuration::get('PS_DISPLAY_DISCOUNT_PRICE')} + {convertPrice price=$productPrice-$quantity_discount.real_value|floatval} + {else} + -{convertPrice price=$quantity_discount.real_value|floatval} + {/if} + {else} + {if Configuration::get('PS_DISPLAY_DISCOUNT_PRICE')} + {convertPrice price = $productPrice-($productPrice*$quantity_discount.reduction)|floatval} + {else} + -{$quantity_discount.real_value|floatval}% + {/if} + {/if} +
+
+{/if} +{if isset($HOOK_PRODUCT_FOOTER) && $HOOK_PRODUCT_FOOTER}{$HOOK_PRODUCT_FOOTER}{/if} + + +{if (isset($product) && $product->description) || (isset($features) && $features) || (isset($accessories) && $accessories) || (isset($HOOK_PRODUCT_TAB) && $HOOK_PRODUCT_TAB) || (isset($attachments) && $attachments) || isset($product) && $product->customizable} +
+ +
+ {if isset($product) && $product->description} + +
{$product->description}
+ {/if} + {if isset($features) && $features} + +
    + {foreach from=$features item=feature} + {if isset($feature.value)} +
  • {$feature.name|escape:'htmlall':'UTF-8'} {$feature.value|escape:'htmlall':'UTF-8'}
  • + {/if} + {/foreach} +
+ {/if} + {if isset($attachments) && $attachments} + + {/if} + {if isset($accessories) AND $accessories} + +
+
+
+
    + {foreach from=$accessories item=accessory name=accessories_list} + {if ($accessory.allow_oosp || $accessory.quantity_all_versions > 0 || $accessory.quantity > 0) AND $accessory.available_for_order AND !isset($restricted_country_mode)} + {assign var='accessoryLink' value=$link->getProductLink($accessory.id_product, $accessory.link_rewrite, $accessory.category)} +
  • +

    + {$accessory.name|escape:'htmlall':'UTF-8'} + {if $accessory.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE} - {if $priceDisplay != 1}{displayWtPrice p=$accessory.price}{else}{displayWtPrice p=$accessory.price_tax_exc}{/if}{/if} +

    + + +

    + {l s='View'} + {if !$PS_CATALOG_MODE && ($accessory.allow_oosp || $accessory.quantity > 0)} + {l s='Add to cart'} + {/if} +

    + +
  • + {/if} + {/foreach} +
+
+
+
+ {/if} + + + {if isset($product) && $product->customizable} +
+
+

+ {l s='After saving your customized product, remember to add it to your cart.'} + {if $product->uploadable_files}
{l s='Allowed file formats are: GIF, JPG, PNG'}{/if} +

+ {if $product->uploadable_files|intval} +
+

{l s='Pictures'}

+
    + {counter start=0 assign='customizationField'} + {foreach from=$customizationFields item='field' name='customizationFields'} + {if $field.type == 0} +
  • {assign var='key' value='pictures_'|cat:$product->id|cat:'_'|cat:$field.id_customization_field} + {if isset($pictures.$key)} +
    + + + {l s='Delete'} + +
    + {/if} +
    + + +
    +
  • + {counter} + {/if} + {/foreach} +
+
+ {/if} + {if $product->text_fields|intval} +
+

{l s='Text'}

+
    + {counter start=0 assign='customizationField'} + {foreach from=$customizationFields item='field' name='customizationFields'} + {if $field.type == 1} +
  • + + +
  • + {counter} + {/if} + {/foreach} +
+
+ {/if} +

+ + + + +

+
+

* {l s='required fields'}

+
+ {/if} + + {if isset($HOOK_PRODUCT_TAB_CONTENT) && $HOOK_PRODUCT_TAB_CONTENT}{$HOOK_PRODUCT_TAB_CONTENT}{/if} +
+
+{/if} +{if isset($packItems) && $packItems|@count > 0} +
+

{l s='Pack content'}

+ {include file="$tpl_dir./product-list.tpl" products=$packItems} +
+{/if} +{/if} diff --git a/tools/json/json.php b/tools/json/json.php index 0f31d8c0d..6e48eac6a 100644 --- a/tools/json/json.php +++ b/tools/json/json.php @@ -801,4 +801,4 @@ if (class_exists('PEAR_Error')) { } } -} \ No newline at end of file +} diff --git a/tools/profiling/Controller.php b/tools/profiling/Controller.php index de8b4d5ed..a6d8f3108 100644 --- a/tools/profiling/Controller.php +++ b/tools/profiling/Controller.php @@ -176,7 +176,6 @@ abstract class Controller extends ControllerCore public function __construct() { - parent::__construct(); // error management set_error_handler('developpementErrorHandler'); @@ -469,13 +468,19 @@ abstract class Controller extends ControllerCore echo '
Useless GROUP BY need to be removed'; } } - echo '
-
-

Doubles (IDs replaced by "XX") (total = '.count(Db::getInstance()->uniqQueries).')

'; $queries = Db::getInstance()->uniqQueries; arsort($queries); + $count = count(Db::getInstance()->uniqQueries); + foreach ($queries as $q => &$nb) + if ($nb == 1) + $count--; + if ($count) + echo '
+
+

Doubles (IDs replaced by "XX") (total = '.$count.')

'; foreach ($queries as $q => $nb) - echo $hr.'getQueryColor($nb).'>'.$nb.' '.$q; + if($nb > 1) + echo $hr.'getQueryColor($nb).'>'.$nb.' '.$q; echo '

Tables stress

'; diff --git a/translations/en.gzip b/translations/en.gzip index e9ba5fcc8..1ac076243 100644 Binary files a/translations/en.gzip and b/translations/en.gzip differ diff --git a/translations/fr.gzip b/translations/fr.gzip index 960058ab7..ba6acc90a 100644 Binary files a/translations/fr.gzip and b/translations/fr.gzip differ