![](/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.