Forum Replies Created
- AuthorPosts
janheu
ParticipantHi,
i would like to use paypal in a form where ppl can select different products and configurations.
The amount is shown in different fields, once they´ve chosen a product and config.
Somehow currently Paypal just recognizes the shipping costs.
when i embed the same fields into mails it works like it should.
Currently i´m using a setup like this to get the amount.$amount = $form->getValue('quform_1_121') ?? $form->getValue('quform_1_131') ?? $form->getValue('quform_1_136') ?? $form->getValue('quform_1_145');
if ($amount) {
// remove currency
$amount = str_replace(['€', ' '], '', $amount);
$amount = number_format((float)$amount, 2, '.', '');
} else {
$amount = '0.00';
}
$quantity = $form->getValue('quform_1_65') ?? $form->getValue('quform_1_34') ?? $form->getValue('quform_1_43') ?? $form->getValue('quform_1_138') ?? $form->getValue('quform_1_144');
$quantity = $quantity ?: '1';
$url = add_query_arg(array(
'cmd' => '_cart',
'upload' => '1',
'charset' => 'utf-8' ...
Any idea why its not grabbing the value correctly?
January 23, 2024 at 3:26 pm in reply to: Limiting the number of entries – two date in one form #36440janheu
ParticipantHi, I´m coming back to this post since I have a similar idea.
We have multiple Dates set in a option field. Based on a selection made before,First the user selects a place via dropdown -> afterwards he/she can select a date (option) based on that selection.
add_action('quform_pre_display_33', function (Quform_Form $form) {
global $wpdb;
$query = "SELECT COUNT(*)
FROM {$wpdb->prefix}quform_entry_data ed
LEFT JOIN {$wpdb->prefix}quform_entries e
ON ed.entry_id = e.id
WHERE e.form_id = %d AND ed.element_id = %d AND ed.value = %s";// Erstes Radio-Button-Element
$uniqueId1 = '33_32';
$limits1 = array(
'03.02.2024' => 6,
'24.02.2024' => 6,
);
updateRadioOptions($form, $uniqueId1, $limits1, $wpdb, $query);// Zweites Radio-Button-Element
$uniqueId2 = '33_33';
$limits2 = array(
'09.02.2024' => 6,
'17.02.2024' => 6,
);
updateRadioOptions($form, $uniqueId2, $limits2, $wpdb, $query);
});function updateRadioOptions($form, $uniqueId, $limits, $wpdb, $query) {
$radio = $form->getElement('quform_' . $uniqueId);
if ($radio instanceof Quform_Element_Radio) {
$options = array();
foreach ($radio->getOptions() as $option) {
$value = isset($option['value']) ? $option['value'] : null;
if ($value && array_key_exists($value, $limits)) {
$count = $wpdb->get_var($wpdb->prepare($query, $form->getId(), $radio->getId(), $value));
if ($count < $limits[$value]) {
$options[] = $option;
}
} else {
$options[] = $option;
}
}
$radio->setOptions($options);
}
}Thats the idea, somehow it doesnt seem to work, any idea how we can adjust it?
Is there a way to display a message if all spots for this place are already booked?
thanks a lotjanheu
ParticipantHi Ally,
thanks i will have a talk with them.
BRjanheu
ParticipantHi Ally,
unfortunately not.
Have you tried via phone?- AuthorPosts