// fix bug upload image
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11777 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
1 parent
4515866661
commit
35ac5cd809
4 files changed
+11
-16
No files matched your search
@@ -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>
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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')
|
||||||
|
|||||||
@@ -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']))
|
||||||
{
|
{
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user