From 381eafdbc49ccd8a4e651683dcdde052e0e14809 Mon Sep 17 00:00:00 2001 From: lLefevre Date: Thu, 10 Nov 2011 16:33:38 +0000 Subject: [PATCH] // fix bug view.tpl in AdminCartsController PSFV-94 --- admin-dev/themes/template/carts/view.tpl | 307 +++++++++++---------- classes/HelperView.php | 3 +- controllers/admin/AdminCartsController.php | 33 ++- 3 files changed, 176 insertions(+), 167 deletions(-) diff --git a/admin-dev/themes/template/carts/view.tpl b/admin-dev/themes/template/carts/view.tpl index c4c590ce2..de19c85b3 100755 --- a/admin-dev/themes/template/carts/view.tpl +++ b/admin-dev/themes/template/carts/view.tpl @@ -24,162 +24,167 @@ * International Registered Trademark & Property of PrestaShop SA *} -

{if $customer->id}{$customer->firstname} {$customer->lastname}{else}{l s='Guest'}{/if} - {l s='Cart #'}{$cart->id|string_format:"%06d"} {l s='from'} {$cart->date_upd}

+{extends file="helper/view/view.tpl"} -
-
-
- {l s='Customer information'} - - {if $customer->id} - getAdminLink('AdminCustomers')}&id_customer={$customer->id}&viewcustomer">{$customer->firstname} {$customer->lastname} {l s='#'}{$customer->id}
- {$customer->email}

- {l s='Account registered:'} {dateFormat date=$customer->date_add}
- {l s='Valid orders placed:'} {$customer_stats.nb_orders}
- {l s='Total paid since registration:'} {displayWtPriceWithCurrency price=$customer_stats.total_orders currency=$currency}
- {else} - {l s='Guest not registered'} - {/if} - -
-
-
-
- {l s='Order information'} - - {if $order->id} - {l s='Order #'}{$order->id|string_format:"%06d"} -

- {l s='Made on:'} {dateFormat date=$order->date_add}



- {else} - {l s='No order created from this cart'} -

{l s='Create an order with this cart'}

- {/if} -
-
-
-
-{l s='Products'}{l s='Cart summary'} -
- - - - - - - - - - - - {foreach from=$products item='product'} - {if isset($customized_datas[$product.id_product][$product.id_product_attribute])} +{block name="override_tpl"} + +

{if $customer->id}{$customer->firstname} {$customer->lastname}{else}{l s='Guest'}{/if} - {l s='Cart #'}{$cart->id|string_format:"%06d"} {l s='from'} {$cart->date_upd}

+ +
+
+
+ {l s='Customer information'} + + {if $customer->id} + getAdminLink('AdminCustomers')}&id_customer={$customer->id}&viewcustomer">{$customer->firstname} {$customer->lastname} {l s='#'}{$customer->id}
+ {$customer->email}

+ {l s='Account registered:'} {dateFormat date=$customer->date_add}
+ {l s='Valid orders placed:'} {$customer_stats.nb_orders}
+ {l s='Total paid since registration:'} {displayWtPriceWithCurrency price=$customer_stats.total_orders currency=$currency}
+ {else} + {l s='Guest not registered'} + {/if} + +
+
+
+
+ {l s='Order information'} + + {if $order->id} + {l s='Order #'}{$order->id|string_format:"%06d"} +

+ {l s='Made on:'} {dateFormat date=$order->date_add}



+ {else} + {l s='No order created from this cart'} +

{l s='Create an order with this cart'}

+ {/if} +
+
+
+
+ {l s='Products'}{l s='Cart summary'} +
+
 {l s='Product'}{l s='UP'}{l s='Qty'}{l s='Stock'}{l s='Total'}
