941-685-8851

Custom Options with *Optional in Title label

March 8, 2010 by admin No Comments »

In Magento custom options, required fields are indicated by a red asterisk *. But what if the client requests that required fields are indicated by *Required , and unrequired fields are indicated by a *Optional?

Screen print of product options with * only on required fields:
Magento Custom Options asterisk required and optional

Screen print of product options with *Required on required fields and *Optional on unrequired fields:
Magento Custom Options asterisk required and optional

Edit the file:  app\design\frontend\default\client\template\catalog\product\view\options\type\select.phtml

On line 29 find this code:

 <?php if ($_option->getIsRequire()): ?><span>&nbsp;*</span>

and change it to this:

 <?php if ($_option->getIsRequire()): ?><span>&nbsp;*Required</span>

Now required select menus will be indicated by an asterisk and the word Required.

To specify the *Optional indicator for unrequired fields, add the following code right after the previous code:

<?php elseif ($_option): ?><span>&nbsp;*Optional</span>

Now unrequired select menus will be indicated by an asterisk and the word Optional.

  • Share/Bookmark
 

Leave a Reply