简体   繁体   English

如何更改链接“添加到购物车”按钮?

[英]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创建,它进入了德美超市,正如我所说,应定向至我自己的产品页面

site example 网站范例

(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 但是我的问题是每个产品的地址与其他产品都不相同

Image 图片

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.

相关问题 有没有办法让 woocommerce_loop_add_to_cart_link 不更改网址地址但仍将产品添加到购物车? - Is there a way I can make woocommerce_loop_add_to_cart_link not change url address but still add product to cart? 我如何用图标替换“添加到购物车”文本(添加到购物车按钮woocommerce) - How can i replace text “Add to cart” with an icon (Add to cart button woocommerce) WooCommerce-如何使用具有相同购物车按钮的Ajax将多种不同的产品添加到购物车? - WooCommerce - How can I add multiple, different products to cart using ajax with same add-to-cart-Button? 如何更改“添加到购物车”按钮以查看“产品列表”部分中的按钮 - how to change add to cart button to view button in list of products section 每次单击添加到购物车按钮时,如何在会话数组中添加值? - How can I add value in a session array every time I click add to cart button? 如何在 Woocommerce 中的 wc_add_to_cart_message 中添加一个额外的按钮? - How can I add an extra button the the wc_add_to_cart_message in Woocommerce? 如果我单击已在购物车中的产品的“添加到购物车”按钮,如何重定向到购物车页面 - How do I redirect to the cart page if I click on the 'Add to cart' button for a product that's already in cart 如何更改按钮的默认 Wordpress 登录页面链接? - How can I change the default Wordpress Login Page link for a button? 如何根据产品属性将magento添加到购物车按钮 - How to change magento add to cart button based on product attribute 如何根据可用性更改WooCommerce添加到购物车按钮 - How to change WooCommerce Add to Cart Button based on Availability
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM