Hello,
I'm testing the Drupal commerce with product options set for event registration product type.
I created my product, associated some checkboxes options to it, so I can display the options checkbox when I'm on my product display node.
What I want now is to add some extra fee depending on the checked option.
I find very few information about that and I don't know where to go. I don't know how to trigged the ajax price refresh when I click on one checkbox. I also don't know how to say (checking this box, it will add $5 fee to the product price).
Can you please help me doing that ?
Regards,
Alex
Comments
Comment #1
greenavus commentedI am also having the same problem. I am building a website that sells quilts, some are a fixed size so dont have options while some have different size options but with each increase in size the user selects, the size is supposed to increase by a cretain amount.
AT the moment, i am using a select list and have no way of knowing how to increase the price of the product dynamically when a different size is selected. This was a very easy thing to do in Ubercart. Maybe i am missing something but i cant find a way to do this.
Comment #2
olafkarsten commentedFor accessing the options in rules, try the solution from this comment. Please report if it works.
http://drupal.org/node/1205628#comment-4720002
Comment #3
olafkarsten commentedMaybe it isn't that clear what that module can do and what not. It is not an plain commerce replacement. If you want ajaxified price adjustments in product display nodes or stock integration (sku's) etc, you should go with plain commerce. If you want a quick way to add some options to your product without changing to stock/price etc, than go with commerce option.
I'm not sure what hunziker is planning for the module. Maybe he will add ajaxified price update and a smoother rules integration. But for now, it's not there.
Comment #4
z-buffer commentedI guess he is planning :)
I use special rule to auto create product display and commerce option to give my customers easy way to use attributes without stock control. This way is very friendly for non-profi users with small shops.
So integrated price control will be nice thing.
Comment #5
klavs commentedIf you just want the price to be modified, when it's shown in the cart - can the module do this currently?
I've setup a field with a List(integer) which I then style using css to show what price they'll pay on each option- so I would be perfectly happy if I could just somehow make it so the price of the product was modified or just set, depending on what option was chosen..
Comment #6
andrew.scullion commentedHaving the ability for a custom line item field, or product option set field to adjust the price, both the line item total price or the product base price, is a very important feature for some use cases.
The case I am working on involves order customisations to rope products where there are products for each rope diameter and colour with stock control. There are then options to add splicing to the ends of some products which do not have associated products for every combination. The cost of a splice varies and is a one time extra fee for the splicing service on that rope product.
This means the customer must be able to add multiple quantities (length of rope required), then add the end splice option required. This must then update the line item total price shown in the cart, not update the product base price which then gets multiplied by the quantity ordered. (updating the base price can currently be done with rules and a loop going through the cart).
Does anyone have a method of achieving this, or can it be built into this module? I am willing to help, however I am fairly new to module developing and it may well take more effort to get me up to speed with how this module works than is worth my input.
Comment #7
klavs commentedI solved my issue by doing what is shown here: http://vimeo.com/31460419 - this enables you to add options to an product-type, and then adjust the products price based on the selected option.
I see no problem (except for complexity) in adding more than one option-group- from which to calculate price.
Comment #8
andrew.scullion commentedI have watched that excellent video by Randy, however it only confirms the issue.
The rules method shown in the video allows you to update the product base price. This price then gets multiplied by the quantity in the line item, which does not work with the case I describe.
With that rules method you end up with:
Line item total = quantity x new_base_price_changed_by_rule_if_option_equals
What I need is:
Line item total = (quantity x base_price) + extra_charge_by_rule_if_option_equals
I hope that makes it clear, there is a significant difference between the two.
Comment #9
a.ross commentedandrew.scullion, maybe you can make the length of the rope an option, like Randy did in the screencast. IMO it doesn't make sense to use the standard quantity unit for it. What if someone needs 2 identical ropes? they would have to configure and add them to cart multiple times. Or do you need that because of stock management?
For the rest of us, the module shown off in that screencast was deprecated in favor of this module: http://drupal.org/project/commerce_custom_product
Comment #10
joecanti commentedAndrew - perhaps just adding a tax rule is what you want? The tax system is all based on rules, and is independent of the products so you can add an extra fee after the product has been created. You can also show the original price next to the updated price.
I'm using that system for adding discounts based on Rules abd its working nicely. I think you can add to the total, or multiply by/divide..
Joe
Comment #11
andrewscullion commentedThe tax system does not let you add a set amount to a line item total as far as I can work out. The key requirement is that the amount added to the line item is a set amount independent of the quantity ordered and is specific to the line item options chosen.
If I am missing something and this can be done please explain how in more detail.
I have also looked at the option post #9, the length of rope must be stock controlled so has to be the quantity and this works well as length when you don't combine like items in the cart, so two separate lengths of rope stay separate in the cart.
Comment #12
klavs commentedWouldn't the simplest solution be, to write a rules.inc file - in your own module -that provides this calculation method - and then if you can make it general enough -you can add it to one of the commerce modules (where you think it would fit in) and send a patch to get it upstreamed?
Comment #13
andrewscullion commentedThat would be a good solution, I have looked into doing exactly that.
I looked through the php code for the function logic to the rules action 'add an amount to the unit price'
Line 128 in commerce_line_item.rules.inc
This does not appear to be straight forward, bear in mind I am new to drupal.
Unfortunately I do not understand enough about how drupal commerce is calculating the line item prices to write the required action function. Any help much appreciated.
I don't really understand what the 'entity_metadata_wrapper' is doing or how the '$difference' variable is being applied to the line item total.
I basically don't know how you access the calculated total (quantity x line item unit price) in order to add a value to it.
Comment #14
joecanti commentedAh I see - my tax solution is not ideal because the option is to 'add an amount to the unit price' - rather than to add an amount to the total price.
It's almost like a postage & packing surcharge - I wonder if you could use the shipping module with flat rate to add a fixed amount onto the total price?
Joe
Comment #15
andrewscullion commentedHi joecanti,
I can make a joke about great minds, that is exactly the work around which I came up with.
That approach is what is currently on the live site at nauticalrope.co.uk however it is a complex way of doing something which should be very simple. It involves adding hidden products to the cart and then rules to calculate the dummy shipping charge which is labelled up as the cost of the options.
As I said before, a much neater solution would be to have the alternative rules action.
Comment #16
georgemastro commentedCheck this new module http://drupal.org/project/commerce_pricing_attributes
It handles a lot of the missing features.
Comment #17
enorniel commentedHello,
as referenced here: https://drupal.org/node/2092387
I try to update the price automatically with a numeric field option. It doesn't seem to work with http://drupal.org/project/commerce_pricing_attributes
That module, apparently, handle only checkboxes.
How can I do it ?
Is there a solution with rules ?
For instance, I would like to sell paper rolls to my customers and I would like them to choose the length of the roll with a price automatically calculated.
Thanks.
Comment #18
sui_page commentedI'm looking for extended functionality which allows products to be priced dynamically dependent on time.
For instance between any given time slot(e.g. 9:30am-10:03am) a product is priced at $20. Then it changes to another price with the provided time slot.
Would something like this be possible with the Price API on Ubercart. If so what time tracking tools would you guys recommend?
Comment #19
Anonymous (not verified) commentedRules support is on the way.
Comment #20
gbyteAlternatively you can check out my sandbox here.