Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By beckyjohnson on
Hi,
I'm working on a small module to disable the the sku and price field from being required in ubercart's product page form. I used coder but it only got me so far. I don't understand what the problem is. I just know that when i enable it i get an error saying there is something wrong iwth line 13 which is the line that has the form_id in it. I can't figure out what is wrong with it. Could someone help me out?
<?php
// $Id$
/**
* @file
* Module to hold my customizations to Ubercart
*/
/**
* Implementation of hook_form_alter()
*/
function skudisable_module_form_alter(&$form, &$form_state, $form_id ) {
if ($form_id == 'product_node_form') {
$form['base']['model']['#required'] = FALSE;
}
}
Comments
Nothing pops out, though the
Nothing pops out, though the error might help to pinpoint the problem. If nothing else, delete the line a re-type (in case there are non visible characters)
Oh my god! I can't believe
Oh my god! I can't believe it! You're right. there were hidden characters in it screwing it up! I'm really happy that you suggested I check for this because now it works! Thank you.
There is one more field I want to disable, which is also part of product_node_forum. Why type of syntax would I use to continue this code argument down to un-require other fields?
Thanks so much!
Becky
Please correct me if I am
Please correct me if I am wrong, but are there not options for these at admin/config/product settings?
----------------------------------------------------------------------
http://classicvinyl.biz
http://music.bwv810.com
http://davidhertzberg.com
http://association.drupal.org/user/1207
I am a writer, researcher and solo drupal freelancer
There are options in the
There are options in the admin section for not showing these on the pages but when you fill out the form, even if you don't display it on the page, you still have to type in a sku and a list price but i'm trying to use uber cart as a product showcase. Nothing is really being sold here, nothing has a price really. It's just a catalogue with info in it.
And I'll try re-typing the line and checking for hidden characters.
Becky
If you are not selling stuff
If you are not selling stuff and just presenting a catalog it would seem using CCK and views would be easier and more straightforward.
Ditto. ----------------------
Ditto.
----------------------------------------------------------------------
http://classicvinyl.biz
http://music.bwv810.com
http://davidhertzberg.com
http://association.drupal.org/user/1207
I am a writer, researcher and solo drupal freelancer
Thanks for that suggestion.
Thanks for that suggestion. I think i'll try it out. Although, off the top of my head, there are some things that ubercart does that I 'm not sure about how i would program on my own. Such ascreating a page that shows a grid view of the products. Or making a themed porthole kind of page that shows all the catalogue options. Like here:http://beta-wimaxforum.org/catalog . Any suggestions?
For the first part there is
For the first part there is an add on to views that provides a grid view. For the second part, access to the url is denied.
Thanks for letting me know
Thanks for letting me know that access was denied for the catalog link. YOu can see a screenshot of what I mean here: http://www.beta-wimaxforum.org/catalogue.jpg
Also the add on to views that creates a grid: is this an add on module or is it that I have create a new view in Views but views has the capabilities to already give me a grid view? Sorry I'm really new to views. I've barely done anything with it.
Becky
Already there
The Views2 module for D6 already has the Grid formatting option available. When you create your view, under the "Basic Settings", there's a Style option, one of the options there is "Grid".
I have another question.
I have another question. Since I'm new to module writing and coding, as an exercise, I went through and modified my form by using hook form alter()
This is what I have now:
The only field I left in the "Product Information" fieldset was the SKU field. My new question is , how do i expand the field set to extend around all of my other unique product information fields that I have added.
I found the code easily in the ubercart product module, but I'm not sure what to do to extend it. I think it has something to do with adding the variable [base] to all my new fields but I don't know how to do it.
Ubercart code
Thanks for all the input and help so far. I still may redo this using CCK but it's a good learning experience for me to try it this way first.
Becky
What about thumbnail images?
I have another question. Ubercart gives me the ablity to make thumbnails for each product as well as a full size version. I know i can make the full size version with CCK image field but how to I make the thumbnail size image for each product?
Thanks,
becky
Use the imagecache module, a
Use the imagecache module, a real work of genius.
----------------------------------------------------------------------
http://classicvinyl.biz
http://music.bwv810.com
http://davidhertzberg.com
http://association.drupal.org/user/1207
I am a writer, researcher and solo drupal freelancer