Closed (fixed)
Project:
Ubercart Ajax Attribute Calculations
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
28 Apr 2009 at 05:42 UTC
Updated:
18 Sep 2013 at 20:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
cyu commentedI've never tested this module in grid view. I suppose as long as the products are separated out into named divs the module could form_alter the needed javascript in. I'd probably commit a patch that did this without interfering with current functionality.
Comment #2
harrisben commentedThere is a div surrounding the price for each item in the grid as follows (an example):
My javascript knowledge is limited so I don't know if you need something to uniquely identify which price in the grid you will be modifying however because as far as I can see there is nothing that can help you with this. If you need a hand with testing this I would be happy to act as a guinea pig.
Comment #3
jantoine commentedharrisben,
I have moved this feature request to the new 6.x-2.x branch, as the 6.x-1.x branch will now only be accepting bug fixes. Currently, uc_aac partly works in grid view in that it can update attributes in the add-to-cart form. It can't however identify other product elements because, ubercart does not wrap products with a "node-$nid" identifier. Since by default, ubercart does not support this, I am setting the status of this issue to postponed. I have created #629048: By default, product (node) elements are undistinguishable in a multi-product display against the ubercart project in hopes that they will add support for this, as I see it to be an important issue. When ubercart adds support for this issue, I will take another look at it.
With all that said, you can still get uc_aac to work with the grid view via theming. First make sure you have a node identifier in the form of "node-$nid" that wraps each product. Second, inside the node identifier, elements should have classes that match the product page such as "uc-price-sell", "uc-price-display", etc. With these in place, you should have no problem with uc_aac working on the grid view.
Cheers,
Antoine
Comment #4
jantoine commentedAdding a bit more information to this issue.
A duplicate issue was created here: #638264: AAC working badly with multiple products (using radio buttons)
Updated the Ubercart issue here: #629048: By default, product (node) elements are undistinguishable in a multi-product display
Updated the title to correctly reflect the issue.
A possible workaround would be to use the form_alter hook to add the necessary identifier to each product (node) element as the form is being built.
Cheers,
Antoine
Comment #5
jantoine commentedAnother scenario has popped up here: #720648: uc_aac not updating sell price in view. Adjusting the title of the issue accordingly.
Cheers
Antoine
Comment #6
chriscalip commentedFor people wanting this functionality right now without waiting for patches, this can be pulled off now with the current mix of ubercart, attributes, Ubercart Ajax Attribute Calculations, Ubercart Views.
Here's how i did it.
On the view I added the nid but had it as excluded from display. Then on the Sell Price Views field I had it rewritten as this:
WORKS! :)
Comment #7
FranCarstens commentedAwe-freakin'-some! This works in custom product nodes too!! You are my hero!
Comment #8
chriscalip commentedbrings a smile in my face.
Comment #9
mikejoconnor commentedSo this issue can be reduced to two issues.
1. We can not depend on classes outside of the form itself. I.E. this module assumes that the add to cart form is placed within a div.add-to-cart. This is a false assumption. Lines 5-11 and 17-28 resolve this by adding a class to the form itself.
Item 2 is a bit more difficult, and not as common. theme_uc_product_add_to_cart() uses two styles of form id's. The standard one is uc_product_add_to_cart_form_[nid], however it can also return uc_product_add_to_cart_form without the appended nid. The remainder of the patch .
Line 20-21 modifies the form name check to be a little more relaxed.
Lines 30-40 add a hidden form field with the nid, removing the need to parse for the nid in the ajax callback(lines 42-53).
Line 55-70 attempts to replace the form using the same form id convention.
I don't know that this resolves all of the issues here, but it should be a step in the right direction.
Comment #10
cyu commentedComment #11
cyu commentedThanks folks, I've committed this code: http://drupal.org/cvs?commit=393898
In digging on this module I found some issues in d6 FAPI that are currently preventing uc_aac from working on checkbox and radio attributes on pages where multiple products are displayed with the same attributes. The problem exists for select attributes as well (element ids not being unique) but in the case of select attributes uc_aac still works as expected.
#855474: multiple products on one page giving unexpected behavior
I had hoped to get a fix in for that along with this patch, but it is a rare scenario and would be messy to code in d6, so I probably will leave it be until d7 unless somebody else submits a patch.
Comment #13
ocamp commentedhi, sorry i cant get this to work.
Is this supposed to make attributes auto calculate in views?
Comment #14
cyu commentedThis should be helpful if you'd like to get this working in a view: #624582: Views Integration Example
Comment #15
bellagio commented#6 solution:
It doesn't work with 6.x-1.x-dev.
Works with 6.x-2.x-dev.
Took me a while to figure it out...