News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Language constant for the buy button [solved]

Started by Aleksej, March 11, 2022, 07:24:04 AM

Previous topic - Next topic

Aleksej

Hello. I made an override for "addtocartbtn.php" file:

<?php
/**
 *
 * loads the add to cart button
 *
 * @package    VirtueMart
 * @subpackage
 * @author Max Milbers, Valerie Isaksen
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2015 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @version $Id: addtocartbtn.php 8024 2014-06-12 15:08:59Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined ('_JEXEC') or die('Restricted access');

if(
$viewData['orderable']) {
echo "<a type='submit' class='addtocart-button' href='https://aleksius.com/' target='_blank' rel='nofollow noopener'><span class='mybuy-button'>Buy</span></a>";

/* echo '<input class="addtocart-button" value="'.vmText::_( 'COM_VIRTUEMART_CART_ADD_TO' ).'" title="'.vmText::_( 'COM_VIRTUEMART_CART_ADD_TO' ).'" />'; */
} else {
echo '<span name="addtocart" class="addtocart-button-disabled" title="'.vmText::_'COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT' ).'" >'.vmText::_'COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT' ).'</span>';
}



Now, by clicking on the buy button, the site page opens:

echo "<a type='submit' class='addtocart-button' href='https://aleksius.com/' target='_blank' rel='nofollow noopener'><span class='mybuy-button'>Buy</span></a>";

Everything works fine. But I need multilingual support. How to change this code so that instead of the word "Buy" I can use a language constant "COM_VIRTUEMART_CART_ADD_TO"? Thanks in advance for your reply.

GJC Web Design

echo "<a type='submit' class='addtocart-button' href='https://aleksius.com/'; target='_blank' rel='nofollow noopener'><span class='mybuy-button'>".vmText::_( 'COM_VIRTUEMART_CART_ADD_TO' )."</span></a>";
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Aleksej

#2
Thank you very much. That helped. The question is closed.