SIngle Option without Drop down list

Posts: 48
Joined: 11/29/2007
Bug Finder

Hello,

I'm new to ubercart and so far i'm loving it. I was using ecommerce module for a while but the subproducts modules are both very buggy and can't deal very well with all the options available, so i made the switch to ubercart.

Anyhoo.

I'm building a webshop for a clothing company.
There are maybe 10 variations of Hoodies.
They will custom make any one of these.
There are many many options for each hoodie: Base color (7), contrast color (7), piping color (7), print graphic (5), print color (7), hood shape (2), womens sizes (6), mens sizes (4).

On the site under a specific style of hoodie you will get 1 product which is totally customisable, plus 2 preset variations, eg Blue / Green / Black / Graphic 1 / Green print / pointy hood : and then the user selects the size

So in total there are 3 products per style of hoodie, 2 preset and 1 custom.

So I tried to setup the preset ones using the attibutes and options, but only giving 1 preset option. However on the page you get a drop down list with only 1 option.

Question 1: how can i remove the drop down list when there is only 1 option available? ie it should just say:
Base Color : Blue
Contrast color : Green
etc
etc

Then have a drop down list for sizes.

Question 2: Every custom product is available in every option, is there a way that i can default this or 'select all'? instead of having to click 50 little boxes each time i make a product.

Thanks for your help, ubercart rocks.

matt

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Welcome aboard! Quick answers for ya (may require some further investigation...):

  1. In this case, you're might try editing the template (using Contemplate or your theme). You can attach some JS (if you know it) that looks for any select box with one option and hides or disables them. Otherwise, you could use a custom module w/ hook_form_alter() that does the same thing in PHP.
  2. If you make a new product class, you can assign it a set of default attributes and options. No more 50 clicks. Smiling
Posts: 48
Joined: 11/29/2007
Bug Finder

Cool, thanks for that ryan.

1.
Contemplate looks very interesting and javascript will do, but it's not really ideal.

What i would really like to do is alter the display template for ubercart but i can't figure out where that is. Is it a nice separate template file or is it all mixed up with the php, or is it handed over to drupal to render a standard form?

Because it currently does 2 different things:

if list_length == null then render an empty text field
if list_length != null then render a drop down list

Where does that get decided? What i want to do is change it to:

if list_length == null then render an empty text field
if list_length == 1 then print the single option in text **
if list_length > 1 null then render a drop down list

**(the same way it does in the cart eg Base Color : Black)

Also, in ubercart, is there a way to choose between a drop down list and radio buttons? Would be a handy feature.

I'll take another look now.

2.
cool, i made a product class the other day but couldn't see where to assign it default attributes and options, i'll take another look. Since i've already made all my products with the standard class can i make a new class and switch existing products over to it?

Thanks for your help,

matt

Posts: 2244
Joined: 08/07/2007
AdministratoreLiTe!

The attributes module creates the form array in _uc_attribute_alter_form(). It uses the Drupal Form API so you can change it however you like. I think having just one option be just a label is a good idea, though. I'll get it in before beta.

Having default attributes and options on your product classes really only benefits new products. Any that you already have would still need to have those options given to them manually. The answer to your question is "yes, you can", but it's not worth the trouble.