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