6 replies [Last post]
amitaibu@drupal.org's picture
Offline
Bug Finder
Joined: 09/08/2007
Juice: 239
Was this information Helpful?

Disclaimer – newbie developer, so I hope I'm not going to write nonsense.

I was thinking on how to integrate Views in the attribute options? Why should we have this? Because options can change, either we need the user to enter some data - like I stated here, or maybe I'll have a stock table which I'd like to query and return only the options which I have in stock. Maybe later add a feature 'If view returns an empty query disable the Add to cart button'?
In other words, have the views power.

I've got some comments/ questions/ thoughts:

1. Do we really need such a feature, or am I just projecting my needs Smiling ?
2. View per option (not View per attribute) allows a certain view to have all the price/ weight adjustments.
3. We need to define a name for the option but also an arbitrary ID. For example, in my T-shirt example I'd like the Views to show the node title, but when I as the admin get the order, I'd like to have the NID as well.

So, what do you think?

Amitai

PreviewAttachmentSize
Snap1.pngSnap1.png14.23 KB
Snap2.pngSnap2.png21.85 KB
amitaibu@drupal.org's picture
Offline
Bug Finder
Joined: 09/08/2007
Juice: 239
Re: Attribute's Options from Views

[EDIT]
I'll post a better code soon...

AttachmentSize
uc_attribute.zip 12.39 KB
amitaibu@drupal.org's picture
Offline
Bug Finder
Joined: 09/08/2007
Juice: 239
Re: Re: Attribute's Options from Views

As promised, here's the new code. Not perfect, but working Sticking out tongue

1. I still get an error on line 1298, for some reason.
2. I'm a bit lazy, so right now every view show's the node's title. It should work like nodereference- show the query result.

I didn't bother much about an testing the upgrade path, so better to re-install uc_attributes.

AttachmentSize
uc_attribute.zip 12.53 KB
Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15453
Re: Re: Re: Attribute's Options from Views

That foreach is probably causing problems due to the first argument not being an array. You can either check the variable w/ is_array() first or try adding (array) before it.

amitaibu@drupal.org's picture
Offline
Bug Finder
Joined: 09/08/2007
Juice: 239
@Ryan,

@Ryan,
Thanks for going over it. Other then the technical issue, do you agree with this concept?. Do you think it should be in Ubercart itself or as a contrib module?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15453
amitaibu@drupal.org
amitaibu@drupal.org wrote:

@Ryan,
Thanks for going over it. Other then the technical issue, do you agree with this concept?. Do you think it should be in Ubercart itself or as a contrib module?

Honestly, I didn't look at the module more than just to give you a lead on the bug. Been zipping through posts to find things that require my attention since I've been gone. Eye-wink

agilpwc's picture
Offline
Joined: 12/10/2007
Juice: 213
Re: Attribute's Options from Views

I would find this views derived attributes useful.

Any help I can provide let me know.