add description to product table

Posts: 95
Joined: 08/07/2007
Uber DonorBug FinderEarly adopter... addicted to alphas.Spreading the word - Ubercart for president.

This is G o o g l e's cache of http://www.ubercart.org/forum/development/1475/add_description_product_t... as retrieved on Aug 2, 2007 22:05:31 GMT.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
This cached page may reference images which are no longer available. Click here for the cached text only.
To link to or bookmark this page, use the following url: http://www.google.com/search?q=cache:2FmbLm0IoJ0J:www.ubercart.org/forum...

Google is neither affiliated with the authors of this page nor responsible for its content.
These search terms have been highlighted: 07 31 2007
Ubercart

* Home
* Documentation
* Forums
* Issues
* Livetest

Home » Forums » Ubercart » Development
add description to product table
Submitted by Phoenix0783 on Wed, 07/18/2007 - 17:49
Phoenix0783
Posts: 10
Joined: 07/17/2007

I'm trying to add a description on the product table page and I have been able to get the column to show up by adding:
$fields[] = array('name' => 'description', 'title' => t('Description'), 'weight' => 7, 'enabled' => true, 'attributes' => array('field' => 'n.body'));
to the uc_product_table in the uc_product.module. I know "n.body" is not accessing the correct table in the table base. It needs to acces "node_revisions." How do I do that? Thanks in advance. Also, is there a way I could add this on its own row beneath each product?

* Add new comment

permalinkWed, 07/18/2007 - 17:49
Phoenix0783
Posts: 10
Joined: 07/17/2007

by table base i mean database, sorry.

* reply

permalinkSat, 07/28/2007 - 13:47
moog
Posts: 10
Joined: 07/28/2007

Im trying to add description to product table also but with no result. Please help us out Smiling

* reply

permalinkSat, 07/28/2007 - 15:30
moog
Posts: 10
Joined: 07/28/2007

Ok I managed to add description. Heres how i did it.

Firstly I added that line like you but without "weight". Weight is controlled by control panel.

<?php
$fields
[] = array('name' => 'description', 'title' => t('Description'), 'enabled' => true, 'attributes' => array('field' => 'n.title'));
?>

Cant understand that last part

<?php
array('field' => 'n.title'));
?>

What is that n.title ?

Ok secondly I added this

<?php
$data
['description'][] = array('data' => l($node->body, 'node/'. $node->nid), 'width' => '70%');
?>

to somewhere line: 741 after price.

Janar

* reply

permalinkMon, 07/30/2007 - 16:44
Phoenix0783
Posts: 10
Joined: 07/17/2007

i had the second part in my code but forgot to throw it up Sticking out tongue. i used a little sql to pull the teaser from the node_revision table for the description, since the teaser and body appear to be the same thing in that table:

<?php
$mysql
= db_query('select nr.teaser from {node_revisions} as nr where nid = %d', $node->nid
$data
['description'][] = array('data' => db_result($mysql));
?>

I still haven't figured out how to get the description on a new line though. Is there a call to tapir that you can use to create a new row and populate the whole row? I suppose this would mess up the table sorting. Can the sorting be turned off?

* reply

permalinkTue, 07/31/2007 - 08:29
Ryan

Posts: 1685
Joined: 09/26/2006
AdministratorCode Monkey Head - I eat bugs.

Can't remember where I posted a possible solution for this, but I don't believe you can simply add a row like you're requesting. What you could do is add your description column to the far right column and try including the HTML in it to end the current row and start a new row. Something like should do the trick, though you may need to modify it to position the text how you'd like.

* reply

permalinkWed, 08/01/2007 - 11:52
Phoenix0783
Posts: 10
Joined: 07/17/2007

so now i have:

<?php
$data
['description'][] = array('data' => '</td></tr><tr><td colspan=3>' . db_result($mysql), 'width' => '0px');
?>

and the description is on a new line Smiling.

now, is there a way to make all of the generated 's that i didn't add have the class of odd so that i don't have odd and even lines since it would be like:
product name price(odd)
description
product name price(even)
description

i suck at javascript dom but i'm sure that would work somehow.

* reply

permalinkThu, 08/02/2007 - 06:46
bwv

Posts: 214
Joined: 02/27/2007
Uber DonorBug Finder

You can use the Views module for this and it works very, very well. There is a field called "header" where you can put the descriptive text. You can even put the text in the footer of the product page if you wish. Check out my site and you will see what I mean; click on any category of product on the sidebar and you will see a description above a grid display. No messing with the UC code. (I have also added a couple of tutorials on adding Views to your UC display; see the contributions section of this site). Best, david
--

========
http://greystokefarm.com/store
Running Drupal 5.1, UC Alpha7c, PHP 5.2.1, MySQL 5.0.37, Apache/1.3.33

* reply

permalinkThu, 08/02/2007 - 15:33
Phoenix0783
Posts: 10
Joined: 07/17/2007

I don't think that is quite what I am looking for; I am trying to add a description of each individual product, not of the general category they are in in the catalog. I do appreciate your trying to help though.

* reply

--