Small patch to follow makes all defined attributes available as properties of uc_order_product and uc_cart_item entities. This makes them available in Rules and as tokens, effectively incorporating some of the functionality of uc_attribute_tokens, and another step in the direction of rules based price alteration.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wodenx’s picture

Status: Active » Needs review
FileSize
4.44 KB
longwave’s picture

Status: Needs review » Needs work

Patch has an unrelated change to uc_authorizenet, and also what's the change to uc_cart_add_item()?

wodenx’s picture

Status: Needs work » Needs review
FileSize
2.55 KB

Yup was just posting a correction when my computer crashed. Here it is.

(btw. the change to uc_cart_add_item() is the start of trying to use the entity api to save/load cart items, so the related rules events have some meaning, but that's a separate issue).

longwave’s picture

mattsmith3’s picture

error: patch failed: uc_attribute/uc_attribute.module:1397
error: uc_attribute/uc_attribute.module: patch does not apply

mattsmith3’s picture

Status: Needs review » Needs work

The last submitted patch, 1632540-attribute-properties-3.patch, failed testing.

mattsmith3’s picture

As soon as an updated patch is in I'll test it. Need this pretty bad- and I think a lot of other people do too. I'll see if I can get the time together to do a quick tutorial of using Ubercart as an invoicing system using this (if it all goes the way I think it will).

TR’s picture

Status: Needs work » Needs review
FileSize
2.14 KB

Re-rolled against current head. Only trivial changes made.

mattsmith3’s picture

I figured as much. Thanks for the fast work. Just applied cleanly. I need a bit to test but I'll be back.

mattsmith3’s picture

I see where in rules this add "Order has a particular attribute option". However, I'm using an open text field here (as an attribute) to reference another entity's id (as payment request ID). So in this workflow, I don't see a way to open that into a condition. In this option to check the attribute option, there is only a dropdown list that looks for attributes that are stored in the database it seems. The data selector in rules doesn't seem to look into attributes.

What I would need is a data comparison or text comparison condition in rules that can look into that attribute's text. Is that possible?

longwave’s picture

"Order has a particular attribute option" is a separate feature already provided by Ubercart.

This patch looks like it should add properties that can be used with the "data comparison" condition to uc_order_product and uc_cart_item entities, where the property name is the attribute name - but I have not yet tested it.

Anonymous’s picture

I've applied this patch, but could anyone advise on how exactly it should be used?

I am trying to test for whether checkbox attributes have been selected when a product is added to the cart so that I can apply a discount coupon.

I'd hoped that the patch would expose additional items in the data selector, but I can't see any change.

What should I enter in the data selector to enable me to set up the condition?

Any help on this would be much appreciated.

Thanks,

Alan

aniebel’s picture

Issue summary: View changes

I have also applied patch but do not see any attribute tokens available. The patch doesn't seem to be effective in exposing attributes to Rules.
Screenshot: http://screencast.com/t/712wAuv7k

I am using UC 7.x-3.8 and have create text input attributes on a product that are filled in by the customer. If I try to drill down to the product attributes in a rule (on checkout), I don't see them available.