+ {l s='Last visit:'} {if $customer_stats['last_visit']}{$last_visit}{else}{l s='never'}{/if}
-{else}
- {$customer->firstname} {$customer->lastname} {l s='has never contacted you'}
-{/if}
-
-{* display hook specified to this page : AdminCustomers *}
-{if $hook !== false}
-
-{if $orders AND count($orders)}
- {assign var=count_ok value=count($orders_ok)}
- {if $count_ok}
-
-
- {l s='Valid orders:'} {$count_ok} {l s='for'} {$total_ok}
-
-
+
+
+
+
+
+
+ {l s='Messages'} ({count($messages)})
+ {if count($messages)}
+
+
+ | {l s='Status'} |
+ {l s='Message'} |
+ {l s='Sent on'} |
+
+ {foreach $messages AS $message}
- | {l s='ID'} |
- {l s='Date'} |
- {l s='Products'} |
- {l s='Total paid'} |
- {l s='Payment'} |
- {l s='State'} |
- {l s='Actions'} |
+ {$message['status']} |
+
+
+ {$message['message']}...
+
+ |
+ {$message['date_add']} |
- {foreach $orders_ok AS $key => $order}
-
- | {$order['id_order']} |
- {$order['date_add']} |
- {$order['nb_products']} |
- {$order['total_paid_real']} |
- {$order['payment']} |
- {$order['order_state']} |
-  |
-
- {/foreach}
-
-
- {/if}
- {assign var=count_ko value=count($orders_ko)}
- {if $count_ko}
-
-
{l s='Invalid orders:'} {$count_ko}
-
-
- | {l s='ID'} |
- {l s='Date'} |
- {l s='Products'} |
- {l s='Total paid'} |
- {l s='Payment'} |
- {l s='State'} |
- {l s='Actions'} |
-
- {foreach $orders_ko AS $key => $order}
-
- | {$order['id_order']} |
- {$order['date_add']} |
- {$order['nb_products']} |
- {$order['total_paid_real']} |
- {$order['payment']} |
- {$order['order_state']} |
-  |
-
- {/foreach}
-
-
+ {/foreach}
+
+ {else}
+ {$customer->firstname} {$customer->lastname} {l s='has never contacted you'}
{/if}
-{else}
- {$customer->firstname} {$customer->lastname} {l s='has not placed any orders yet'}
-{/if}
-
-{if $products AND count($products)}
-
-
{l s='Products'} ({count($products)})
-
-
- | {l s='Date'} |
- {l s='Name'} |
- {l s='Quantity'} |
- {l s='Actions'} |
-
- {foreach $products AS $key => $product}
-
- | {$product['date_add']} |
- {$product['product_name']} |
- {$product['product_quantity']} |
-  |
-
- {/foreach}
-
-{/if}
-
-
-
{l s='Addresses'} ({count($addresses)})
-{if count($addresses)}
-
-
- | {l s='Company'} |
- {l s='Name'} |
- {l s='Address'} |
- {l s='Country'} |
- {l s='Phone number(s)'} |
- {l s='Actions'} |
-
- {foreach $addresses AS $key => $address}
-
- | {if $address['company']}{$address['company']}{else}--{/if} |
- {$address['firstname']} {$address['lastname']} |
- {$address['address1']} {if $address['address2']}{$address['address2']}{/if} {$address['postcode']} {$address['city']} |
- {$address['country']} |
-
- {if $address['phone']}
- {$address['phone']}
- {if $address['phone_mobile']} {$address['phone_mobile']}{/if}
- {else}
- {if $address['phone_mobile']} {$address['phone_mobile']}{else}--{/if}
- {/if}
- |
-
-
-
- |
-
- {/foreach}
-
-{else}
- {$customer->firstname} {$customer->lastname} {l s='has not registered any addresses yet'}
-{/if}
-
-
-
{l s='Discounts'} ({count($discounts)})
-{if count($discounts)}
-
-
- | {l s='ID'} |
- {l s='Code'} |
- {l s='Type'} |
- {l s='Value'} |
- {l s='Qty available'} |
- {l s='Status'} |
- {l s='Actions'} |
-
- {foreach $discounts AS $key => $discount}
-
- | {$discount['id_discount']} |
- {$discount['name']} |
- {$discount['type']} |
- {$discount['value']} |
- {$discount['quantity_for_user']} |
-  |
-
-
-
- |
-
- {/foreach}
-
-{else}
- {$customer->firstname} {$customer->lastname} {l s='has no discount vouchers'}.
-{/if}
-
-
-
-
{l s='Carts'} ({count($carts)})
- {if $carts AND count($carts)}
+
+ {* display hook specified to this page : AdminCustomers *}
+ {if $hook !== false}
+
{$hook}
+ {/if}
+
+
+
+
{l s='Groups'} ({count($groups)})
+ {if $groups AND count($groups)}
| {l s='ID'} |
- {l s='Date'} |
- {l s='Total'} |
- {l s='Carrier'} |
+ {l s='Name'} |
{l s='Actions'} |
- {foreach $carts AS $key => $cart}
-
- | {$cart['id_cart']} |
- {$cart['date_add']} |
- {$cart['total_price']} |
- {$cart['name']} |
-  |
+ {foreach $groups AS $key => $group}
+
+ | {$group['id_group']} |
+ {$group['name']} |
+  |
+
+ {/foreach}
+
+ {/if}
+
+
+
+
{l s='Orders'} ({count($orders)})
+ {if $orders AND count($orders)}
+ {assign var=count_ok value=count($orders_ok)}
+ {if $count_ok}
+
+
+ {l s='Valid orders:'} {$count_ok} {l s='for'} {$total_ok}
+
+
+
+ | {l s='ID'} |
+ {l s='Date'} |
+ {l s='Products'} |
+ {l s='Total paid'} |
+ {l s='Payment'} |
+ {l s='State'} |
+ {l s='Actions'} |
+
+ {foreach $orders_ok AS $key => $order}
+
+ | {$order['id_order']} |
+ {$order['date_add']} |
+ {$order['nb_products']} |
+ {$order['total_paid_real']} |
+ {$order['payment']} |
+ {$order['order_state']} |
+  |
+
+ {/foreach}
+
+
+ {/if}
+ {assign var=count_ko value=count($orders_ko)}
+ {if $count_ko}
+
+
{l s='Invalid orders:'} {$count_ko}
+
+
+ | {l s='ID'} |
+ {l s='Date'} |
+ {l s='Products'} |
+ {l s='Total paid'} |
+ {l s='Payment'} |
+ {l s='State'} |
+ {l s='Actions'} |
+
+ {foreach $orders_ko AS $key => $order}
+
+ | {$order['id_order']} |
+ {$order['date_add']} |
+ {$order['nb_products']} |
+ {$order['total_paid_real']} |
+ {$order['payment']} |
+ {$order['order_state']} |
+  |
+
+ {/foreach}
+
+
+
+ {/if}
+ {else}
+ {$customer->firstname} {$customer->lastname} {l s='has not placed any orders yet'}
+ {/if}
+
+ {if $products AND count($products)}
+
+
{l s='Products'} ({count($products)})
+
+
+ | {l s='Date'} |
+ {l s='Name'} |
+ {l s='Quantity'} |
+ {l s='Actions'} |
+
+ {foreach $products AS $key => $product}
+
+ | {$product['date_add']} |
+ {$product['product_name']} |
+ {$product['product_quantity']} |
+  |
+
+ {/foreach}
+
+ {/if}
+
+
+
{l s='Addresses'} ({count($addresses)})
+ {if count($addresses)}
+
+
+ | {l s='Company'} |
+ {l s='Name'} |
+ {l s='Address'} |
+ {l s='Country'} |
+ {l s='Phone number(s)'} |
+ {l s='Actions'} |
+
+ {foreach $addresses AS $key => $address}
+
+ | {if $address['company']}{$address['company']}{else}--{/if} |
+ {$address['firstname']} {$address['lastname']} |
+ {$address['address1']} {if $address['address2']}{$address['address2']}{/if} {$address['postcode']} {$address['city']} |
+ {$address['country']} |
+
+ {if $address['phone']}
+ {$address['phone']}
+ {if $address['phone_mobile']} {$address['phone_mobile']}{/if}
+ {else}
+ {if $address['phone_mobile']} {$address['phone_mobile']}{else}--{/if}
+ {/if}
+ |
+
+
+
+ |
{/foreach}
{else}
- {l s='No cart available'}.
+ {$customer->firstname} {$customer->lastname} {l s='has not registered any addresses yet'}
{/if}
-
-
-{if count($interested)}
-
-
{l s='Products'} ({count($interested)})
+
+
+
{l s='Discounts'} ({count($discounts)})
+ {if count($discounts)}
- {foreach $interested as $key => $p}
-
- | {$p['id']} |
- {$p['name']} |
-  |
+
+ | {l s='ID'} |
+ {l s='Code'} |
+ {l s='Type'} |
+ {l s='Value'} |
+ {l s='Qty available'} |
+ {l s='Status'} |
+ {l s='Actions'} |
+
+ {foreach $discounts AS $key => $discount}
+
+ | {$discount['id_discount']} |
+ {$discount['name']} |
+ {$discount['type']} |
+ {$discount['value']} |
+ {$discount['quantity_for_user']} |
+  |
+
+
+
+ |
+
+ {/foreach}
+
+ {else}
+ {$customer->firstname} {$customer->lastname} {l s='has no discount vouchers'}.
+ {/if}
+
+
+
+
{l s='Carts'} ({count($carts)})
+ {if $carts AND count($carts)}
+
+
+ | {l s='ID'} |
+ {l s='Date'} |
+ {l s='Total'} |
+ {l s='Carrier'} |
+ {l s='Actions'} |
+
+ {foreach $carts AS $key => $cart}
+
+ | {$cart['id_cart']} |
+ {$cart['date_add']} |
+ {$cart['total_price']} |
+ {$cart['name']} |
+  |
+
+ {/foreach}
+
+ {else}
+ {l s='No cart available'}.
+ {/if}
+
+
+ {if count($interested)}
+
+
{l s='Products'} ({count($interested)})
+
+ {foreach $interested as $key => $p}
+
+ | {$p['id']} |
+ {$p['name']} |
+  |
+
+ {/foreach}
+
+
+ {/if}
+
+
+
+ {* Last connections *}
+ {if count($connections)}
+
{l s='Last connections'}
+
+
+ | {l s='Date'} |
+ {l s='Pages viewed'} |
+ {l s='Total time'} |
+ {l s='Origin'} |
+ {l s='IP Address'} |
+
+ {foreach $connections as $connection}
+
+ | {$connection['date_add']} |
+ {$connection['pages']} |
+ {$connection['time']} |
+ {$connection['http_referer']} |
+ {$connection['ipaddress']} |
{/foreach}
-
-{/if}
-
-
-
-{* Last connections *}
-{if count($connections)}
-
{l s='Last connections'}
-
-
- | {l s='Date'} |
- {l s='Pages viewed'} |
- {l s='Total time'} |
- {l s='Origin'} |
- {l s='IP Address'} |
-
- {foreach $connections as $connection}
+
+ {/if}
+
+ {if count($referrers)}
+ {l s='Referrers'}
+
- | {$connection['date_add']} |
- {$connection['pages']} |
- {$connection['time']} |
- {$connection['http_referer']} |
- {$connection['ipaddress']} |
+ {l s='Date'} |
+ {l s='Name'} |
+ {if $shop_is_feature_active}{l s='Shop'} | {/if}
- {/foreach}
-
-
-{/if}
+ {foreach $referrers as $referrer}
+
+ | {$referrer['date_add']} |
+ {$referrer['name']} |
+ {if $shop_is_feature_active}{$referrer['shop_name']} | {/if}
+
+ {/foreach}
+
+
+ {/if}
+{/block}
-{if count($referrers)}
-
{l s='Referrers'}
-
-
- | {l s='Date'} |
- {l s='Name'} |
- {if $shop_is_feature_active}{l s='Shop'} | {/if}
-
- {foreach $referrers as $referrer}
-
- | {$referrer['date_add']} |
- {$referrer['name']} |
- {if $shop_is_feature_active}{$referrer['shop_name']} | {/if}
-
- {/foreach}
-
-
-{/if}
-
{l s='Back to customer list'}
\ No newline at end of file
diff --git a/admin-dev/themes/template/helper/view/view.tpl b/admin-dev/themes/template/helper/view/view.tpl
new file mode 100644
index 000000000..8c63d6447
--- /dev/null
+++ b/admin-dev/themes/template/helper/view/view.tpl
@@ -0,0 +1,43 @@
+{*
+* 2007-2011 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-2011 PrestaShop SA
+* @version Release: $Revision: 8971 $
+* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
+* International Registered Trademark & Property of PrestaShop SA
+*}
+
+
+
+{block name="override_tpl"}{/block}
diff --git a/classes/AdminController.php b/classes/AdminController.php
index 93fbe39de..670628479 100644
--- a/classes/AdminController.php
+++ b/classes/AdminController.php
@@ -73,6 +73,7 @@ class AdminControllerCore extends Controller
public $tpl_form_vars = array();
public $tpl_list_vars = array();
+ public $tpl_view_vars = array();
public $fields_value = false;
@@ -289,6 +290,10 @@ class AdminControllerCore extends Controller
array_pop($tabs);
$tabs[] = array('name' => sprintf($this->l('Add %s'), $this->table));
break;
+ case 'view':
+ array_pop($tabs);
+ $tabs[] = array('name' => sprintf($this->l('View %s'), $this->table));
+ break;
}
// note : this should use a tpl file
foreach ($tabs AS $key => $item)
@@ -1003,17 +1008,17 @@ class AdminControllerCore extends Controller
// Template override
$tpl = $this->tpl_folder.'content.tpl';
- $tpl_action = $this->tpl_folder.$this->display.'.tpl';
+ //$tpl_action = $this->tpl_folder.$this->display.'.tpl';
// Check if action template has been override
// new smarty : template_dir is an array.
// @todo : add override path to the smarty config, and checking all array item
- if (file_exists($this->context->smarty->template_dir[0].'/'.$tpl_action))
+ /*if (file_exists($this->context->smarty->template_dir[0].'/'.$tpl_action))
{
if (method_exists($this, $this->display.Tools::toCamelCase($this->className)))
$this->{$this->display.Tools::toCamelCase($this->className)}();
$this->context->smarty->assign('content', $this->context->smarty->fetch($tpl_action));
- }
+ }*/
// Check if content template has been override
if (file_exists($this->context->smarty->template_dir[0].'/'.$tpl))
@@ -1332,6 +1337,17 @@ class AdminControllerCore extends Controller
*/
public function initView()
{
+ if (empty($this->toolbar_title))
+ $this->initToolbarTitle();
+
+ $helper = new HelperView($this);
+ $helper->override_folder = $this->tpl_folder;
+ $helper->tpl_vars = $this->tpl_view_vars;
+ $this->setHelperDisplay($helper);
+ $view = $helper->generateView();
+ $this->toolbar_fix = false;
+
+ return $view;
}
/**
@@ -1672,7 +1688,10 @@ class AdminControllerCore extends Controller
if (isset($_GET['view'.$this->table]))
{
if ($this->tabAccess['view'] === '1')
+ {
$this->display = 'view';
+ $this->action = 'view';
+ }
else
$this->_errors[] = Tools::displayError('You do not have permission to view here.');
}
diff --git a/classes/Helper.php b/classes/Helper.php
index ebb58188f..1c3b3812f 100755
--- a/classes/Helper.php
+++ b/classes/Helper.php
@@ -63,7 +63,6 @@ class HelperCore
public function __construct()
{
$this->context = Context::getContext();
-
}
/*public function setTpl($tpl)
diff --git a/classes/HelperView.php b/classes/HelperView.php
new file mode 100644
index 000000000..9dedebaf9
--- /dev/null
+++ b/classes/HelperView.php
@@ -0,0 +1,62 @@
+
+* @copyright 2007-2011 PrestaShop SA
+* @version Release: $Revision: 9194 $
+* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+* International Registered Trademark & Property of PrestaShop SA
+*/
+
+class HelperViewCore extends Helper
+{
+ public $id;
+ public $toolbar = true;
+ public $table;
+ public $token;
+
+ /** @var if not null, a title will be added on that list */
+ public $title = null;
+
+ public function __construct()
+ {
+ $this->base_folder = 'helper/view/';
+ $this->base_tpl = 'view.tpl';
+ parent::__construct();
+ }
+
+ public function generateView()
+ {
+ $this->tpl = $this->createTemplate($this->base_tpl);
+
+ $this->tpl->assign(array(
+ 'title' => $this->title,
+ 'current' => $this->currentIndex,
+ 'title' => $this->title,
+ 'token' => $this->token,
+ 'table' => $this->table,
+ 'show_toolbar' => $this->show_toolbar,
+ 'toolbar_fix' => $this->toolbar_fix,
+ 'toolbar_btn' => $this->toolbar_btn
+ ));
+
+ return parent::generate();
+ }
+}
diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php
index 5a6d6d258..f90a2fb9a 100644
--- a/controllers/admin/AdminCustomersController.php
+++ b/controllers/admin/AdminCustomersController.php
@@ -34,16 +34,8 @@ class AdminCustomersControllerCore extends AdminController
$this->lang = false;
$this->deleted = true;
- $this->addRowAction('edit');
- $this->addRowAction('view');
- $this->addRowAction('delete');
-
- $this->requiredDatabase = true;
-
$this->context = Context::getContext();
- $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
-
$this->default_form_language = $this->context->language->id;
$genders_icon = array('default' => 'unknown.gif');
@@ -152,6 +144,12 @@ class AdminCustomersControllerCore extends AdminController
public function initList()
{
+ $this->addRowAction('edit');
+ $this->addRowAction('view');
+ $this->addRowAction('delete');
+
+ $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
+
$this->_select = '(YEAR(CURRENT_DATE)-YEAR(`birthday`)) - (RIGHT(CURRENT_DATE, 5) < RIGHT(birthday, 5)) AS `age`, (
SELECT c.date_add FROM '._DB_PREFIX_.'guest g
LEFT JOIN '._DB_PREFIX_.'connections c ON c.id_guest = g.id_guest
@@ -366,13 +364,6 @@ class AdminCustomersControllerCore extends AdminController
return parent::initForm();
}
- public function initContent()
- {
- if ($this->display == 'view')
- return $this->initView();
- parent::initContent();
- }
-
public function initView()
{
if (!($customer = $this->loadObject()))
@@ -492,11 +483,7 @@ class AdminCustomersControllerCore extends AdminController
for ($i = 0; $i < $total_referrers; $i++)
$referrers[$i]['date_add'] = Tools::displayDate($referrers[$i]['date_add'], $this->default_form_language, true);
- $this->context->smarty->assign(array(
- 'table' => $this->table,
- 'current' => self::$currentIndex,
- 'token' => $this->token,
- 'content' => $this->content,
+ $this->tpl_view_vars = array(
'customer' => $customer,
'gender_image' => $gender_image,
@@ -550,7 +537,10 @@ class AdminCustomersControllerCore extends AdminController
// Referrers
'referrers' => $referrers,
- ));
+ 'show_toolbar' => true
+ );
+
+ return parent::initView();
}
public function postProcess()