[英]How can I change the link “add to cart” button?
When i click on the "add to cart" (button) , i want it to be directed to my own products page ,which i've created it with gallery Component ,it goes to virtuemart while, as i said it should be directed to my own product page 当我单击“添加到购物车”(按钮)时,我希望将其定向到我自己的产品页面,该页面已使用Gallery Component创建,它进入了德美超市,正如我所说,应定向至我自己的产品页面
(components/com_virtuemart/views/productdetails/tmpl/default_addtocart.php) (组件/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 ?>
something similar to that. 类似的东西。
<a href="yourwebsite.com/thelinkyouwanthere.php">Buy Product</a>
<span class="addtocart-button">
<a href="yourwebsite.com/thelinkyouwanthere.php">Buy Product</a>
Function:getAddToCartButton 函数: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;
}
But my problem is that the address is different for each product with other products 但是我的问题是每个产品的地址与其他产品都不相同
Thank you 谢谢
Use template overrides: How to override the output from the Joomla! 使用模板替代: 如何替代Joomla的输出! core 核心
On your example you should add this file on your template: 在示例中,您应该将此文件添加到模板中:
templates/your_template/html/com_virtuemart/productdetails/default_addtocart.php
where your_template
is the directory of the template your are using. 其中your_template
是您正在使用的模板的目录。
A good starting point is to copy the original final and then edit according to your needs. 一个好的起点是复制原始的最终版本,然后根据需要进行编辑。 In general you should avoid the modification of the original files, because you may lost your changes when you update the extension. 通常,应避免修改原始文件,因为更新扩展名时可能会丢失所做的更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.