Posted by FranCarstens on August 27, 2009 at 4:42pm
8 followers
Jump to:
| Project: | Ubercart Discounts (Alternative) |
| Version: | 6.x-2.x-dev |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
UC_Discounts had/has the same problem: "Discounts are being added at checkout, but when it sends it on to PayPal, they get charged the full, non-discounted price."
It works when sending the info as 1 line item, instead of itemised. Unfortuntely this is not ideal as it affects shop-owners using 3rd party software to connect with Paypal ex Shipworks.
Otherewise, this module works really well, and it's ease of use beats uc_discounts out of the water.
Comments
#1
Other related links (uc_discount):
http://drupal.org/node/346521
http://www.ubercart.org/comment/30007/Re_UC_Discounts_not_sending_discou...
http://www.ubercart.org/comment/30053/Bug_found_not_fixed_yet
#2
I am having the same issue with Google checkout.
#3
I'm unable to reproduce this with a fixed price discount and the paypal gateway using the latest 6.x-2.x dev version. Can you post steps to reproduce?
#4
This is my setup:
Drupal 6.14, UC6x-2.0-rc7, UC_discounts_alt 6.x-1.0-beta36
Qualifying Type: Minimum Price
Qualifying Amount: 45
Discount Type: Fixed Amount Off
Discount Amount: 30
Filter by Products -> Products: Samples (CS)
Require Single Product to Qualify.
Maximum times applied: 1
Can be combined with other discounts
Max uses, per user, per code: 0
Paypal Website Payments Standard:
PayPal cart submission method: Submit an itemized order showing each product and description.
In PP Website Payments Standard block it does state the following:
You must use a single line item on your site if you have any fees or discounts besides shipping and tax.
I'm sure this is the issue... Just not sure why it's an issue and if there's not something that can be done about it. PHP is not my playground... I'm better at the html, css and Photoshop stuff.
Here's another page RE: Issue -> http://www.ubercart.org/forum/module_support/8029/uc_discounts_not_sendi...
#5
Marking as active with the link provided. Thanks.
#6
I also have had this problem with every type of discount module.
Couldn't the solution be to edit the line-items before submission?
Paypal's API can't handle negative line-items which is why you'd need to somehow edit the submitted products' prices before sending them to paypal.
Is that possible?
I'm willing to do the grunt work of coding it if anyone knows where to dig, although I don't have time to look through the code atm....
There is an ubercart line-item function though... could that be used?
#7
I am also experiencing this with google checkout
#8
I've also encountered this same problem w/ google checkout.
#9
Does this still happen when you chose the "submit the whole order as a single line item" option at http://www.masteringdrupal.com/admin/store/settings/payment/edit/methods ?
#10
I believe I have found a solution. I don't really know my way around this module, but I was able to track down a solution. If someone has a more elegant way of implementing it, then please do so. This function also assumes you have an itemized paypal setup using web payment standard. It will not search for those settings. I want to make that very clear.
<?php
/**
* Implementation of hook_form_FORM_ID_alter()
* adds discount_amount_cart to uc_paypal_wps_form for an
* itemized paypal setup
*/
function uc_discounts_form_uc_paypal_wps_form_alter(&$form, $form_state) {
if (($order_id = intval($_SESSION['cart_order'])) > 0) {
$order = uc_order_load($order_id);
if ($order->payment_method == 'paypal_wps') {
$form['discount_amount_cart'] = array('#type' => 'hidden', '#value' => uc_discounts_get_discount_amount_for_order('review'));
}
}
}
?>
What this does is add the "discount_amount_cart" paypal variable to the form to send to paypal. No need to discount individual items if you have a universal discount being applied.
Some backstory: I have a Buy 1 Get 1 Free sale (no coupon). To my chagrin, I found that the discount wasn't being passed to paypal. I looked at the paypal form (considering everything else was working up and through order review) to find that there wasn't any discount option being passed. I researched paypal's api and found the discount_amount_cart option. Very useful in this situation.
Again, I made this function to suit my own needs. If someone wants to expand upon this to have uc_discounts look for an itemized or one-line paypal setting, please do so. I also use WPS, so again, it's not universal for all paypal options.
HTH,
Robert
#11
#12
Unless you do some hacking you must set the paypal payment method to pass the whole order as a single item rather than itemised then you get the correct order total.
#13
double post
#14
Not for me .... I noticed the full price passing to the sandbox, so I researched here. Thought setting the line items was my problem. I went to the uc config for PP and it was already set correctly. ???? So the discount is not passing on either setting.
It's a fixed discount of $10.00 for purchasing 2 items @ $75.00 each. The total looks right in the cart, then passes to PP as $150.00 and not $140.00. I tried both settings ... no luck.
#15
OK ..... I have it working now with single line item and with multi-line item configurations. Although the settings state that single line item config is needed for discounts on the Pal Pal Standard set up dialogue, both work for me. The bug I found is with the enable/disable panel in the checkout settings page described as "Enter discount codes." This must be enabled for either line item field to work properly. This bug is described on the UC forum for this issue as well.
So if the panel must be hidden on check out perhaps a custom template, some css, or lighter strategy is best in contrast to hacking module core until it is fixed.
There must be a connection/function for passing the discount to PP in the code between enabling this panel and discounts passing in general. Isolating the function (code culprit) and enabling it even if the panel is disabled will fix the problem.