News:

Looking for documentation? Take a look on our wiki

Main Menu

How to add Custom field option's label text as a label class

Started by skhn123, March 27, 2014, 10:34:25 AM

Previous topic - Next topic

skhn123

Hello Everyone.
If the question does not make sense then let me clarify.
first where to edit customfields code to make changes and second i want to add class in custom field's label. same as its text. showing next to radio button. [Image Attached.] i have choose string from custom fields and created a cart attribute for selecting color. these are the html code generated by custom field:

<div class="product-field-type-S">
<label class="product-fields-title">Color</label>
<input type="radio" name="customPrice[2][9]" value="17" checked="checked" id="172">
<label class="other-customfield" for="172">red </label>
<input type="radio" name="customPrice[2][9]" value="18" id="182">
<label class="other-customfield" for="182">blue </label>
</div>


you can see the "other-customfield" in label so i want to add an extra class for example : if label has red as its text then its class should be "other-customfield red" .

Any help suggestion. please help me. and sorry for my bad English.

skhn123

Hello Everyone
I have solved it myself and if anyone is looking for same solution here is the modification you must do:
go to administrator\components\com_virtuemart\models\customfield.php in somewhere line 965
check for these code:
<label for="' . $productCustom->virtuemart_customfield_id .$row. '" class="other-customfield ">' . $this->displayProductCustomfieldFE ($product, $productCustom, $row) . ' ' . $price . '</label>';

and add this ' . $this->displayProductCustomfieldFE ($product, $productCustom, $row) . '

after class="other-customfield HERE"

so it will be like this
<label for="' . $productCustom->virtuemart_customfield_id .$row. '" class="other-customfield ' . $this->displayProductCustomfieldFE ($product, $productCustom, $row) . ' ">' . $this->displayProductCustomfieldFE ($product, $productCustom, $row) . ' ' . $price . '</label>';

thanks