News:

Support the VirtueMart project and become a member

Main Menu

Condition to echo on category

Started by gpessoa, January 12, 2022, 01:32:13 AM

Previous topic - Next topic

gpessoa

Hi ppl,

I have a problem on a condition to echo my text on Category

If I use "my text" condition, it crashes...
<?php  
if  (
$product->product_availability == my text ) {
echo JText::_('MYTEXT').$sep ;
}
?>


However, the "my text" works fine on product detail view.

But, instead of using "my text" if I use "100", it works fine!
<?php  
if  (
$product->product_availability == 100 ) {
echo JText::_('MYTEXT').$sep ;
}
?>


I already try a few ways, but so far, got no luck!

Thanks in advanced
J 3.10.5; VM 3.4.2; PHP 7.2.34

Jörgen

<?php  
if  (
$product->product_availability == my text ) {
echo JText::_('MYTEXT').$sep ;
}
?>


What is :
my text

Syntax error, This will brake any language.

Are you looking to check for for $my_text ? or "my text" ? or ???

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

gpessoa

Used the word "my text", but the word I want to use is "on stock"
I already try it with just "stock"
   It doesn't crashes, but also doesn't work properly
only echo MYTEXT tag language, and not the description under that tag
J 3.10.5; VM 3.4.2; PHP 7.2.34

GJC Web Design

<?php  
        $mytext 
JText::_('MYTEXT');
if  ($product->product_availability == $mytext ) {
echo JText::_('MYTEXT').$sep ;
}
?>
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

gpessoa

Thank you GJC Web Design
Now it rocks!  8)
J 3.10.5; VM 3.4.2; PHP 7.2.34