简体   繁体   中英

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

site example

(components/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

    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! 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM