I believe that I started having issues right after upgrading Commerce to 7.x-1.11
When changing attributes on product display, the price was no longer updating. It was also not updating the cart either.
I think this is related, recent commit to commerce: https://www.drupal.org/node/2332333
In my situation I am also stuck on the 7.x-1.x version of commerce_option, a requirement for this module. Upgrading causes more issues that it's worth right now.
I attached a diff of the changes I had to the module that got me working again. Sorry no patch. Hopefully it helps someone as I spent way too much time tracking this issue down.
| Comment | File | Size | Author |
|---|---|---|---|
| #58 | 20151216-commerce-order-get-correct-price-for-items-with-adjusted-prices.patch | 1.45 KB | alexgreyhead |
| #29 | 3.png | 40.06 KB | nelslynn |
| #29 | 2.png | 43.57 KB | nelslynn |
| #29 | 1.png | 95.92 KB | nelslynn |
| #24 | BeforePatch.png | 43.1 KB | nelslynn |
Comments
Comment #1
didumir commentedI'm having this issue, too, but still i have to try your diff.
What I have seen so far:
in commerce_pricing_attributes.rules.inc, line 51, the condition
never is true. It was with Commerce 7.x-1.10
Comment #2
cutmedia commentedWe ran into this issue too, the diff above fixes it, release a patch?
Comment #3
didumir commentedThe diff above is working here too, thank you!
Comment #4
stevieb commentedI'm having the same issue ... will try the diff
Comment #5
stevieb commentedthe diff works for the add to cart form but not for the checkout or checkout review
my product is broken down into a 90€ (full price) and 60€ (concession) - if I choose the concession the price is 60€ in the cart but 90€ at checkout
Comment #6
stevieb commentedso I tracked it down a bit and the Rules 7.x-2.8 update is the culprit
after downgrading to Rules 7.x-2.7 the diff above is working
thanks
Comment #7
tadesign commentedSame problem as yourself Stevieb, the diff works for the add to cart form but not checkout or checkout review.
I did try updating to Rules 2.8 before the problems were noticed but I'm back using Rules 7.x-2.7 after an earlier problem where VAT wasn't adding to the cart. Despite being back on 2.7 I'm still having no luck with the checkout/checkout review pages adding the attribut prices to the base product price.
Cheers
Rich
Comment #8
joe huggansStevieb can you confirm that the diff above works for prices in cart and on summary page also after downgrading to Rules 7.x-2.7? Thanks
Comment #9
joe huggansIs it necessary to fully uninstall Commerce and then reinstall with the Rules 7.x-2.7 ? Or can we simply disable all modules, uninstall rules and replace with Rules 7.x-2.7 then apply patch?
Comment #10
stevieb commentedI simply downgraded to Rules 7.x-2.7 ran updates and cleared my caches
the rules update has no DB changes so you could try to delete the rules folder and them upload it again. uninstalling any modules should not be necessary
Comment #11
joe huggansOk so thanks stevieb, I have done as you suggested and it seems to be working in part. The prices are correct on the cart page and on the summary/checkout pages.
The only thing which is not working for me is the ajax price change on the actual page when someone chooses an option. I'm wondering if this is something to do with the fact that I am displaying my products in a view rather than creating an actual content type with a product reference field.
Any suggestions here would be great.
edit: Just done a quick check and I can confirm that this is only an issue when creating a view of products it seems. Can not get the price to change when views is rendering the products
Comment #12
stevieb commentedtry using display suite and everything should work for you
Comment #13
fugazi commentedsame problem
Comment #14
nerdsidious commentedSame problem here. Downgraded Rules and it didn't work on the add to cart or checkout still. Applied the Diff and then it worked on the add to cart, but not in checkout. I cannot figure out a way to get it to change the price through checkout.
Comment #15
danzVP06 commentedAs for my side, it's not working at all.. I tried the beta and dev version of pricing attribute and vice versa for the commerce option, my Rules is only 7.x-2.7.
I've tried setting up the pricing the same way it was done on the screencast, after choosing the options, the price is not updating at all, same goes for the cart and checkout. I also applied the diff, still made no changes for my side.
Comment #16
bluesman2014 commentedstevieb
Could you be more specific? Which functionality of display suite are you referring to?
Thanks
Comment #17
chrinor2002 commentedI can confirm that using rules-7.x2.7 and applying the diff seems to work. It seemed to on our testing server anyways.
Comment #18
daneshjoo commentedhi
same probleme after upgrade but with another section:
https://www.drupal.org/node/2206569
Comment #19
mmtt commentedThe same with me. The prise does not change selecting an other option. I tried to patch it with the diff from jimmynash but I get errors during patching 7.x-1.0-beta4.
Have you used it against the dev?
Comment #20
fugazi commentedI need to edit my patch to commit https://www.drupal.org/node/2001706 have added commit https://www.drupal.org/node/2420303. When using now everything works.
Comment #21
anybodyI can finally confirm that the patch in #20 works in the combination of:
- commerce 1.11
- rules 2.7
where functionality was completely broken with commerce 1.11 before!! It fixes the issue.
Because the module is completely broken with the current commerce version and there is a fix available, I'd suggest and kindly ask for:
- a new .dev-release
- a new stable release
And a look by a module maintainer to get this fixed soon. Our shop for example was completely broken by this issue, because it depends on the functionality.
I'll also set this related with an issue in commerce_option.module (#2417947: Commerce 7.x-1.11: Option values are not stored) that is based on the same problem.
Comment #22
nelslynn commentedThank you Anybody!
I'd just like to confirm that #21 also works with the latest Rules Module version, 7.x-2.9
Comment #23
leducdubleuet commentedWell, this is great, I guess it is time to change the status then, thank you all!
Comment #24
nelslynn commentedI just noticed something with this patch. When I have one option for a product (yes/no checkbox), a "None" option is added. This did not show with the unpatched version.
See screenshots.
Comment #25
leducdubleuet commentedHave you tried checking the Required box for your option?
Comment #26
andriyun commented@nelslynn I think this bug is your subjective case. Becouse i can't reproduce it on clean drupal instalation on simplytest.me
Maybe you should add more details.
Comment #27
andriyun commentedCoomonly patch #20 works for me.
@fugazi thank!
+1 to RTBC
Comment #28
peter caritas commentedPatch #20 worked for me
-Drupal 7.35
-Commerce 7.x-1.11
-Rules 7.x-2.9
Comment #29
nelslynn commented@LeDucDuBleuet -- > yes I check required and same issue. I wouldn't want to use "required" anyway because this is an optional add-on for a product.
@andriyun --> I don't think this is a bug as everything worked fine for 2 years before the patch.
Here's how to reproduce the issue
- set up a list field with checkbox/radio button widget, and assign 'unlimited' options (unlimited triggers a checkbox widget to display). Add one or more options. See screenshot 1 & 2
- In the product, select one or more options (either produce the extra -none- option), see screenshot 3
Question: why would a -None- option be added for a checkbox widget (a yes/no situation)? A -none- is only needed for a "radio" button widget.
Comment #30
fugazi commented#29 confirm your problem.
I have previously made another update from https://www.drupal.org/node/2293403 and had not thought to remove that before.
you like to make reversed again, but unfortunately also the problem is not solved.
Delete from line 1048:
and replace with:
I then tried a bad and fast solution, and it works to your satisfaction.
if I have found the error of problemes, I will again release a patch.
Comment #31
mmtt commentedI tried it again with -Drupal 7.35 -Commerce 7.x-1.11 -Rules 7.x-2.9 and the patch #20 but the price does not change with changing the attributes.
Comment #32
nelslynn commentedThanks Fugazi. With your fix in #30, everything is back to working great.
Comment #33
JF74 commentedHello!
I don't know if there is about the same issue but when i select an attribute and i click on "add to cart" the page refrech and the pop up "add to cart confirmation" appear whith the original (wrong) price but when i go to paid the cart the right price is display?
Comment #34
fugazi commented@JF74 what do you mean refers to putting here. https://www.drupal.org/node/2336869
Comment #35
mmtt commentedwith the patch patch #20 Drupal 7.35 -Commerce 7.x-1.11 -Rules 7.x-2.9 the price is calculated but after edding somthing to the cart, every shown price in the cart shows not the price with the added option. Only with an new page refresh the right price with the price option is shown.
Comment #36
fugazi commented# 35 The problem seems to be a big one. I was standing right in front of the same and did not know how I can solve this.
There is a dirty solution is not drupal standard. For me it works and that was important to me.
Here is a js file which is calculated. I would be pleased even if the problem is solved drupal standard.
I have installed it in my themes. Everyone knows how to do it but here again a short explanation.
1. Write code in a anything.js
2. put file in the themes folder
3. js file to write to themes.info scripts[] = js/confirm.js
4. empty cache run cron
now the amount in add to cart confirmation should be added.
I say again here explicitly that it is a dirty solution, and absolutely not, drupal standard
I have just published since many have the problem here also. The best way to solve it in the module.
Comment #37
mmtt commented@fugazi thanks for you solution. I've not tried it now.
But I've read the comment from joshmiller about the concept behint "Commerce Pricing Attributes" module http://drupal.stackexchange.com/questions/117770/commerce-attribute-pric...
I would like to see a pricing module flexible as "Commerce Pricing Attributes" but not breaking the commerce design standards. But as i know there are now other solutions.
Comment #38
TravisJohnston commentedJust to confirm, #20 worked for me as well with Commerce 1.11 and Rules 7.29. THANKS!
Comment #39
egarbeil commentedI tried all of the above and nothing works, with Commerce 1.11, Rules (both 7.27 and 7.29) and Core 7.35. The diff patch produces a PDO exception when I try to use it (duplicate entry). I had to back it out. Not using panels or display suite. The theme is not customized, just mayo. Products are t-shirt (price 14.00). attribute is Name on back (add 4.00). It takes the information and nothing happens.
mmtt, What are the other options to solve this issue? Right now, I'm looking at having to restore the client site in order to roll back commerce to 7.10.
Comment #40
Patriciok commentedHello,
to those who get this to work witch version of the "Commerce Product Option" modul are you using?
If I applying the #20 patch I get this error when i am adding something to the cart:
Notice: Undefined property: Entity::$field_name in commerce_pricing_attributes_calculate_adjusment() (line 57 of /.../sites/all/modules/commerce_pricing_attributes/commerce_pricing_attributes.rules.inc).line 57 is this:(starts at if(!array_key_exists)
And the price at the cart dont change.
Comment #41
mmtt commented@egarbeil I gave up using Commerce Pricing Attributes and went back to only variants which i to create and change with commerce feeds. All variants are managed from spreatsheets handy and clear.
Comment #42
Samgarr commented#20 worked for me, but now i am facing to same issue as #30, javascript in #31 does not work for me...
Comment #43
Anonymous (not verified) commentedChanged to critical since the intended functionality is broken.
Comment #44
bisonbleu commentedPatch #20 worked for me; price is updated in product display & cart.
-Drupal 7.36
-Commerce Kickstart 7.x-2.22
-Commerce 7.x-1.11
-Rules 7.x-2.9
-commerce_option-7.x-1.0-beta2+35-dev
-commerce_product_attributes-7.x-1.0-beta3+0-dev
I currently see 1 minor issues:
- the price is not updated in Commerce add to cart confirmation overlay
-
the selected option which changes the price is not displayed in the checkout** In my use case, a rental store, I have an number of days option set which lets you rent for 1 day, 1 week or 1 month. All prices are based on the daily cost e.g. 1 day = $1, 1 week = 3.5 days ($3.50), 1 month = 10 days ($10).
So in the checkout, it would be helpful to show the time period e.g. that the user selected the 1 week option which costs $3.50 (and not $1).
Update - this can be achieved with this patch.
Comment #45
fugazi commented#44 I could solve the problem with this #36Comment #46
vegantriathleteTo confirm what @bisonbleu wrote in #44,
I have things working with:
Commerce Kickstart 7.x-2.23 (Drupal 7.36, Commerce 7.x-1.11, Rules 7.x-2.9)
Commerce Option 7.x-1.0-beta2+35-dev
Commerce Product Attributes 7.x-1.0-beta3+0-dev
Commerce Pricing Attributes 7.x-1.0-beta4 patched with #20
The patch from #1696656: Views integration had been applied (by a different developer) previously, but even in that environment I was not seeing the price in the overlay. So, I have not reapplied the patch right now.
I'm going to call this good as long as the client signs off on it.
Thanks to all for posting about all the various pieces, and especially to @bisonbleu for the summary!
Comment #47
fugazi commented#44 I confirm the Commerce add to cart confirmation so not working. The problem is that the page is reloaded, and only then the information in Commerce add to cart confirmation is added. So he accepts the new price was loading. "without price attributes" There is a possibility the problem with ajax to solve, but unfortunately I have not found a way, without installing a new module. I have tested with commerce_ajax_cart and my js file to make it work. The modules commerce_ajax_cart is but too much for me so not a good solution.
I will continue to test and review whether a small change can solve the problem in js. as yet no success.
Comment #48
spanners commentedConfirming the patch #20 worked for me. Tried this module for the first time (first go at Drupal Commerce actually) and watched screencast multiple times, followed by banging my head on my desk multiple times.
Comment #49
leducdubleuet commentedPatch #20 worked for me as well, the price is updated in product display & cart.
-Drupal 7.37
-Commerce 7.x-1.11
-Rules 7.x-2.9
-commerce_option-7.x-1.0-beta2+35-dev
-commerce_product_attributes-7.x-1.0-beta3
-Commerce Pricing Attributes 7.x-1.0-beta4 patched with #20
I am happy the original issue is resolved and the module is working again! Thanks to all!
Should we advance this critical bug to RTBC and open a new issue to follow up on the "Commerce add to cart confirmation"?
Comment #50
fugazi commentedLeDucDuBleuet, The fist is a good idea, I will take any questions about the theme "Commerce add to cart confirmation" out here https://www.drupal.org/node/2336869 in order to avoid duplicates. I sat on RTBC status and hope for all ok.
Comment #51
andyg5000The patch in #20 fixes a few issue with using $form_state['default_product'] in the submit handler, but needs work to be RTBC.
1) Indentation is messed up causing -/+ on lines that aren't actually changed
2) Drupal coding standards aren't followed (comments and spacing)
3) Resetting$form_state['default_product'] probably isn't a good idea in commerce_pricing_attributes_add_to_cart_form_attributes_refresh() since $form_state is typically passed as a reference even though it's not in this case. I'd suggest attempting to load the product object before the if statement instead.
Thanks for the work
Comment #53
anybody@#51. Thanks, you are right! At least we should also consider the problems from #30 and create a new, clean fix. I have no good testing environment currently. Is there a developer who can create the final patch and test it?
For all others having problems currently: #20 is a good quick fix which makes the module working again but introduces some minor problems. The problems above may not all be related to this change (but some are). Somehow the patch is a first step and makes it work again in general.
Comment #54
hg_master commentedPatch #20 worked for me. Thank you. I think Dev should commit and update soon.
Comment #55
greatmatter commentedInterestingly, #20 no longer works on my install. I now get an error only when viewing the cart/checkout (not sure if that's the same as #40):
Notice: Undefined property: Entity::$field_name in commerce_pricing_attributes_calculate_adjusment() (line 57 of /var/www/html/sites/all/modules/contrib/commerce_pricing_attributes/commerce_pricing_attributes.rules.inc).After DPMing everything, it looks like "field_name" isn't one of the properties of the $commerce_option object anymore, and as a result, special pricing isn't working.
Has anyone else seen this?
Comment #56
r0ber commentedThanks ! patch #20 works for me too.
Comment #57
alexgreyhead commentedI second Greatmatter's comment - the patch at #20 doesn't work on Commerce 1.11.
This is obviously a blocking issue, and at the moment I'm not sure whether I want to keep banging my head against the wall trying to get this module to work; I've already had to patch it once, the patch in #20 doesn't seem to be working now, and I don't know what else to try.
I wonder if reverting to an older version of Commerce will fix it? But then that will undoubtedly introduce regressions elsewhere, so I'm loath to try that.
Very frustrating, and I don't understand the nuts and bolts of Commerce enough to be able to figure this one out :(
Comment #58
alexgreyhead commentedOkay, I have found that patching the commerce_order module fixes the problem.
The issue seems to stem from the fact that this module doesn't change the product's base price, but instead just sets its price, while the commerce_order looks at the base price of a line item when calculating the order total.
So I changed commerce_order.module from this (line 1380):
... to:
I have attached a patch file, but it's not rolled against a dev version of commerce_order, and I haven't done a full regression test so can't be certain that it hasn't caused a whole load of other issues elsewhere :(
There is also the problem that the Subtotal (before discounts) figure is still wrong, but this doesn't seem to affect the final total (which is a sign of some strange logic, since you would want to calculate your final price based on the subtotal value, but instead I think it's being calculated twice...).
Comment #59
leducdubleuet commentedI am still using the patch in #20 with the same setup I had in #49 and it is still working properly.
@greatmatter @alexharries This module works only with the 1.x branch of Commerce Product Option, I believe this error comes from commerce_option-7.x-2.x... If so, I suggest using version 1.x instead.
@alexharries Unless I am mistaken, we cannot have a patch in a module queue that patches another module.
Comment #60
leducdubleuet commentedI just noticed there is a duplicate issue that was created not so long ago with a cleaner and smaller patch. It is basically the same solution as in #20 but without the indentation errors and the extra fixes on the $lang_code and the option none or not required. It may have a better chance of getting committed there!
Comment #61
alexgreyhead commentedHi LeDuc :) Thanks for your reply. In answer to your points:
@greatmatter @alexharries This module works only with the 1.x branch of Commerce Product Option, I believe this error comes from commerce_option-7.x-2.x... If so, I suggest using version 1.x instead.
I just confirmed; my commerce_option.info reports I am on 7.x-1.0-beta2.
@alexharries Unless I am mistaken, we cannot have a patch in a module queue that patches another module.
No, we can't, but since that patch is not very widely tested, and only applies to the specific use case of this module not working, I would tentatively suggest that it will do more good to be here where people with the same issue can see it, than on the commerce_order issue queue, where it will probably languish until someone with a better understanding of the Commerce modules, and more time on their hands, can roll and test a proper patch.
:)
Alex
Comment #62
leducdubleuet commentedComment #63
leducdubleuet commented@alexharries Ok then, if this can help, I am using current dev commerce_option-7.x-1.0-beta2+35-dev with this patch.
Comment #64
egarbeil commentedI ended up having to roll back to commerce 1.10. We have since lost the client due to the problems with this issue and have stopped using commerce for retail. I still find it incredibly useful for CRM sites, but won't use it for any kind of store. Ubercart wasn't working well for 7.x when we switched over to commerce, and they have since come a really long way. We have gone back to Ubercart, where price modifications are not an issue. I am not willing to lose another client.
Comment #65
kurti commentedI´m using:
Drupal 7.43
Commerce 13
Product option 1.0-beta2
Products attributes 1.0-beta3
Pricing attributes 1.0-beta4 width this patch.
Patch #58 for Pricing attributes (in my Drupal) causes a PDO exception.
Inside the product display page the price is correctly changed, but when I add it to cart the price remain the original.
¿¿ Is there anything to change more ??
I´m desperated...
Many thanks!!
Comment #66
giorgoskRelated issue #2595383: Does not change the price when update commerce 7.x-1.11 patch #3 makes everything work as normal
why is there 2 seperate issues for this problem ?
Comment #67
fabregas23 commentedI´m using this modules:
commerce pricing attributes
commerce product attributes
Commerce Product Option
Inside the product display page the price is correctly changed, but when I add it to cart the price remain the original.
help me please