5 replies [Last post]
elarifr's picture
Joined: 09/30/2007
Juice: 5
Was this information Helpful?

Hello all.
I'm very new to drupal / ubercart as it make only two days that i installed first pilot site. i'm a computer repair technician in France and i have a customer wanting a small web page to resell refurb cars (sorry for my english Sad

i have installed drupal / ubercart and played with cck to add extra field for
brand / model / colors / year / km / motor power....
there will be no online resell (this is only a product show)
for now i made a small test site http://accedinfo.com/ott52/ and still have some difficulties to manage taxonomy / categories in products but has i see other live site it seems drupal / ubercart should be a good way for this customer so i will like to play a bit in drupal code...

reading the post avalaible here it seems that using cck should create some garbage in product it there are some change in cck field?

i have found a uc_extra_column module that seems/claims to add directly field much more in ubercart api (tapir ?) way ?

should it be as easy as hacking the uc_extra_field to create a new module to add directly few fields i need in product without having to play with cck ?
does something like
$fields[] = array('name' => 'brand',
'title' => t('Brand'),
'weight' => 0,
'enabled' => true,
be enough to create a brand field in product table ?
if yes, then how to create a kind of autocomplete field (for brand, color... ) , or drop down menu with already populated values (for manufacture year , motor power ...)

any entry point that i can check to understand (fast & easy ? ) how to play with uc_ modules ?

thanks for any anwser, and please remember i have absolutly no knowhow in Drupal Sad

Lyle's picture
Joined: 08/07/2007
Juice: -40968
Re: ubercart for a car repair shop / reselling old cars ?

uc_extra_field is a good example of how to use TAPIr to to put more information in the product tables. You're on the right track with adding the Brand field to the $fields array, but you will also need to put the actual brand names in the $data array.

['brand'][] = $node->field_brand[0];

That's a guess of the kind of thing that needs to be done. This assumes that the brand is held in a CCK field called field_brand.

I'm not sure what you mean about garbage in the product because of CCK fields, but I think CCK is what you need. Take a look at uc_product_table() in uc_product.module to see how it handles the image field.

elarifr's picture
Joined: 09/30/2007
Juice: 5
thanks lyle

thanks lyle
i've tried to hack extra_column but i did not understand that field must be created with cck before. i dreamed the uc api will manage this transparently....
is there a way to create those cck field from a uc module or should it be more nice to hack a cck module to create field and an uc_ module to manage field in product?

about data garbage, as i read more the forum, i seems it apply only in checkout/old order if data change in cck field then old order should display new cck value ?
if true, this will be no problem for this project

thank ryan
i tried to hack the code and understand that it was only to display in product listing but not in product page Sad
iconv() error is very strange the page was working very well and did not display any error. but monday morning it shows error. more strange: i had an old session opened that did not display any error !
i will look at new update Sad

Lyle's picture
Joined: 08/07/2007
Juice: -40968
Re: thanks lyle

The order module doesn't have any knowledge of CCK fields. It barely knows that products are nodes. Instead it copies over the product data like cost, price, weight, and SKU and stores them in its own table when the order is made. If a product is edited at a later date, those changes don't have any effect on old orders.

That said, I'm not seeing what you want CCK and Ãœbercart to do together. If it's just a matter of having the CCK fields be displayed in the product lists, you should take a look at Views. It already handles a lot of that functionality. I'll see if there's anything I need to do to allow Views to override the catalog URLs.

elarifr's picture
Joined: 09/30/2007
Juice: 5
how to hook product setting ?

i have begin to write a module for handling cars selling fields
i can now install / uninstall module that add/remove the fields i need
the colum list are displayed in the product page listing and with (table view?) i can select which field are displayed and relative weights

how can i hook store/configuration/products/edit/edit field to manage these fields as the core products fields?
how can i check if i want somme field to be edited/viewed only by administer (like for costs) ?

it seems i need to use

function uc_extra_cars_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  if ($node->type != 'product') {

  switch ($op) {
    case 'delete':
    case 'insert':
    case 'update':
    case 'load':
    case 'view':

to insert/display/update field in the product page


function uc_extra_cars_form_alter($form_id, &$form) {
  if ($form_id != 'product_node_form') {

to edit data ?

it seems also that must i make dbquery inside my module to read/write the extra fields or are there already in an array when module is loaded ?

hope to be not too much confusing Sad


Ryan's picture
Joined: 08/07/2007
Juice: 15476
Re: ubercart for a car repair shop / reselling old cars ?

I'll second Lyle... Honestly, if you're not using the information in these custom fields at checkout at all and a new page is being created for each car, I'd stick with CCK. I think the extra field module you refer to is for getting it to show on product listing pages, not the individual product page. If you need to create a custom list using some of the fields you have defined, you should be able to use the Views module just fine.

Also, the iconv problem on your site right now is due to a non PHP4 compatible part of the catalog module. This has been fixed for the next release, so you can update the site later today or tomorrow and the bug won't show any more. (Or update the site to PHP5 if you can.)