Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development
This commit is contained in:
+3
-3
@@ -14,7 +14,7 @@
|
||||
<td class="center range_type"></td>
|
||||
<td class="border_left range_sign"><</td>
|
||||
{foreach from=$ranges key=r item=range}
|
||||
<td class="center"><input name="range_sup[{$range.id_range|intval}]" type="text" {if isset($form_id) && !$form_id} value="" {else} value="{if isset($change_ranges) && $range.id_range == -1} {else}{$range.delimiter2|string_format:"%.6f"}{/if}" {/if}/><sup>*</sup><span class="weight_unit"> {$PS_WEIGHT_UNIT}</span><span class="price_unit"> {$currency_sign}</span></td>
|
||||
<td class="center"><input name="range_sup[{$range.id_range|intval}]" type="text" {if isset($form_id) && !$form_id} value="" {else} value="{if isset($change_ranges) && $range.id_range == 0} {else}{$range.delimiter2|string_format:"%.6f"}{/if}" {/if}/><sup>*</sup><span class="weight_unit"> {$PS_WEIGHT_UNIT}</span><span class="price_unit"> {$currency_sign}</span></td>
|
||||
{foreachelse}
|
||||
<td class="center"><input name="range_sup[{$range.id_range|intval}]" type="text" /><sup>*</sup><span class="weight_unit"> {$PS_WEIGHT_UNIT}</span><span class="price_unit"> {$currency_sign}</span></td>
|
||||
{/foreach}
|
||||
@@ -23,8 +23,8 @@
|
||||
<td class="border_top border_bottom border_bold"><span class="fees_all" {if $ranges|count == 0}style="display:none" {/if}>All</span></td>
|
||||
<td></td>
|
||||
{foreach from=$ranges key=r item=range}
|
||||
<td class="center border_top border_bottom {if $range.id_range != -1} validated {/if}" >
|
||||
<input type="text" {if isset($form_id) && !$form_id} disabled="disabled"{/if} {if $range.id_range == -1} style="display:none"{/if} /><span class="currency_sign" {if $range.id_range == -1} style="display:none" {/if}> {$currency_sign}</span>
|
||||
<td class="center border_top border_bottom {if $range.id_range != 0} validated {/if}" >
|
||||
<input type="text" {if isset($form_id) && !$form_id} disabled="disabled"{/if} {if $range.id_range == 0} style="display:none"{/if} /><span class="currency_sign" {if $range.id_range == 0} style="display:none" {/if}> {$currency_sign}</span>
|
||||
</td>
|
||||
{foreachelse}
|
||||
<td class="center border_top border_bottom">
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
{block name="td_content"}
|
||||
{if isset($params.prefix)}{$params.prefix}{/if}
|
||||
{if isset($params.color) && isset($tr[$params.color])}
|
||||
<span class="color_field" style="background-color:{$tr.color};color:{if Tools::getBrightness($tr.color) < 128}white{else}#383838{/if}">
|
||||
<span class="color_field" style="background-color:{$tr[$params.color]};color:{if Tools::getBrightness($tr[$params.color]) < 128}white{else}#383838{/if}">
|
||||
{/if}
|
||||
{if isset($tr.$key)}
|
||||
{if isset($params.active)}
|
||||
|
||||
+8
-8
@@ -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, ','));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+10
-2
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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/';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -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}
|
||||
|
||||
@@ -551,7 +551,6 @@ class InstallModelInstall extends InstallAbstractModel
|
||||
'blockviewed',
|
||||
'cheque',
|
||||
'favoriteproducts',
|
||||
'feeder',
|
||||
'graphartichow',
|
||||
'graphgooglechart',
|
||||
'graphvisifire',
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user