// fix bug upload image

This commit is contained in:
lLefevre
2011-12-27 08:53:27 +00:00
parent cb9294f2c6
commit abd89081ee
4 changed files with 12 additions and 17 deletions
@@ -79,10 +79,10 @@
<label>{l s='Carriers:'}</label> <label>{l s='Carriers:'}</label>
</td> </td>
<td class="padding-bottom:5px;"> <td class="padding-bottom:5px;">
<select name="carriers[]" multiple="multiple" size="4"> <select name="carriers[]" multiple="multiple" size="4" style="height:100px;width:200px;">
{foreach $carrier_list as $carrier} {foreach $carrier_list as $carrier}
<option value="{$carrier.id_reference}" {if isset($carrier.selected) && $carrier.selected}selected="selected"{/if}>{$carrier.name}</option> <option value="{$carrier.id_reference}" {if isset($carrier.selected) && $carrier.selected}selected="selected"{/if}>{$carrier.name}</option>
{/foreach} {/foreach}
</select> </select>
</td> </td>
</tr> </tr>
-1
View File
@@ -87,7 +87,6 @@ class FileUploaderCore
if($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)) if($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions))
return array('error' => Tools::displayError('File has an invalid extension, it should be one of '). $these . '.'); return array('error' => Tools::displayError('File has an invalid extension, it should be one of '). $these . '.');
return $this->file->save(); return $this->file->save();
} }
+1 -1
View File
@@ -314,7 +314,7 @@ class HelperCore
*/ */
public function renderAssoShop($type = 'shop') public function renderAssoShop($type = 'shop')
{ {
if (!Shop::isFeatureActive() || (!$this->id && $this->context->shop->getContextType() != Shop::CONTEXT_ALL)) if (!Shop::isFeatureActive())
return; return;
if ($type != 'shop' && $type != 'group_shop') if ($type != 'shop' && $type != 'group_shop')
+7 -11
View File
@@ -27,8 +27,6 @@
class AdminProductsControllerCore extends AdminController class AdminProductsControllerCore extends AdminController
{ {
protected $max_file_size = NULL;
/** @var integer Max image size for upload /** @var integer Max image size for upload
* As of 1.5 it is recommended to not set a limit to max image size * As of 1.5 it is recommended to not set a limit to max image size
**/ **/
@@ -90,8 +88,7 @@ class AdminProductsControllerCore extends AdminController
$this->imageType = 'jpg'; $this->imageType = 'jpg';
$this->context = Context::getContext(); $this->context = Context::getContext();
$this->_defaultOrderBy = 'position'; $this->_defaultOrderBy = 'position';
$this->max_file_size = (Configuration::get('PS_LIMIT_UPLOAD_IMAGE_VALUE') * 1000000); $this->max_image_size = (int)Configuration::get('PS_PRODUCT_PICTURE_MAX_SIZE');
$this->max_image_size = (Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE') * 1000000);
$categoriesArray = array(); $categoriesArray = array();
$categories = Category::getSimpleCategories($this->context->language->id); $categories = Category::getSimpleCategories($this->context->language->id);
@@ -1041,8 +1038,7 @@ class AdminProductsControllerCore extends AdminController
self::$currentIndex = 'index.php?tab=AdminProducts'; self::$currentIndex = 'index.php?tab=AdminProducts';
$allowedExtensions = array("jpeg", "gif", "png", "jpg"); $allowedExtensions = array("jpeg", "gif", "png", "jpg");
// max file size in bytes // max file size in bytes
$sizeLimit = $this->max_file_size == 0 ? 10485760 : $this->max_file_size; $uploader = new FileUploader($allowedExtensions, $this->max_image_size);
$uploader = new FileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload(); $result = $uploader->handleUpload();
if (isset($result['success'])) if (isset($result['success']))
{ {
@@ -1270,7 +1266,7 @@ class AdminProductsControllerCore extends AdminController
$this->status = 'ok'; $this->status = 'ok';
} }
protected function _validateSpecificPrice($id_shop, $id_currency, $id_country, $id_group, $id_customer, $price, $from_quantity, $reduction, $reduction_type, $from, $to) protected function _validateSpecificPrice($id_shop, $id_currency, $id_country, $id_group, $id_customer, $price, $from_quantity, $reduction, $reduction_type, $from, $to)
{ {
if (!Validate::isUnsignedId($id_shop) || !Validate::isUnsignedId($id_currency) || !Validate::isUnsignedId($id_country) || !Validate::isUnsignedId($id_group) || !Validate::isUnsignedId($id_customer)) if (!Validate::isUnsignedId($id_shop) || !Validate::isUnsignedId($id_currency) || !Validate::isUnsignedId($id_country) || !Validate::isUnsignedId($id_group) || !Validate::isUnsignedId($id_customer))
@@ -2698,7 +2694,7 @@ class AdminProductsControllerCore extends AdminController
$input_namepack_items = Tools::getValue('namePackItems'); $input_namepack_items = Tools::getValue('namePackItems');
else else
foreach ($product->packItems as $pack_item) foreach ($product->packItems as $pack_item)
$input_namepack_items .= $pack_item->pack_quantity.' x '.$pack_item->name.'¬§'; $input_namepack_items .= $pack_item->pack_quantity.' x '.$pack_item->name.'¤';
$data->assign(array( $data->assign(array(
'product' => $product, 'product' => $product,
@@ -2980,7 +2976,7 @@ class AdminProductsControllerCore extends AdminController
$j = 0; $j = 0;
for ($i = $alreadyGenerated[Product::CUSTOMIZE_TEXTFIELD]; $i < (int)($this->getFieldValue($obj, 'text_fields')); $i++) for ($i = $alreadyGenerated[Product::CUSTOMIZE_TEXTFIELD]; $i < (int)($this->getFieldValue($obj, 'text_fields')); $i++)
$customizableFieldIds[] = 'newLabel_'.Product::CUSTOMIZE_TEXTFIELD.'_'.$j++; $customizableFieldIds[] = 'newLabel_'.Product::CUSTOMIZE_TEXTFIELD.'_'.$j++;
return implode('¬§', $customizableFieldIds); return implode('¤', $customizableFieldIds);
} }
private function _displayLabelField(&$label, $languages, $default_language, $type, $fieldIds, $id_customization_field) private function _displayLabelField(&$label, $languages, $default_language, $type, $fieldIds, $id_customization_field)
@@ -3240,7 +3236,7 @@ class AdminProductsControllerCore extends AdminController
$data->assign('token', $this->token); $data->assign('token', $this->token);
$data->assign('table', $this->table); $data->assign('table', $this->table);
$data->assign('max_image_size', (int)Configuration::get('PS_PRODUCT_PICTURE_MAX_SIZE') / 1000); $data->assign('max_image_size', $this->max_image_size / 1000);
$data->assign('up_filename', strval(Tools::getValue('virtual_product_filename_attribute'))); $data->assign('up_filename', strval(Tools::getValue('virtual_product_filename_attribute')));
$data->assign('currency', $this->context->currency); $data->assign('currency', $this->context->currency);
@@ -3834,7 +3830,7 @@ class AdminProductsControllerCore extends AdminController
$input_namepack_items = Tools::getValue('namePackItems'); $input_namepack_items = Tools::getValue('namePackItems');
else else
foreach ($product->packItems as $pack_item) foreach ($product->packItems as $pack_item)
$input_namepack_items .= $pack_item->pack_quantity.' x '.$pack_item->name.'¬§'; $input_namepack_items .= $pack_item->pack_quantity.' x '.$pack_item->name.'¤';
$this->tpl_form_vars['input_namepack_items'] = $input_namepack_items; $this->tpl_form_vars['input_namepack_items'] = $input_namepack_items;
} }