Skip to content

Commit

Permalink
Remove old legacy zones controller
Browse files Browse the repository at this point in the history
  • Loading branch information
ks129 committed Mar 26, 2021
1 parent 0bbf934 commit 31a1f08
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 161 deletions.
160 changes: 0 additions & 160 deletions controllers/admin/AdminZonesController.php
Original file line number Diff line number Diff line change
@@ -1,160 +0,0 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* 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.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* 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 [email protected] 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <[email protected]>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/

/**
* @property Zone $object
*/
class AdminZonesControllerCore extends AdminController
{
public $asso_type = 'shop';

public function __construct()
{
$this->bootstrap = true;
$this->table = 'zone';
$this->className = 'Zone';
$this->lang = false;

parent::__construct();

$this->fields_list = [
'id_zone' => [
'title' => $this->trans('ID', [], 'Admin.Global'),
'align' => 'center',
'class' => 'fixed-width-xs',
],
'name' => [
'title' => $this->trans('Zone', [], 'Admin.Global'),
],
'active' => [
'title' => $this->trans('Enabled', [], 'Admin.Global'),
'align' => 'center',
'active' => 'status',
'type' => 'bool',
'orderby' => false,
'class' => 'fixed-width-sm',
],
];
$this->bulk_actions = [
'delete' => [
'text' => $this->trans('Delete selected', [], 'Admin.Actions'),
'confirm' => $this->trans('Delete selected items?', [], 'Admin.Notifications.Warning'),
'icon' => 'icon-trash',
],
];
}

public function initPageHeaderToolbar()
{
if (empty($this->display)) {
$this->page_header_toolbar_btn['new_zone'] = [
'href' => self::$currentIndex . '&addzone&token=' . $this->token,
'desc' => $this->trans('Add new zone', [], 'Admin.International.Feature'),
'icon' => 'process-icon-new',
];
}

parent::initPageHeaderToolbar();
}

public function renderList()
{
$this->addRowAction('edit');
$this->addRowAction('delete');

return parent::renderList();
}

public function renderForm()
{
$this->fields_form = [
'legend' => [
'title' => $this->trans('Zones', [], 'Admin.International.Feature'),
'icon' => 'icon-globe',
],
'input' => [
[
'type' => 'text',
'label' => $this->trans('Name', [], 'Admin.Global'),
'name' => 'name',
'required' => true,
'hint' => $this->trans('Zone name (e.g. Africa, West Coast, Neighboring Countries).', [], 'Admin.International.Help'),
],
[
'type' => 'switch',
'label' => $this->trans('Active', [], 'Admin.Global'),
'name' => 'active',
'required' => false,
'is_bool' => true,
'values' => [
[
'id' => 'active_on',
'value' => 1,
'label' => $this->trans('Yes', [], 'Admin.Global'),
],
[
'id' => 'active_off',
'value' => 0,
'label' => $this->trans('No', [], 'Admin.Global'),
],
],
'hint' => $this->trans('Allow or disallow shipping to this zone.', [], 'Admin.International.Help'),
],
],
];

if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = [
'type' => 'shop',
'label' => $this->trans('Shop association', [], 'Admin.Global'),
'name' => 'checkBoxShopAsso',
];
}

$this->fields_form['submit'] = [
'title' => $this->trans('Save', [], 'Admin.Actions'),
];

return parent::renderForm();
}

/**
* Get all zones displayed in a select input.
*/
public function displayAjaxZones()
{
$this->context->smarty->assign([
'zones' => Zone::getZones(),
]);

$array = [
'hasError' => false,
'errors' => '',
'data' => $this->context->smarty->fetch('controllers/zones/select.tpl'),
];
$this->ajaxRender(json_encode($array));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public function getControllersClasses()
return [
['AdminCarriersController'],
['AdminStatusesController'],
['AdminZonesController'],
['AdminLoginController'],
['AdminQuickAccessesController'],
['AdminCustomerThreadsController'],
Expand Down

0 comments on commit 31a1f08

Please sign in to comment.