From 95f43d3ac614ef5e7f8db49a9c71c28c2ce0f46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Mon, 25 Feb 2013 18:45:28 +0100 Subject: [PATCH] [-] BO: Fix #PSCFV-7995 countries/groups/currencies refreshment when selecting a shop in specific price form --- .../products/specific_prices_shop_update.tpl | 27 ++++++++++ controllers/admin/AdminProductsController.php | 50 ++++++++++++++++++- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 admin-dev/themes/default/template/controllers/products/specific_prices_shop_update.tpl diff --git a/admin-dev/themes/default/template/controllers/products/specific_prices_shop_update.tpl b/admin-dev/themes/default/template/controllers/products/specific_prices_shop_update.tpl new file mode 100644 index 000000000..3d06de19a --- /dev/null +++ b/admin-dev/themes/default/template/controllers/products/specific_prices_shop_update.tpl @@ -0,0 +1,27 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* 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 license@prestashop.com 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 http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +{foreach from=$option_list item='row'} + +{/foreach} \ No newline at end of file diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index bd7a7c6bc..06ec28af6 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -360,6 +360,54 @@ class AdminProductsControllerCore extends AdminController return $result; } + public function ajaxProcessGetCountriesOptions() + { + if (!$res = Country::getCountriesByIdShop((int)Tools::getValue('id_shop'), (int)$this->context->language->id)) + return ; + + $tpl = $this->createTemplate('specific_prices_shop_update.tpl'); + $tpl->assign(array( + 'option_list' => $res, + 'key_id' => 'id_country', + 'key_value' => 'name' + ) + ); + + $this->content = $tpl->fetch(); + } + + public function ajaxProcessGetCurrenciesOptions() + { + if (!$res = Currency::getCurrenciesByIdShop((int)Tools::getValue('id_shop'))) + return ; + + $tpl = $this->createTemplate('specific_prices_shop_update.tpl'); + $tpl->assign(array( + 'option_list' => $res, + 'key_id' => 'id_currency', + 'key_value' => 'name' + ) + ); + + $this->content = $tpl->fetch(); + } + + public function ajaxProcessGetGroupsOptions() + { + if (!$res = Group::getGroups((int)$this->context->language->id, (int)Tools::getValue('id_shop'))) + return ; + + $tpl = $this->createTemplate('specific_prices_shop_update.tpl'); + $tpl->assign(array( + 'option_list' => $res, + 'key_id' => 'id_group', + 'key_value' => 'name' + ) + ); + + $this->content = $tpl->fetch(); + } + public function ajaxProcessDeleteVirtualProduct() { if (!($id_product_download = ProductDownload::getIdFromIdProduct((int)Tools::getValue('id_product')))) @@ -4251,4 +4299,4 @@ class AdminProductsControllerCore extends AdminController } } } -} \ No newline at end of file +}