I would like a way of having a link to the actual product ordered in the customers acount history. This used to work but since Opencart updated it no longer works
The old code is:
edit: catalog/controller/account/order.php
find:
$this->data['products'][] = array('order_product_id' => $product['order_product_id'],
add after:
'href' => $this->url->link('product/product', 'product_id=' .$product['order_product_id']),
edit: catalog/view/theme/default/template/account/order_info.php
find:
<?php echo $product['name']; ?>
replace with:
<a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
EDIT:: I am using version 1.5.6.4
Thanks!
Use $product['product_id']
instead of $product['order_product_id']
. Value in order_product_id
refers to PK in table order_product
so product_id
is the value you want to use ;-)
Here is the order_product
create statement for reference:
CREATE TABLE `order_product` (
`order_product_id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`model` varchar(64) NOT NULL,
`quantity` int(4) NOT NULL,
`price` decimal(15,4) NOT NULL DEFAULT '0.0000',
`total` decimal(15,4) NOT NULL DEFAULT '0.0000',
`tax` decimal(15,4) NOT NULL DEFAULT '0.0000',
`reward` int(8) NOT NULL,
PRIMARY KEY (`order_product_id`)
)
opencart 1.5.5.1 how change on normal link?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.