I try to create a new vmcustom plugin.
Inside function plgVmOnProductEdit I call:
$options_style = array('style-dark'=>'LAYOUT_HERO_DARK','style-light'=>'LAYOUT_HERO_LIGHT'); =>[b]THIS CODE I WANT CHANGE AND LOAD FROM XML SETUP FILE[/b]
$html .= VmHTML::select($paramName.'['.$row.'][custom_hero_style]', $options_style, 'style-dark','','value','text',false, true, true).'<br style="clear:both"/>';
original function VmHTML::select is from Patrick in administrator/components/com_virtuemart/helpers/html.php
But $options_style i set in xml file:
<field name="custom_hero_style" type="list" default="style-dark"
global="1"
label="HERO_STYLE_LABEL"
description="HERO_STYLE_DESC">
<option value="style-dark">LAYOUT_HERO_DARK</option>
<option value="style-light">LAYOUT_HERO_LIGHT</option>
</field>
How can I set up options value from plugin XML?
I tried print_r ($field) and I'm looking only this:
stdClass Object (
[
virtuemart_custom_id
] => 40 [
custom_parent_id
] => 0 [
virtuemart_vendor_id
] => 1 [
custom_jplugin_id
] => 1016 [
custom_element
] => acm_hero [
admin_only
] => 0 [
custom_title
] => Sekce produktu - Hero [
show_title
] => 1 [
custom_tip
] => [
custom_value
] => [
custom_desc
] => [
field_type
] => E [
is_list
] => 0 [
is_hidden
] => 0 [
is_cart_attribute
] => 0 [
is_input
] => 0 [
layout_pos
] => [
custom_params
] => custom_hero_style= "" |custom_hero_content_position= "" |custom_hero_text_align= "" |custom_hero_heading= "" |custom_hero_intro= "" |custom_hero_bg= "" | [
shared
] => 0 [
published
] => 1 [
ordering
] => 12 [
virtuemart_customfield_id
] => 437 [
virtuemart_product_id
] => 3 [
customfield_value
] => [
customfield_price
] => 0.000000 [
customfield_params
] => custom_hero_style= "style-dark" | [
fpublished
] => 0 [
override
] => 0 [
disabler
] => 0 [
_varsToPushParam
] => Array ( [
custom_hero_style
] => Array ( [
0
] => [
1
] => char ) [
custom_hero_content_position
] => Array ( [
0
] => [
1
] => char ) [
custom_hero_text_align
] => Array ( [
0
] => [
1
] => char ) [
custom_hero_heading
] => Array ( [
0
] => [
1
] => char ) [
custom_hero_intro
] => Array ( [
0
] => [
1
] => varchar ) [
custom_hero_bg
] => Array ( [
0
] => [
1
] => char ) ) [
custom_hero_style
] => style-dark [
custom_hero_content_position
] => [
custom_hero_text_align
] => [
custom_hero_heading
] => [
custom_hero_intro
] => [
custom_hero_bg
] => [
_xParams
] => customfield_params )
without info about the option from XML.
Thanks
Rudolf
You need to setup the params via the $this->setConfigParameterable ('customfield_params', $varsToPush); construction. Check the textinput plugin as example. You can also check the view.html.php of the shipment or payment to see how to display a xml form. The xml elements use the files in the fields folder to display the elements.
Thanks Max.
You answer me on the my second question, not yet sent.
Now I correctly save all params from plugin to DB and loaded with the product :)