[-] FO : #PSCFV-3034 - Add return quantity to order detail
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16312 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -216,5 +216,31 @@ class OrderReturnCore extends ObjectModel
|
||||
ON orsl.id_order_return_state = o.state AND orsl.id_lang = '.(int)Context::getContext()->language->id.'
|
||||
WHERE ord.`id_order_detail` = '.(int)$id_order_detail);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Add returned quantity to products list
|
||||
* @param array $products
|
||||
* @param int $id_order
|
||||
*/
|
||||
public static function addReturnedQuantity(&$products, $id_order)
|
||||
{
|
||||
$details = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT od.id_order_detail, IFNULL(GREATEST(od.product_quantity_return, ord.product_quantity),0) as qty_returned
|
||||
FROM ps_order_detail od
|
||||
LEFT JOIN ps_order_return_detail ord
|
||||
ON ord.id_order_detail = od.id_order_detail
|
||||
WHERE od.id_order = 1'
|
||||
);
|
||||
if (!$details)
|
||||
return;
|
||||
|
||||
$detail_list = array();
|
||||
foreach ($details as $detail)
|
||||
$detail_list[$detail['id_order_detail']] = $detail;
|
||||
|
||||
foreach ($products as &$product)
|
||||
$product['qty_returned'] = $detail_list[$product['id_order_detail']]['qty_returned'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -161,6 +161,8 @@ class OrderDetailControllerCore extends FrontController
|
||||
$customizedDatas = Product::getAllCustomizedDatas((int)($order->id_cart));
|
||||
Product::addCustomizationPrice($products, $customizedDatas);
|
||||
|
||||
OrderReturn::addReturnedQuantity($products, $order->id);
|
||||
|
||||
$customer = new Customer($order->id_customer);
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
|
||||
@@ -397,6 +397,7 @@ $_LANG['order-detail_ec53a8c4f07baed5d8825072c89799be'] = 'État';
|
||||
$_LANG['order-detail_f4e8b53a114e5a17d051ab84d326cae5'] = 'Total frais de port';
|
||||
$_LANG['order-detail_f8617a92ba0a0a4eabee724eab7c9f48'] = 'Transporteur :';
|
||||
$_LANG['order-detail_f8f5730f2ee46b88120ff192190fb7cd'] = 'Bons de réduction :';
|
||||
$_LANG['order-detail_fdfac28b5ad628f25649d9c2eb4fc62e'] = 'Retourné';
|
||||
$_LANG['order-follow_01abfc750a0c942167651c40d088531d'] = 'n°';
|
||||
$_LANG['order-follow_0d3cfc2fe56119651ee7848f3e32d84d'] = 'Etiquette de retour';
|
||||
$_LANG['order-follow_229ca46a5d762e19a428f59449c916ad'] = 'Veuillez spécifier un motif de retour !';
|
||||
|
||||
@@ -123,6 +123,9 @@
|
||||
<th class="{if $return_allowed}item{else}first_item{/if}">{l s='Reference'}</th>
|
||||
<th class="item">{l s='Product'}</th>
|
||||
<th class="item">{l s='Quantity'}</th>
|
||||
{if $order->hasProductReturned()}
|
||||
<th class="item">{l s='Returned'}</th>
|
||||
{/if}
|
||||
<th class="item">{l s='Unit price'}</th>
|
||||
<th class="last_item">{l s='Total price'}</th>
|
||||
</tr>
|
||||
@@ -130,37 +133,37 @@
|
||||
<tfoot>
|
||||
{if $priceDisplay && $use_tax}
|
||||
<tr class="item">
|
||||
<td colspan="{if $return_allowed}6{else}5{/if}">
|
||||
<td colspan="{if $return_allowed || $order->hasProductReturned()}{if $order->hasProductReturned() && $return_allowed}7{else}6{/if}{else}5{/if}">
|
||||
{l s='Total products (tax excl.):'} <span class="price">{displayWtPriceWithCurrency price=$order->getTotalProductsWithoutTaxes() currency=$currency}</span>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr class="item">
|
||||
<td colspan="{if $return_allowed}6{else}5{/if}">
|
||||
<td colspan="{if $return_allowed || $order->hasProductReturned()}{if $order->hasProductReturned() && $return_allowed}7{else}6{/if}{else}5{/if}">
|
||||
{l s='Total products'} {if $use_tax}{l s='(tax incl.)'}{/if}: <span class="price">{displayWtPriceWithCurrency price=$order->getTotalProductsWithTaxes() currency=$currency}</span>
|
||||
</td>
|
||||
</tr>
|
||||
{if $order->total_discounts > 0}
|
||||
<tr class="item">
|
||||
<td colspan="{if $return_allowed}6{else}5{/if}">
|
||||
<td colspan="{if $return_allowed || $order->hasProductReturned()}{if $order->hasProductReturned() && $return_allowed}7{else}6{/if}{else}5{/if}">
|
||||
{l s='Total vouchers:'} <span class="price-discount">{displayWtPriceWithCurrency price=$order->total_discounts currency=$currency convert=1}</span>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if $order->total_wrapping > 0}
|
||||
<tr class="item">
|
||||
<td colspan="{if $return_allowed}6{else}5{/if}">
|
||||
<td colspan="{if $return_allowed || $order->hasProductReturned()}{if $order->hasProductReturned() && $return_allowed}7{else}6{/if}{else}5{/if}">
|
||||
{l s='Total gift-wrapping:'} <span class="price-wrapping">{displayWtPriceWithCurrency price=$order->total_wrapping currency=$currency}</span>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr class="item">
|
||||
<td colspan="{if $return_allowed}6{else}5{/if}">
|
||||
<td colspan="{if $return_allowed || $order->hasProductReturned()}{if $order->hasProductReturned() && $return_allowed}7{else}6{/if}{else}5{/if}">
|
||||
{l s='Total shipping'} {if $use_tax}{l s='(tax incl.)'}{/if}: <span class="price-shipping">{displayWtPriceWithCurrency price=$order->total_shipping currency=$currency}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="totalprice item">
|
||||
<td colspan="{if $return_allowed}6{else}5{/if}">
|
||||
<td colspan="{if $return_allowed || $order->hasProductReturned()}{if $order->hasProductReturned() && $return_allowed}7{else}6{/if}{else}5{/if}">
|
||||
{l s='Total:'} <span class="price">{displayWtPriceWithCurrency price=$order->total_paid currency=$currency}</span>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -184,6 +187,11 @@
|
||||
<label for="cb_{$product.id_order_detail|intval}">{$product.product_name|escape:'htmlall':'UTF-8'}</label>
|
||||
</td>
|
||||
<td><input class="order_qte_input" name="order_qte_input[{$smarty.foreach.products.index}]" type="text" size="2" value="{$product.customizationQuantityTotal|intval}" /><label for="cb_{$product.id_order_detail|intval}"><span class="order_qte_span editable">{$product.customizationQuantityTotal|intval}</span></label></td>
|
||||
{if $order->hasProductReturned()}
|
||||
<td>
|
||||
{$product['qty_returned']}
|
||||
</td>
|
||||
{/if}
|
||||
<td>
|
||||
<label for="cb_{$product.id_order_detail|intval}">
|
||||
{if $group_use_tax}
|
||||
@@ -267,6 +275,11 @@
|
||||
</label>
|
||||
</td>
|
||||
<td><input class="order_qte_input" name="order_qte_input[{$product.id_order_detail|intval}]" type="text" size="2" value="{$productQuantity|intval}" /><label for="cb_{$product.id_order_detail|intval}"><span class="order_qte_span editable">{$productQuantity|intval}</span></label></td>
|
||||
{if $order->hasProductReturned()}
|
||||
<td>
|
||||
{$product['qty_returned']}
|
||||
</td>
|
||||
{/if}
|
||||
<td>
|
||||
<label for="cb_{$product.id_order_detail|intval}">
|
||||
{if $group_use_tax}
|
||||
|
||||
Reference in New Issue
Block a user