Not the first time this kind of thing has been brought up, but I didn't see a feature request issue, so here it is :)

Aside from some surface markup issues, there are serious limitations for themers trying to rearrange and style the sub-components of the add to cart form (attributes, quantity, add to cart button). What would it take to make it possible for these chunks to be printed separately?

Comments

rszrama’s picture

So, the normal course of action is to add a form theme function to your theme. Is this not possible right now? Or are you looking for something more like a default form theme function that also calls sub-theme functions?

stephthegeek’s picture

I'm talking about the components of it, such as attributes and quantity. theme_uc_product_add_to_cart is just a wrapper for all that stuff inside uc_product_add_to_cart_form. Unless I'm missing something, there's no way to, for example, put custom classes or markup around attributes in that form.

rszrama’s picture

Hmm... yeah, I suppose the way to do it is to form alter your markup in adding either #theme or #element_prefix and #element_suffix data to the elements you want to tweak. I'm not sure there's a very Drupally way to make it any easier than that. : ?

Island Usurper’s picture

The really difficult part about this is that attributes are added to that form with hook_form_alter() already. I really don't want people to have to change their module weight just so they can theme the add to cart form.

Ooh, I think you are missing something. theme_uc_attribute_add_to_cart() doesn't actually do anything, but it is registered as a theme function, so you should be able to override it and add markup around all of the attributes. There's also theme_uc_product_add_to_cart_form(), which will let you style the quantity field and the submit button as well.

stephthegeek’s picture

I'm talking about in the product tpl file being able to say "print attributes here" and "print quantity field here" and "print add to cart button here", not overriding the whole thing in template.php.

Island Usurper’s picture

Status: Active » Postponed

OK, I see. I think I know what it would take to let that happen, but a lot of it is like other features slated for UC 3. Specifically, it would take a template file for the add to cart form, since you can only put the whole form as it is into the product template. Then the attribute module will have to modify the variables available to the add to cart template so that the attributes can be printed.

We're planning on having an actual product template that ships with Ubercart, so providing templates for lots of other things makes a lot of sense. So, hang on for just a little while longer.

tr’s picture

Version: 6.x-2.0-beta5 » 7.x-3.x-dev
Status: Postponed » Active
Issue tags: -theme layer +Ubercart theme layer

Tagging and moving to UC 7.x-3.x

lpalgarvio’s picture

The label "Quantity" also needs a CLASS or ID please!
some of us need to get rid of it using display: none or reduce the size minimum!