Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add Mini Descriptions to Product Listings


npn2531

Recommended Posts

This is a relatively easy way to dress up your category product listings with a mini description in the product name column. It also allows for adding some HTML to customize how it displays.

 

You can see what it looks like here:

 

http://www.niora.com/anti-aging-acne-care

 

On what it looks like on a new install of OSCommerce here:

 

http://adult-acne-product.com/catalog/index.php?cPath=3_10

 

 

 

1)Create a new field in products_description, I suggest 255 characters long

 

ALTER TABLE `products_description` ADD `products_minidescp` LONGTEXT NOT NULL

 

 

2. Paste the following query into catalog/includes/modules/product_listings.php about line 85-90 (assuming a new install). Be sure to place it below the ' }' and above '$cur_row = sizeof($list_box_contents) - 1;'

 

//BOF add a mini-description
$pl_id = $listing['products_id'];
$minidescp_query = tep_db_query("select products_id, products_minidescp from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id  = '" .$pl_id. "'");
   $minidescp = tep_db_fetch_array($minidescp_query);
   $pl_minidescp = '<p>'.$minidescp['products_minidescp'].'</p>';
//EOF add a mini-description

 

 

3. A few lines below that add the variable $pl_minidescp at the end of this line:

 

This line:

 $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';

 

is changed to this:

 

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br/>'.$pl_minidescp;

 

4. Manually enter your mini-descriptions into products_descriptions.products_minidescp

( A proper user interface in admin/categories.php might look it like a contribution )

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Link to comment
Share on other sites

George,

 

 

I believe the full contribution can be found here :

 

http://addons.oscommerce.com/info/3123

 

 

 

Chris

 

Jeebus, and it's been around since 05. It has the user interface, the hard part. This tip here has the advantage of being nothing more than a short bit of code added to one file and adding one field to one table, but you are going to have to be fine with adding data directly to the database to use this.

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Link to comment
Share on other sites

Well George,

 

It is a good addition...........unfortunately someone thought of it 4 yrs ago. But, I am sure you will come up with something nobody else has sooner or later. Just joking with you.

 

Tip: Check the add-ons section before starting a new contribution.

 

 

 

 

Chris

Link to comment
Share on other sites

I had no notion of making a contribution out of this. It always fun to think about making a contribution, but I took one look at admin/categories.php and that notion went quickly by the wayside.

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Link to comment
Share on other sites

  • 2 weeks later...

I had no notion of making a contribution out of this. It always fun to think about making a contribution, but I took one look at admin/categories.php and that notion went quickly by the wayside.

 

 

But categories.php is a nice little file easy to mod!! cool.gif

 

 

I kid!!, I admit I cannot understand why it was made as it is, clearly it started out to edit categories, but then does products too, I think the two functions would be better done in seperate files. huh.gif

 

 

PS take care when adding queries in the listing, on a large shop or slow server too many queries can become an issue, its better to get the data for all displayed product with one query, instead of one query for every product. wink.gif

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

But categories.php is a nice little file easy to mod!! cool.gif

 

 

I kid!!, I admit I cannot understand why it was made as it is, clearly it started out to edit categories, but then does products too, I think the two functions would be better done in seperate files. huh.gif

 

 

PS take care when adding queries in the listing, on a large shop or slow server too many queries can become an issue, its better to get the data for all displayed product with one query, instead of one query for every product. wink.gif

 

Yes, I had to unfold the extra long page extension handles on Adobe Golive just to open categories.php. In regards to adding a new query on the listings page, it did feel redundant to add a new query on products_description as variables for the fields of the products_description table are floating around already. But I didn't find a query in or above product_listings.php I felt comfortable adding the new field products_minidescrip to.

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Link to comment
Share on other sites

Here is how you eliminate the query in product_listing.php, and make an easy way to add a mini-description even easier (the entire process follows):

 

1)Create a new field in products_description, I suggest 255 characters long, as before

 