+ - - - - - - - - {foreach from=$customized_datas[$product.id_product][$product.id_product_attribute] item='customization'} - - + + + + + + + + {foreach from=$products item='product'} + {if isset($customized_datas[$product.id_product][$product.id_product_attribute])} + + + + + + + + + {foreach from=$customized_datas[$product.id_product][$product.id_product_attribute] item='customization'} + + + + + + + {/foreach} - - - - - - - {/foreach} - {/if} - - {if $product.cart_quantity > $product.customizationQuantityTotal} - - - - - - - + {/if} + + {if $product.cart_quantity > $product.customizationQuantityTotal} + + + + + + + + + {/if} + {/foreach} + + + + + + {if $total_discounts != 0} + + + {/if} - {/foreach} - - - - - - {if $total_discounts != 0} - - - + {if $total_wrapping > 0} + + + + + {/if} + {if $cart->getOrderTotal(true, Cart::ONLY_SHIPPING) > 0} + + + + + {/if} + + + - {/if} - {if $total_wrapping > 0} - - - - - {/if} - {if $cart->getOrderTotal(true, Cart::ONLY_SHIPPING) > 0} - - - - - {/if} - - - - -
{$product.image} - {$product.name}{if isset($product.attributes)}
{$product.attributes}{/if}
- {if $product.reference}$this->l('Ref:') {$product.reference}{/if} - {if $product.reference && $product.supplier_reference} / {$product.supplier_reference}{/if} -
-
{displayWtPriceWithCurrency price=$product.price_wt currency=$currency}{$product.customizationQuantityTotal}{$product.qty_in_stock}{displayWtPriceWithCurrency price=$product.total_customization_wt currency=$currency}
- {foreach from=$customization.datas key='type' item='datas'} - {if $type == constant('Product::CUSTOMIZE_FILE')} -
    - {foreach from=$datas key='index' item='data'} -
  • - - -
  • - {/foreach} -
- {elseif $type == constant('Product::CUSTOMIZE_TEXTFIELD')} -
    - {foreach from=$datas key='index' item='data'} -
  • {if $data.name}{$data.name}{else}{l s='Text #'}{$smarty.foreach.count.index}{/if}{l s=':'}{$data.value}
  • - {/foreach} -
- {/if} +
 {l s='Product'}{l s='UP'}{l s='Qty'}{l s='Stock'}{l s='Total'}
{$product.image} + {$product.name}{if isset($product.attributes)}
{$product.attributes}{/if}
+ {if $product.reference}$this->l('Ref:') {$product.reference}{/if} + {if $product.reference && $product.supplier_reference} / {$product.supplier_reference}{/if} +
+
{displayWtPriceWithCurrency price=$product.price_wt currency=$currency}{$product.customizationQuantityTotal}{$product.qty_in_stock}{displayWtPriceWithCurrency price=$product.total_customization_wt currency=$currency}
+ {foreach from=$customization.datas key='type' item='datas'} + {if $type == constant('Product::CUSTOMIZE_FILE')} +
    + {foreach from=$datas key='index' item='data'} +
  • + + +
  • + {/foreach} +
+ {elseif $type == constant('Product::CUSTOMIZE_TEXTFIELD')} +
    + {foreach from=$datas key='index' item='data'} +
  • {if $data.name}{$data.name}{else}{l s='Text #'}{$smarty.foreach.count.index}{/if}{l s=':'}{$data.value}
  • + {/foreach} +
