Home › Forums › Quform WordPress › Dynamic dropdown product list
- This topic has 5 replies, 2 voices, and was last updated 10 years, 1 month ago by Ally.
- AuthorPosts
- March 19, 2014 at 1:32 pm #9233fair-agencewebParticipant
Hello,
I was wondering if it was possible in a qform to build a select that will automatically fill the options with a product list taken in a specific category.
I am using WPShop and i wanted to insert a qform in the product sheet (it will be called with a lightbox)Here are the specs of my website :
Wordpress 3.8.1
Custom theme (locally running for now)plugins :
WPShop 1.3.7.8
Lightbox Plus ColorBox 2.6Thanks for your answer
March 20, 2014 at 8:36 am #9241AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
March 20, 2014 at 10:56 am #9243fair-agencewebParticipantHello,
Thanks for your answer but i must admit that i absolutely don’t get it
For example, the user post that code :
function mytheme_post_to_another_script($form)
{
// Rewrite the post variables
$post = array(
'vendor' => $_POST['iphorm_3_3'],
'newvendor' => $_POST['iphorm_3_7'],
'rep' => $_POST['iphorm_3_8'],
'delete' => $_POST['iphorm_3_11'],
);// Create a new cURL resource
$ch = curl_init();// Set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, 'http://test.gen-techno.com/scripts/vendorupdate.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));// Grab URL and pass it to the browser
curl_exec($ch);// Close cURL resource, and free up system resources
curl_close($ch);
}
add_action('iphorm_post_process_3', 'mytheme_post_to_another_script', 10, 1);
I don’t understand where this code is inserted, in function.php ?
Plus, how does it get informations ?
My dropdown list must fill itself with a list of product, in a specific category, i’m not sur that this code is the right one for what i meant to do, is it ?March 21, 2014 at 9:34 am #9248AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
March 21, 2014 at 11:15 am #9253fair-agencewebParticipantHello,
well i’m sorry but that doesn’t help at all. Where do i have to insert that part of code ? is that in a specified file somewhere ? how do i get the form to take this particular function ?
Can you be a bit more specific with your advices please ?
Plus the options here are set manually, aren’t they ?function mytheme_dynamic_dropdown_values($form)
{
$options = array();// Connect to the database and build up the $options array with the options,
// they should be in the format:
// $options = array(
// 0 => array(
// 'label' => 'Option 1',
// 'value' => 'Option 1'
// ),
// 1 => array(
// 'label' => 'Option 2',
// 'value' => 'Option 2'
// ),
// ... etc ...
// );$dropdown = $form->getElement('iphorm_2_1');
if ($dropdown instanceof iPhorm_Element_Select) {
$dropdown->setOptions($options);
}
}
add_action('iphorm_pre_display_2', 'mytheme_dynamic_dropdown_values');Best regards,
F.March 24, 2014 at 10:20 am #9269AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.