And so today, the next client took me to do the possibility of withdrawal of goods pictures in the history of the customer orders, after all registered customers can log in to the office and see all your orders together with photos as the goods themselves, and of itself as it can be done, I shall paint in detail here.
The changes will make in the next four files as follows:
1 2 3 4 |
1. /catalog/controller/account/order.php 2. /catalog/model/account/order.php 3. /catalog/view/theme/your theme/stylesheet/stylesheet.css 4. /catalog/view/theme/your theme/template/account/order_info.tpl |
Well start ...
1. Open File /catalog/controller/account/order.php
Find the line:
1 2 3 |
$this->data['products'] = array(); and $products = $this->model_account_order->getOrderProducts($this->request->get['order_id']); |
And add the code between them:
1 |
$this->load->model('tool/image'); |
Next, find the code below:
1 |
$this->data['products'][] = array( |
And add to it:
1 2 3 4 5 |
if (empty($product['image'])) { $thumb = ''; } else { $thumb = $this->model_tool_image->resize($product['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height')); } |
There you find the code below:
1 |
'name' => $product['name'], |
and thereafter adding:
1 |
'thumb' => $thumb, |
2. Open File /catalog/model/account/order.php
In it we find the line:
1 |
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'"); |
And replace it with:
1 |
$query = $this->db->query("SELECT op.*, p.image FROM `" . DB_PREFIX . "order_product` op LEFT JOIN `" . DB_PREFIX . "product` p ON (p.product_id = op.product_id) WHERE order_id = '" . (int)$order_id . "'"); |
3. Open File /catalog/view/theme/your theme/stylesheet/stylesheet.css
And after the code (PS: in your topic can be a little different):
1 2 3 4 |
table.list .center { text-align: center; padding: 7px; } |
add a couple of lines of styles:
1 2 3 4 |
table.list .left > img { float: left; } |
4. Open File /catalog/view/theme/your theme/template/account/order_info.tpl
Find the following code:
1 |
<td class="left"><?php echo $product['name']; ?> |
And replace it with:
1 2 3 |
<td class="left"> <img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /> <?php echo $product['name']; ?> |
There about after the code:
1 |
<small> - <?php echo $option['name']; ?>: <?php echo $option['value']; ?></small> |
We find:
1 |
<?php } ?></td> |
And replace it with the following code:
1 2 |
<?php } ?> </td> |
Now that your users have the opportunity to watch their order history, along with photos of the ordered goods.
Ps: If you want to see the smaller size of the images and not those that you suggested above can be used instead of the code config_image_category_width the following code config_image_additional_width
No Comment
You can post first response comment.