Merge branch 'task-ImgMobileCategories' into develop

This commit is contained in:
Marion Muszynski 2017-09-25 10:59:58 +02:00
commit 80c6a3db16
4 changed files with 112 additions and 16 deletions

View File

@ -486,8 +486,7 @@ class AdminCategories extends AdminTab
} }
} }
// @Override Antadis // @Override Antadis - Delete Image Thumb && Mobile
/* Delete Image Thumb */
elseif (isset($_GET['deleteImageThumb']) && isset($_GET['id_lang'])) elseif (isset($_GET['deleteImageThumb']) && isset($_GET['id_lang']))
{ {
if (Validate::isLoadedObject($object = $this->loadObject())) { if (Validate::isLoadedObject($object = $this->loadObject())) {
@ -495,6 +494,14 @@ class AdminCategories extends AdminTab
Tools::redirectAdmin($currentIndex.'&updatecategory&token='.Tools::getValue('token').'&id_category='.(int)($object->id)); Tools::redirectAdmin($currentIndex.'&updatecategory&token='.Tools::getValue('token').'&id_category='.(int)($object->id));
} }
}
elseif (isset($_GET['deleteImageMobile']) && isset($_GET['id_lang']))
{
if (Validate::isLoadedObject($object = $this->loadObject())) {
$this->deleteImageMobile($object,$_GET['id_lang']);
Tools::redirectAdmin($currentIndex.'&updatecategory&token='.Tools::getValue('token').'&id_category='.(int)($object->id));
}
} }
// @EndOverride Antadis // @EndOverride Antadis
@ -515,6 +522,7 @@ class AdminCategories extends AdminTab
// @Override Antadis // @Override Antadis
foreach (Language::getLanguages(FALSE) as $language) { foreach (Language::getLanguages(FALSE) as $language) {
$this->deleteImageThumb($object, $language['id_lang']); $this->deleteImageThumb($object, $language['id_lang']);
$this->deleteImageMobile($object, $language['id_lang']);
} }
// @End Antadis // @End Antadis
$object->deleteImage(); $object->deleteImage();

View File

@ -1244,6 +1244,31 @@ class AdminOrders extends AdminTab
echo '<p><b>Numéro de suivi </b> : '. $number['shipping_number'] .' ajouté le '. $date->format('d m Y') .'</p>'; echo '<p><b>Numéro de suivi </b> : '. $number['shipping_number'] .' ajouté le '. $date->format('d m Y') .'</p>';
} }
} }
// assign delay to Products
if (Module::isInstalled('privatesales_delay')) {
if (!class_exists('SaleDelay')) {
require_once _PS_ROOT_DIR_.'/modules/privatesales_delay/saledelay.php';
}
$delay_products = SaleDelay::associateDelay($products);
$delays = array_keys($delay_products);
$date = new DateTime($order->date_add);
$delivery_date = SaleDelay::getDeliveryDate($delays, null, $date, true);
foreach($delivery_date as $k => $date) {
if($k == 1) {
echo '<p class="delivery-date">
'.$this->l('Date d\'expédition : entre le').' <strong>'.$date['date_start']->format('d/m/Y').'</strong> '.$this->l('et le').' <strong>'.$date['date_end']->format('d/m/Y').'</strong>
</p>';
} elseif ($k == 5){
echo '<p class="delivery-date">'.$this->l('Date d\'expédition :').' <strong>'.$this->l('avant le 24/12').'</strong></p>';
} elseif ($k == 8){
echo '<p class="delivery-date">'.$this->l('Date d\'expédition :').' <strong>'.$this->l('envoi en 48h').'</strong></p>';
} elseif ($k == 9){
echo '<p class="delivery-date">'.$this->l('Date d\'expédition :').' '.$this->l('Delai indiqué sur la fiche produit').'</p>';
}
}
}
echo '<legend><img src="../img/admin/delivery.gif" /> '.$this->l('Shipping information').'</legend> echo '<legend><img src="../img/admin/delivery.gif" /> '.$this->l('Shipping information').'</legend>
'.$this->l('Total weight:').' <b>'.number_format($order->getTotalWeight(), 3).' '.Configuration::get('PS_WEIGHT_UNIT').'</b><br /> '.$this->l('Total weight:').' <b>'.number_format($order->getTotalWeight(), 3).' '.Configuration::get('PS_WEIGHT_UNIT').'</b><br />
'.$this->l('Carrier:').' <b>'.($carrier->name == '0' ? Configuration::get('PS_SHOP_NAME') : $carrier->name).'</b><br /> '.$this->l('Carrier:').' <b>'.($carrier->name == '0' ? Configuration::get('PS_SHOP_NAME') : $carrier->name).'</b><br />

