add img folder, delete folder creation in installer and fix image view in category form

This commit is contained in:
Rodney Figaro 2017-01-09 13:18:54 +01:00
parent 202a362e9e
commit fb852e6301
4 changed files with 42 additions and 14 deletions

1
.gitignore vendored
View File

@ -118,4 +118,5 @@ modules/labelgenerate/img/
modules/product_vouchers/*.csv
modules/labelgenerate/img/*
modules/purchaseguide/img/*
!modules/purchaseguide/img/index.php

View File

@ -134,7 +134,7 @@ class AdminGuideCategories extends AdminTab
'max_bytes' => $this->maxImageBytes,
'allowed_format' => 'JPEG',
'html_file' => "img",
'path' => $obj->getImageFileUrl()
'path' => $obj->getImageFileUrl().'?rand='.time()
]
),
'active' => array(

View File

@ -0,0 +1,36 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7233 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@ -6,10 +6,8 @@ require_once(__DIR__.'/classes/GuideCategory.php');
class PurchaseGuide extends Module
{
const MODULE_NAME = 'purchaseguide';
public function __construct() {
$this->name = self::MODULE_NAME;
$this->name = 'purchaseguide';
$this->tab = 'front_office_features';
$this->author = 'Antadis';
$this->version = '1.0';
@ -90,7 +88,7 @@ class PurchaseGuide extends Module
Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'tab`
VALUES (DEFAULT, "'.$param['id_parent'].'", "'.$param['class_name'].'", "'.self::MODULE_NAME.'", '.($last_position+1).')
VALUES (DEFAULT, "'.$param['id_parent'].'", "'.$param['class_name'].'", "'.$this->name.'", '.($last_position+1).')
');
$tab_id = Db::getInstance()->Insert_ID();
@ -125,7 +123,7 @@ class PurchaseGuide extends Module
$rows = Db::getInstance()->ExecuteS('
SELECT `id_tab`
FROM `'._DB_PREFIX_.'tab`
WHERE `module` = "'.self::MODULE_NAME.'"
WHERE `module` = "'.$this->name.'"
');
foreach ($rows as $row) {
Db::getInstance()->Execute('
@ -140,7 +138,7 @@ class PurchaseGuide extends Module
Db::getInstance()->Execute('
DELETE FROM `'._DB_PREFIX_.'tab`
WHERE `module` = "'.self::MODULE_NAME.'"
WHERE `module` = "'.$this->name.'"
');
}
@ -230,13 +228,6 @@ class PurchaseGuide extends Module
)
');
// Add image folder
$path = GuideCategory::getImagePath();
if(!is_dir($path)) {
mkdir($path, 0775);
}
return true;
}