Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding a field in Product listing in catalog


Genius

Recommended Posts

Hi,

 

Does anyone know how to add a field from the database to the Product listing on the catalog. What i am trying to do is i have a field in my products table database called products_format and i would like that to be displayed on the product listing page so i would have the Image, the Product Code the Product Name and the price and the Format and the buy button.

 

 

thanks.

Link to comment
Share on other sites

Heres the text from a contrib. Dont no who wrote it

 

1.DB

---------------------------------

We add new fields in osc database

example: products_size, int(3), null:yes

 

 

2.admin\includes\languages\english\categories.php

The Admin english label for this field

-------------------------------------------------------------------------

define('TEXT_PRODUCTS_SIZE', 'Products Size:');

 

3.catalog\includes\languages\english\product_info.php

The Catalog english label for this field

-------------------------------------------------------

define('TEXT_PRODUCTS_SIZE','Products Size:');

 

We do the above steps in all languages files we use!

 

4.admin/categories.php

So we can add/edit/view the new fields in admin area

----------------------------------

------> In

$sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']), .......

we add

'products_size' => tep_db_prepare_input($HTTP_POST_VARS['products_size']),

 

 

-------> In

$product_query = tep_db_query("select products_quantity,....

we add the new field(s)

...products_size....

 

------> In

tep_db_query("insert into " . TABLE_PRODUCTS . " (

we add the new field(s)

....products_size....values...."', '" . $product['products_size'].....

 

-------> In

if ( ($HTTP_GET_VARS['pID']) && (!$HTTP_POST_VARS) ) {

$product_query = tep_db_query("select pd.products_name,

we add the new field(s)

///,p.products_size....

 

------> After

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_WEIGHT; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_weight', $pInfo->products_weight); ?></td>

</tr>

we add

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_SIZE; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_size', $pInfo->products_size); ?></td>

</tr>

 

 

-------> In

// copy image only if modified

$products_image = tep_get_uploaded_file('products_image');

$image_directory = tep_get_local_path(DIR_FS_CATALOG_IMAGES);

if (is_uploaded_file($products_image['tmp_name'])) {

tep_copy_uploaded_file($products_image, $image_directory);

$products_image_name = $products_image['name'];

} else {

$products_image_name = $HTTP_POST_VARS['products_previous_image'];

}

} else {

$product_query = tep_db_query(.....

We add the new field(s)

..,p.products_size....

 

 

 

5.catalog/product_info.php

Adding the new field(s) in catalog product view page

 

------> In

?php

$product_info_query = tep_db_query("select

We add

the new field(s)

...p.products_size...

 

------> Before

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

And After

</table>

We Add

<?php

//sandalwood

if (tep_not_null($product_info['products_size'])) {

echo TEXT_PRODUCTS_SIZE.' '.$product_info['products_size'];

}

//end of sandalwood

?>

END OF 13.4.2003 Actions #########################################################################

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...