Commit 1bebbdf4 authored by Julien Bourdeau's avatar Julien Bourdeau

// Continue merge of add order and view order in BO

parent 276c4ea3
......@@ -22,9 +22,9 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if $product['customizedDatas']}
{if $product['customizedDatas'] || $product['customized_data']}
{* Assign product price *}
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
{if ($taxCalculationMethod == $smarty.const.PS_TAX_EXC)}
{assign var=product_price value=($product['unit_price_tax_excl'] + $product['ecotax'])}
{else}
{assign var=product_price value=$product['unit_price_tax_incl']}
......
......@@ -24,13 +24,12 @@
*}
{* Assign product price *}
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
{if ($taxCalculationMethod == $smarty.const.PS_TAX_EXC)}
{assign var=product_price value=($product['unit_price_tax_excl'] + $product['ecotax'])}
{else}
{assign var=product_price value=$product['unit_price_tax_incl']}
{/if}
{if ($product['product_quantity'] > $product['customizationQuantityTotal'])}
<tr class="product-line-row">
<td>{if isset($product.image) && $product.image->id}{$product.image_tag}{/if}</td>
<td>
......@@ -73,8 +72,8 @@
</span>
{/if}
</td>
{if $display_warehouse}<td>{$product.warehouse_name|escape:'html':'UTF-8'}</td>{/if}
{if ($order->hasBeenPaid())}
{if isset($display_warehouse) && $display_warehouse}<td>{$product.warehouse_name|escape:'html':'UTF-8'}</td>{/if}
{if (isset($order) && $order->hasBeenPaid())}
<td class="productQuantity text-center">
{$product['product_quantity_refunded']}
{if count($product['refund_history'])}
......@@ -90,7 +89,7 @@
{/if}
</td>
{/if}
{if $order->hasBeenDelivered() || $order->hasProductReturned()}
{if isset($order) && ($order->hasBeenDelivered() || $order->hasProductReturned())}
<td class="productQuantity text-center">
{$product['product_quantity_return']}
{if count($product['return_history'])}
......@@ -110,38 +109,42 @@
<td class="total_product">
{displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}
</td>
<td colspan="2" style="display: none;" class="add_product_fields">&nbsp;</td>
<td class="cancelCheck standard_refund_fields current-edit" style="display:none">
<input type="hidden" name="totalQtyReturn" id="totalQtyReturn" value="{$product['product_quantity_return']}" />
<input type="hidden" name="totalQty" id="totalQty" value="{$product['product_quantity']}" />
<input type="hidden" name="productName" id="productName" value="{$product['product_name']}" />
{if ((!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN')) AND (int)($product['product_quantity_return']) < (int)($product['product_quantity']))}
<input type="checkbox" name="id_order_detail[{$product['id_order_detail']}]" id="id_order_detail[{$product['id_order_detail']}]" value="{$product['id_order_detail']}" onchange="setCancelQuantity(this, {$product['id_order_detail']}, {$product['product_quantity'] - $product['customizationQuantityTotal'] - $product['product_quantity_return']})" {if ($product['product_quantity_return'] + $product['product_quantity_refunded'] >= $product['product_quantity'])}disabled="disabled" {/if}/>
{else}
--
{/if}
</td>
<td class="cancelQuantity standard_refund_fields current-edit" style="display:none">
{if ($product['product_quantity_return'] + $product['product_quantity_refunded'] >= $product['product_quantity'])}
<input type="hidden" name="cancelQuantity[{$product['id_order_detail']}]" value="0" />
{elseif (!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN'))}
<input type="text" id="cancelQuantity_{$product['id_order_detail']}" name="cancelQuantity[{$product['id_order_detail']}]" onclick="selectCheckbox(this);" value="" />
{/if}
{if isset($order)}
<td colspan="2" style="display: none;" class="add_product_fields">&nbsp;</td>
{if $product['customizationQuantityTotal']}
{assign var=productQuantity value=($product['product_quantity']-$product['customizationQuantityTotal'])}
{else}
{assign var=productQuantity value=$product['product_quantity']}
{/if}
<td class="cancelCheck standard_refund_fields current-edit" style="display:none">
<input type="hidden" name="totalQtyReturn" id="totalQtyReturn" value="{$product['product_quantity_return']}" />
<input type="hidden" name="totalQty" id="totalQty" value="{$product['product_quantity']}" />
<input type="hidden" name="productName" id="productName" value="{$product['product_name']}" />
{if isset($order) && ((!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN')) AND (int)($product['product_quantity_return']) < (int)($product['product_quantity']))}
<input type="checkbox" name="id_order_detail[{$product['id_order_detail']}]" id="id_order_detail[{$product['id_order_detail']}]" value="{$product['id_order_detail']}" onchange="setCancelQuantity(this, {$product['id_order_detail']}, {$product['product_quantity'] - $product['customizationQuantityTotal'] - $product['product_quantity_return']})" {if ($product['product_quantity_return'] + $product['product_quantity_refunded'] >= $product['product_quantity'])}disabled="disabled" {/if}/>
{else}
--
{/if}
</td>
<td class="cancelQuantity standard_refund_fields current-edit" style="display:none">
{if ($product['product_quantity_return'] + $product['product_quantity_refunded'] >= $product['product_quantity'])}
<input type="hidden" name="cancelQuantity[{$product['id_order_detail']}]" value="0" />
{elseif (!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN'))}
<input type="text" id="cancelQuantity_{$product['id_order_detail']}" name="cancelQuantity[{$product['id_order_detail']}]" onclick="selectCheckbox(this);" value="" />
{/if}
{if ($order->hasBeenDelivered())}
{$product['product_quantity_refunded']}/{$productQuantity-$product['product_quantity_refunded']}
{elseif ($order->hasBeenPaid())}
{$product['product_quantity_return']}/{$productQuantity}
{else}
0/{$productQuantity}
{if $product['customizationQuantityTotal']}
{assign var=productQuantity value=($product['product_quantity']-$product['customizationQuantityTotal'])}
{else}
{assign var=productQuantity value=$product['product_quantity']}
{/if}
{if ($order->hasBeenDelivered())}
{$product['product_quantity_refunded']}/{$productQuantity-$product['product_quantity_refunded']}
{elseif ($order->hasBeenPaid())}
{$product['product_quantity_return']}/{$productQuantity}
{else}
0/{$productQuantity}
{/if}
</td>
{/if}
</td>
<td class="partial_refund_fields current-edit" style="display:none; width: 250px;">
<div class="form-group">
<div class="col-lg-4">
......@@ -175,7 +178,7 @@
</div>
</td>
{if ($can_edit && !$order->hasBeenDelivered())}
{if (isset($order) && $can_edit && !$order->hasBeenDelivered())}
<td class="product_invoice" style="display: none;">
{if sizeof($invoices_collection)}
<select name="product_invoice" class="edit_product_invoice">
......@@ -220,4 +223,3 @@
</td>
{/if}
</tr>
{/if}
{*
* 2007-2014 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 [email protected] 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 <[email protected]>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{foreach from=$products item=product key=k}
{* Include product line partial *}
{include file='controllers/orders/_product_line.tpl'}
{* Include customized datas partial *}
{include file='controllers/orders/_customized_data.tpl'}
{/foreach}
......@@ -925,10 +925,11 @@
</thead>
<tbody>
{foreach from=$products item=product key=k}
{* Include customized datas partial *}
{include file='controllers/orders/_customized_data.tpl'}
{d var=$product}
{* Include product line partial *}
{include file='controllers/orders/_product_line.tpl'}
{* Include customized datas partial *}
{include file='controllers/orders/_customized_data.tpl'}
{/foreach}
{if $can_edit}
{include file='controllers/orders/_new_product.tpl'}
......
......@@ -463,7 +463,18 @@ die(json_encode(array("test")));
}
}
echo Tools::jsonEncode(array_merge($this->ajaxReturnVars(), array('errors' => $errors)));
$ajaxVars = $this->ajaxReturnVars();
$views = array();
$product_tbody = $this->createTemplate('controllers/orders/_product_tbody.tpl');
$product_tbody->assign(array(
'currency' => $ajaxVars['currency'],
'products' => $ajaxVars['summary']['products'],
'taxCalculationMethod' => 0,
));
$views['product_tbody'] = $product_tbody->fetch();
echo Tools::jsonEncode(array_merge($ajaxVars, array('errors' => $errors, 'views' => $views)));
}
}
......
......@@ -1608,6 +1608,7 @@ class AdminOrdersControllerCore extends AdminController
// Smarty assign
$this->tpl_view_vars = array(
'order' => $order,
'taxCalculationMethod' => $order->getTaxCalculationMethod(),
'cart' => new Cart($order->id_cart),
'customer' => $customer,
'gender' => $gender,
......@@ -2042,6 +2043,7 @@ class AdminOrdersControllerCore extends AdminController
$this->context->smarty->assign(array(
'product' => $product,
'order' => $order,
'taxCalculationMethod' => $order->getTaxCalculationMethod(),
'currency' => new Currency($order->id_currency),
'can_edit' => $this->tabAccess['edit'],
'invoices_collection' => $invoice_collection,
......
......@@ -721,11 +721,11 @@ function updateCartProducts(products, gifts, id_address_delivery)
id_customization = this.id_customization;
});
}
cart_content += '<tr><td></td><td colspan="3">'+customized_desc+'</td><td>';
cart_content += '<div class="input-group fixed-width-md"><div class="input-group-btn"><a href="#" class="btn btn-default decreaseqty_product" rel="'+id_product+'_'+id_product_attribute+'_'+id_customization+'"><i class="icon-caret-down"></i></a><a href="#" class="btn btn-default increaseqty_product" rel="'+id_product+'_'+id_product_attribute+'_'+id_customization+'" ><i class="icon-caret-up"></i></a></div>';
cart_content += '<input type="text" rel="'+id_product+'_'+id_product_attribute+'_'+id_customization +'" class="cart_quantity" value="'+this.quantity+'" />';
cart_content += '<div class="input-group-btn"><a href="#" class="delete_product btn btn-default" rel="delete_'+id_product+'_'+id_product_attribute+'_'+id_customization+'" ><i class="icon-remove"></i></a></div>';
cart_content += '</div></td><td></td></tr>';
cart_content += '<tr><td></td><td colspan="3">'+customized_desc+'</td><td>';
cart_content += '<div class="input-group fixed-width-md"><div class="input-group-btn"><a href="#" class="btn btn-default decreaseqty_product" rel="'+id_product+'_'+id_product_attribute+'_'+id_customization+'"><i class="icon-caret-down"></i></a><a href="#" class="btn btn-default increaseqty_product" rel="'+id_product+'_'+id_product_attribute+'_'+id_customization+'" ><i class="icon-caret-up"></i></a></div>';
cart_content += '<input type="text" rel="'+id_product+'_'+id_product_attribute+'_'+id_customization +'" class="cart_quantity" value="'+this.quantity+'" />';
cart_content += '<div class="input-group-btn"><a href="#" class="delete_product btn btn-default" rel="delete_'+id_product+'_'+id_product_attribute+'_'+id_customization+'" ><i class="icon-remove"></i></a></div>';
cart_content += '</div></td><td></td></tr>';
});
}
});
......@@ -842,6 +842,7 @@ function updateQty(id_product, id_product_attribute, id_customization, qty)
success : function(res)
{
displaySummary(res);
updateViews(res.views);
var errors = '';
if (res.errors.length)
{
......@@ -857,6 +858,11 @@ function updateQty(id_product, id_product_attribute, id_customization, qty)
});
}
function updateViews(views)
{
$('#customer_cart tbody').append(views.product_tbody);
}
function resetShippingPrice()
{
$('#shipping_price').val(shipping_price_selected_carrier);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment