OpenCart 2.3.0.2 Porto主题:结账页条款链接改新标签打开
Hey there! Let's get that Terms & Conditions link opening in a new tab instead of a popup on your OpenCart 2.3.0.2 with the Porto theme. Here's a step-by-step fix:
Step 1: Locate the relevant template file
First, you'll need to find where the Terms & Conditions link is rendered in the checkout flow. For Porto, this is almost always in the order confirmation template:catalog/view/theme/porto/template/checkout/confirm.tpl
Open this file and search for phrases like "Terms & Conditions" or information/information/agree to pinpoint the link code.
Step 2: Modify the link markup
The original link will likely look something like this (using an onclick handler to trigger the modal):
<a href="#" onclick="modal('index.php?route=information/information/agree&information_id=<?php echo $information_id; ?>'); return false;"><?php echo $text_terms; ?></a>
Replace that with a standard link that uses target="_blank" to open in a new tab. You can use OpenCart's built-in $agree variable (which already holds the full terms URL) for a cleaner implementation:
<a href="<?php echo $agree; ?>" target="_blank"><?php echo $text_terms; ?></a>
If for some reason the $agree variable isn't available in your template, hardcode the URL (just replace 5 with your actual Terms & Conditions information ID, which you can find in your OpenCart admin under Catalog > Information):
<a href="index.php?route=information/information/agree&information_id=5" target="_blank"><?php echo $text_terms; ?></a>
Step 3: Remove any modal-binding JavaScript
Sometimes Porto's custom JS overrides link behavior. Check the theme's JavaScript files (usually in catalog/view/theme/porto/js/) for code that forces the modal. Look for files like checkout.js or common.js, and search for lines similar to:
$('.terms a').on('click', function(e) { e.preventDefault(); modal($(this).attr('href')); });
Comment out or delete this block to stop the modal from triggering when the link is clicked.
Step 4: Clear your caches
Don't forget to clear OpenCart's internal cache (go to System > Settings > Edit your store > Server > Clear Cache) and your browser's cache to make sure the changes take effect immediately.
If you're still having issues, double-check that you're editing the correct template file (sometimes Porto uses overrides for specific checkout steps) and that no other custom JS is interfering with the link behavior.
内容的提问来源于stack exchange,提问作者user3282626

