From 52b881723f7e17dffabd5947adacd9e2608f0255 Mon Sep 17 00:00:00 2001 From: vAugagneur Date: Thu, 5 Jul 2012 10:27:26 +0000 Subject: [PATCH] [-] BO : fixed #PSCFV-3058 SAV multi fix git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16231 b9a71923-0436-4b27-9f14-aed3839534dd --- controllers/front/ContactController.php | 16 +++++------ themes/default/contact-form.tpl | 20 ++++++++++--- themes/default/js/contact-form.js | 37 +++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 13 deletions(-) create mode 100755 themes/default/js/contact-form.js diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index 47f472c03..ef3dc3a87 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -199,6 +199,7 @@ class ContactControllerCore extends FrontController { parent::setMedia(); $this->addCSS(_THEME_CSS_DIR_.'contact-form.css'); + $this->addJS(_THEME_JS_DIR_.'contact-form.js'); } /** @@ -256,18 +257,15 @@ class ContactControllerCore extends FrontController $orders[$row['id_order']] = Tools::displayDate($date[0], $this->context->language->id); $tmp = $order->getProducts(); foreach ($tmp as $key => $val) - $products[$val['product_id']] = $val['product_name']; + $products[$row['id_order']][$val['product_id']] = array('value' => $val['product_id'], 'label' => $val['product_name']); } - $orderList = ''; + $order_tab = array(); foreach ($orders as $key => $val) - $orderList .= ''; - $orderedProductList = ''; - - foreach ($products as $key => $val) - $orderedProductList .= ''; - $this->context->smarty->assign('orderList', $orderList); - $this->context->smarty->assign('orderedProductList', $orderedProductList); + $order_tab[] = array('value' => $key, 'label' => $key.' -- '.$val, 'selected' => (int)(Tools::getValue('id_order')) == $key); + + $this->context->smarty->assign('orderList', $order_tab); + $this->context->smarty->assign('orderedProductList', $products); } } } diff --git a/themes/default/contact-form.tpl b/themes/default/contact-form.tpl index 579e2354c..d43d59ff3 100644 --- a/themes/default/contact-form.tpl +++ b/themes/default/contact-form.tpl @@ -73,9 +73,9 @@

{if isset($customerThread.email)} - + {else} - + {/if}

{if !$PS_CATALOG_MODE} @@ -83,7 +83,12 @@

{if !isset($customerThread.id_order) && isset($isLogged) && $isLogged == 1} - + {elseif !isset($customerThread.id_order) && !isset($isLogged)} {elseif $customerThread.id_order > 0} @@ -95,7 +100,14 @@

{if !isset($customerThread.id_product)} - + {foreach from=$orderedProductList key=id_order item=products name=products} + + {/foreach} {elseif $customerThread.id_product > 0} {/if} diff --git a/themes/default/js/contact-form.js b/themes/default/js/contact-form.js new file mode 100755 index 000000000..c6bb80625 --- /dev/null +++ b/themes/default/js/contact-form.js @@ -0,0 +1,37 @@ +/* +* 2007-2012 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-2012 PrestaShop SA +* @version Release: $Revision: 6594 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +$(document).ready(function () { + $('select[name=id_order]').change(function () { + showProductSelect($(this).attr('value')); + }); +}); + +function showProductSelect(id_order) +{ + $('.product_select').hide().attr('disabled', 'disabled'); + $('#'+id_order+'_order_products').show().removeAttr('disabled'); +} \ No newline at end of file