/    Sign up×
Community /Pin to ProfileBookmark

Hiding <li> with no data

Hey folks,

We are using Magento as an eCommerce platform. On the backend, we have created attributes for our products which will house information that we would like to display on the frontend to our customers.

For the display on the frontend we are using jquery’s .accordion to display our information

Example:

[code]
<li>
<div class=”handle”>
<h3><?php echo $this->__(‘Measuring’) ?></h3>
<span></span>
</div>
<div class=”panel loading”>
<?php echo $this->__($_product->getData(‘usak_measuring’)); ?>
</div>
</li>
<li>
<div class=”handle”>
<h3><?php echo $this->__(‘Availability’) ?></h3>
<span></span>
</div>
<div class=”panel loading”>
<?php echo $this->__($_product->getData(‘usak_avil’)); ?>
</div>
</li>
[/code]

What we are looking to do is to hide sections that have no information in the backend. Example :

Casual Kilt
usak_measuring- Measuring instructions for the casual kilt
Clan Crest kilt Pin
usak_measuring – Left Empty since it does not pertain to the product.

If you pull up the Clan Crest Kilt Pin, it would not show the measuring guide section. Anyone have any suggestions on how to achieve this?

Thanks

to post a comment
HTML

2 Comments(s)

Copy linkTweet thisAlerts:
@deathshadowSep 19.2014 — Uhm, what makes something that has a numbered heading -- saying it is a section unto itself -- a list item in the first place?

If I'm following what you are TRYING to do, I'd do a store and check before the output -- also in the process axing the silly opening and closing PHP willy-nilly.

Really though I don't know enough about your data or how you are trying to give it semantic meaning and style it to weigh in more than that. You SEEM to have lists for nothing, DIV for nothing, classes for nothing, and I'm kind-of guessing the empty span sandbag is a CSS image replacement?

Good rule of thumb, if you're putting headings into a LI, it's not a LI.
Copy linkTweet thisAlerts:
@khushishrmaSep 29.2014 — The HTML List item element (<li>) is used to represent a list item. It ought to be contained in an ordered list (<ol>), an unordered list (<ul>) or a menu (<menu>), where it represents a single entity in that list. I share this with my family and friends
×

Success!

Help @robsch spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...