View File

@ -42,7 +42,12 @@ class AdminAntCreationcategories extends AdminTab
if($category->add()) { if($category->add()) {
if (isset($_FILES['image_thumb']) && $_FILES['image_thumb']['name'] != NULL) { if (isset($_FILES['image_thumb']) && $_FILES['image_thumb']['name'] != NULL) {
copy($_FILES['image_thumb']['tmp_name'], _PS_CAT_IMG_DIR_.$category->id.'_thumb_vp.jpg'); copy($_FILES['image_thumb']['tmp_name'], _PS_CAT_IMG_DIR_.$category->id.'_thumb_vp_2.jpg');
copy($_FILES['image_thumb']['tmp_name'], _PS_CAT_IMG_DIR_.$category->id.'_thumb_vp_3.jpg');
}
if (isset($_FILES['image_mobile']) && $_FILES['image_mobile']['name'] != NULL) {
copy($_FILES['image_mobile']['tmp_name'], _PS_CAT_IMG_DIR_.$category->id.'_mobile_vp_2.jpg');
copy($_FILES['image_mobile']['tmp_name'], _PS_CAT_IMG_DIR_.$category->id.'_mobile_vp_3.jpg');
} }
if (isset($_FILES['image_category']) && $_FILES['image_category']['name'] != NULL) { if (isset($_FILES['image_category']) && $_FILES['image_category']['name'] != NULL) {
copy($_FILES['image_category']['tmp_name'], _PS_CAT_IMG_DIR_.$category->id.'.jpg'); copy($_FILES['image_category']['tmp_name'], _PS_CAT_IMG_DIR_.$category->id.'.jpg');
@ -219,6 +224,14 @@ class AdminAntCreationcategories extends AdminTab
'name' => 'image_category', 'name' => 'image_category',
'id' => 'preview_category', 'id' => 'preview_category',
), ),
array(
'type' => 'uploadImage',
'label' => $this->l('Image Application : '),
'label-class' => 'col-md-2',
'input-class' => 'col-md-6',
'name' => 'image_mobile',
'id' => 'preview_mobile',
),
array( array(
'type' => 'tag', 'type' => 'tag',
'label' => $this->l('Sous Catégorie : '), 'label' => $this->l('Sous Catégorie : '),

View File

@ -522,4 +522,54 @@ class Category extends CategoryCore {
return $result; return $result;
} }
public function deleteImage()
{
if (!$this->id)
return false;
/* Deleting object images and thumbnails (cache) */
if ($this->image_dir)
{
if (file_exists($this->image_dir.$this->id.'.'.$this->image_format)
&& !unlink($this->image_dir.$this->id.'.'.$this->image_format))
return false;
}
if (file_exists(_PS_TMP_IMG_DIR_.$this->table.'_'.$this->id.'.'.$this->image_format)
&& !unlink(_PS_TMP_IMG_DIR_.$this->table.'_'.$this->id.'.'.$this->image_format))
return false;
if (file_exists(_PS_TMP_IMG_DIR_.$this->table.'_mini_'.$this->id.'.'.$this->image_format)
&& !unlink(_PS_TMP_IMG_DIR_.$this->table.'_mini_'.$this->id.'.'.$this->image_format))
return false;
$types = ImageType::getImagesTypes();
foreach ($types AS $image_type)
if (file_exists($this->image_dir.$this->id.'-'.stripslashes($image_type['name']).'.'.$this->image_format)
&& !unlink($this->image_dir.$this->id.'-'.stripslashes($image_type['name']).'.'.$this->image_format))
return false;
// @Override Antadis
foreach (Language::getLanguages(FALSE) as $language) {
$this->deleteImageThumb($language['id_lang']);
$this->deleteImageMobile($language['id_lang']);
}
// @End Override
return true;
}
// @Adding Antadis
public function deleteImageThumb($id_lang)
{
if(file_exists(_PS_ROOT_DIR_.'/img/c/'.$this->id.'_thumb_vp_'.(int)$id_lang.'.jpg')) {
unlink(_PS_ROOT_DIR_.'/img/c/'.$this->id.'_thumb_vp_'.(int)$id_lang.'.jpg');
}
}
// @Adding Antadis
public function deleteImageMobile($id_lang)
{
if(file_exists(_PS_ROOT_DIR_.'/img/c/'.$this->id.'_mobile_vp_'.(int)$id_lang.'.jpg')) {
unlink(_PS_ROOT_DIR_.'/img/c/'.$this->id.'_mobile_vp_'.(int)$id_lang.'.jpg');
}
}
} }