Ability to enter a quantity
-
This post is a donation of code (or at least the start of code) to extend the “wp_paypal_payment_box” shortcode to support a “max_quantity” attribute that (if greater than one) will render a select box with the number of items that the user is intending to buy. The selected number is submitted to PayPal via the standard “quantity” variable.
Here is the patch I have made to v4.8 of this plugin:
diff -U 3 -r trunk/shortcode_view.php update/shortcode_view.php --- trunk/shortcode_view.php 2016-01-21 22:35:46.000000000 -0600 +++ update/shortcode_view.php 2016-01-21 22:36:12.000000000 -0600 @@ -97,6 +97,7 @@ 'email' => '', 'currency' => 'USD', 'options' => 'Payment for Service 1:15.50|Payment for Service 2:30.00|Payment for Service 3:47.00', + 'max_quantity' => '', 'return' => site_url(), 'cbt' => '', 'reference' => 'Your Email Address', @@ -144,6 +145,16 @@ <select class="wp_paypal_button_options"> <?php echo $html_options; ?> </select> + <?php if ($max_quantity > 1) { ?> + <label for="quantity">Quantity:</label> + <select name="quantity" style="width: 5em;"> + <?php + for ($i = 1; $i <= $max_quantity; $i++) { + ?> + <option><?php echo $i; ?></option> + <?php } ?> + </select> + <?php } ?> </div> <?phphttps://ww.wp.xz.cn/plugins/wordpress-easy-paypal-payment-or-donation-accept-plugin/
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Ability to enter a quantity’ is closed to new replies.