ALTER TABLE `products_description` ADD `products_minidescp` LONGTEXT NOT NULL

Then manually add your product descriptions to the database.

 

2) on about line 153 in index.php change:

 

case 'PRODUCT_LIST_NAME':
         $select_column_list .= 'pd.products_name,   ';
         break;

to this:

case 'PRODUCT_LIST_NAME':
         $select_column_list .= 'pd.products_name, pd.products_minidescp,  ';
         break;

 

(you are adding the phrase ->pd.products_minidescp,)

 

3) On about line 103 in includes/modules/product_listing.php, change this:

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';

 

to this:

  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br/>'. $listing['products_minidescp'];

 

(You are adding-><br/>'. $listing['products_minidescp']; <- to the end of the line.)

 

You can see it here:

http://www.niora.com/anti-aging-acne-care

 

or here on a new OSCommerce install:

http://adult-acne-product.com/catalog/index.php?cPath=3_10

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Link to comment
Share on other sites

  • 10 months later...

Jeebus, and it's been around since 05. It has the user interface, the hard part. This tip here has the advantage of being nothing more than a short bit of code added to one file and adding one field to one table, but you are going to have to be fine with adding data directly to the database to use this.

 

either this addon is out of date or written wrong...there's a piece of code that needs to be added onto another piece of code that is not in the file. I checked in the code editor, dreamweaver and coffee cup just to make certain I'm not losing my mind and it definitely is not there.....plus this has to be one of the longest-taking addons to install, not to mention adding to your database...skip this if you know what's good for you....

Link to comment
Share on other sites

See comment #8 for the correct way to add the mini description in 2.2RC2a.

For 2.3 it is a little different and done like this:

 

1)Create a new field in products_description, I suggest 255 characters long, as before

ALTER TABLE `products_description` ADD `products_minidescp` LONGTEXT NOT NULL

Then type in your mini descriptions directly into the database.

 

 

2) on about line 121 in index.php change:

case 'PRODUCT_LIST_NAME':
         $select_column_list .= 'pd.products_name,   ';
         break;

 

to this:

case 'PRODUCT_LIST_NAME':
         $select_column_list .= 'pd.products_name, pd.products_minidescp,  ';
         break;

 

3) finally in includes/modules/product_listing.php, change this:

case 'PRODUCT_LIST_NAME':
           if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
             $prod_list_contents .= '        <td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a></td>';
           } else {
             $prod_list_contents .= '        <td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a></td>';
           }

to this:

case 'PRODUCT_LIST_NAME':
           if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
             $prod_list_contents .= '        <td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br/>'. $listing['products_minidescp'].'</td>';
           } else {
             $prod_list_contents .= '        <td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br/>'. $listing['products_minidescp'].'</td>';
           }

Click the demo here to see what this looks like.

http://www.niora.com/css-oscommerce.php

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Link to comment
Share on other sites

  • 5 weeks later...

Step one has a minor error: longtext is 4 million characters, not 255. For a 255 character data field, use this:

 

ALTER TABLE `products_description` ADD `products_minidescp` VARCHAR(255) NOT NULL

 

Yes, you use phpMyAdmin. Just click on the SQL tab and paste that code in, then click Go.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I added it to admin/categories.php, by searching for all occurrences of products_description and adding products_minidescp after it. Then add a new function by copying the tep_get_products_description to tep_get_products_minidescp

Link to comment
Share on other sites

I added it to admin/categories.php, by searching for all occurrences of products_description and adding products_minidescp after it. Then add a new function by copying the tep_get_products_description to tep_get_products_minidescp

 

That's about the most succinct and clearest instructions I've heard for doing this. Thanks!

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Link to comment
Share on other sites

  • 3 weeks later...

Am I missing something here? :blink:

I'm running osCommerce 2.3.1, and changed all the files, and added the field in the database.

 

How is it intended that the new field should be used?

