Hi!
Um, I was getting an error Fatal error: __clone method called on non-object in /path/to/drupal/sites/all/modules/uc_discount/uc_discount.module on line 111
when I try to view some orders (I can't really remember what those orders were though - whether they have discounts or what) and some pages (for some reason that error comes out when i visit a userpoints page).
I tried doing it like this here http://drupal.org/node/597992#comment-2982582 (the issue was closed so I created a new one). It didn't display any errors anymore although I'm not sure if it's the right solution.
Any help appreciated!
Thanks!
Comment | File | Size | Author |
---|---|---|---|
#36 | uc_discount.802900_36.patch | 1.56 KB | ar-jan |
Comments
Comment #1
calbasiHi,
I've reply you here:
http://drupal.org/node/597992#comment-3251218
Comment #2
joekrukoskyI had the same error after upgrading to UC 2.3 and the 6.x-1.x-dev (2010-Jul-11)
I found the solution in http://drupal.org/node/597992#comment-2982582, but it took me a while because I confused my issue the trigger issue (which I did not have). So I'm just reposting the solution here to simplify the search for others.
Reposted from dsdeiz's post http://drupal.org/node/597992#comment-2982582 :
Comment #3
grub3 CreditAttribution: grub3 commented@coolfiretech
Your fix is extremely important.
it can be changed to if (isset($context['subject']['node']) && is_object($context['subject']['node'])){
Comment #4
haysuess CreditAttribution: haysuess commentedThis saved me too!!! Any time I added a blank item to my orders it would give me WSOD. This change isn't in the most recent dev version either...that should be fixed ASAP!
Comment #5
smscotten CreditAttribution: smscotten commentedAgreed. Changing to "bug report" because it is a code problem that breaks the functionality of the module.
Comment #6
Rene Hostettler CreditAttribution: Rene Hostettler commentedHey had the same issue
Fatal error: __clone method called on non-object in /var/aegir/platforms/pressflow-6.19.92/sites/all/modules/uc_discount/uc_discount.module on line 133
I fixed by changing:
and also had to change
Comment #7
ñull CreditAttribution: ñull commentedsubscribing
Just to confirm that I see this error too when introducing a blank line in an order. Any fix jet?
Comment #8
jazzitup CreditAttribution: jazzitup commentedConfirmed. This issue could be reproduced with the clean D6.20, latest UC 6.x-2.x-dev and latest uc_discount 6.x-1.x-dev. After proposed fixes I still had issues and had to change the block starting from line 127 - instead of:
there should be:
Comment #9
joachim CreditAttribution: joachim commentedUrgh, looks like UC has made API changes :/
The proposed changes need to be posted as a patch file so people can review it -- see http://drupal.org/patch. Only then set the status to 'needs review'.
Comment #10
jazzitup CreditAttribution: jazzitup commentedI hope this helps. The attached patch should integrate all of the proposed changes from above.
EDIT: Even with those patches, module doesn't seem to work properly with the latest Ubercart, probably caused by the API changes mentioned earlier. Reported issue: #1010304: Incompatibility with the latest version of Ubercart
Comment #11
grub3 CreditAttribution: grub3 commentedCongrats, your patch seems to work.
I did test using two different accounts on our production server.
This seems to be okay.
Comment #12
jazzitup CreditAttribution: jazzitup commented@grub3: Are you sure? It seems like this module have some serious issues with the latest Ubercart API changes. It doesn't throw an error, or warning messages, but it just does not seem to work. There are a few cases where it calculates the discount, but there are many different cases where the discount will not be applied after you define the discount's predicate by using CA. At least for me.
Can you confirm everything's ok with this module on your production server, please? What Ubercart version do you use on that setup?
Comment #13
mattman CreditAttribution: mattman commentedJust applied the patch from #10 (production server) and I'm back up and running. Thanks a bunch for the fix! My cart is a very simple one but it seems as if the discount rules (I only have one) is being applied.
Comment #14
joachim CreditAttribution: joachim commentedThanks for the review!
Be great if we got a couple more reviews for this patch, given how crucial good operation of Ubercart is.
Also, the patch needs a reroll for Drupal coding standards -- whitespace, indentation, and things like 'else if'. Anyone got a few minutes to take a shot at it?
Comment #15
dsdeiz CreditAttribution: dsdeiz commentedI had time! Not entirely sure if I got the patch right though. I haven't tested it either since I can't remember how I got the error originally. I just made the changes mentioned above based from madjoe's patch. And some little changes that the coder module mentioned.
Comment #16
jazzitup CreditAttribution: jazzitup commentedCan anyone confirm that the module works properly with the latest UC, please?
When I say properly, I need a confirmation on all types of discounts applied to products/total orders.
Comment #17
schackattack CreditAttribution: schackattack commentedi applied the patches on the latest dev release. still no order discounts get applied, product discounts do.
Comment #18
jazzitup CreditAttribution: jazzitup commented@schackattack: Thanks for the report!
Comment #19
joachim CreditAttribution: joachim commented@dsdeiz: Thanks for updating the patch... unfortunately, now it's going too far, sorry! Coder fixes that aren't relevant here shouldn't be in this issue.
Someone could probably fix this by hand, just by stripping out all the patch hunks in the second patch that are not in the first.
I should say that I'm not in a position to test this patch myself -- the site I used to use this module on no longer uses it, so I don't have paid time to work on this module. I'm also really busy with other projects at the moment, so all I can do is keep an eye on this module's issues and when patches get sufficient testing by other users, commit them.
Comment #20
schackattack CreditAttribution: schackattack commentedI just tried what joachim suggested, merged the two patches. still to no effect.
Comment #21
joachim CreditAttribution: joachim commentedI didn't say merge them!
Comment #22
joachim CreditAttribution: joachim commentedPatch in #10 needs to be properly formatted code. You *can* use coder module to do this, but make sure to not add other changes that are not relevant here. Though it's simpler to just read up on the coding guidelines...
Comment #23
schackattack CreditAttribution: schackattack commentedok. sorry- wrong choice of words. i stripped out all the lines from the 2nd patch, that weren't in the first. correct?
Comment #24
joachim CreditAttribution: joachim commentedYup, sounds right. Can you upload it please?
Comment #25
grub3 CreditAttribution: grub3 commentedSubscribe. Please apply ASAP, hundreds of websites are probably waiting. We can't allow a page of death.
Comment #26
joachim CreditAttribution: joachim commented@grub3: Anyone can make the patch and upload it, including you. As soon as there's a patch I can apply, I will apply it. I'm sorry to be hardnosed maintainer here but I am extremely busy with client work and none of them need this module.
Comment #27
AaronBaumanhere is the patch described by shack and joachim.
it resolved the fatal error in my case, but i did not test any further.
Comment #28
torgosPizzaSubscribing, will test patch when I can.
Comment #29
Rob B CreditAttribution: Rob B commentedThanks aaronbauman (and those who found the fix), I have applied your patch and now I can view/edit my orders again. I will post if I run into any issues.
Comment #30
brettev CreditAttribution: brettev commentedI'm trying to get this to work, and I'm seeing that the patch given makes the fatal error go away, and it shows the correct price on the order's subtotal, but then the order total has the original pre-discounted total. on the cart/checkout page, it shows subtotal as the right price, but total as the full price. If you click on continue, on the cart/checkout/review page, it shows the correct information. So its really just not showing the right total on the cart/checkout page
Comment #31
fcortez CreditAttribution: fcortez commentedI was getting the same error as above. I suspect uc_discount module was conflicting with uc_coupons module. I applied the patch in #27, and the error went away. Thank you for the patch.
Comment #32
scotwith1tTried patch in #27 and works fine. Please commit to dev whenever you get a chance. Thanks to aaronbauman, shack and joachim!!
Comment #33
joachim CreditAttribution: joachim commentedI'm a bit alarmed by these two changes. They seem to be a big change and I so out of touch with this module's code I've no idea why they are there and what they do.
Comment #34
Beanjammin CreditAttribution: Beanjammin commentedI have recreated the patch from #27 without the parts highlighted by joachim in #33 that appear to effect how the discount is calculated. All I was after was the ability to view / edit / delete effected orders.
Comment #35
AaronBauman#33, #34: makes sense.
not sure why i changed that logic either.
#34 works to address the error for me.
+1 vote for rtbc
Comment #36
ar-jan CreditAttribution: ar-jan as a volunteer commentedHere's a reroll (34 applied with offset).