![](/img/trans.png)
[英]Is there a way I can make woocommerce_loop_add_to_cart_link not change url address but still add product to cart?
[英]How can I change the link “add to cart” button?
当我单击“添加到购物车”(按钮)时,我希望将其定向到我自己的产品页面,该页面已使用Gallery Component创建,它进入了德美超市,正如我所说,应定向至我自己的产品页面
(组件/com_virtuemart/views/productdetails/tmpl/default_addtocart.php)
<span class="addtocart-button">
<?php echo shopFunctionsF::getAddToCartButton ($this->product->orderable);
// Display the add to cart button END ?>
类似的东西。
<a href="yourwebsite.com/thelinkyouwanthere.php">Buy Product</a>
<span class="addtocart-button">
<a href="yourwebsite.com/thelinkyouwanthere.php">Buy Product</a>
函数:getAddToCartButton
static public function getAddToCartButton($orderable){
if($orderable){
vmJsApi::jPrice();
$html = '<input type="submit" name="addtocart" class="addtocart-button" value="'.JText::_('COM_VIRTUEMART_CART_ADD_TO') .'" title="'.JText::_('COM_VIRTUEMART_CART_ADD_TO') .'" />';
} else {
$html = '<input name="addtocart" class="addtocart-button-disabled" value="'.JText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT') .'" title="'.JText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT') .'" />';
}
return $html;
}
但是我的问题是每个产品的地址与其他产品都不相同
谢谢
使用模板替代: 如何替代Joomla的输出! 核心
在示例中,您应该将此文件添加到模板中:
templates/your_template/html/com_virtuemart/productdetails/default_addtocart.php
其中your_template
是您正在使用的模板的目录。
一个好的起点是复制原始的最终版本,然后根据需要进行编辑。 通常,应避免修改原始文件,因为更新扩展名时可能会丢失所做的更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.