News:

Looking for documentation? Take a look on our wiki

Main Menu

Option for VmHTML::select - original from Patrick

Started by pinochico, February 09, 2020, 13:28:46 PM

Previous topic - Next topic

pinochico

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
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

pinochico

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 :)
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products