ninogui wrote:1511 localhost here
Bug
- On customer side, when entering the order history and choosing one order, customer selects one single line product and chooses to return it. Regardless of choosing one or more product lines all of them show up on the next screen for product return, meaning customer has to remove product lines that are not in fact to return ? I consider this a bug because on the first screen the customer is being asked what to do with the selected products
- Also apparently customer is able to issue the return for any qty product, even much more than he ever bought ?
thks
I have a solution to fix the 2 bugs in the return products form.
Topic 1: Trying to return a single product from an order
Scenario: While viewing a previous order the user checks a box next to a single product from the order and then selects return from the action dropdown menu.
Problem: All products in the order are loaded into the return form.
Solution: Pass the array of selected products from order controller to the return controller and then show only the selected products.
Open: catalog\controller\account\order.php
Find:
Code: Select all
'product' => $this->model_account_order->getOrderProducts($order_id)
Paste Above:
Code: Select all
'selected' => $this->request->post['selected'],
Open: catalog\controller\account\return.php
Find:
Code: Select all
foreach ($this->session->data['return']['product'] as $result) {
$this->data['return_products'][] = array(
'name' => $result['name'],
'model' => $result['model'],
'quantity' => 1,
'opened' => false,
'comment' => ''
);
}
Replace with:
Code: Select all
foreach ($this->session->data['return']['product'] as $result) {
if (in_array($result['order_product_id'], $this->session->data['return']['selected'])) {
$this->data['return_products'][] = array(
'name' => $result['name'],
'model' => $result['model'],
'quantity' => 1,
'opened' => false,
'comment' => ''
);
}
}
Topic 2: Limit the returned quantity of a product to up-to the amount ordered:
Open:
/catalog/view/theme/yourTheme/template/account/return_form.tpl
Find:
Code: Select all
<input type="text" name="return_product[<?php echo $return_product_row; ?>][quantity]" value="<?php echo $return_product['quantity']; ?>" />
Replace With:
Code: Select all
<select name="return_product[<?=$return_product_row;?>][quantity]" id="return_product[<?=$return_product_row?>][quantity]">
<?php
for ($i = 1; $i <= $return_product[quantity]; $i++) {
echo '<option value="'.$i.'">'.$i.'</option>';
}
?>
</select>
Then Open:
/catalog/controller/account/return.php
Find:
Code: Select all
$this->data['return_products'][] = array(
'name' => $result['name'],
'model' => $result['model'],
'quantity' => 1,
'opened' => false,
'comment' => ''
);
Replace With:
Code: Select all
$this->data['return_products'][] = array(
'name' => $result['name'],
'model' => $result['model'],
'quantity' => $result['quantity'],
'opened' => false,
'comment' => ''
);