From 66a9b54de33e2aaeaf23da99af780d4a21e4bb73 Mon Sep 17 00:00:00 2001 From: vinvin27 Date: Thu, 25 Jun 2015 12:53:40 +1000 Subject: [PATCH] php error --- controllers/admin/AdminSuperAbandonedCart.php | 99 +------------------ 1 file changed, 5 insertions(+), 94 deletions(-) diff --git a/controllers/admin/AdminSuperAbandonedCart.php b/controllers/admin/AdminSuperAbandonedCart.php index b911278..b8e13bd 100755 --- a/controllers/admin/AdminSuperAbandonedCart.php +++ b/controllers/admin/AdminSuperAbandonedCart.php @@ -89,8 +89,8 @@ public function renderList() {

30 * * * * '.$cron_url.'


'. $this->l('All email send is also send to : ') . Configuration::get('PS_SHOP_EMAIL') .'

-

Don\'t forget to set cron task :

-

30 * * * * '.$cron_url.'

+ + '; return $header . parent::renderList(); } @@ -156,6 +156,7 @@ public function renderForm() { 'required' => true, 'class' => 't', 'desc' => 'Also mail subject' + ), array( 'type' => 'select', @@ -313,10 +314,6 @@ public function renderForm() { } return $extra . parent::renderForm(); - - - - return parent::renderForm(); } @@ -372,38 +369,7 @@ public function postProcess() { } - - //if( !Tools::getIsset('voucher_name') OR Tools::isEmpty(Tools::getValue('voucher_name')) ){ $this->errors[] = Tools::displayError('Voucher name can\'t be empty'); } - - // ADD WAY - if ( ( !$id_campaign = (int) Tools::getValue('id_campaign') ) && empty($this->errors) ) { - - // Check values for voucher : - $defaultLanguage = new Language((int)(Configuration::get('PS_LANG_DEFAULT'))); - $voucher_name = Tools::getValue('voucher_name'); - $voucher_code = Tools::getValue('voucher_code'); - $voucher_amount_type = Tools::getValue('voucher_amount_type'); - $voucher_amount_value = Tools::getValue('voucher_amount_value'); - $voucher_date = Tools::getValue('voucher_date_to'); - - $new_voucher = new CartRule(null,$defaultLanguage->id); - - $new_voucher->name = $voucher_name; - $new_voucher->date_from = date('Y-m-d'); - $new_voucher->date_to = $voucher_date; - $new_voucher->description = 'Campaign : '.$voucher_name; - $new_voucher->code = $voucher_code; - $new_voucher->quantity = 1000; // Todo : Update when campaign is lunch to number of concerned people - // Si percent : - if( $voucher_amount_type == 'percent' ){ - $new_voucher->reduction_percent = $voucher_amount_value; - } // if fixed amount - else{ - $new_voucher->reduction_amount = $voucher_amount_value; - } - - $new_voucher->save(); // Create campaign : $campaign = new Campaign(); @@ -493,37 +459,6 @@ public function postProcess() { } } - $voucher_name = Tools::getValue('voucher_name'); - $voucher_code = Tools::getValue('voucher_code'); - $voucher_amount_type = Tools::getValue('voucher_amount_type'); - $voucher_amount_value = Tools::getValue('voucher_amount_value'); - $voucher_date = Tools::getValue('voucher_date_to'); - - - $campaign = new Campaign($id_campaign); - - $new_voucher = new CartRule($campaign->id_voucher,$defaultLanguage->id); - - $new_voucher->name = $voucher_name; - - - $new_voucher->date_from = date('Y-m-d'); - $new_voucher->date_to = $voucher_date; - $new_voucher->description = 'Campaign : '.$voucher_name; - $new_voucher->code = $voucher_code; - $new_voucher->quantity = 1000; // Todo : Update when campaign is lunch to number of concerned people - - // Si percent : - if( $voucher_amount_type == 'percent' ){ - $new_voucher->reduction_percent = $voucher_amount_value; - } // if fixed amount - else{ - $new_voucher->reduction_amount = $voucher_amount_value; - } - // d($new_voucher); - if( ! $new_voucher->save() ){ - $this->errors[] = Tools::displayError('An error has occured : when saved voucher'); - } // Create campaign : @@ -538,6 +473,7 @@ public function postProcess() { }else{ $campaign->id_voucher = 0; } + $campaign->active = Tools::getValue('active'); $path = _PS_ROOT_DIR_.'/modules/superabandonedcart/mails/'.$defaultLanguage->iso_code.'/'; @@ -633,29 +569,4 @@ public function postProcess() { } } - - - /* public function processImageCategory($FILES, $id) { - if (isset($FILES['path_img']) && isset($FILES['path_img']['tmp_name']) && !empty($FILES['path_img']['tmp_name'])) { - if ($error = ImageManager::validateUpload($FILES['path_img'], 4000000)) - return Tools::displayError($this->l('Invalid image')); - else { - $ext = substr($FILES['path_img']['name'], strrpos($FILES['path_img']['name'], '.') + 1); - $file_name = 'ban_'.$id . '.' . $ext; - $path = _PS_MODULE_DIR_ . 'categoriesbanner/images/' . $file_name; - - // if file exist (update case) - if (file_exists($path)){ - unlink($path); - } - - $banner = new Banner($id); - $banner->path_img = '/modules/categoriesbanner/images/' . $file_name; - $banner->save(); - if (!move_uploaded_file($FILES['path_img']['tmp_name'], $path)) - return Tools::displayError($this->l('An error occurred while attempting to upload the file.')); - - } - } - } */ -} +} \ No newline at end of file