| | #1 | |
| Active Warrior Join Date: 2011
Posts: 58
Thanks: 9
Thanked 1 Time in 1 Post
|
I am trying to hide 'no value' custom attributes on my magento frontend. I am wondering if there is a way to hide the entire code if the 'singer' field (including attribute title) is emtpy on my magento backend? I found a couple solutions online, i was able to hide the attribute value itself, but not the <b>Singer:</B> It seems to show no matter what. This is what I have so far:
| |
| |
| | #2 | |
| Feet of Fury War Room Member Join Date: 2012 Location: On your screen
Posts: 171
Thanks: 113
Thanked 183 Times in 138 Posts
|
I can't think of any reason that such an approach wouldn't work. Good luck. | |
|
Bros find strictly platonic dudes on seekBromance.com _______________________________________________ "It's pretty simple. You work hard, you believe anything is possible, and you try to make the world better." | ||
| |
| | #3 |
| Active Warrior Join Date: 2011
Posts: 58
Thanks: 9
Thanked 1 Time in 1 Post
|
sorry but I m really noob at this. If its possible, can someone please modify my original code accordingly Thank you very much in advance. |
| |
| | #4 |
| Active Warrior War Room Member Join Date: 2005
Posts: 96
Thanks: 11
Thanked 16 Times in 13 Posts
|
well it depends on what is the value that corresponds to empty, is it ""? if so, you can try if(!empty($_product->getResource()->getAttribute('singer')->getFrontend()->getValue($_product))) { ?> <b>Singer:</b> <?php echo $_product->getResource()->getAttribute('singer')->getFrontend()->getValue($_product) ?><br /> <?php } |
| |
| | #5 |
| Active Warrior Join Date: 2011
Posts: 87
Thanks: 16
Thanked 10 Times in 9 Posts
|
The <b>Singer:</b> is going to show no matter what. It's not within the php code. It's part of your html. So no matter what goes on with your script, the html will show up.
|
|
Need a QR Code? Check out my QR Code Generator. It's FREE!
| |
| |
| | #6 |
| Active Warrior Join Date: 2011
Posts: 58
Thanks: 9
Thanked 1 Time in 1 Post
|
I got that going. Thanks guys. Now i am experiencing something different; This is what I have right now on my frontend (magento)- product view; Code: <?php echo "<b>Edition:</b> ".()->getAttributeText('edition')> Edition 1 Edition 2 Edition 3 I would like to make it possible so that if "edition 1" is selected on backend, it will show an image. How can I possibily achieve something like that? Thanks again |
| |
|
| Bookmarks |
| Tags |
| statement |
| |