// fix bug view.tpl in AdminCartsController PSFV-94

This commit is contained in:
lLefevre
2011-11-10 16:33:38 +00:00
parent 4d0719d8f7
commit 381eafdbc4
3 changed files with 176 additions and 167 deletions
+156 -151
View File
@@ -24,162 +24,167 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
<h2>{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}</h2> {extends file="helper/view/view.tpl"}
<br /> {block name="override_tpl"}
<div style="float: left;">
<fieldset style="width: 400px"> <h2>{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}</h2>
<legend><img src="../img/admin/tab-customers.gif" />{l s='Customer information'}</legend>
<span style="font-weight: bold; font-size: 14px;"> <br />
{if $customer->id} <div style="float: left;">
<a href={$link->getAdminLink('AdminCustomers')}&id_customer={$customer->id}&viewcustomer">{$customer->firstname} {$customer->lastname}</a></span> {l s='#'}{$customer->id}<br /> <fieldset style="width: 400px">
<a href="mailto:{$customer->email}">{$customer->email}</a> <br /><br /> <legend><img src="../img/admin/tab-customers.gif" />{l s='Customer information'}</legend>
{l s='Account registered:'} {dateFormat date=$customer->date_add}<br /> <span style="font-weight: bold; font-size: 14px;">
{l s='Valid orders placed:'} <b>{$customer_stats.nb_orders}</b><br /> {if $customer->id}
{l s='Total paid since registration:'} <b>{displayWtPriceWithCurrency price=$customer_stats.total_orders currency=$currency}</b><br /> <a href={$link->getAdminLink('AdminCustomers')}&id_customer={$customer->id}&viewcustomer">{$customer->firstname} {$customer->lastname}</a></span> {l s='#'}{$customer->id}<br />
{else} <a href="mailto:{$customer->email}">{$customer->email}</a> <br /><br />
{l s='Guest not registered'} {l s='Account registered:'} {dateFormat date=$customer->date_add}<br />
{/if} {l s='Valid orders placed:'} <b>{$customer_stats.nb_orders}</b><br />
</span> {l s='Total paid since registration:'} <b>{displayWtPriceWithCurrency price=$customer_stats.total_orders currency=$currency}</b><br />
</fieldset> {else}
</div> {l s='Guest not registered'}
<div style="float: left; margin-left: 40px"> {/if}
<fieldset style="width: 400px"> </span>
<legend><img src="../img/admin/cart.gif" /> {l s='Order information'}</legend> </fieldset>
<span style="font-weight: bold; font-size: 14px;"> </div>
{if $order->id} <div style="float: left; margin-left: 40px">
<a href="{$link->getAdminLink('AdminOrders')}&id_order={$order->id}&vieworder"> {l s='Order #'}{$order->id|string_format:"%06d"}</a></span> <fieldset style="width: 400px">
<br /><br /> <legend><img src="../img/admin/cart.gif" /> {l s='Order information'}</legend>
{l s='Made on:'} {dateFormat date=$order->date_add}<br /><br /><br /><br /> <span style="font-weight: bold; font-size: 14px;">
{else} {if $order->id}
{l s='No order created from this cart'}</span> <a href="{$link->getAdminLink('AdminOrders')}&id_order={$order->id}&vieworder"> {l s='Order #'}{$order->id|string_format:"%06d"}</a></span>
<p><a href="{$link->getAdminLink('AdminOrders')}&id_cart={$cart->id}&addorder">{l s='Create an order with this cart'}</a></p> <br /><br />
{/if} {l s='Made on:'} {dateFormat date=$order->date_add}<br /><br /><br /><br />
</fieldset> {else}
</div> {l s='No order created from this cart'}</span>
<br style="clear:both;" /> <p><a href="{$link->getAdminLink('AdminOrders')}&id_cart={$cart->id}&addorder">{l s='Create an order with this cart'}</a></p>
<fieldset style="margin-top:25px; width: 715px; "> {/if}
<legend><img src="../img/admin/cart.gif" alt="{l s='Products'}" />{l s='Cart summary'}</legend> </fieldset>
<div style="float:left;"> </div>
<table style="width: 700px;" cellspacing="0" cellpadding="0" class="table" id="orderProducts"> <br style="clear:both;" />
<thead> <fieldset style="margin-top:25px; width: 715px; ">
<tr> <legend><img src="../img/admin/cart.gif" alt="{l s='Products'}" />{l s='Cart summary'}</legend>
<th align="center" style="width: 60px">&nbsp;</th> <div style="float:left;">
<th>{l s='Product'}</th> <table style="width: 700px;" cellspacing="0" cellpadding="0" class="table" id="orderProducts">
<th style="width: 80px; text-align: center">{l s='UP'}</th> <thead>
<th style="width: 20px; text-align: center">{l s='Qty'}</th>
<th style="width: 30px; text-align: center">{l s='Stock'}</th>
<th style="width: 90px; text-align: right; font-weight:bold;">{l s='Total'}</th>
</tr>
<tbody>
{foreach from=$products item='product'}
{if isset($customized_datas[$product.id_product][$product.id_product_attribute])}
<tr> <tr>
<td align="center">{$product.image}</td> <th align="center" style="width: 60px">&nbsp;</th>
<td><a href="{$link->getAdminLink('AdminProducts')}&id_product={$product.id_product}&updateproduct"> <th>{l s='Product'}</th>
<span class="productName">{$product.name}</span>{if isset($product.attributes)}<br />{$product.attributes}{/if}<br /> <th style="width: 80px; text-align: center">{l s='UP'}</th>
{if $product.reference}$this->l('Ref:') {$product.reference}{/if} <th style="width: 20px; text-align: center">{l s='Qty'}</th>
{if $product.reference && $product.supplier_reference} / {$product.supplier_reference}{/if} <th style="width: 30px; text-align: center">{l s='Stock'}</th>
</a> <th style="width: 90px; text-align: right; font-weight:bold;">{l s='Total'}</th>
</td> </tr>
<td align="center">{displayWtPriceWithCurrency price=$product.price_wt currency=$currency}</td> <tbody>
<td align="center" class="productQuantity">{$product.customizationQuantityTotal}</td> {foreach from=$products item='product'}
<td align="center" class="productQuantity">{$product.qty_in_stock}</td> {if isset($customized_datas[$product.id_product][$product.id_product_attribute])}
<td align="right">{displayWtPriceWithCurrency price=$product.total_customization_wt currency=$currency}</td> <tr>
</tr> <td align="center">{$product.image}</td>
{foreach from=$customized_datas[$product.id_product][$product.id_product_attribute] item='customization'} <td><a href="{$link->getAdminLink('AdminProducts')}&id_product={$product.id_product}&updateproduct">
<tr> <span class="productName">{$product.name}</span>{if isset($product.attributes)}<br />{$product.attributes}{/if}<br />
<td colspan="2"> {if $product.reference}$this->l('Ref:') {$product.reference}{/if}
{foreach from=$customization.datas key='type' item='datas'} {if $product.reference && $product.supplier_reference} / {$product.supplier_reference}{/if}
{if $type == constant('Product::CUSTOMIZE_FILE')} </a>
<ul style="margin: 0; padding: 0; list-style-type: none;"> </td>
{foreach from=$datas key='index' item='data'} <td align="center">{displayWtPriceWithCurrency price=$product.price_wt currency=$currency}</td>
<li style="display: inline; margin: 2px;"> <td align="center" class="productQuantity">{$product.customizationQuantityTotal}</td>
<a href="displayImage.php?img={$data.value}&name={$order->id}-file{$smarty.foreach.count.index}" target="_blank"> <td align="center" class="productQuantity">{$product.qty_in_stock}</td>
<img src="{$pic_dir}{$data.value}_small" alt="" /></a> <td align="right">{displayWtPriceWithCurrency price=$product.total_customization_wt currency=$currency}</td>
</li> </tr>
{/foreach} {foreach from=$customized_datas[$product.id_product][$product.id_product_attribute] item='customization'}
</ul> <tr>
{elseif $type == constant('Product::CUSTOMIZE_TEXTFIELD')} <td colspan="2">
<ul style="margin-bottom: 4px; padding: 0; list-style-type: none;"> {foreach from=$customization.datas key='type' item='datas'}
{foreach from=$datas key='index' item='data'} {if $type == constant('Product::CUSTOMIZE_FILE')}
<li>{if $data.name}{$data.name}{else}{l s='Text #'}{$smarty.foreach.count.index}{/if}{l s=':'}<b>{$data.value}</b></li> <ul style="margin: 0; padding: 0; list-style-type: none;">
{/foreach} {foreach from=$datas key='index' item='data'}
</ul> <li style="display: inline; margin: 2px;">
{/if} <a href="displayImage.php?img={$data.value}&name={$order->id}-file{$smarty.foreach.count.index}" target="_blank">
<img src="{$pic_dir}{$data.value}_small" alt="" /></a>
</li>
{/foreach}
</ul>
{elseif $type == constant('Product::CUSTOMIZE_TEXTFIELD')}
<ul style="margin-bottom: 4px; padding: 0; list-style-type: none;">
{foreach from=$datas key='index' item='data'}
<li>{if $data.name}{$data.name}{else}{l s='Text #'}{$smarty.foreach.count.index}{/if}{l s=':'}<b>{$data.value}</b></li>
{/foreach}
</ul>
{/if}
{/foreach}
</td>
<td align="center"></td>
<td align="center" class="productQuantity">{$customization.quantity}</td>
<td align="center" class="productQuantity"></td>
<td align="center"></td>
</tr>
{/foreach} {/foreach}
</td> {/if}
<td align="center"></td>
<td align="center" class="productQuantity">{$customization.quantity}</td> {if $product.cart_quantity > $product.customizationQuantityTotal}
<td align="center" class="productQuantity"></td> <tr>
<td align="center"></td> <td align="center">{$product.image}</td>
</tr> <td>
{/foreach} <a href="{$link->getAdminLink('AdminProducts')}&id_product={$product.id_product}&updateproduct">
{/if} <span class="productName">{$product.name}</span>{if isset($product.attributes)}<br />{$product.attributes}{/if}<br />
{if $product.reference}{l s='Ref:'} {$product.reference}{/if}
{if $product.cart_quantity > $product.customizationQuantityTotal} {if $product.reference && $product.supplier_reference} / {$product.supplier_reference}{/if}
<tr> </a>
<td align="center">{$product.image}</td> </td>
<td> <td align="center">{displayWtPriceWithCurrency price=$product.product_price currency=$currency}</td>
<a href="{$link->getAdminLink('AdminProducts')}&id_product={$product.id_product}&updateproduct"> <td align="center" class="productQuantity">{math equation='x - y' x=$product.cart_quantity y=$product.customizationQuantityTotal}</td>
<span class="productName">{$product.name}</span>{if isset($product.attributes)}<br />{$product.attributes}{/if}<br /> <td align="center" class="productQuantity">{$product.qty_in_stock}</td>
{if $product.reference}{l s='Ref:'} {$product.reference}{/if} <td align="right">{displayWtPriceWithCurrency price=$product.product_total currency=$currency}</td>
{if $product.reference && $product.supplier_reference} / {$product.supplier_reference}{/if} </tr>
</a> {/if}
</td> {/foreach}
<td align="center">{displayWtPriceWithCurrency price=$product.product_price currency=$currency}</td> <tr class="cart_total_product">
<td align="center" class="productQuantity">{math equation='x - y' x=$product.cart_quantity y=$product.customizationQuantityTotal}</td> <td colspan="5">{l s='Total products:'}</td>
<td align="center" class="productQuantity">{$product.qty_in_stock}</td> <td class="price bold right">{displayWtPriceWithCurrency price=$total_products currency=$currency}</td>
<td align="right">{displayWtPriceWithCurrency price=$product.product_total currency=$currency}</td> </tr>
{if $total_discounts != 0}
<tr class="cart_total_voucher">
<td colspan="5">{l s='Total vouchers:'}</td>
<td class="price-discount bold right">{displayWtPriceWithCurrency price=$total_discounts currency=$currency}</td>
</tr> </tr>
{/if} {/if}
{/foreach} {if $total_wrapping > 0}
<tr class="cart_total_product"> <tr class="cart_total_voucher">
<td colspan="5">{l s='Total products:'}</td> <td colspan="5">{l s='Total gift-wrapping:'}</td>
<td class="price bold right">{displayWtPriceWithCurrency price=$total_products currency=$currency}</td> <td class="price-discount bold right">{displayWtPriceWithCurrency price=$total_wrapping currency=$currency}</td>
</tr> </tr>
{/if}
{if $total_discounts != 0} {if $cart->getOrderTotal(true, Cart::ONLY_SHIPPING) > 0}
<tr class="cart_total_voucher"> <tr class="cart_total_delivery">
<td colspan="5">{l s='Total vouchers:'}</td> <td colspan="5">{l s='Total shipping:'}</td>
<td class="price-discount bold right">{displayWtPriceWithCurrency price=$total_discounts currency=$currency}</td> <td class="price bold right">{displayWtPriceWithCurrency price=$total_shipping currency=$currency}</td>
</tr>
{/if}
<tr class="cart_total_price">
<td colspan="5" class="bold">{l s='Total:'}</td>
<td class="price bold right">{displayWtPriceWithCurrency price=$total_price currency=$currency}</td>
</tr> </tr>
{/if} </table>
{if $total_wrapping > 0}
<tr class="cart_total_voucher"> {if $discounts}
<td colspan="5">{l s='Total gift-wrapping:'}</td> <table cellspacing="0" cellpadding="0" class="table" style="width:280px; margin:15px 0px 0px 420px;">
<td class="price-discount bold right">{displayWtPriceWithCurrency price=$total_wrapping currency=$currency}</td>
</tr>
{/if}
{if $cart->getOrderTotal(true, Cart::ONLY_SHIPPING) > 0}
<tr class="cart_total_delivery">
<td colspan="5">{l s='Total shipping:'}</td>
<td class="price bold right">{displayWtPriceWithCurrency price=$total_shipping currency=$currency}</td>
</tr>
{/if}
<tr class="cart_total_price">
<td colspan="5" class="bold">{l s='Total:'}</td>
<td class="price bold right">{displayWtPriceWithCurrency price=$total_price currency=$currency}</td>
</tr>
</table>
{if $discounts}
<table cellspacing="0" cellpadding="0" class="table" style="width:280px; margin:15px 0px 0px 420px;">
<tr>
<th><img src="../img/admin/coupon.gif" alt="{l s='Discounts'}" />{l s='Discount name'}</th>
<th align="center" style="width: 100px">{l s='Value'}</th>
</tr>
{foreach from=$discounts item='discount'}
<tr> <tr>
<td><a href="{$link->getAdminLink('AdminDiscounts')}&id_discount={$discount.id_discount}&updatediscount">{$discount.name}</a></td> <th><img src="../img/admin/coupon.gif" alt="{l s='Discounts'}" />{l s='Discount name'}</th>
<td align="center">- {displayWtPriceWithCurrency price=$discount.value_real currency=$currency}</td> <th align="center" style="width: 100px">{l s='Value'}</th>
</tr> </tr>
{/foreach} {foreach from=$discounts item='discount'}
</table> <tr>
{/if} <td><a href="{$link->getAdminLink('AdminDiscounts')}&id_discount={$discount.id_discount}&updatediscount">{$discount.name}</a></td>
<div style="float:left; margin-top:15px;"> <td align="center">- {displayWtPriceWithCurrency price=$discount.value_real currency=$currency}</td>
{l s='According to the group of this customer, prices are printed:'} <b>{if $order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC}{l s='tax excluded'}{else}{l s='tax included'}{/if}</b> </tr>
</div></div> {/foreach}
</table>
</fieldset> {/if}
<div class="clear" style="height:20px;">&nbsp;</div> <div style="float:left; margin-top:15px;">
{l s='According to the group of this customer, prices are printed:'} <b>{if $order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC}{l s='tax excluded'}{else}{l s='tax included'}{/if}</b>
</div></div>
</fieldset>
<div class="clear" style="height:20px;">&nbsp;</div>
{/block}
+2 -1
View File
@@ -54,7 +54,8 @@ class HelperViewCore extends Helper
'table' => $this->table, 'table' => $this->table,
'show_toolbar' => $this->show_toolbar, 'show_toolbar' => $this->show_toolbar,
'toolbar_fix' => $this->toolbar_fix, 'toolbar_fix' => $this->toolbar_fix,
'toolbar_btn' => $this->toolbar_btn 'toolbar_btn' => $this->toolbar_btn,
'link' => $this->context->link
)); ));
return parent::generate(); return parent::generate();
+18 -15
View File
@@ -99,7 +99,7 @@ class AdminCartsController extends AdminController
parent::__construct(); parent::__construct();
} }
public function viewCart() public function initView()
{ {
if (!($cart = $this->loadObject(true))) if (!($cart = $this->loadObject(true)))
return; return;
@@ -157,20 +157,23 @@ class AdminCartsController extends AdminController
$imageProduct = new Image($image['id_image']); $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') : '--'); $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, $this->tpl_view_vars = array(
'discounts' => $cart->getCartRules(), 'products' => $products,
'order' => $order, 'discounts' => $cart->getCartRules(),
'cart' => $cart, 'order' => $order,
'currency' => $currency, 'cart' => $cart,
'customer' => $customer, 'currency' => $currency,
'customer_stats' => $customer->getStats(), 'customer' => $customer,
'total_products' => $total_products, 'customer_stats' => $customer->getStats(),
'total_discounts' => $total_discounts, 'total_products' => $total_products,
'total_wrapping' => $total_wrapping, 'total_discounts' => $total_discounts,
'total_price' => $total_price, 'total_wrapping' => $total_wrapping,
'total_shipping' => $total_shipping, 'total_price' => $total_price,
'customized_datas' => $customized_datas 'total_shipping' => $total_shipping,
)); 'customized_datas' => $customized_datas
);
return parent::initView();
} }
public function ajaxPreProcess() public function ajaxPreProcess()