Author Topic: Language constant for the buy button [solved]  (Read 1208 times)

Aleksej

  • Beginner
  • *
  • Posts: 2
  • A beginner
    • Aleksius.com
  • Skype Name: aleksej-khoroshevskij
  • VirtueMart Version: 3.8.2 10325
Language constant for the buy button [solved]
« on: March 11, 2022, 07:24:04 am »
Hello. I made an override for "addtocartbtn.php" file:

Code: [Select]
<?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:

Code: [Select]
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

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10638
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
Re: Language constant for the buy button
« Reply #1 on: March 11, 2022, 09:11:53 am »
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
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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

  • Beginner
  • *
  • Posts: 2
  • A beginner
    • Aleksius.com
  • Skype Name: aleksej-khoroshevskij
  • VirtueMart Version: 3.8.2 10325
Re: Language constant for the buy button [solved]
« Reply #2 on: March 11, 2022, 11:37:54 am »
Thank you very much. That helped. The question is closed.