I don't see where to set my price per role on the default attributes/options editor. Am I overlooking it, or is price per role (options) only on each Product instance?

CommentFileSizeAuthor
price-per-role-per-option.png14 KBtexas-bronius

Comments

fenstrat’s picture

The default attribute price is entered on the Options tab (in the Price field). Additional price roles for each attribute are set on the Option prices tab.

It's a little confusing that the default price is entered on one tab and the additional role prices on another, but it was the most straight forward way to add this functionallity to Ubercart.

fenstrat’s picture

Hmm, also helps to actually read your question.

The answer to which is yes, at this stage there are no default attribute/options role prices. They're only available for each product instance.

texas-bronius’s picture

Status: Active » Closed (fixed)

Thanks for the reply. I won't clutter the thread with a feature request, but should someone else stumble across this, then maybe that will warrant it.

texas-bronius’s picture

Component: Documentation » Code
Category: support » feature
Status: Closed (fixed) » Active

This has become an important feature.

Could you help provide some guidance as to how one might go about changing the module to allow setting a "default" price per role per option? Is there a particular challenge that exists with Options?

Would it be appropriate to work in some kind of logic that says "if uc_pprop.nid" not set, then use this default value? This way, any option used on any product could default to the reseller value provided here. If the store admin changes this value on the product, he can get a special per-node association (as currently).

Thanks
-Bronius

texas-bronius’s picture

So uc_price_per_role_load_option_prices returns option prices via $nid, and this is loaded in just a couple places. As a proof-of-concept, it should be possible to run this query first, then if no option prices are returned for that node, a subsequent query is made for node-less option prices for the array of $oid passed in.

I'm not sure how to write that query in Drupal, but it might be something like:

SELECT oid, rid, price FROM uc_price_per_role_option_prices where oid in (.., .., .., ...) and nid is null;

in sql. Then, the same hook_form_alter could use the same output and apply the "default" values.

I think this should offer an unobtrusive mechanism of providing both a price per option per node and a default price per option to fall back on.

fenstrat’s picture

A uc_price_per_role_default_option_prices table or the like would need to be setup to store default prices, just as uc_attribute_options stores default prices.

They'd then need to be inserted into uc_price_per_role_option_prices when an attribute was turned on for a given product.

This would be a nice feature. No time at present to write it myself.

As for the "updateability" of attribute prices on products based on updating the default attribute take a look at #298395: Let admin push class attribute/option changes out to existing nodes

lilacbow’s picture

I really need this option for my website. I have a wholesale user role with discounted pricing of 50% off per product, but I cannot extend this
discount to the options. That is a HUGE drawback. Am I wrong in thinking that the Retail/Wholesale capacity for this Drupal,Ubercart system is
deficient. I am new to this so any direction, comment or advice is greatly welcomed.

fenstrat’s picture

@lilacbow uc_price_per_role already allows you assign prices per role to attributes. That was covered in this issue: #708434: Attributes Pricing in 6? - until there is a 1.1 release you'll have to use the -dev version.

This issue is about extending that functionality to allow options to have a default prices.

As for the retail/wholesale capabilities of Ubercart they are fairly well developed. For d7 you might also be interested in http://drupal.org/project/commerce