Active
Project:
Ubercart
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
21 Mar 2009 at 02:25 UTC
Updated:
4 Jan 2011 at 16:13 UTC
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
Comment #1
rszrama commentedSo, 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?
Comment #2
stephthegeek commentedI'm talking about the components of it, such as attributes and quantity.
theme_uc_product_add_to_cartis just a wrapper for all that stuff insideuc_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.Comment #3
rszrama commentedHmm... 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. : ?
Comment #4
Island Usurper commentedThe 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.
Comment #5
stephthegeek commentedI'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.
Comment #6
Island Usurper commentedOK, 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.
Comment #7
tr commentedTagging and moving to UC 7.x-3.x
Comment #8
lpalgarvio commentedThe 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!