Magento产品页面在新标签目标空白中打开



我正在尝试找到一种打开我的网站产品页面打开的方法。请帮助我。

如果使用自定义主题,请检查路径:

app/design/frontend/{your_namespace}/{your_theme}/template/catalog/product/list.phtml

如果使用RWD主题,请检查路径:

app/design/frontend/rwd/default/template/catalog/product/list.phtml

找到任何锚点链接,然后添加traget =" _ blank"

<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">

更改为:

<a href="<?php echo $_product->getProductUrl() ?>" target="_blank" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">

将下面的list.phtml文件放入主题文件夹中,然后添加html属性

文件路径是app/design/frontend/ your_package (base)/ your_theme (默认)

target =" _空白"

找到行

<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">

将其更改为

<a target="_blank" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">

也为列表和网格处理...

codazon主题,在下面的文件路径上添加 target="_blank"

/app/design/frontend/Codazon/unlimited/furniture/Magento_Catalog/templates/product/list/list-styles/list-style17.phtml

<a href="<?= $_product->getProductUrl() ?>" target="_blank" class="product photo product-item-photo"> 

最新更新