简体   繁体   中英

Hide required attribute labels for configurable products in product view in Magento

How can I hide the labels of the required attributes in configurable products other than setting the div to display:none? I just want to show the dropdown menu in product view, ie the "Choose an Option..." dropdown box, without the label (eg Color, Size) which is always one line above.

I tried this by commenting out

 <?php echo $_attribute->getLabel() ?> 

in product/view/type/configurable.phtml but it had no effect, so I hid it via CSS. Is there are more elegant way?

Commenting out the line that you tried should get you the results you want but did you happen to clear magentos cache? It's been awhile since I've worked with magento but I seem to remember the cache being troublesome for things like this.

<dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt>

I found out that Magiczoomplus module is somehow interfering with the configurable products. Magento now uses the configurable.phtml in the magiczoomplus directory instead of its "own" one...commenting it out in Magiczoomplus configurable.phtml works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM