diff --git a/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form_ranges.tpl b/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form_ranges.tpl index 0f1dbafa2..2fa54471c 100644 --- a/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form_ranges.tpl +++ b/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form_ranges.tpl @@ -14,7 +14,7 @@ < {foreach from=$ranges key=r item=range} - *  {$PS_WEIGHT_UNIT}  {$currency_sign} + *  {$PS_WEIGHT_UNIT}  {$currency_sign} {foreachelse} *  {$PS_WEIGHT_UNIT}  {$currency_sign} {/foreach} @@ -23,8 +23,8 @@ All {foreach from=$ranges key=r item=range} - - + + {foreachelse} 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 add0db76d..ae80d9d10 100644 --- a/admin-dev/themes/default/template/helpers/list/list_content.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_content.tpl @@ -59,7 +59,7 @@ {block name="td_content"} {if isset($params.prefix)}{$params.prefix}{/if} {if isset($params.color) && isset($tr[$params.color])} - + {/if} {if isset($tr.$key)} {if isset($params.active)} diff --git a/classes/Cart.php b/classes/Cart.php index e5d3cd729..3e48b7040 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -134,6 +134,7 @@ class CartCore extends ObjectModel 'cart_rows' => array('resource' => 'cart_row', 'virtual_entity' => true, 'fields' => array( 'id_product' => array('required' => true, 'xlink_resource' => 'products'), 'id_product_attribute' => array('required' => true, 'xlink_resource' => 'combinations'), + 'id_address_delivery' => array('required' => true, 'xlink_resource' => 'addresses'), 'quantity' => array('required' => true), ) ), @@ -3212,25 +3213,24 @@ class CartCore extends ObjectModel public function getWsCartRows() { - $query = ' + return Db::getInstance()->executeS(' SELECT id_product, id_product_attribute, quantity FROM `'._DB_PREFIX_.'cart_product` - WHERE id_cart = '.(int)$this->id.' - AND id_shop = '.(int)Context::getContext()->shop->id; - - $result = Db::getInstance()->executeS($query); - return $result; + WHERE id_cart = '.(int)$this->id.' AND id_shop = '.(int)Context::getContext()->shop->id + ); } public function setWsCartRows($values) { if ($this->deleteAssociations()) { - $query = 'INSERT INTO `'._DB_PREFIX_.'cart_product`(`id_cart`, `id_product`, `id_product_attribute`, `quantity`, `date_add`, `id_shop`) VALUES '; + $query = 'INSERT INTO `'._DB_PREFIX_.'cart_product`(`id_cart`, `id_product`, `id_product_attribute`, `id_address_delivery`, `quantity`, `date_add`, `id_shop`) VALUES '; foreach ($values as $value) $query .= '('.(int)$this->id.', '.(int)$value['id_product'].', '. - (isset($value['id_product_attribute']) ? (int)$value['id_product_attribute'] : 'NULL').', '.(int)$value['quantity'].', NOW(), '.(int)Context::getContext()->shop->id.'),'; + (isset($value['id_product_attribute']) ? (int)$value['id_product_attribute'] : 'NULL').', '. + (isset($value['id_address_delivery']) ? (int)$value['id_address_delivery'] : 0).', '. + (int)$value['quantity'].', NOW(), '.(int)Context::getContext()->shop->id.'),'; Db::getInstance()->execute(rtrim($query, ',')); } diff --git a/classes/ImageManager.php b/classes/ImageManager.php index c7500c8fd..c647b6ea3 100644 --- a/classes/ImageManager.php +++ b/classes/ImageManager.php @@ -407,6 +407,7 @@ class ImageManagerCore case 'jpeg': default: $quality = (Configuration::get('PS_JPEG_QUALITY') === false ? 90 : Configuration::get('PS_JPEG_QUALITY')); + imageinterlace($resource,1); /// make it PROGRESSIVE $success = imagejpeg($resource, $filename, (int)$quality); break; } diff --git a/classes/Media.php b/classes/Media.php index 31b960cf9..eb73c8232 100755 --- a/classes/Media.php +++ b/classes/Media.php @@ -224,7 +224,7 @@ class MediaCore $url_data = parse_url($css_uri); $file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']); // check if css files exists - if (!@filemtime($file_uri)) + if (!@filemtime($file_uri) && !array_key_exists('host', $url_data)) return false; if (Context::getContext()->controller->controller_type == 'admin') @@ -386,6 +386,7 @@ class MediaCore { //inits $css_files_by_media = array(); + $external_css_files = array(); $compressed_css_files = array(); $compressed_css_files_not_found = array(); $compressed_css_files_infos = array(); @@ -400,6 +401,13 @@ class MediaCore $infos = array(); $infos['uri'] = $filename; $url_data = parse_url($filename); + + if(array_key_exists('host', $url_data)) + { + $external_css_files[$filename] = $media; + continue; + } + $infos['path'] = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, '/', $url_data['path']); $css_files_by_media[$media]['files'][] = $infos; if (!array_key_exists('date', $css_files_by_media[$media])) @@ -461,7 +469,7 @@ class MediaCore $url = str_replace(_PS_THEME_DIR_, _THEMES_DIR_._THEME_NAME_.'/', $filename); $css_files[$protocol_link.Tools::getMediaServer($url).$url] = $media; } - return $css_files; + return array_merge($external_css_files, $css_files); } public static function getBackTrackLimit() diff --git a/classes/ProductSale.php b/classes/ProductSale.php index d264a1ef9..cc1922ef0 100644 --- a/classes/ProductSale.php +++ b/classes/ProductSale.php @@ -67,7 +67,7 @@ class ProductSaleCore if ($nb_products < 1) $nb_products = 10; $final_order_by = $order_by; if (is_null($order_by) || $order_by == 'position' || $order_by == 'price') $order_by = 'sales'; - if (is_null($order_way) || $order_by == 'sales') $order_way == 'DESC'; + if (is_null($order_way) || $order_by == 'sales') $order_way = 'DESC'; $groups = FrontController::getCurrentCustomerGroups(); $sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1'); $interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20; diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 2ac7515fc..cf12984dd 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -381,6 +381,39 @@ class AdminControllerCore extends Controller break; } $this->toolbar_title = $bread_extended; + + if (Tools::isSubmit('submitFilter')) + { + $filter = ''; + foreach ($this->fields_list AS $field => $t) + { + if ($val = Tools::getValue($this->table.'Filter_'.$field)) + { + if(!is_array($val) && !empty($val)) + $filter .= ($filter ? ', ' : $this->l(' filter by ')).$t['title'].' : '; + + if (isset($t['type']) && $t['type'] == 'bool') + $filter .= ((bool)$val) ? $this->l('yes') : $this->l('no'); + elseif(is_string($val)) + $filter .= $val; + elseif(is_array($val)) + { + $tmp = ''; + foreach($val as $v) + if(is_string($v) && !empty($v)) + $tmp .= ' - '.$v; + if(Tools::strlen($tmp)) + { + $tmp = ltrim($tmp, ' - '); + $filter .= ($filter ? ', ' : $this->l(' filter by ')).$t['title'].' : '; + $filter .= $tmp; + } + } + } + } + if ($filter) + $this->toolbar_title[] = $filter; + } } /** diff --git a/classes/controller/ModuleFrontController.php b/classes/controller/ModuleFrontController.php index 7da522ba2..31184bcb4 100644 --- a/classes/controller/ModuleFrontController.php +++ b/classes/controller/ModuleFrontController.php @@ -68,8 +68,8 @@ class ModuleFrontControllerCore extends FrontController */ public function getTemplatePath() { - if (file_exists(_PS_THEME_DIR_.'modules/'.$this->module->name.'/views/templates/front/'.$template)) - return _PS_THEME_DIR_.'modules/'.$this->module->name.'/views/templates/front/'.$template; + if (file_exists(_PS_THEME_DIR_.'modules/'.$this->module->name.'/views/templates/front/'.$this->template)) + return _PS_THEME_DIR_.'modules/'.$this->module->name.'/views/templates/front/'.$this->template; return _PS_MODULE_DIR_.$this->module->name.'/views/templates/front/'; } } diff --git a/controllers/admin/AdminCarrierWizardController.php b/controllers/admin/AdminCarrierWizardController.php index 98cdc1ad1..70f79d11c 100644 --- a/controllers/admin/AdminCarrierWizardController.php +++ b/controllers/admin/AdminCarrierWizardController.php @@ -454,7 +454,7 @@ class AdminCarrierWizardControllerCore extends AdminController // init blank range if (!count($tpl_vars['ranges'])) - $tpl_vars['ranges'][] = array('id_range' => -1, 'delimiter1' => 0, 'delimiter2' => 0); + $tpl_vars['ranges'][] = array('id_range' => 0, 'delimiter1' => 0, 'delimiter2' => 0); } public function renderGenericForm($fields_form, $fields_value, $tpl_vars = array()) @@ -607,17 +607,36 @@ class AdminCarrierWizardControllerCore extends AdminController { if (!isset($range_sup[$key])) continue; - + $add_range = true; if ($range_type == Carrier::SHIPPING_METHOD_WEIGHT) - $range = new RangeWeight((int)$key); + { + if (!RangeWeight::rangeExist((int)$carrier->id, (float)$delimiter1, (float)$range_sup[$key])) + $range = new RangeWeight(); + else + { + $range = new RangeWeight((int)$key); + $add_range = false; + } + } + if ($range_type == Carrier::SHIPPING_METHOD_PRICE) - $range = new RangePrice((int)$key); - - $range->id_carrier = (int)$carrier->id; - $range->delimiter1 = (float)$delimiter1; - $range->delimiter2 = (float)$range_sup[$key]; - $range->save(); - + { + if (!RangePrice::rangeExist((int)$carrier->id, (float)$delimiter1, (float)$range_sup[$key])) + $range = new RangePrice(); + else + { + $range = new RangePrice((int)$key); + $add_range = false; + } + } + if ($add_range) + { + $range->id_carrier = (int)$carrier->id; + $range->delimiter1 = (float)$delimiter1; + $range->delimiter2 = (float)$range_sup[$key]; + $range->save(); + } + if (!Validate::isLoadedObject($range)) return false; $price_list = array(); @@ -632,7 +651,7 @@ class AdminCarrierWizardControllerCore extends AdminController 'price' => (float)$fee[$key] ); } - + if (count($price_list) && !$carrier->addDeliveryPrice($price_list, true)) return false; } @@ -692,9 +711,9 @@ class AdminCarrierWizardControllerCore extends AdminController $new_carrier->position = $current_carrier->position; $new_carrier->update(); - $this->updateAssoShop($new_carrier->id); - $new_carrier->copyCarrierData((int)$current_carrier->id); - $this->changeGroups($new_carrier->id); + $this->updateAssoShop((int)$new_carrier->id); + $this->duplicateLogo((int)$new_carrier->id, (int)$current_carrier->id); + $this->changeGroups((int)$new_carrier->id); // Call of hooks Hook::exec('actionCarrierUpdate', array( 'id_carrier' => (int)$current_carrier->id, @@ -848,4 +867,19 @@ class AdminCarrierWizardControllerCore extends AdminController { return $field; } + + public function duplicateLogo($new_id, $old_id) + { + $old_logo = _PS_SHIP_IMG_DIR_.'/'.(int)$old_id.'.jpg'; + if (file_exists($old_logo)) + copy($old_logo, _PS_SHIP_IMG_DIR_.'/'.(int)$new_id.'.jpg'); + + $old_tmp_logo = _PS_TMP_IMG_DIR_.'/carrier_mini_'.(int)$old_id.'.jpg'; + if (file_exists($old_tmp_logo)) + { + if (!isset($_FILES['logo'])) + copy($old_tmp_logo, _PS_TMP_IMG_DIR_.'/carrier_mini_'.$new_id.'.jpg'); + unlink($old_tmp_logo); + } + } } diff --git a/css/admin.css b/css/admin.css index 1e885be5e..f02fcd24b 100644 --- a/css/admin.css +++ b/css/admin.css @@ -2593,7 +2593,6 @@ margin-bottom:7px; padding:5px; border: 1px solid #FFD700; background-color: #FFFFDD; - font: normal 12px Verdana, Arial, Helvetica, sans-serif; color:#5A5655; -moz-border-radius : 5px; -webkit-border-radius: 5px; @@ -2625,9 +2624,9 @@ margin-bottom:7px; #carrier_wizard .border_left {border-left:solid 1px #C0C0C0;} #carrier_wizard .border_right {border-right:solid 1px #C0C0C0;} #carrier_wizard .border_all {border:solid 1px #C0C0C0;} -#carrier_wizard input.field_error {border : solid 1px red; background-color:#FFCCCCheight: 1px;} +#carrier_wizard input.field_error {border : solid 1px red; background-color:#FFCCCC;} #carrier_wizard table td.center {text-align: center} -#carrier_wizard .new_range {float: left; margin: 20px 0 0 10px; width: 130px;} +#carrier_wizard .new_range, #carrier_wizard .validate_range {float: left; margin: 20px 0 0 10px; width: 130px;} #carrier_wizard tr.fees_all { background: #CCCCCC} #carrier_wizard #zones_table input[type=text] {width: 45px;} #carrier_wizard #fieldset_form { min-height: 190px} diff --git a/install-dev/models/install.php b/install-dev/models/install.php index f2be6f8ee..43aaaddd6 100644 --- a/install-dev/models/install.php +++ b/install-dev/models/install.php @@ -551,7 +551,6 @@ class InstallModelInstall extends InstallAbstractModel 'blockviewed', 'cheque', 'favoriteproducts', - 'feeder', 'graphartichow', 'graphgooglechart', 'graphvisifire', diff --git a/js/admin_carrier_wizard.js b/js/admin_carrier_wizard.js index 83f9c8698..520fe2df8 100644 --- a/js/admin_carrier_wizard.js +++ b/js/admin_carrier_wizard.js @@ -94,6 +94,9 @@ function onFinishCallback(obj, context) } else window.location.href = carrierlist_url; + }, + error: function(XMLHttpRequest, textStatus, errorThrown) { + jAlert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus); } }); } @@ -202,6 +205,9 @@ function validateSteps(step_number) displayError(datas.errors, step_number); resizeWizard(); } + }, + error: function(XMLHttpRequest, textStatus, errorThrown) { + jAlert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus); } }); return is_ok; @@ -315,6 +321,9 @@ function bind_inputs() $('#zone_ranges').replaceWith(data); displayRangeType(); bind_inputs(); + }, + error: function(XMLHttpRequest, textStatus, errorThrown) { + jAlert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus); } }); });