Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add New Fields To The Product Description Easily


RMD27

Recommended Posts

How to easily add extra fields to your product description.

 

For example you might want to add/edit fields like specs, features, video, notes etc without having to edit the main product description text. If you use Easy Populate already you know what I mean, especially if you are dealing with large files/product descriptions!

 

Important - This method requires you have Easy Populate installed in order to maintain the extra fields, you could do it through phpmyadmin or similar but that would be a nightmare. Easy Populate will allow you to add videos to the product description of hundreds of products in a matter of minutes

 

Why I put this here: I needed somewhere to put these instructions so I could easily refer to them when I needed them so I thought I may as well put them here. Maybe they can help someone else.

 

Why I wanted this feature - I use Easy Populate a lot and sometimes I want to try a new layout or change a certain type of product information, as it stood I had to edit the product_description field which could take a while, especially if there was a lot of text and images in there. By adding these fields, it helps break the product description down into manageable chunks.

 

Originally I just wanted to add a field to say delivery times, like 24-48 hours instead of stating a date like 23.4.11. The standard OSC fields didn't allow it so I looked into creating a field which I could use text in instead of just a date. When I figured out how to do this I thought why not use this method to create many new fields to make editing of the product information easier

 

The key to this method is all down to the people who created Easy Populate, they made this possible. Link at bottom

 

I'll say now that my php and sql knowledge is zero, I have just pieced together info found in other threads. Link at bottom

 

-----------------Start--------------

 

1. To create the field in the database run this SQL query in phpmyadmin

 

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

 

If you want more than 255 characters use the same setting as the products_description field

 

2. Go to admin/easypopulate.php

 

And follow the instructions detailed around line 300, with regards to how to set up Easy Populate to work with the extra field/fields you have created, you need to edit 1 line

 

3. Go to catalog/product_info.php around line 84

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description

 

add the names of the fields you have added after pd.product_description, for example

 

pd.products_description, pd.products_thenameofmyextrafield,

 

4. Then find this around line 163

 

<p><?php echo stripslashes($product_info['products_description']); ?></p>

 

copy <?php echo stripslashes($product_info['products_description']); ?> and paste it where you want it to appear on the page and change "products_description" to "products_thenameofmyextrafield"

 

And thats it, you can add as many extra fields as you want using this method, I have experienced no problems as yet using Easy Populate like this

 

The thread which details adding the extra field can be found here

 

http://forums.oscomm...oduct-listings/

 

This is the Easy Populate contribution which you will need to maintain the extra fields

http://www.oscommerc...ntributions,500

 

I hope this helps someone!

 

DISCLAIMER: I except no responsibility for any issues caused by using this method, back up before you change anything!

Link to comment
Share on other sites

  • 2 weeks later...

A quick note: I use this method on v2.2 RC2

*And a quick addition

 

If you want the new/extra fields to have a title/header/heading/label put this in

 

 

<?php if ($product_info['products_benefits'] != NULL) { echo "TheNameOfMyExtraField: "; } ?>

 

before the

<?php echo stripslashes($product_info['products_thenameofmyextrafield']); ?>

 

 

 

Of course you can also tie the title into your stylesheet if you want the headings to appear in different colours/fonts etc

 

Enclose the heading code as follows

 

<p class="ProdInfTitles"><?php if ($product_info['products_specs'] != NULL) { echo "TheNameOfMyExtraField: "; } ?></p>

 

And add a reference in your stylesheet at the bottom

 

p.ProdInfTitles {

font-family: Verdana;

font-size: 12px;

color: #00b300;

font-weight: bold;

}

 

As always back up before you make any changes. This might not work on your shop

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...