Closed (fixed)
Project:
Ubercart Views
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
30 Apr 2009 at 06:31 UTC
Updated:
27 May 2011 at 03:02 UTC
Jump to comment: Most recent file
Add support for Übercart attributes.
At ubercart.org there is a contribution that offers views support for attributes. The lead of that project has been contacted but hasn't answered.
Further investigation is going on.
| Comment | File | Size | Author |
|---|---|---|---|
| #45 | attributes_for_cdd23.txt | 3.75 KB | madsph |
| #40 | view-attribute.jpg | 511.73 KB | selinav |
| #33 | uc_views-add_field_options.txt | 1.33 KB | compa |
| #33 | uc_views-add_filter_options.txt | 1.48 KB | compa |
| #25 | simple_exported_view.txt | 2.9 KB | madsph |
Comments
Comment #1
micheleannj commentedsubscribing...
Comment #2
dawick commentedWould be nice to see stocks for attributes aswell (as with the module on ubercart.org)! Just adding, having it both as filter and as field (based on images?) would really make a nice addition.
Comment #3
madsph commentedI have been looking at the module on ubercart.org, but it is kind of old, so it will require some hard work to port it.
I will get around to it eventually, but right now I am not using attributes that much my self, so my knowledge about attributes is limited, which is why this has not been prioritized as high as I maybe should.
If any one is able to contribute it would be much appreciated though!
Comment #4
asak commentedsubscribing.
much needed functionality.
Comment #5
madsph commentedIt seems that the views project for attributes over on ubercart.org has been revived - that is really great news!
I think that the new maintainer could need some help, so those of you with the skills and the interest should check it out:
http://www.ubercart.org/contrib/3960
Comment #6
hanoiiFor what I just read on ubercart's contrib it seems that the guy (Josh) that was trying to help kind of switched to the idea of contributing to this module, is there any work at all going on with uc_attributes?
Comment #7
madsph commentedI hadn't seen that - thank you for making aware of it.
I'll try to figure out where sanguis has come to - and hopefully we can start making some progress on this.
Comment #8
hanoiiHi madsph,
I wanted to check something with you. I have a requirement for a client that needs two things for now:
- product report in CSV (including uc_attribute information) and some other stuff
- sales report in CSV (one sale per line, with all the line items).
I kind of need this a bit fast so I am tempted in code it quick and dirty, but what I'd really like to do is expose whatever is that's not exposed yet to views and create both reports with Views and views_bonus (CSV).
I checked the CVS messages and there seems to be some work going on in the 3.x branch with uc_attributes so wondering what have been done in that front and how stable that branch is in order to use it on production and test it/help improving it. And what are your thoughts on doing what I need with your modue.
Thanks,
a.=
Comment #9
madsph commentedThe idea is that you should be able to do just that - but unfortunately the uc_attributes support is far from achieving this at the moment.
I have had some people announcing that they are working on it but I haven't seen a working module for drupal 6.x yet.
I intend to do some work on this, but haven't had the need my self yet, and don't have the time to do it right now, so unfortunately I can't help you right now :-(
Going with the 3.0 module would be better for you if you are starting a new project. I think of it as stable enough for production, the fact that I haven't made it the preferred release yet is mainly a time issue (I want to be able to handle help request if people have problems upgrading a running production environment).
The combination of views 2 and the bonus pack sound just the way I would have done it, so I think that is the right way ... if only uc_attributes where supported.
If you need to create view definitions fast for some tables I have another project http://drupal.org/project/code_gen that can generate modules with view definitions for you.
the module is quite simple so you might have to add some joins manually and switch various handlers - but it will give you a head start doing all the trivial stuff of creating view definitions.
Comment #10
hanoiiAfter almost three full days I have something to share. It's the first approach, it might need work, but I can say it's functional. Would like some feedback in terms of the possibility of this be included in the code, and if not, I might just end up creating a module for myself. I tried to do this as usable as possible for my particular use case as well as others.
A summary of the difficulties I found working with this:
- uc_product_adjustments is the unfriendliest table I've ever seen. Not only it stores serialized data, but it has a mixed combination of keys. What I mean with this, is that the adjustments are related to the node itself, but they are also related to the stock table, although the relationship is not mandatory, it will depend on the configuration and what modules you have enabled.
- It's impossible to avoid duplicate data if both tables are available (stock and adjustments), I really struggled with this, but eventually I understood that with relationships, you might tweak up the views to whatever you needs might be. By using relationship, you can work around the duplication of data. You can eventually loose to see a few adjustments, but if you want stock information to control the report (as I do) you can live with it. If not you can create the the relationships the other way or have one report for stock and one for adjustments or have the data duplicated and work it on your own.
- Because of the use of relationship, you can end up with empty combinations field. I added logic to the field (according to a configuration entry) so the field handler can fetch all other combinations that were not really related to the stock table but are available to the node. This would only makes sense if you use the stock->adjustments relationship which is also defined in the patch.
I also left an entry for an immediate improvement that I might need (or anybody else) for an option to group combinations together in a single row, something close to what CCK multiple field does.
I learned a lot of views in this process so that's one thing I am very happy with.
Now that I went through the code, I'd also suggest a bit of cleanup. Maybe group views data according to specific table/functions in subfunctions or maybe use custom module include files? I tried the first approach in the patch, so you can look if you like it.
And worth saying that I did this in the 3.x-dev branch
Comment #11
hanoiiAlready a quick fix!
Was using a protected keyword for a function and I found out that's only PHP5, so removed it for now.
Comment #12
hanoiiAlready a quick fix!
Was using a protected keyword for a function and I found out that's only PHP5, so removed it for now.
Comment #13
hanoiiAlready a quick fix!
Was using a protected keyword for a function and I found out that's only PHP5, so removed it for now.
Comment #14
hanoiiI apologize for the triple post above :s.. all three patches are the same.
Comment #15
ezraw commentedHi hanoii,
Thanks for tackling this much-needed feature. I ran the patch against the 3.x-dev branch and it is working great. I am running it with views calculations and it really a much needed step forward with reporting.
Thanks to you, with exposed filters, we can now select a product, an attribute and then see a total number of products ordered. This is important to us because we bulk order products after they have been ordered. For example, we sell shirts and jackets as fundraiser for our local public school. We have to total the color, size, cut, etc.
What would totally kick up the level of awesomeness would be if we could have attributes output as fields. If you added attributes as fields then we could output a list of all orders by customer name, product and match them up to the selected attribute (size, color) for delivery. Otherwise we have to print each order separately to see that data. Hope you would consider that feature request.
Thanks again,
ezraw
Comment #16
madsph commentedThis looks really great!
Thanks a lot for all the hard work. I will give it some thorough testing and then add it to the module.
Comment #17
madsph commentedI have tested your patch and it works really great.
To add this to the project I decided to create a new sub module called uc_views_attribute, in order to keep the dependency to uc_attribute away from the core module.
I also added an old filter which was previously added conditionally (
if (module_exists('uc_attribute')) to this new submodule.thank you for the great work!
Comment #18
psychoman commentedthank you very much!
Hope to see working with separate fields: option-images, prices and stock.
Comment #19
awconstable commentedgreat work guys!
Just one thing that I can't get to work...
I have a product with one set of attributes and a unique SKU for each product+attribute combination.
When adding the attribute as a field in views the results list the unique SKU for each product+attribute combination multiple times, once for each attribute, when really it should list each unique SKU once because that SKU only has the one attribute.
Is it possible I've configured views incorrectly? or have I stumbled onto a bug?
Thanks
Comment #20
madsph commentedCan you attach an exported version of your view, or create a screen shot?
I am not able to recreate this bug.
Comment #21
awconstable commentedsure.
the export is attached along with two screen shots, one with and one without attributes.
I'm trying to get a listing the same as the screenshot without attributes, but with the attribute instead of the SKU...
thanks in advance
Comment #22
dan.nsk commentedHi awconstable,
Try adding a "Product attributes: Model" field instead of "Product: SKU" for the event_view_with_attributes
Comment #23
jarchowk commentedQuick Question - I am trying to use this for a jCarousel view for all the attributes for a certain product (in my case an art print with all of the framing options in a carousel). I got this going, but how would I include the price for the certain attribute?
Comment #24
awconstable commentedThanks for the idea dan.nsk, unfortunately I get the same results as before.
Comment #25
madsph commentedI think dan.nsk is on to the right path.
I have created a simple view (with out the stock things - which module did you install to make those available?).
I think that contains the things you are asking for, doesn't it?
Comment #26
shimodart commentedHello guys!
really wonderful module and appriciate your work very much!!
now i'd like to ask if it's become possible to choose attributes for filter option in Views!
i read "handling for attribute options filter is not complete" in http://www.ubercart.org/contrib/3960
but you guys have been working hard now so there may be some progress of this matter.
and would you please tell me how to setup if anyone has achieved.
thanks in advance.
Comment #27
ezraw commentedHi shimodart, the patch above in #13 allows you to filter by attribute. It's been committed and moved to the submodule "uc_views_attributes." Once I applied the patch, my attributes just showed up as an option when I added a filter. I would assume the submodule works the same way.
Comment #28
compa commentedHi Hanoii & madsph
Thanks for putting in all this work, it works on the new activity registry i'm setting up for a local youth club!
I'm kinda wondering why you provide the possibility to 'filter' on attribute but why the 'field' doesn't show these.
I'd be very happy if you can provide me a pointer how to adjust uc_views_attribute_handler_field_combination to provide the 'attributes' to the field view as well.
Regards,
Tom
Comment #29
shimodart commentedHi ezraw!
oops i mistook the big comment by hanoii.
now the filters come out!!
but... i could only get only one node's thumnail.... i'll check a bit more.
THANKS anyway!
shimodart
Comment #30
compa commentedJust to clarify, i'm not looking for a list/view/fields of the product attributes but for a view where i see the field of the ordered attributes.
So if someone ordered product a with a text-attribute of "aaaa" and someone else ordered product a with text attribute of "bbbbb" i'd like to see
Person Product Attributes
1 A aaa
2 A bbb
3 A ccc
3 B xxx
etcetera
Comment #31
shimodart commentedHi ezraw
I tested the latest dev ver. of uc_views but i could only see "Purchased products: attribute" filter,
not "Products: attribute" filter which I desire to see.
I want to filter all the products (not depend on purchased or not) by attributes.
Did you achieve filtering by using patch on #13?
I'm a bit afraid of using patch so I'd like to ask to ensure.
so to compa,
you can exactly do that by using latest dev version!!
thanks
shimodart
Comment #32
ezraw commentedHi shimodart,
I updated to the latest dev version and I still see a list of fields to filter on under "Order product." I assume you've created attributes already? I also have "Order product: SKU" in my fields list. Not sure if that matters or not.
Comment #33
compa commentedHi shimodart,
I'm running the latest dev tarball available from the uc_views module site (or do you refer to the CVS-Head version?).
When i'm adding a view (create new view, type "Order Products view") I can see my attributes in the filter but not in the view.
Attached the full output of add-filter and add-view (it's the "jeugdlid" things i'm looking for to display).
Hope you can help us out!
Cheers, CoMPa
Comment #34
madsph commentedSorry to be so late to join the discussion - just got back from holiday.
Which version of Ubercart are you guys running? I got this issue earlier #600832: Not interacting with legacy orders from 5.x which suggests that something has happened to the datamodel of attributes and that could explain why you are experiencing different behaviors.
I have to take care of a problem for a client first before coming back to this, but your input will help me get to the root cause of this.
Thanks
madsph
Comment #35
compa commentedHi Madsph,
Hope you enjoyed the holiday and as for me, i'm not in that big of a hurry - just wondering how to get things organised on our website.
I'm running UC "6.x-2.0-rc7" 23rd sept and "uc_views-6.x-3.x-dev" 7th oct
The filter order product: attrname works for me (see attachments in #33) it's just that they don't show in 'fields' (for display)
Cheers,
Comment #36
madsph commented@compa You are right - I also only get this for view types 'Node' - I can't remmeber why this is so, but I will have a look into it and see if it can be solved.
Comment #37
madsph commentedI have added a new field handler that displays the selected attributes of an order_product. I think you may need to run at least UC "6.x-2.0-rc4" to make it work, because the way attributes are stored in the data field has changed.
The new field is called 'Order product: Product attributes' and displays the selection as an unordered list with css class product-description.
Hope that meets your requirements.
Comment #38
compa commentedHi madsph,
Updated from CVS and now the Order product: Product attributes is visible indeed.
For my personal liking i'd rather have it in 'seperate' fields (like with the filter where you can select individual attributes) but looking at the coding i'm not sure that would be feasible i guess. That would make up for seperation of the values in the table. Thanks for the quick solution though!
Cheers,
Comment #39
ezraw commentedWorks great. Thank you for this small but valuable piece of awesomeness!
Comment #40
selinav commentedHello,
great module.
Can you help me, I have a shop which sell clothes.
My attribute is the size.
I try to do a view that display the clothes in stock for each size.
For the cloth 'Tunique Hippie', I have few sizes : 36, 38, 40, etc...
Each size have a stock reference:
Size 36, stock reference->Hippie36 :stock quantity 2
Size 38, stock reference->Hippie38 :stock quantity 0
Size 40, stock reference->Hippie40 :stock quantity 3
...etc
I want it display the quantity corresponding to the attribute size.
Cloth________| Size____|Ref stock| Quantity
---------------------------------------------
Tunique Hippie | Size:36 | Hippie36 | 2
Tunique Hippie | Size:38 | Hippie38 | 0
Tunique Hippie | Size:40 | Hippie40 | 3
If I display, it well works
Cloth________| Ref stock| Quantity
---------------------------------------------
Tunique Hippie | Hippie36 | 2
Tunique Hippie | Hippie38 | 0
Tunique Hippie | Hippie40 | 3
But doesn't with
Cloth________| Size____| Quantity
-----------------------------------
Tunique Hippie | Size:36 | 2
Tunique Hippie | Size:38 | 0
Tunique Hippie | Size:40 | 3
How correct it?
I will wish to display a select list in a block to display the clothes that are available for each size.
See the attached file to view my current display.
Thanks in advance.
Comment #41
madsph commentedI am not sure exactly what you are trying to do.
Do you want to make a block ordered by attribute (size) which for each size has a select list of each product with the given attribute that is in stock?
Comment #42
selinav commentedno, I try to expose a select list with the available size (36, 38, 40...).
When you select the 38 size, for example, it displays in the content all clothes which are in stock for this size.
Sorry for my broken english
Comment #43
cdd23 commentedThank you for your great work on this module.
I am new to Drupal but not new to MySQL and PHP, so I can usually find my way around code at a basic level, but Drupal is still only starting to become clearer to me.
I am trying to create a View (my first ever) that will show orders placed in Ubercart along with the attributes that were selected by the user at the time of purchase. But when I edit a clone of the "Orders" view at /admin/build/views, and add a field, the "Order Product: Product attributes" option is not one of the options that appears.
I also tried adding a new "Order Products" view and didn't get the "Order Product: Product attributes" option for a field in that view either.
The specific purpose is using Ubercart for a registration for a conference. Users registering pay a set fee for the conference and choose which workshops they want to attend, which are set up as attributes of the Registration product in Ubercart.
I am using Drupal 6.14, Ubercart 6.x-2.0, Ubercart Views 6.x-3.x-dev (2009-Nov-02).
I'm afraid I am not sure how to include more information with this post as others have done to show my problem more fully.
Thank you for any help.
Comment #44
madsph commented@selinav
I am afraid that I haven't got any solution to your problem out of the box. have you tried to make a filter, and expose it in the view?
Comment #45
madsph commented@cdd23
You should have attributes support with the uc_views version that you use.
I have made an example that you can import and use as a basis for what you are trying to do (see attached file).
Hope this helps.
madsph
Comment #46
cdd23 commented@madsph
Thank you so much for your help and generosity with your time.
I tried importing the example you created and got the following errors:
* Field handler uc_order_products.attributes is not available.
* Unable to import view.
I looked in uc_views_attribute/views/ and found uc_views_attribute_handler_field_order_product_attribute.inc, which seems like a good candidate for the functionality I need, or at least part of it, but I can't find a "Field handler uc_order_products.attributes" (which makes sense since the error is that it is not available :-) )
As far as I can tell, the example you wrote doesn't specifically request that Field handler, so that's being requested by the Views module due to the way your example is constructed. (How off base am I here?)
Is there perhaps something wrong with my installation of the uc_views module that it doesn't include that field handler? Or is that field handler supposed to be elsewhere in the module or in another module (like UC itself)? I've looked around quite a bit and can't figure out where it is supposed to be, but imagine it must be defined within the views module (or uc_views) since it is a field handler. Again, I'm very new to Drupal but willing to learn.
Thank you for any further help you can provide.
Comment #47
madsph commentedAt least this explains why you didn't get the option to select the attributes in the first place :-)
As far as I can tell - you are not on the same version of uc_views as I am or you haven't enabled the uc_views_attributes module.
Can you verify this?
Comment #48
selinav commentedI have tried to make a filter exposed in a block but it has no effect.
If I search a size out of stock it returns the reference of the same product in other sizes...
Comment #49
cdd23 commentedmadsph
My sincere apologies. I had not turned on the uc_views_attributes module after installing uc_views 6.x-3.x-dev. I have now done that and can now add an Attributes Field.
And I imported the views example you wrote for me and it looks great. It is very helpful to me to see how this works and get started working with Views.
Thank you again for your coding and help to newbs like me.
Comment #50
madsph commented@cdd23 No problem - happy to hear it is working :-)
@selinav I haven't got a setup right now, that allows me to play around with the stock settings that you have, so I am afraid I can't make a quick fix you.
I am away on a conference next week - can you maybe make a quick description of your setup (with stocks and attributes) then I will see if I can fit some experiments into the conference breaks.
Comment #51
selinav commentedI have :
- the 6.14 drupal version.
- ubercart 6.x-2.0-rc6
- ubercart views 6.x -3.x-dev
- uc_attribute_views found on http://www.ubercart.org/contrib/3960#comment-43532
Comment #52
shimodart commentedHello!
Firstly thank you very much for all the hard work on contribute modules!
@compa
sorry for replying late but glad you found the solution.
I posted some comments before but have been away for weeks and now come back to project.
I'm now in urgent need for uc_views_attribute help.
I think at the moment I can put the filter for "Order Product: Attribute: (attr name)",
but it's not possible that putting the filter by "Product: Attribute (attr_name)", is this right?
I'd like to let users choose products by attribute regarding stocks where they are purchased or not.
The functionality I'm going to achieve is the searching function like http://www.lafraise.com/ .
(please refer the attachment file)
Very appreciated if anyone can provide the patch for this.
Thanks!
Comment #53
madsph commentedThis thread is growing too long, and I am starting to loose track of all the info in here, so I am closing it now.
I have transfered shimodart's feature request to a new issue #651036: Add filter support for product attributes.
I am a bit out of time at the moment I hope some one else (hanoii?) has the time to look into this.
Comment #54
shimodart commented@madsh
thanks for your work!
I'll move into the thread you created.
Shimoda
Comment #55
ratinakage commentedHi,
Now that this is working, how can we get it to also filter products by attributes that are in stock?
Thanks!!