Closed (fixed)
Project:
Ubercart
Version:
7.x-3.x-dev
Component:
Products
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
22 Dec 2011 at 22:54 UTC
Updated:
3 Nov 2014 at 21:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
wodenx commentedHere is a patch as a starting point. It updates the prices of attribute options when they are displayed as 'total price' to be accurate even if there are more than one priced attribute associated with a product. The second part of the patch turns off this functionality for checkboxes, because that seemed confusing.
Responses to longwave's comments from the parent issue:
Did you find this confusing with select/radio options as well as checkboxes? I totally agree about checkboxes, but the other makes sense to me because the price next to each option is always the correct total with that option selected.
Do you think both the sell price and the display price should be updated? Or perhaps only the display price (and the weight)?
uc_aac (which I hadn't even known existed...) also provides an option to modify the price adjustments so they're always relative to the display price - do you agree with this approach? (as I recall, that's how places like Dell and Lenovo handle configurable systems - once you select an option, cheaper ones are listed with a negative value).
marking as "needs work" because I think we want additional functionality.
Comment #2
wodenx commentedBy the way - updating the other product fields should be very easy to do once #1301430: Inclusive tax implementation is not flexible (attribute options) goes in.
Comment #3
artatum commentedThis is a great news that this feature is about to be moved on D7.
I've tried to edit the module,( manually) with the patch above. The spining icon is there when I click on an option but my price remains unchanged.
Could you put the whole uc_attribute.module file please ? Or maybe I missed smthing...
thx a lot for this long awaited work...
Comment #4
wodenx commentedAs longwave said in the other thread, this is still a work in progress (hence the "needs work" status) - I don't think this will be completed until #1301430: Inclusive tax implementation is not flexible (attribute options) lands.
Comment #5
artatum commentedAs you were talking of 'total price', and my attributes are displaying the difference for now, I looked for editing my attributes display but could not find the menu item for that. Could you tell me where it can be edited please ?
Comment #6
wodenx commentedYou specify how option prices are displayed at admin/store/settings/products - is that what you're looking for?
Comment #7
artatum commentedBingo!
Gee I looked for it 100 times there, yet. Shame on me.
But THX a LOT.:-)
Comment #8
wodenx commentedPatch at #1 no longer applies.
Comment #9
wodenx commentedCompletely reworked this - attached patch provides a generic mechanism for any module which adds fields to the "add-to-cart" form to cause node display to update based on customer input. It then uses this mechanism to update display-price, cost and weight when attribute options change.
The mechanism is controlled by a store-wide product setting.
Definitely need some tests to go with this...
Comment #11
jarrodirwin commentedHey this is a great addition and is almost exactly what I would say a lot of people are asking after (including myself).
One question I do have is does this provide the ability to update the initial product price on the node? I would like to use the 'Display price adjustment' option but have it also update the overall price depending on what attribute is chosen.
Do I need to add a particular id/class to the theme of the product price or anything like that or is that out of scope of this patch?
Comment #12
wodenx commentedTests were failing because they assumed the attribute prices would be included. Changed the default behavior - but I still need to write some tests for this.
@jarrodirwin: This updates the "display_price" of the node - not the "sell_price". I don't update the sell_price because I think it will be usefulto have both the unmodified and modified prices available for display. No you don't need to add any css.
Comment #13
wodenx commentedThe method used to determine which divs to replace on the node display is theme dependent and needs to be changed.
Comment #14
longwaveSounds like #13 is related to #629048: By default, product (node) elements are undistinguishable in a multi-product display
Comment #15
benitezv1ang commented#12: 1380772-attribute-ajax-12.patch queued for re-testing.
Comment #16
wodenx commentedStatus is "needs work" because of #13.
Comment #17
tr commentedNow that 3.0 is out I'd like to make an effort to get this finished!
Comment #18
wodenx commentedI'm swamped at the moment, but I think this is just waiting for #629048: By default, product (node) elements are undistinguishable in a multi-product display. Once that (or something like it) gets in, it should be pretty easy to fix the issue in #13.
Comment #19
combait commentedWhat is the status of this feature ? Can i implement 1 of the patches or do i need to wait for a fix ?
Comment #20
longwaveYou can try out the patch in #12 and see if it works for you. Please post back with your results; whether it works or not may depend on your theme as noted above.
Comment #21
combait commentedWhat dependencies are required for this to work ?
Comment #22
wodenx commentedRebased this to the current DEV. I think it's really only being held up by the issue mentioned in #18
Comment #23
general975 commentedI couldn't get the patch to work (im using tortise svn and it rejected all the changes, even when I remove the a/ and b/ folder paths)
I did, however, make all the changes manually. Like post #21 are there dependencies for this to work? Everything works as normal so to me that says that I got all of the php code right., but no update of the prices.
update: to clarify, I am showing the Display price, and hiding both the Sell price and List price
Comment #24
wodenx commentedThe patch applies with some offsets - here is a rebased version. Also, assuming your by-hand changes are complete, you need to enable this feature at admin/store/settings/products by checking the box labelled "Update product display based on customer selections".
Comment #25
general975 commentedThanks wodenx!
It works great for me using a modified version of bluesmaster. My only complaint is that the ajax, and thus the spinning update icon, is used for attributes that have a $0 price adjustment. I'll probably dive into the code to see where I can put in a condition to check for this.
Comment #26
ComputerWolf commented#24: 1380772-24-attribute-ajax.patch queued for re-testing.
Comment #27
general975 commentedHas this been tested with the newest ubercart update?
Also, I have been unable to get the patch to work either with tortoisesvn or cygwin.
Comment #28
jarrodirwin commentedI can confirm it applies cleanly and works as expected with 7.x-3.1
Comment #29
Poieo commentedWorking well with 7.x-3.1.
However, I second @general975 in that there should be a check to see if the attribute has a price adjustment before calling the ajax function. The current patch attempts to update the price regardless of whether or not the attribute actually has a price adjustment.
Comment #30
benitezv1ang commentedhow can i apply the patch on my site
Can you please help me
Thanks
Comment #31
stewart.adam commentedDetails on how to do so are available in the Drupal documentation: http://drupal.org/patch/apply
Comment #32
jarrodirwin commentedAnyone using this having any issues with speed? It takes an age for the total to update on my site.
http://www.pwnpcs.co.uk/?q=laptops/sager-n6175-clevo-w170er-high-perform... (click Configure tab)
Any ideas on how to speed this up?
Comment #33
chertzogCross posting from #1691666: Unexpected behavior with other ajax modules.
The patch in #24 applies clean, and seems to work. But when used in conjunction with UC Dropdown Attributes stuff breaks. I cant tell if the problem is because if this patch or the other module, because they both work perfectly when used independently.
Comment #34
benitezv1ang commentedi tried the patch on my site with no luck can some one post a zip file as module.
I want to test it and work on the module too.
Comment #35
benitezv1ang commentedCan you please send me a copy of theAjax-ify attribute option price selection
as module not a patch
I try patch and does not work for me
Thanks
Comment #36
longwave@benitezv1ang: We do not supply pre-patched modules, please use http://drupal.org/patch/apply to learn how to apply patches, or explain why you had "no luck" and someone might be able to help.
Comment #37
digital fire commentedJust tested on UC 7.x-3.1. Ajax icon spins like its doing something but it doesn't modify the Display price.
Comment #38
digital fire commentedIf I can get in contact with any of the maintainers. I'm willing to run tests with very quick turn around responses on the tests. Would love to help with the issue that the display price isn't changing.
Comment #39
longwave@Digital Fire: That is perhaps related to the problem described in #13 - what theme are you using? If you change your theme to Bartik, does the Ajax update work?
Comment #40
digital fire commentedJust ran that test and it did not work. I am using the whitebull theme which is a pretty simple/basic theme.
Comment #41
digital fire commentedLet me know if there is anything else I can try.
Comment #42
longwave@Digital Fire: The patch works for me in both Bartik and Whitebull, after patching, clearing cache and enabling the checkbox. Perhaps this has the same cause in your setup as #1669796: Items won't add to cart?
There are some minor code style issues in this patch which I will try to clean up soon, otherwise it looks good to me. I don't see why we have to wait for #629048: By default, product (node) elements are undistinguishable in a multi-product display to get this into -dev.
Comment #43
longwaveUpdated patch with coding standards and documentation fixes. Code is otherwise identical to #24.
Comment #44
digital fire commentedWell in that particular issue. I was dealing with an old site. Thats the reason i'm using the whitebull theme. I created a new site from scratch since the old one was hacked to hell from previous devs. ATM I don't have any caching enabled since i'm still in dev with this one. I will go over the patch one more time and make sure I did everything correctly (I'm manually patching).
Comment #45
digital fire commentedIt might have something to do with the particular way I have my products set up. Right now the products have a 0$ price. You pick an attribute and that is what is supposed to be the final product price. I will try adding a base price for the product and the attribute should just add to the final price. Maybe it has something to do with it being a base line 0$. Will review my patch, test this theory and report back.
Comment #46
digital fire commentedBelow you will find pastebins of my patched code for review and in case anyone needs to manually patch the code like I did. I don't think I missed anything so the next step I will take is listed any additional modules I have that may be interfering with this. If there are any particular modules that you KNOW will conflict. Please let me know.
Comment #47
longwaveThere is nothing I know of that should conflict with this, although obviously I don't know every single module out there. So the Ajax spinner spins, but the page never updates? Does the spinner eventually stop? The next thing I would try is debugging with Firebug to see what, if anything, comes back in the Ajax update. If your site is publically available, posting a link will let other people help debug - or contact me privately if you don't want to post the link here.
Comment #48
digital fire commentedI sent you a message with the link. Indeed the AJAX spinner comes up for about a second or two and then goes away. I tried using firebug, but could not find any changes (Probably due to my inexperience with Firebug as I prefer to use the inspect tool).
Comment #49
digital fire commentedI tried using Firebug and I did see ajax doing SOMETHING but it appeared as if it never touched the display price.
Comment #50
longwaveThe Ajax is working, your product node div id is missing, which means your problem is #629048: By default, product (node) elements are undistinguishable in a multi-product display. I sent more details by email.
Comment #51
longwaveThis patch adds classes to the replaced elements, working around #629048: By default, product (node) elements are undistinguishable in a multi-product display for many cases. Doesn't work with product kits or where the same node is displayed twice on the page. To solve this I think we need a more complex solution using drupal_html_id(), but perhaps this is good enough for now.
Comment #52
digital fire commentedIt works! Thank you so much! Will be posting and linking to this on the SE. If there is any additional testing I can help with on this or any other issue. Feel free to message me and I will assist where/when ever possible.
Comment #53
longwaveCommitted #51. Bug reports about this feature, or followups for the issues I mentioned above, should be posted as new issues.
Comment #54
digital fire commentedGood Morning. Any idea when the product kits will be integrated with the ajax price change?
Comment #55
maen commentedI have exactly the same issue like Digital Fire. It's sending something but it seems there's no result. @ Digital Fire: Could you please explain how to theme in Ubercart 3 Drupal 7 the divs to achieve the goal?
I don't believe that I'm the only one who stucks here...
Do I only have to create a node--product.tpl.php and render some divs with nid? Is there a special theme to use for attributes? Would be awesome to read about!
THX in advance
maen
Comment #56
benitezv1ang commentedis now included in Ubercart 7.x-3.x-dev and will be in 7.x-3.2 when it is released. Enable the feature by checking "Update product display based on customer selections" at /admin/store/settings/products.
Posted by longwave on August 8, 2012 at 4:40pm
Comment #57
maen commentedThx a lot, very good!
Comment #59
benitezv1ang commentedI nedd some help
it works ok with out custom node but
I need to update Total Price in custom node. node--product.tpl
Help me please
Thanks
Comment #60
benitezv1ang commentedubercart 3 update price
Here is the the code to update price in custom page after selection. node--product.tpl
Comment #61
hockey2112 commentedCan this feature be used on product grids created with Views? I have the Display Price set to be shown in the view, but the attribute selection does not change the price dynamically (even though the little blue circle spins when making a selection).
Comment #62
xl_cheese commentedDoes anyone have a solution to also update the SKU? The D6 aac module used to update the price and the sku, but this only seems to update the price.
Thanks for any help!
Comment #63
RAWDESK commentedHi everybody,
I would like to attach this comment i've posted on an issue related to (no)price update after product attribute selection :
https://www.drupal.org/node/2171129#comment-9303073
My currently installed Ubercart version has the 'Update product display based on customer selections' enabled and it works smoothly, except in 1 small 'ifty' case :
If the attribute selection occurs the first time with an anonymous user, the price is not updated.
On chrome and firefox the Ajax icon is visibly running, so i am assuming this issue is not related to ajax directly, although in some other thread, i've read that an ajax 'cache: false' setting might solve some browser caching issues related to ajax.
All subsequent attribute selections then again do perform the price update correctly.
Somebody also experienced this symptom ?
Comment #64
RAWDESK commented@benitezv1ang
Thanks for the code snippet in #60.
I was even able to use it in combination with the dropdown attributes module resulting in a price update on every option change.
What i still would like to achieve is also an update in my cart item total price.
As illustrated in attached screenshot, i would like to show 156€ (total price including options), instead of 61€ (price without options)
You know in which module i have to include the sell price instead of product price ?
Thanks
*EDIT*
This was related to AURA theme customization, as reported here to support :
http://support.diamondlayers.org/questions/aura-premium-drupal-7-theme/u...