11 replies [Last post]
pkintu's picture
Offline
Joined: 06/21/2010
Juice: 29
Was this information Helpful?

Hello All

I want to display the dropdown box of selecting no.of products rather no.of products to be entered on catalog/product page.

How can i achieve this from ubercat ?

I later want to add the combobox for selecting no.of product which also shows the the total price of no. of products selected.

e.g . combo box display following text

select product :
3 products - 100$
6 products - 190$
9 products - 280$

like this way...

How can i achieve this in drupal and ubercart.

Please reply soon.

Thanks

Paresh Patel

-
Kintu Designs
http://www.kintudesigns.com

WebNewCastle's picture
Offline
Joined: 04/29/2009
Juice: 595
.

Hi Paresh,

I think you would just need a small module to do some form alterations. And the display options can be a small function which grabs the product's price and does the calculation so that the option in the select field is the quantity but the label is the quantity and price.

Your form alteration would, I think, just be with hook_form_alter (or Form ID alter), a conditional clause to identify the add to cart form, and then identify the field for the alterations (something like $form['qty']). You can then change the type to select, put in the function to change the display/options, and etc. So you're probably looking at just two main functions in a module file and an info file for a custom module.

- Matt

Matthew Winters / WebNewCastle.com - Drupal & Ubercart development, training, and consulting. Drupal profile
Online community, product development, & policy management.

WebNewCastle's picture
Offline
Joined: 04/29/2009
Juice: 595
.

P.S. I suppose you would need some additional functions if the calculation is not just a straight quantity times a base amount. If the calculation is a set scheme from product to product, then it wouldn't matter. If you want to have different rates/discounts per product (i.e. purchasing 3 with product A has a different calculation scheme than 3 of product B), then you might need to add some additional fields to the product creation form to handle this.

- Matt

Matthew Winters / WebNewCastle.com - Drupal & Ubercart development, training, and consulting. Drupal profile
Online community, product development, & policy management.

pkintu's picture
Offline
Joined: 06/21/2010
Juice: 29
Its done !!!

Thanks matt !

for replaying as well as guiding me ,

As i am new to drupal , on starting , it was difficult to understand your guideline then I have read and learn about the
hook_from_alter and how to make custom module , during my search the following link also helps great to achieve my
requirement

http://www.ubercart.org/forum/ideas_and_suggestions/15307/default_quanti...

After reading these , I re-read your guideline and then i was able to understand and implement.

Now i have achieved my requirement as i want.

Thanks Smiling

-
Kintu Designs
http://www.kintudesigns.com

imstillatwork's picture
Offline
Bug Finder
Joined: 12/27/2008
Juice: 207
Re: Dropdown box instead textbox to enter quantity

You don't need a module for this! Think simple!

The built in options does this already.

1) Create a new attribute called 'quantity pricing' or something like that.

2) Create the options for the attribute and adjust the pricing as needed
3 products - 100$
6 products - 190$
9 products - 280$

3) in the product edit main screen, enter a 0 in the "Default quantity to add to cart: " field. it will disable the qty text box.

4) don't forget to test, and check things like the attribute help text if you need to clarify anything for the visitors.

here is my example, but SLIGHTLY different. I use it for case pricing so I leave the qty field disabled.

http://www.northwestcandlesupply.com/product/floating-hibiscus-candle

ericmorford's picture
Offline
Joined: 06/08/2010
Juice: 19
Hi, I've added the attribute

Hi,

I've added the attribute selectbox for pricing quantity and multiple options for different prices for a particular product as an example, however i am not sure if i am configuring correctly because it is not working. I have several products and inputted zero into the 'Default quantity to add to cart area' into one of the products settings as an example, and nothing is happening. Can you please help me out?

imstillatwork's picture
Offline
Bug Finder
Joined: 12/27/2008
Juice: 207
Re: Hi, I've added the attribute

I did a test on mine and the qty field had disappeared straight away. I'll check if there are any requirements for that option.

ericmorford's picture
Offline
Joined: 06/08/2010
Juice: 19
Re: Re: Hi, I've added the attribute

Ok I got the text box to go away. But now how do I get an option for an attribute to select a cost like in your website example:

Price each $7
Case of 6, $38

On mine, it is trying to increment, It says

1 cm + $45.00

5 cm + $200.00

10 cm + amount....
.....

So how do I get it like yours? I want distinct values for say 1 cm and 5 cm and 10 cm rather that selecting an incremental operator in the dropdown box.

imstillatwork's picture
Offline
Bug Finder
Joined: 12/27/2008
Juice: 207
Re: Re: Re: Hi, I've added the attribute

There is a setting for that somewhere, lol can't remember gotta check hold on...

Store -> Configuration -> Attribute Settings. Choose 'Display Total Price'.

Then, remember that it will display option price PLUS product price, so when filling out the option price, I subtract the single item product price.

So example product is $12

option prices look like:

each: $0 (display as $12)
case of 6: $60 (displays as $72)

of course I give discounts on cases so I would drop 10% off the total before I subtract the $12
case of 6: $52.80 (display as 64.80)

clunky but works. The store attributes needs a setting for attribute to make the attribute price the total / final price

pkintu's picture
Offline
Joined: 06/21/2010
Juice: 29
I'll try for it

Thanks for posting

As I am working on another module , i could not get time to implement and test this as you said.

But I'll test this as what you said and post my review.

-
Kintu Designs
http://www.kintudesigns.com

WebNewCastle's picture
Offline
Joined: 04/29/2009
Juice: 595
.

That's an interesting suggestion. Simple is nice and better - good philosophy. Can you post what you did to translate the attribute selection to a quantity displayed in checkout? I'm assuming you had to add a module or some code for that.

- Matt

Matthew Winters / WebNewCastle.com - Drupal & Ubercart development, training, and consulting. Drupal profile
Online community, product development, & policy management.

imstillatwork's picture
Offline
Bug Finder
Joined: 12/27/2008
Juice: 207
Re: .

Since i'm dealing with cases (technically the same thing - multiple of an item at different prices, semantically maybe not) I don't mind the cart saying 1qty of an item which is a case of xx products

I did however put the help text on that attribute as you can see in my example link on that site I posted. It lets the user know that they are buying x boxes that each contain n items. Maybe this could be solved with simple labeling of the options. like calling them 3 packs, 6 packs, 9 packs, etc or whatever your increments are.

I agree that ultimately a quantity pricing module would be the best with several option for setting up automatic price adjustments ($ or % off per x items, autogenerated dropdown selections, etc)