+ {/if} + {/foreach} +
{$customization.quantity}
{$customization.quantity}
{$product.image} - - {$product.name}{if isset($product.attributes)}
{$product.attributes}{/if}
- {if $product.reference}{l s='Ref:'} {$product.reference}{/if} - {if $product.reference && $product.supplier_reference} / {$product.supplier_reference}{/if} -
-
{displayWtPriceWithCurrency price=$product.product_price currency=$currency}{math equation='x - y' x=$product.cart_quantity y=$product.customizationQuantityTotal}{$product.qty_in_stock}{displayWtPriceWithCurrency price=$product.product_total currency=$currency}
{$product.image} + + {$product.name}{if isset($product.attributes)}
{$product.attributes}{/if}
+ {if $product.reference}{l s='Ref:'} {$product.reference}{/if} + {if $product.reference && $product.supplier_reference} / {$product.supplier_reference}{/if} +
+
{displayWtPriceWithCurrency price=$product.product_price currency=$currency}{math equation='x - y' x=$product.cart_quantity y=$product.customizationQuantityTotal}{$product.qty_in_stock}{displayWtPriceWithCurrency price=$product.product_total currency=$currency}
{l s='Total products:'}{displayWtPriceWithCurrency price=$total_products currency=$currency}
{l s='Total vouchers:'}{displayWtPriceWithCurrency price=$total_discounts currency=$currency}
{l s='Total products:'}{displayWtPriceWithCurrency price=$total_products currency=$currency}
{l s='Total vouchers:'}{displayWtPriceWithCurrency price=$total_discounts currency=$currency}
{l s='Total gift-wrapping:'}{displayWtPriceWithCurrency price=$total_wrapping currency=$currency}
{l s='Total shipping:'}{displayWtPriceWithCurrency price=$total_shipping currency=$currency}
{l s='Total:'}{displayWtPriceWithCurrency price=$total_price currency=$currency}
{l s='Total gift-wrapping:'}{displayWtPriceWithCurrency price=$total_wrapping currency=$currency}
{l s='Total shipping:'}{displayWtPriceWithCurrency price=$total_shipping currency=$currency}
{l s='Total:'}{displayWtPriceWithCurrency price=$total_price currency=$currency}
- -{if $discounts} - - - - - - {foreach from=$discounts item='discount'} +
{l s='Discounts'}{l s='Discount name'}{l s='Value'}
+ + {if $discounts} + - - + + - {/foreach} -
{$discount.name}- {displayWtPriceWithCurrency price=$discount.value_real currency=$currency}{l s='Discounts'}{l s='Discount name'}{l s='Value'}
-{/if} -
-{l s='According to the group of this customer, prices are printed:'} {if $order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC}{l s='tax excluded'}{else}{l s='tax included'}{/if} -
- -
-
 
+ {foreach from=$discounts item='discount'} + + {$discount.name} + - {displayWtPriceWithCurrency price=$discount.value_real currency=$currency} + + {/foreach} + + {/if} +
+ {l s='According to the group of this customer, prices are printed:'} {if $order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC}{l s='tax excluded'}{else}{l s='tax included'}{/if} +
+ + +
 
+{/block} diff --git a/classes/HelperView.php b/classes/HelperView.php index 9dedebaf9..23ad4c47f 100644 --- a/classes/HelperView.php +++ b/classes/HelperView.php @@ -54,7 +54,8 @@ class HelperViewCore extends Helper 'table' => $this->table, 'show_toolbar' => $this->show_toolbar, 'toolbar_fix' => $this->toolbar_fix, - 'toolbar_btn' => $this->toolbar_btn + 'toolbar_btn' => $this->toolbar_btn, + 'link' => $this->context->link )); return parent::generate(); diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index f3db1f7e0..392fa01e5 100755 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -99,7 +99,7 @@ class AdminCartsController extends AdminController parent::__construct(); } - public function viewCart() + public function initView() { if (!($cart = $this->loadObject(true))) return; @@ -157,20 +157,23 @@ class AdminCartsController extends AdminController $imageProduct = new Image($image['id_image']); $product['image'] = (isset($image['id_image']) ? cacheImage(_PS_IMG_DIR_.'p/'.$imageProduct->getExistingImgPath().'.jpg', 'product_mini_'.(int)($product['id_product']).(isset($product['id_product_attribute']) ? '_'.(int)($product['id_product_attribute']) : '').'.jpg', 45, 'jpg') : '--'); } - $this->context->smarty->assign(array('products' => $products, - 'discounts' => $cart->getCartRules(), - 'order' => $order, - 'cart' => $cart, - 'currency' => $currency, - 'customer' => $customer, - 'customer_stats' => $customer->getStats(), - 'total_products' => $total_products, - 'total_discounts' => $total_discounts, - 'total_wrapping' => $total_wrapping, - 'total_price' => $total_price, - 'total_shipping' => $total_shipping, - 'customized_datas' => $customized_datas - )); + $this->tpl_view_vars = array( + 'products' => $products, + 'discounts' => $cart->getCartRules(), + 'order' => $order, + 'cart' => $cart, + 'currency' => $currency, + 'customer' => $customer, + 'customer_stats' => $customer->getStats(), + 'total_products' => $total_products, + 'total_discounts' => $total_discounts, + 'total_wrapping' => $total_wrapping, + 'total_price' => $total_price, + 'total_shipping' => $total_shipping, + 'customized_datas' => $customized_datas + ); + + return parent::initView(); } public function ajaxPreProcess()