Re: New to UberCart, your patience (and cooperation) please! :D

Posts: 1377
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

#1 is something that I'd like to see built into core - the ability to "require" attribute selection in the order page. Right now I think you'd have to write a small custom module and invoke hook_form_alter() to require those fields. You can see an example of how it's done in the Gift certificate Contribution. It would simply be adding '#required' => TRUE), to that form's particular element.

#2 is probably a Javascript addition, I'd looking to jQuery to do your bidding. You'd have to make calls to onChange and whatnot, no need to specific since jQuery can traverse down the DOM using the elements' IDs. (Sorry if this is all babble to you, you'll understand eventually Smiling

#3 - Using hook_form_alter, set the attribute '#maxlength' => 25 or whatever # of chars you want to restrict to.

#4- Again, using hook_form_alter (sensing a pattern yet? Eye-wink), you can add '#weight' => 10 or some higher number to sink the element you want towards the bottom. Although for styling your add to cart form (and not affecting its functionality such as the above issues) you could put the Submit form pretty much wherever you want. (On my site, I've gotten rid of it entirely - except for when an attribute is selected - and made it into a button.)

The main issue is Contemplate doesn't interact with the Forms API, so you can't change how the form gets rendered, you can only affect its output - and then interact with the data that it's giving you. In other words I could spit out a list of "Other Products in this Vocabulary" but I couldn't say "make all fields required". Does this make sense?

Sorry if some of this is over your head. Definitely start looking through the Contribs, they will help a lot, and also the drupal.org site. I would also recommend Pro Drupal Development by Matt Westgate and John VanDyk. The book is worth its weight in gold. (And the community here rocks as well!)

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

New to UberCart, your patience (and cooperation) please! :D By: CLiDE (15 replies) Tue, 01/15/2008 - 02:02