2014-09-09 21:10
浏览 57


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


$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


<?php echo $product['name']; ?>

replace with:

<a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>

EDIT:: I am using version


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongxie9169 2014-09-10 12:07

    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`)
    点赞 评论
  • duanping5306 2015-03-01 09:00

    opencart how change on normal link? enter image description here

    点赞 评论

相关推荐 更多相似问题