diff --git a/classes/Cart.php b/classes/Cart.php index 1afc74b67..41a7e1d24 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -1591,9 +1591,9 @@ class CartCore extends ObjectModel */ public function getPackageList($flush = false) { - static $cache = false; - if ($cache !== false && !$flush) - return $cache; + static $cache = array(); + if (isset($cache[(int)$this->id]) && $cache[(int)$this->id] !== false && !$flush) + return $cache[(int)$this->id]; $product_list = $this->getProducts(); // Step 1 : Get product informations (warehouse_list and carrier_list), count warehouse @@ -1821,7 +1821,7 @@ class CartCore extends ObjectModel ); } } - $cache = $final_package_list; + $cache[(int)$this->id] = $final_package_list; return $final_package_list; } diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index 4b6c0503f..14dc91682 100755 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -721,7 +721,9 @@ class FrontControllerCore extends Controller $this->setMobileMedia(); return true; } - $this->addCSS(_THEME_CSS_DIR_.'grid_prestashop.css', 'all'); + + if (Tools::file_exists_cache(_PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, _THEME_CSS_DIR_.'grid_prestashop.css'))) + $this->addCSS(_THEME_CSS_DIR_.'grid_prestashop.css', 'all'); $this->addCSS(_THEME_CSS_DIR_.'global.css', 'all'); $this->addjquery(); $this->addjqueryPlugin('easing'); diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php index 8d3d68d5c..b678cc1d4 100644 --- a/controllers/admin/AdminCustomerThreadsController.php +++ b/controllers/admin/AdminCustomerThreadsController.php @@ -458,7 +458,7 @@ class AdminCustomerThreadsControllerCore extends AdminController $extension = false; foreach ($extensions as $key => $val) - if (substr($filename, -4) == $key || substr($filename, -5) == $key) + if (substr(Tools::strtolower($filename), -4) == $key || substr(Tools::strtolower($filename), -5) == $key) { $extension = $val; break; diff --git a/controllers/admin/AdminMetaController.php b/controllers/admin/AdminMetaController.php index a268098ff..6a08f8bc7 100644 --- a/controllers/admin/AdminMetaController.php +++ b/controllers/admin/AdminMetaController.php @@ -66,7 +66,7 @@ class AdminMetaControllerCore extends AdminController ), 'PS_ALLOW_ACCENTED_CHARS_URL' => array( 'title' => $this->l('Accented URL'), - 'desc' => $this->l('Enable if you want to allow accented characters in your friendly URLs.'), + 'desc' => $this->l('Enable if you want to allow accented characters in your friendly URLs.').' '.$this->l('You should only activate this option if you are using non-latin characters ; for all the latin charsets, your SEO will be better without this option.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool' diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index 713d8bd1d..598258a8d 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -57,7 +57,7 @@ class ContactControllerCore extends FrontController $this->errors[] = Tools::displayError('Please select a subject from the list provided. '); else if (!empty($_FILES['fileUpload']['name']) && $_FILES['fileUpload']['error'] != 0) $this->errors[] = Tools::displayError('An error occurred during the file-upload process.'); - else if (!empty($_FILES['fileUpload']['name']) && !in_array(substr($_FILES['fileUpload']['name'], -4), $extension) && !in_array(substr($_FILES['fileUpload']['name'], -5), $extension)) + else if (!empty($_FILES['fileUpload']['name']) && !in_array(substr(Tools::strtolower($_FILES['fileUpload']['name']), -4), $extension) && !in_array(substr(Tools::strtolower($_FILES['fileUpload']['name']), -5), $extension)) $this->errors[] = Tools::displayError('Bad file extension'); else { diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 202801041..989c59ee3 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -340,26 +340,39 @@ class ProductControllerCore extends FrontController { $images = $this->product->getImages((int)$this->context->cookie->id_lang); $product_images = array(); + + if(isset($images[0])) + $this->context->smarty->assign('mainImage', $images[0]); foreach ($images as $k => $image) { if ($image['cover']) { - $this->context->smarty->assign('mainImage', $images[0]); + $this->context->smarty->assign('mainImage', $image); $cover = $image; $cover['id_image'] = (Configuration::get('PS_LEGACY_IMAGES') ? ($this->product->id.'-'.$image['id_image']) : $image['id_image']); $cover['id_image_only'] = (int)$image['id_image']; } $product_images[(int)$image['id_image']] = $image; } + if (!isset($cover)) - $cover = array( - 'id_image' => $this->context->language->iso_code.'-default', - 'legend' => 'No picture', - 'title' => 'No picture' + { + if(isset($images[0])) + { + $cover = $images[0]; + $cover['id_image'] = (Configuration::get('PS_LEGACY_IMAGES') ? ($this->product->id.'-'.$images[0]['id_image']) : $images[0]['id_image']); + $cover['id_image_only'] = (int)$images[0]['id_image']; + } + else + $cover = array( + 'id_image' => $this->context->language->iso_code.'-default', + 'legend' => 'No picture', + 'title' => 'No picture' ); + } $size = Image::getSize(ImageType::getFormatedName('large')); $this->context->smarty->assign(array( - 'have_image' => Product::getCover((int)Tools::getValue('id_product')), + 'have_image' => isset($cover['id_image'])? array((int)$cover['id_image']) : Product::getCover((int)Tools::getValue('id_product')), 'cover' => $cover, 'imgWidth' => (int)$size['width'], 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), @@ -432,11 +445,37 @@ class ProductControllerCore extends FrontController else $combinations[$row['id_product_attribute']]['available_date'] = ''; - if (isset($combination_images[$row['id_product_attribute']][0]['id_image'])) - $combinations[$row['id_product_attribute']]['id_image'] = $combination_images[$row['id_product_attribute']][0]['id_image']; - else + if (!isset($combination_images[$row['id_product_attribute']][0]['id_image'])) $combinations[$row['id_product_attribute']]['id_image'] = -1; + else + { + $combinations[$row['id_product_attribute']]['id_image'] = $id_image = (int)$combination_images[$row['id_product_attribute']][0]['id_image']; + if ($row['default_on'] && $id_image > 0) + { + if (isset($this->context->smarty->tpl_vars['images']->value)) + $product_images = $this->context->smarty->tpl_vars['images']->value; + if (is_array($product_images) && isset($product_images[$id_image])) + { + $product_images[$id_image]['cover'] = 1; + $this->context->smarty->assign('mainImage', $product_images[$id_image]); + if (count($product_images)) + $this->context->smarty->assign('images', $product_images); + } + if (isset($this->context->smarty->tpl_vars['cover']->value)) + $cover = $this->context->smarty->tpl_vars['cover']->value; + if (is_array($cover) && is_array($product_images)) + { + $product_images[$cover['id_image']]['cover'] = 0; + if (isset($product_images[$id_image])) + $cover = $product_images[$id_image]; + $cover['id_image'] = (Configuration::get('PS_LEGACY_IMAGES') ? ($this->product->id.'-'.$id_image) : (int)$id_image); + $cover['id_image_only'] = (int)$id_image; + $this->context->smarty->assign('cover', $cover); + } + } + } } + // wash attributes list (if some attributes are unavailables and if allowed to wash it) if (!Product::isAvailableWhenOutOfStock($this->product->out_of_stock) && Configuration::get('PS_DISP_UNAVAILABLE_ATTR') == 0) { @@ -616,4 +655,4 @@ class ProductControllerCore extends FrontController } return $specific_prices; } -} +} \ No newline at end of file diff --git a/modules/sendtoafriend/sendtoafriend-extra.tpl b/modules/sendtoafriend/sendtoafriend-extra.tpl index cd2f84f35..f7439b9cd 100644 --- a/modules/sendtoafriend/sendtoafriend-extra.tpl +++ b/modules/sendtoafriend/sendtoafriend-extra.tpl @@ -45,7 +45,7 @@ $('document').ready(function(){ {/literal}url: "{$module_dir}sendtoafriend_ajax.php",{literal} type: "POST", headers: {"cache-control": "no-cache"}, - data: {action: 'sendToMyFriend', secure_key: '{/literal}{$stf_secure_key}{literal}', friend: JSON.stringify(datas)},{/literal}{literal} + data: {action: 'sendToMyFriend', secure_key: '{/literal}{$stf_secure_key}{literal}', friend: unescape(JSON.stringify(datas).replace(/u/g, '%u'))},{/literal}{literal} dataType: "json", success: function(result){ $.fancybox.close(); diff --git a/themes/default/css/global.css b/themes/default/css/global.css index 65080eac9..a85048f2e 100644 --- a/themes/default/css/global.css +++ b/themes/default/css/global.css @@ -261,6 +261,7 @@ table.table_block { border:1px solid #999; border-bottom:none; background:white; + border-collapse:inherit } table.std th, table.table_block th { @@ -804,6 +805,7 @@ table#cart_summary .cart_total_price td.cart_voucher { table#cart_summary #total_price_container { border-bottom:1px solid #999; + border-right: none; } .cart_voucher .title_block, .cart_voucher h4 diff --git a/themes/default/js/product.js b/themes/default/js/product.js index f80461748..e97e7446c 100644 --- a/themes/default/js/product.js +++ b/themes/default/js/product.js @@ -118,7 +118,7 @@ function findCombination(firstTime) //show the large image in relation to the selected combination if (combinations[combination]['image'] && combinations[combination]['image'] != -1) - displayImage( $('#thumb_' + combinations[combination]['image']).parent() ); + displayImage($('#thumb_' + combinations[combination]['image']).parent()); //show discounts values according to the selected combination if (combinations[combination]['idCombination'] && combinations[combination]['idCombination'] > 0) @@ -414,17 +414,14 @@ function displayImage(domAAroundImgThumb, no_animation) { if (typeof(no_animation) == 'undefined') no_animation = false; - if (domAAroundImgThumb.attr('href')) { - var newSrc = domAAroundImgThumb.attr('href').replace('thickbox','large'); + var newSrc = domAAroundImgThumb.attr('href').replace('thickbox', 'large'); if ($('#bigpic').attr('src') != newSrc) { - $('#bigpic').fadeOut((no_animation ? 0 : 'fast'), function(){ - $(this).attr('src', newSrc).show(); - if (typeof(jqZoomEnabled) != 'undefined' && jqZoomEnabled) - $(this).attr('alt', domAAroundImgThumb.attr('href')); - }); + $('#bigpic').attr('src', newSrc); + if (typeof(jqZoomEnabled) != 'undefined' && jqZoomEnabled) + $(this).attr('alt', domAAroundImgThumb.attr('href')); } $('#views_block li a').removeClass('shown'); $(domAAroundImgThumb).addClass('shown'); @@ -468,24 +465,29 @@ function serialScrollFixLock(event, targeted, scrolled, items, position) function refreshProductImages(id_product_attribute) { $('#thumbs_list_frame').scrollTo('li:eq(0)', 700, {axis:'x'}); - $('#thumbs_list li').hide(); + id_product_attribute = parseInt(id_product_attribute); - if (typeof(combinationImages) != 'undefined' && typeof(combinationImages[id_product_attribute]) != 'undefined') + 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 (i > 0) - { - var thumb_width = $('#thumbs_list_frame >li').width() + parseInt($('#thumbs_list_frame >li').css('marginRight')); - $('#thumbs_list_frame').width((parseInt((thumb_width)* i) + 3) + 'px'); // Bug IE6, needs 3 pixels more ? + if (parseInt($('#thumbs_list_frame >li:visible').length) < parseInt($('#thumbs_list_frame >li').length)) + $('#wrapResetImages').show('slow'); + else + $('#wrapResetImages').hide('slow'); } else { - $('#thumbnail_' + idDefaultImage).show(); - displayImage($('#thumbnail_' + idDefaultImage + ' a')); + $('#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 ? } @@ -548,6 +550,11 @@ $(document).ready(function() $('#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); @@ -563,11 +570,6 @@ $(document).ready(function() 'transitionIn' : 'elastic', 'transitionOut' : 'elastic' }); - original_url = window.location + ''; - first_url_check = true; - checkUrl(); - initLocationChange(); - }); function saveCustomization() @@ -668,12 +670,12 @@ function getProductAttribute() function initLocationChange(time) { if(!time) time = 500; - setInterval(checkUrl, time); + setInterval(checkUrl, time); } function checkUrl() { - if (original_url != window.url || first_url_check) + if (original_url != window.location || first_url_check) { first_url_check = false; url = window.location + ''; @@ -710,11 +712,11 @@ function checkUrl() if (count >= 0) { findCombination(false); - original_url = window.location + ''; + original_url = url; } // no combination found = removing attributes from url else window.location = url.substring(0, url.indexOf('#')); } } -} +} \ No newline at end of file diff --git a/themes/default/product.tpl b/themes/default/product.tpl index 6089dbe4c..b7695b1e7 100644 --- a/themes/default/product.tpl +++ b/themes/default/product.tpl @@ -200,8 +200,8 @@ var fieldRequired = '{l s='Please fill in all the required fields before saving {foreach from=$images item=image name=thumbnails} {assign var=imageIds value="`$product->id`-`$image.id_image`"}