[SOLVED+PROP]How to Add Custom Field item from the Custom Field Group (parent) ?

Started by veeco, September 29, 2012, 14:49:18 PM

Previous topic - Next topic

veeco

Hi guys,
i make a group of custom field (using type: parent), but then i only can attached the group of field at once in Product page, can i add item in the group ?

i asked this because, somewhere i see a screenshot where user can add 'item' directly for cart atributes


[attachment cleanup by admin]
Work On Doxa Web Developer Indonesia - http://doxadigital.com |

veeco

After tracking, i found out that Virtuemart 2.0.10/11 will not display custom field item in group, because the query is only for parent=0:
$q='SELECT virtuemart_custom_id as value ,custom_title as text FROM `#__virtuemart_customs` where custom_parent_id=0
AND field_type <> "R" AND field_type <> "Z"'


However this solution is not really flexible, as sometime we would like to add new customfield item in the same group/parent for specific product to deal with Cart Attribute . So i proposed to list all with a mark for the group/parent (oh.. i much prefer to use the word 'group' instead of 'parent').

so i change the query on models/customfields.php, function getCustomsList to:
$q='SELECT virtuemart_custom_id as value ,
CASE WHEN  custom_parent_id=0 THEN
CONCAT(custom_title," (Group/Collection)") ELSE custom_title
END as text
FROM `#__virtuemart_customs`
where field_type <> "R" AND field_type <> "Z" ';


You can see the result on attached file
This is my first day with virtuemart2... i don't mean to change VM2 the way i want, but i think this query offers more flexibility, so admin can add by collection/group or by individual.

What do you think ?


[attachment cleanup by admin]
Work On Doxa Web Developer Indonesia - http://doxadigital.com |