dosf40815 2015-08-06 08:41 采纳率: 100%
浏览 33
已采纳

如何链接到具有与我的网站相同的产品页面ID的外部OpenCart产品页面?

I would like to add an external link to the OpenCart product page - it can be anywhere on the page. I just want to link it to the same product page on an external site that has different options.

I tried to define it in the product controller file at breadcumbs but I don't have idea how can I change the default http value via PHP str_replace or something similar.

'href' => $this->url->link('product/product', $url . '&product_id=' . $this->request->get['product_id']),
'href2' => $this->url->link('product/product', $url . '&product_id=' . $this->request->get['product_id']),

I also tried to place this after the breadcrumb in product.tpl like <a href="<?php echo $breadcrumb['href2']; ?>"

So this is working slightly - I just need to do the PHP replace or something better on the product page to point to the external domain.

  • 写回答

1条回答 默认 最新

  • down00112 2015-08-06 11:06
    关注

    Rather than modifying the core PHP. You can do this easily inside your product.tpl file instead.

    1 - Open /catalog/view/theme/default/product.tpl

    2 - Add your link

    <a href="http://example.com/index.php?route=product/product&product_id=<?php echo $this->request->get["product_id"]; ?>">Your Link</a>
    

    What I am doing here is using $_GET to fetch your ProductID from the HEADER and that saves modifying the controllers.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程