This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 3
Quantity in paypal/payment
Started 11 years ago by Fa | 11 posts |
-
Hi,
I've been thinking as well to have a qty field that will affect the total and had the following thoughts:- what i have:
* a multi-radio list (required with a default value checked)
* a qty combo dropdown that contains in custom css class the value: qty_3 where 3 is the id of the radio list in my case li_3 (i looked at the form source code to find that value) (required with a default value 1 selected) (the qty_3 class doesn't exist, just used as a link between the combo and the radio list)
* in the payment panel associated to the form, i have dropped in both fields, have put my values on the radios but i left the combo untouched, ie 0 for each value
* in the handler of the radio button, there is some code that looks for the associated qty_X where X is the id of the parent of the current radio (ie li_X) and gets the text of the qty combo selected item; then it is just used to multiply with the value of pricedef
* in the handler of the select/combo (below in the same block) on the change, there is some code to check that in the class of the parent there is something like "qty_", if so, find the "li_X" where X is the value in qty_X and trigger a click action on the checked radio button.So, if i click on a radio, look for the value in the associated combo and multiply, if i change the value in the combo, look for the checked radio and trigger its handler to recompute.
It all worked ok on the front-end and displays the proper total but on the submit, it doesn't ie on the paypal page. And looking further, i see that the form stores in the database the selected items (combo and radio) and in the ap_element_prices the prices shown in the form. So the qty meaning is "lost". And the paypal code "looks" inside the tables to post its values.
Has anyone gone further with a "quantity field"?
Thanks.Posted 11 years ago # -
Update:
Thanks to this post
http://www.appnitro.com/forums/topic/pass-additional-information-to-paypal-machform-3x?replies=11#post-14977
I managed to have paypal display my selection by hard-coding in include\post-functions.php
just aboveif(!empty($amount) && ($amount !== '0.00')){
something with if $form_id == 'myform' and adding a ' quantity' in $paypal_params which pulled out the qty value from $price_titlesPosted 11 years ago # -
Update:
I noticed that the email notifications and the entry in the form manager were not reflecting the proper total, so also modified (hard-coded) this function: mf_get_payment_total in includes\post-functions.php (something similar as in mf_get_merchant_redirect_url).
Posted 11 years ago # -
Hi Fa,
Thank you for sharing this, that's a lot of work I must say.
I have a news for you. I'm not sure if this would made you happy or upset but we've added the Quantity support for payment-enabled forms within the next update (v3.5)
You will be able to use the "Number" field to calculate with other price-enabled field. Here is some screenshot of the number field property:
We're still working on few other features and hopefully v3.5 will be available within May, next month.
MachForm Founder
Posted 11 years ago # -
Fabulous news! I,m not sure about Fa, but makes me and a lot of other people very happy.
Posted 11 years ago # -
Thanks Yuniar, reading through various posts, it is what i guessed would be coming soon. Which is good news indeed!
Note: Yuniar, am i correct to understand that only the number field could be used as a qty and not the dropdown field?
Currently, on the form i am working on where qty is 'attached' to the dropdown, i noticed that:
- when i reload, or when there is an error in the form, the total becomes wrong (and forgets the qty), so i will be looking at finding the amendments to make.
- that using the tab and arrow on the keyboard to increase the value in the dropdown, the total doesn't change unless i press enter in the dropdown after scrolling on a value with the keydown. (this one, i'll pass... because the submission goes correctly)I mention these in case the dropdown field 'joins' the number field with the qty, in the coming feature. ;-)
Needless to say that i will certainly use the qty feature when it's released.
Posted 11 years ago # -
Yes, I'm afraid only Number field can be used to enter the quantity. You can then associate the number field with other fields (multiple choice, checkboxes, dropdown, price)
MachForm Founder
Posted 11 years ago # -
Thank you Yuniar.
Posted 11 years ago # -
Awesome feature!
Thanks
Posted 11 years ago # -
Is there any chances to have a early version of the quantity field?
Posted 11 years ago # -
I'm sorry, we don't have public beta version for this one.
MachForm Founder
Posted 11 years ago #
Reply
You must log in to post.