When we create a Product Display with attributes, being able to show the price difference in the Select List / Radio Buttons would be a great advantage for certain e-commerce business models. This feature is also default, I mean comes out of the box, in other platforms (UC, Magento, etc).
As I'm not a developer unfortunately I cannot code it myself, reason why I'm posting it here. Also without this functionality I'll not be able to use DC at all.
For instance in the DC Demo:
http://demo.commerceguys.com/dc/catalog/wearables/all-tied-up
Scenario 1:
You see "All Tied Up: Size Small"
Then on the Select List i would like to have:
Size:
- S: $8
- M: $8
_ L: $8
- X: +$2 (or the total price $10)
Scenario 2:
You see "All Tied Up: Size X-Large"
Then on the Select List:
Size:
- S: -$2
- M: -$2
_ L: -$2 (or the total price $8)
- X: $10
I do know that when you select an option the final price updates automatically, but in same cases when you have many attributes, for the costumer is extremely useful to have an overview of the price difference according to the attributes without needing to click on each of them to see the final price.
As far as I know, in UC this was by default. I also understand the DC has a a different approach to attributes.
Comments
Comment #1
urlaub CreditAttribution: urlaub commentedMust Have!
Comment #2
courtney.mob CreditAttribution: courtney.mob commentedComment #3
courtney.mob CreditAttribution: courtney.mob commentedComment #4
courtney.mob CreditAttribution: courtney.mob commented@elianhi, I meant to subscribe but I change the name of the issue to "Subscribe." I changed it back the best I could, sorry! I would like to have this feature too. You explained it well.
Comment #5
courtney.mob CreditAttribution: courtney.mob commentedComment #6
elianhi CreditAttribution: elianhi commented@:courtney.mob: thanks
Comment #7
jbova CreditAttribution: jbova commentedsub
Comment #8
chrisnovak CreditAttribution: chrisnovak commentedI have been looking for functionality like this myself, or something close to this. I would expect that things like computers have custom attributes that can change the actual price of the product such as Apple's "build your own" Macbook (see screenshot).
Product attributes could have part numbers or a SKU which would be used for inventory and to be used as a pick list for the employees who are building out the product.
I may be making this too complex, but wouldn't part of this solution be that products should be able to refer to other products (or parts) which can then be used to create an attribute selection list?
Comment #9
illuminatico CreditAttribution: illuminatico commentedThe only way I have found to do this, is to put the price in the title of the attribute product, so that it shows the price in the attribute list. I have been trying to get a view to display the price based on which product is selected, but can't seem to get it to work. If anyone has gotten this to work, please post!
Comment #10
Dimm CreditAttribution: Dimm commented+1
Comment #11
asw20pilot CreditAttribution: asw20pilot commentedPersonally I would like to see the total price for each attribute shown.
I think showing the price difference is confusing (that is how I feel when I shop in online shops that do it). I also think it would be a bit more difficult to implement. However, showing the price of the different attributes before you select them is a must. I don't understand how it can be that this problem apparently ignored by Drupal Commerce which is extremely well thought through in most other respects.
Comment #12
vasikefrom #1596250: Allow the showing of product price next to product title in product displays with multiple products - a duplicate issue
Comment #13
goodale CreditAttribution: goodale commentedI've just changed the title as I'd put in a feature request
http://drupal.org/node/1596250
for the total price to be shown, which seems to be a subset of the functionality discussed here.
This is the one missing feature which made me choose ubercart over commerce; I'm sure I can't be unique in that.
Comment #14
lsolesen CreditAttribution: lsolesen commentedThese guys claims to have a custom code solution, which I tried here: https://gist.github.com/3884197, but that did not work for me. Maybe some of you guys are more clever.
Comment #15
CSoft CreditAttribution: CSoft commented@rszrama: are there any plans appear in the future versions of the DC attributes as in the Ubercart? I mean described in this topic the problem. This functionality is very lacking :(
Comment #16
rszrama CreditAttribution: rszrama commentedIt's just waiting on a patch; I'd be happy to put it in whenever. Probably the main difference that's kept one from appearing is the fact that our attributes are dependent on each other, whereas in Ubercart an attribute option could only make an independent alteration of the product price.
Comment #17
joachim CreditAttribution: joachim commentedYup, for each option in the widgets you'd need to figure out which product you end up with if you change just that value. Not impossible, but fiddly!
Comment #18
mesch CreditAttribution: mesch commentedI've been thinking a bit about how this could be done. Here are the steps I came up with:
1. For the selected product, find all possible singular option divergences and the resulting product for each.
2. For the set of products found in #1, pass each through rules to calculate the sell price.
3. Modify the attribute options form elements to display the price differentials.
All of this seems quite doable, but perhaps may not be very performant. I wonder whether we could store some kind of pre-computed product-option matrix in cache to significantly speed up #1. Number 2 doesn't seem like a good candidate for caching since pricing rules may depend on environment-specific variables such as user roles. I suppose we could price out all referenced products on initial page load, and then cache them temporarily so that they wouldn't have to be re-calculated with each subsequent request. Number 3 should be straightforward.
For a couple attributes each with a couple options, I'd expect this to be reasonably performant even without caching. But if we're talking hundreds of possible combinations, adding this in could really bog things down.
Comment #19
candelas CreditAttribution: candelas commentedsubscribing
Comment #20
Jody LynnI'm doing this in a form_alter:
Comment #21
vasikethere's a re-work of the previous solution (#20), which works only for "field_product" product reference field and for field attributes that has "value" property for its value.
this will require a little patch for Drupal commerce (attached to this comment), will pass the product reference field name.
this should be work no matter of the fields names or types,
BUT only if there's only ONE product field defined as attribute - i can't imagine how this should work for multiple attributes.
i'll be back very soon, with a patch for this issue for Drupal Commerce - Cart. module
Comment #22
vasikeand here is the real patch for Drupal Commerce - Cart module:
- add new settings to the product's field instance, cart settings: display_price, display_price_position, display_price_separator
- use this settings in commerce_cart_add_to_cart_form() to add the price to attribute selection, according with them
- it will work for a single attribute only.
- it keeps the previous, even it wasn't needed here (but useful for other alterings).
Comment #23
vasikehere is a new patch that adds new value to the to form context : entity bundle.
these new values for the fom context are useful for other alterings: so we can get all the data about the field/instance/entity/displays settings, etc ...
ex. possible use : #1667642-1: Quantity decrease/increase functionality to be set in add to cart form formatter or .
Comment #24
rszrama CreditAttribution: rszrama commentedA few notes here:
if (count($qualifying_fields) == 1 && $instance['commerce_cart_settings']['display_price']) {
because $instance['commerce_cart_settings']['display_price'] doesn't exist.Comment #25
vasikethank you Ryan
let's try another patch that should have some answers to your last directions:
1. Move to Add to cart formatter - done
2. not anymore available
3. use $options variable instead of $used_options
4. Not yet - still there, used for other patch #1667642-5: Quantity decrease/increase functionality to be set in add to cart form formatter or .
5. Tokenizer Indeed - i think you were so right about it. So now there a token replacement so any of product data could be used.
Others:
- I kept the "Available only for single referenced product type with a single attribute defined".
- i create new helper function "commerce_cart_product_type_attributes" for getting the attributes fields of a product type.
- maybe some work about Token module : with and without.
and here is the patch
Comment #26
vasikeindeed there was some token code used, without checking is exists (& enabled).
here is a new patch that should correct this.
it seems that the formatted price (ex. [commerce-product:commerce_price] token) it's not available (working) without Token module.
Comment #27
vasikei'm afraid that previous (2) patches are limited to one product type referenced.
What if there are several product types and only one product display for all of them?
And every product type has a different field defined as its attribute, then the solution above will not provide the response for this.
So i think the Token "formatter" should be moved to the attribute settings (field instance settings).
What else could be done in the "Add to cart formmater" it's maybe an extra option for the attribute display: default formatter or token formatter.
i'll be back soon with the attribute - Token formatter patch.
Comment #28
vasikeand here is a new patch that puts the attribute "Token formatter" in the product field instance attribute settings.
Questions:
- should the new "commerce_cart_product_type_attributes()" helper function introduced in #25 be kept?
- is there anything needed for the "Add to cart form" formatter, related with the attrbitutes "Token formatters"?
Comment #29
patoshi CreditAttribution: patoshi commenteddo you happen to have a screenshot of how this would look after its implemented? thanks!
Comment #30
vasikeback to #25 (#26) approach : use the "Add to Cart form" formatter settings.
i re-work the #26 patch.
The main change is the use limitation.
Previous : Available only for single referenced product type with a single attribute defined.
New : Only for multiple product reference, except for single referenced product type with multiple attributes defined.
Actually i think the tokenzing of product select options should be customizing alternative to products Attributes.
So maybe the limitation should for "single referenced product type with attribute(s) defined.
New patch attached.
Comment #31
vasikeIt seems the "show_single_product_attributes" is used only with attributes, probably was better is we had
"show_single_product_options" as the machine name of the setting and use it also for no attributes case.
however, there is a new patch that use this setting also for product references without attributes defined,
for product selection.
i also changed the setting title/description to include both "product options" and attributes widgets.
Comment #33
mesch CreditAttribution: mesch commentedI developed a patch that displays pricing for each displayed option (that isn't the equal to the current product). It should work for multiple attributes.
Comment #34
zkrebs CreditAttribution: zkrebs commentedI applied patch #31 and get this error on my node page now:
Warning: in_array() expects parameter 2 to be array, null given in commerce_cart_add_to_cart_form() (line 2102 of .../jtea/sites/all/modules/commerce/modules/cart/commerce_cart.module).
version = "7.x-1.9"
Comment #35
zkrebs CreditAttribution: zkrebs commentedAlso, if the product attribute is missing, it shows up as a [product] field on the add-to-cart form, instead of displaying nothing.
Comment #36
vasikethere is a new patch that should cover the #34 and #35 issues.
@slavojzizek : thank you Sir
Comment #40
vasikei don't think the failure of tests are related with this patch.
Comment #41
berin CreditAttribution: berin commentedall the patches didn't worked for me.
something new?
Comment #42
vasike@berin : what do you mean by the patches didn't work for you? please detail.
thank you.
Comment #43
wqmeng CreditAttribution: wqmeng commentedHello,
I think this patch not support multi currency yet?
Thank you.
Comment #44
japerryUpdated patch for HEAD on commerce.
Comment #45
florisg CreditAttribution: florisg as a volunteer commentedRerolled #44 against latest 1.x-dev #f830856
Comment #46
KarlSheaReroll on latest 1.x-dev (3d898163)