You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

OpenCart 2.0.3.1版本商品页“撰写评论”按钮失效问题求助

Fixing the Non-Functional "Write Review" Button in OpenCart 2.0.3.1

Hey there, let's tackle this frustrating issue with your old OpenCart store. I’ve seen this exact problem pop up with 2.0.3.1 a few times, so here are the most common fixes to get your review button working again:

  • First, verify the button's frontend link
    Right-click the "撰写评论" button and select "Inspect" to check the <a> tag's href attribute. It should look something like index.php?route=product/product/write&product_id=XX (where XX is your product's ID). If the link is empty or malformed, head to your theme's product template file:
    catalog/view/theme/[your-theme]/template/product/product.tpl
    Find the button code (usually looks like this):

    <a href="<?php echo $review; ?>" class="button"><?php echo $button_write_review; ?></a>
    

    Make sure the $review variable is being output correctly. If it’s missing, the controller isn’t passing the right value.

  • Check the product controller for missing variable assignment
    Open catalog/controller/product/product.php and look for this line (it should be in the main product logic section):

    $data['review'] = $this->url->link('product/product/write', 'product_id=' . $this->request->get['product_id']);
    

    If this line is missing or has typos (like misspelling write or product_id), add/correct it, then clear your store’s cache.

  • Validate SEO URL settings (if enabled)
    If you’re using SEO URLs, broken routing could be the culprit. Go to your admin panel: System > Settings > Edit Store > Server and confirm "SEO URL" is turned on. Also, double-check your .htaccess file has the default OpenCart SEO rules (no custom rules that might block the product/product/write route).

  • Clear all caches
    OpenCart 2.x caches template and controller data aggressively. Go to System > Settings > Edit Store > Server and click "Clear Cache". Also, clear your browser’s cache and cookies—old cached links can stick around even after you fix the code.

  • Rule out third-party plugin conflicts
    If you’ve installed any product-page or review-related plugins, they might be overriding the button’s link. Temporarily disable all non-core plugins, then test the button. If it starts working, re-enable plugins one by one to find the culprit.

  • Check guest user permissions
    Make sure unregistered users can access the review page. Go to System > Users > User Groups, edit the "Guest" group, and verify the product/product/write route is checked under "Access Permissions".

If none of these steps resolve the issue, share snippets from your product.tpl and product.php files, and I can help dig deeper into the problem.

内容的提问来源于stack exchange,提问作者NoobProgrammer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 12:02:32