Tagged: 

Viewing 7 reply threads
  • Author
    Posts
    • #2642
      atanas
      Member

      Hi,

      Is there a way to implement custom save/load functions if we do not want to use the default saving to metadata?

      Or is there a general setting to have all the fields on the custom post save in a single postmeta record, without grouping the fields, as they are in separate files?

      Thanks
      Atanas

    • #2649
      Steve
      Keymaster

      @atanas– Piklist uses core WordPress functions, and saving post meta is usually one value per record. If you want to save a group of field data in one array, use the Piklist group field. You can see a sample of this in the built-in Demos:
      Add New Demo > Groups tab > Address (Grouped).

      Let me know if that helps.

    • #2651
      atanas
      Member

      Thanks Dteve,

      Tried to put them in a group with all sort of issues came with sub grouos in the group – the fields and labels are mis-aligned. I will post the code on the othe thread, as it shows the issue with both the conditions and mis alignment, or do you want me to post here?

      Thanks
      Atanas

    • #2654
      atanas
      Member

      Hi Steve,

      I posted the sample code in the other thread, I am attaching here two screen shots – how the fields should look (the shipping field needs to be outside of the add more), and how they look if they are all bundled together in one group so the data is saved in one postmeta.

      Thanks,
      Atanas

      Attachments:
      You must be logged in to view attached files.
    • #2657
      atanas
      Member

      Hi Steve,

      Just in case, here is also the code when the shipping is ungrouped and saves in a separate postmeta, if it can also help nail down the issues

      piklist('field',
      		array('type' => 'group',
      		      'label' => 'Fruits',
      		      'add_more' => true,
      		      'description' => 'Select a fruit.',
      		      'fields' => array(
      			      array(
      				      'type' => 'select',
      				      'field' => 'country',
      				      'label' => 'Country',
      				      'value' => 'US',
      				      'columns' => 4,
      				      'choices' => array(
      					      'US' => 'United States',
      					      'EU' => 'European Union'
      				      )
      			      ),
      
      			      array(
      				      'type' => 'select',
      				      'field' => 'fruits',
      				      'label' => 'Fruits',
      				      'value' => 'apples',
      				      'columns' => 12,
      				      'choices' => array(
      					      "apples" => "Apples",
      					      "oranges" => "Oranges",
      				      )
      			      ),
      
      			      array(
      				      'type' => 'select',
      				      'field' => 'apples',
      				      'label' => 'Apples',
      				      'columns' => 12,
      				      'value'   => 'post_title',
      				      'choices' => array(
      					      "aceymac" => 'Aceymac  apple',
      					      "akero" => 'Akero  apple',
      				      ),
      				      'conditions' => array(
      					      array(
      						      "reset" => false,
      						      'field' => 'fruits',
      						      'value' => "apples"
      					      ),
      
      				      )),
      			      array(
      				      'type' => 'select',
      				      'field' => 'oranges',
      				      'label' => 'Oranges',
      				      'columns' => 12,
      				      'choices' => array(
      					      "blood" => "Blood Orange",
      					      "navel" => "Navel Orange"
      				      ),
      				      'conditions' => array(
      					      array(
      						      "reset" => false,
      						      'field' => 'fruits',
      						      'value' => "oranges"
      					      ),
      
      				      )),
      		      ),
      	)
      );
      
      piklist('field',
      		      array(
      			      'type' => 'select',
      			      'field' => 'shipping',
      			      'label' => 'Shipping',
      			      'columns' => 4,
      			      'choices' => array(
      				      ''          => '',
      				      'ground'  => 'Ground',
      				      'UPS'    => 'UPS',
      			      )
      
      		      )
      );
      
    • #2659
      Steve
      Keymaster

      @atanas– The original issue was “Custom save/load”. Is this still an issue? Is the code you posted related to this issue?

    • #2660
      atanas
      Member

      Hi steve,

      Originally I asked about a custom save/load since sub groups do not work. You suggested I use a group to have all the data saved in a single record, and that is why I posted the code to help you see the issues. Either of the solutions (custom save/load put all fields in a master group) would be ok, even though with too many fields it will be a burden to have them in a single file i order to use a mater group.

      Thanks
      Atanas

    • #2664
      Steve
      Keymaster

      Closing this ticket since we are working on the issue here >

Viewing 7 reply threads
  • The topic ‘Custom save/load’ is closed to new replies.