From 9a0e3ca81e1912bd2056eee3466fae89cb8cf770 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 18 Jul 2013 10:54:05 +0200 Subject: [PATCH] // Added logo remove link in carrier wizard --- .../controllers/carrier_wizard/logo.tpl | 18 +++++++++++++++++- .../controllers/carrier_wizard/summary.tpl | 3 ++- .../admin/AdminCarrierWizardController.php | 13 +++++++++---- js/admin_carrier_wizard.js | 2 +- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/carrier_wizard/logo.tpl b/admin-dev/themes/default/template/controllers/carrier_wizard/logo.tpl index ac8329c7f..f9256ec1c 100644 --- a/admin-dev/themes/default/template/controllers/carrier_wizard/logo.tpl +++ b/admin-dev/themes/default/template/controllers/carrier_wizard/logo.tpl @@ -29,12 +29,24 @@

+ {l s='Remove the logo'}

{l s='Format:'} JPG, GIF, PNG. {l s='Filesize:'} {$max_image_size|string_format:"%.2f"} {l s='MB max.'} +
{l s='Current size:'} {l s='undefined'}.

- {l s='Summary'} - + {l s='Carrier name:'} +
 
 
diff --git a/controllers/admin/AdminCarrierWizardController.php b/controllers/admin/AdminCarrierWizardController.php index d6d4907a2..d41884288 100644 --- a/controllers/admin/AdminCarrierWizardController.php +++ b/controllers/admin/AdminCarrierWizardController.php @@ -635,11 +635,16 @@ class AdminCarrierWizardControllerCore extends AdminController if (Tools::getValue('logo')) { - $logo = basename(Tools::getValue('logo')); - if (!file_exists(_PS_TMP_IMG_DIR_.$logo) || !copy(_PS_TMP_IMG_DIR_.$logo, _PS_SHIP_IMG_DIR_.$carrier->id.'.jpg')) + if (Tools::getValue('logo') == 'null' && file_exists(_PS_SHIP_IMG_DIR_.$carrier->id.'.jpg')) + unlink(_PS_SHIP_IMG_DIR_.$carrier->id.'.jpg'); + else { - $return['has_error'] = true; - $return['errors'][] = $this->l('An error occurred while saving carrier logo.'); + $logo = basename(Tools::getValue('logo')); + if (!file_exists(_PS_TMP_IMG_DIR_.$logo) || !copy(_PS_TMP_IMG_DIR_.$logo, _PS_SHIP_IMG_DIR_.$carrier->id.'.jpg')) + { + $return['has_error'] = true; + $return['errors'][] = $this->l('An error occurred while saving carrier logo.'); + } } } $return['id_carrier'] = $carrier->id; diff --git a/js/admin_carrier_wizard.js b/js/admin_carrier_wizard.js index bbf932573..3bbf037d6 100644 --- a/js/admin_carrier_wizard.js +++ b/js/admin_carrier_wizard.js @@ -91,7 +91,7 @@ function displaySummary() $('#summary_name').html($('#name').val()); // Delay and pricing - tmp = summary_translation_meta_informations.replace('@s2', $('#delay_1').val()); + tmp = summary_translation_meta_informations.replace('@s2', '' + $('#delay_1').val() + ''); if ($('#is_free_on').attr('checked')) tmp = tmp.replace('@s1', summary_translation_free); else