Do you have to fill in the short description somewhere, or will this be retrieved from the original description?

 

Sorry for any stupid questions.

I am who I am, unfortunately.

Link to comment
Share on other sites

You have to fill out the short description directly into the database. The new field is empty and does not pull info from anywhere. You can do this if you are familiar with how to use phpMyAdmin.

 

However, if you would rather fill in the field from the admin, see post #14 above.

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Link to comment
Share on other sites

You have to fill out the short description directly into the database. The new field is empty and does not pull info from anywhere. You can do this if you are familiar with how to use phpMyAdmin.

 

However, if you would rather fill in the field from the admin, see post #14 above.

Now i understand much better.

Many thanks for the explanation and for the quick reply. :D

I am who I am, unfortunately.

Link to comment
Share on other sites

  • 2 weeks later...

After all thesee posts i have to say this is a step back for oscommerce. What a lot of trouble to go through to get a short description. There is a contribution, that works with 2.3.1 which automatically uses the first 80 characters fron the product descriptions and add that as a short description. No messing with the databse at all, and you only need to add the information once. Simple to use and install. The contribution can be found HERE

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

After all thesee posts i have to say this is a step back for oscommerce. What a lot of trouble to go through to get a short description. There is a contribution, that works with 2.3.1 which automatically uses the first 80 characters fron the product descriptions and add that as a short description. No messing with the databse at all, and you only need to add the information once. Simple to use and install. The contribution can be found HERE

Good to know! I'll try this instead.

I am who I am, unfortunately.

Link to comment
Share on other sites

  • 3 weeks later...

After all thesee posts i have to say this is a step back for oscommerce. What a lot of trouble to go through to get a short description. There is a contribution, that works with 2.3.1 which automatically uses the first 80 characters fron the product descriptions and add that as a short description. No messing with the databse at all, and you only need to add the information once. Simple to use and install. The contribution can be found HERE

And if you want to add a short description that is different from the long description? This method on this thread is the way to go?

Link to comment
Share on other sites

And if you want to add a short description that is different from the long description? This method on this thread is the way to go?

 

So you would sooner have to edit your database for every product description, even those products that you already have in your store, rather than use the first part of your product description that is already in your database.

 

If you think that is the way to go, you go for it. I suppose its down to what you prefer, and i prefer not to have to do things twice for every product in my store.

 

if you add the contribution that was mentioned, oscommerce automatically uses the first 80 characters (this can be altered) of your normal product description and adds a read more link that goes to the main product description. One description two jobs.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

So you would sooner have to edit your database for every product description, even those products that you already have in your store, rather than use the first part of your product description that is already in your database.

 

If you think that is the way to go, you go for it. I suppose its down to what you prefer, and i prefer not to have to do things twice for every product in my store.

 

if you add the contribution that was mentioned, oscommerce automatically uses the first 80 characters (this can be altered) of your normal product description and adds a read more link that goes to the main product description. One description two jobs.

Hi

 

I know what you mean, killing two birds with one stone so to speak, I was thinking along the lines of the mini description being incorporated into Easy Populate. That is the only way I would choose to manage the mini description.

 

The outline given in this thread makes it seem easy to set up an extra field, but I don't know how easy it would be to incorporate it into Easy Populate.

Link to comment
Share on other sites

Hi

 

I know what you mean, killing two birds with one stone so to speak, I was thinking along the lines of the mini description being incorporated into Easy Populate. That is the only way I would choose to manage the mini description.

 

The outline given in this thread makes it seem easy to set up an extra field, but I don't know how easy it would be to incorporate it into Easy Populate.

If anyone is interested I figured out that EP gives you the instructions on how to incorporate a new field like the one detailed in this thread, into its upload download function

 

http://www.oscommerce.com/forums/topic/371245-this-product-will-be-in-stock-on-format/page__gopid__1567600#entry1567600

Link to comment
Share on other sites

  • 1 year later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...