Fixed quantity options, how do I make them

Events happening in the community are now at Drupal community events on www.drupal.org.
RwD's picture

It seems the e-commerce modules are unable to represent a product for which a customer can choose from a fixed set of quantities. Like for example toilet paper which you could buy with 6, 10 or 20 rolls per package. Since I have just over 2000 products to set up it would be nice not to have to make 20 sub-products for each and every product, but just edit a list in which I can enter quantity-price (and if possible also articlenr+price from our supplier)

What do I want

Suppose I sell bags of apples with a fixed set of apples per bag (being to lazy to fill them at demand). Then I could have the following options:

appels (10) = $1.00
appels (20) = $1.90
appels (50) = $4.00
appels (90) = $6.50

If you want 68 apples you'd have to buy 50+20, 3*20+10, 90 or any other combination that gives you the apples you wish for.

Solutions

E-commerce support

I couldn't find any solution to this with the e-commerce package. So I was wondering if something like this could/will be added?

Write myself

I am certain that I can write such a product if I get some hints. I figured out which things I need to know and if someone can help me with those I'll write the product (and probably hand over all code if the e-commerce project wants it)
How do I:

  1. Let the user make a choice from an admin specified set of options.
    These options go into a new table that has fields like "productid,quantity,price".
  2. Store the choice made with the cart
  3. Allow admin to set options

Pointing me to examples for any of the points above will also be fine.

Comments

Subproducts for EC v4

brmassa's picture

Rwd,

i created a module called EC Live Subproducts, which is a advanced version of the original Ecommerce subproducts. (On Ecommerce v4, to be release just before Drupal 6, both modules will be merged!).

Im planning to create a feature which is bacly what you are asking. instead the attribute add (decrease) the subproduct price, it multiplies...

As long i create this to EC Live Subproducts, i will port to EC4.

regards,

massa

I need this functioning this week or the next

RwDwR's picture

Ok, my support from e-commerce itself suggestion was a bit dumb I admit. Although it is good to hear you will be making this feature so at least I know this is going to be solved withpout my help once (please make sure that if you do there is also the option to set an absolute price rather then an adjustment to the existing), I need the solution a lot quicker, like this week.

Could you perhaps give me a short explanation of the steps I need to take to do this? (it is 11pm over here so I'm not going to do anything today anymore) I've copied the tangible directory, renamed everything and added a table having the fields "qid,nid,quantity,price" just to try out (and later add more info). nid should be the products id. But besides from that I have not yet done anything else yet!

Or would it perhaps be a thing for me to look into your module and change it so it can do this. Which option would be the easiest most flexible and quick way?

Time and Suggestions

brmassa's picture

RwD,

lets go:

  1. I dont have much free time this week to help you, unfortunatelly. i will do my best to help.
  2. i believe its faster if you modify the EC Live Sbuproducts. Almost everything you are going to need is already there. what you should do is:
    1. create a new field on Subproduct Attribute node type: multiply_price. so admins can choose if this attribute adds or multiplies the parent product`s price.
    2. on the ec_live_subproducts_subproduct_set function, you must check if the multiply_price is on and them change the
      <?php
      $price
      += $pproduct_attribute["pricevariation"];
      ?>
      line in order to multiply instead only sum values.

Im going to be out from computers (and internet) for the next few weeks. so good luck!

massa

Thanks

RwDwR's picture

Ok, I will look into this option. But I think I am seeing one problem even before I've started... The variations you make can be applied to products meaning that either all articles use the same variations or I should create different sets of variations outside of the product (this is of course only if your module works in the same basic way as the original module does). This means I would have to make one variation for each product also because I do not simply multiply the price of the product. I'm not sure about the proper english term, but I give a discount: buying 90 apples at once is cheaper then buying 50+2*20 apples.

So I will give it a look, but I think the module does not do the trick I need even after doing the modifications.

I do have an idea for you: Also introduce the option to REPLACE the original products price. I know this gives some issues with multiple combinations, but you could restrict a product to having at most 1 property that can replace it's price and all other properties with price modifications just change the replace price or something like that??

e-Commerce Module

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: