Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add product weight to product_info screen


isorm

Recommended Posts

Posted

Anyone know how I can add the product weight that is in the database to the product info screen? It is already on the product listing page but I want to add it to the description page. I have seen contributions that fix this but they require adding SQL entry's to my database which I do no want to do. Thanks for any help!

 

-Matt

Posted

See this in /catalog/product_info.php ... yours may look a little different .

 

   $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_retail_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

Add products_weight to the beginning of the query, prior to TABLE_PRODUCTS

 

 

place $product_info['products_weight'] wherever you want it used. For example ...

 

<?php echo $product_info['products_weight']; ?>

  • 4 months later...
Posted

Thanks for this one!

 

To make it even nicer, I've put it like this (one line!):

<?php if (PRODUCT_LIST_WEIGHT > 0) { echo TEXT_PRODUCT_WEIGHT . ' ' . $product_info['products_weight'] . ' ' . TEXT_PRODUCT_WEIGHT_UNIT; } ?>

 

and added in /catalog/includes/languages/english/product_info.php the following:

define('TEXT_PRODUCT_WEIGHT', 'Weight:');
define('TEXT_PRODUCT_WEIGHT_UNIT', 'kg');

 

This allows for somewhat more flexibility, you can switch it on/off via the admin panel, together with the list column setting for 'weight' (0=off).

 

To the developers: I DO feel a strong urge to recommend having the base weight unit defined somewhere in the configuration database for the next version, don't you agree?

 

M.

I don't want to set the world on fire—I just want to start a flame in your heart.

 

osCommerce Contributions:

Class cc_show() v1.0 – Show Credit Cards, Gateways

More Product Weight v1.0

Archived

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

×
×
  • Create New...