Colissimo fix routing.xml, thelia.sql and adding "Activate free shipping" option
new file: local/modules/Colissimo/AdminIncludes/module-config-js.html modified: local/modules/Colissimo/AdminIncludes/module_configuration.html modified: local/modules/Colissimo/Colissimo.php modified: local/modules/Colissimo/Config/config.xml modified: local/modules/Colissimo/Config/routing.xml new file: local/modules/Colissimo/Config/schema.xml modified: local/modules/Colissimo/Config/thelia.sql new file: local/modules/Colissimo/Controller/FreeShipping.php new file: local/modules/Colissimo/Form/FreeShipping.php modified: local/modules/Colissimo/I18n/en_US.php modified: local/modules/Colissimo/I18n/fr_FR.php new file: local/modules/Colissimo/Model/Base/ColissimoFreeshipping.php new file: local/modules/Colissimo/Model/Base/ColissimoFreeshippingQuery.php new file: local/modules/Colissimo/Model/ColissimoFreeshipping.php new file: local/modules/Colissimo/Model/ColissimoFreeshippingQuery.php new file: local/modules/Colissimo/Model/Map/ColissimoFreeshippingTableMap.php
This commit is contained in:
48
local/modules/Colissimo/Controller/FreeShipping.php
Normal file
48
local/modules/Colissimo/Controller/FreeShipping.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Colissimo\Controller;
|
||||
|
||||
use Colissimo\Model\ColissimoFreeshipping;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
|
||||
class FreeShipping extends BaseAdminController {
|
||||
public function set() {
|
||||
$form = new \Colissimo\Form\FreeShipping($this->getRequest());
|
||||
$response=null;
|
||||
|
||||
try {
|
||||
$vform = $this->validateForm($form);
|
||||
$data = $vform->get('freeshipping')->getData();
|
||||
|
||||
$save = new ColissimoFreeshipping();
|
||||
$save->setActive(!empty($data))->save();
|
||||
$response = Response::create('');
|
||||
} catch (\Exception $e) {
|
||||
$response = JsonResponse::create(array("error"=>$e->getMessage()), 500);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user