skip to Main Content

I have a variable that is Yes/no

Need to hide the price and show a custom text if this variable is set to Yes, how we can achive this quick and easy

2

Answers


  1. Go Admin -> Catalog -> Attributes -> Manage Attributes

    Set “Used in Product View page” to Yes

    Then in view.phtml :

    if($_product->getAttributeText('name_price')=='yes')
    {
        echo "display text";
    }
    
    Login or Signup to reply.
  2. 1)You should specify more than that. Do you want to do that in javascript or php? 2)If a value can assume 2 values, I think is better use boolean.
    3)If the condition is true (the variable is yes), do you want to change a value in an object or what?
    So I’m going to write pseudo code for you…

    if (myVariable) then
        object = {
            ....
            visibility: false
        }
    else 
        {...}
    
    if(object.visibility) then
        customText = "Custom Text"
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search