简体   繁体   English

Opencart链接到订单历史记录中的产品

[英]Opencart link to product in order history

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 这曾经有用,但是自从Opencart更新以来,它不再起作用

The old code is: 旧代码是:

edit: catalog/controller/account/order.php 编辑: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 编辑:目录/视图/主题/默认/模板/帐户/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 编辑::我正在使用版本1.5.6.4

Thanks! 谢谢!

Use $product['product_id'] instead of $product['order_product_id'] . 使用$product['product_id']代替$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 ;-) order_product_id值是指表order_product PK,因此product_id是您要使用的值;-)

Here is the order_product create statement for reference: 这是order_product create语句供参考:

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? opencart 1.5.5.1正常链接如何更改? 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM