Author Topic: Condition to echo on category  (Read 826 times)

gpessoa

  • Jr. Member
  • **
  • Posts: 164
Condition to echo on category
« on: January 12, 2022, 01:32:13 am »
Hi ppl,

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

If I use "my text" condition, it crashes…
Code: [Select]
<?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!
Code: [Select]
<?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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3921
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Condition to echo on category
« Reply #1 on: January 12, 2022, 08:09:54 am »
Code: [Select]
<?php  
if  (
$product->product_availability == my text ) {
echo JText::_('MYTEXT').$sep ;
}
?>

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

  • Jr. Member
  • **
  • Posts: 164
Re: Condition to echo on category
« Reply #2 on: January 12, 2022, 11:20:33 am »
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

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10637
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
Re: Condition to echo on category
« Reply #3 on: January 12, 2022, 11:54:05 am »
Code: [Select]
<?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
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

gpessoa

  • Jr. Member
  • **
  • Posts: 164
Re: Condition to echo on category
« Reply #4 on: January 12, 2022, 20:16:16 pm »
Thank you GJC Web Design
Now it rocks!  8)
J 3.10.5; VM 3.4.2; PHP 7.2.34