Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Manufacturer's name and quantity available


quetzlcoatl

Recommended Posts

Posted

This is a very simple trick that is useful for displaying the product's manufacturer and quantity available on the product_info.php.

 

Open product_info.php, and look for this bit of code around line 70:

 

<?php
 } else {
   $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_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 . "'");
   $product_info = tep_db_fetch_array($product_info_query);

 

Replace with:

 

<?php
 } else {
   $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, pa.manufacturers_name, p.products_image, pd.products_url, p.products_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, " . TABLE_MANUFACTURERS . " pa 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 . "'");
   $product_info = tep_db_fetch_array($product_info_query);

 

Then, look for this bit around line 83:

 

if (tep_not_null($product_info['products_model'])) {
     $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
     $products_name = $product_info['products_name'];

 

And replace with:

 

if (tep_not_null($product_info['products_model'])) {
     $products_name = $product_info['products_name'] . '<br><span class="smallText">Product Model #: [' . $product_info['products_model'] . ']<br>Quantity Available: [' . $product_info['products_quantity'] . ']<br>Manufacturer: [' . $product_info['manufacturers_name'] . ']</span>';
   } else {
     $products_name = $product_info['products_name'];

 

 

Hope this is of use to someone.... This will also label the quantity, manu's name, and model #. If you don't want the labels, just remove them where it says:

 

Product Model#:

Quantity Available:

Manufacturer:

Posted

One little thing I just noticed, the manu's name part does not work properly, for some reason it just displays the first manufactuer's name from the manufacturers table. Will fix this asap.

Posted

You will need to use this code instead of the one I posted originally:

 

<?php
 } else {
   $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, pa.manufacturers_name, pa.manufacturers_id, p.products_image, pd.products_url, p.products_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, " . TABLE_MANUFACTURERS . " pa where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and p.manufacturers_id = pa.manufacturers_id and pd.language_id = '" . (int)$languages_id . "'");
   $product_info = tep_db_fetch_array($product_info_query);

 

 

I promise this one will work.

  • 2 months later...
Posted

I tried and it works.

 

Here You have something to file product_info.php

I use this to place some infos in tables.

 

<? echo $product_info['products_quantity']; ?>

 

<? $r = mysql_fetch_array(mysql_query("SELECT * FROM " . TABLE_MANUFACTURERS . " WHERE manufacturers_id='$product_info[manufacturers_id]'"));
echo $r['manufacturers_name'];
?>

 

<? echo '['.$product_info['products_model'].']'; ?>

 

its simply and works. In this way I makle many other things.

 

bye

  • 4 months later...
Posted
I tried and it works.

 

Here You have something to file product_info.php

I use this to place some infos in tables.

 

<? echo $product_info['products_quantity']; ?>

 

<? $r = mysql_fetch_array(mysql_query("SELECT * FROM " . TABLE_MANUFACTURERS . " WHERE manufacturers_id='$product_info[manufacturers_id]'"));
echo $r['manufacturers_name'];
?>

 

<? echo '['.$product_info['products_model'].']'; ?>

 

its simply and works. In this way I makle many other things.

 

bye

i'm trying to get the manufacturers name to appear in the what new box, i used the code from the above post but nothing is returned to the screen,

 

cam anyone help?

Posted

hmmmm..... Does $r need to be defined as a variable. If so where and how would it be done?

Posted

If your have trouble getting this to work in Version 2.2

Try change the "pa" to "pm"

 

in these kind of statements

pa.manufacturers_id
  • 4 weeks later...
Posted

WARNING: DO NOT PUT THIS CODE IN YOUR SITE. IT WILL FUBAR IT!

 

Is anyone crafty enought to make it say for 0 quanity a message like "Call for information?"

 

something like....

 

if ($products_quantity [products_qty=>0]) { echo TEXT_ZERO_QUANTITY}

else {

(tep_not_null($product_info['products_model'])) {

$products_name = $product_info['products_name'] . '<span class="smallText"><br>Manufacturer: ' . $product_info['manufacturers_name'] . '<span class="smallText"><br>Manufacturer# ' . $product_info['products_model'] . '<br>Available: ' . $product_info['products_quantity'] . '</span>';

} else {

$products_name = $product_info['products_name'];

}

 

 

Would be nice to have a define (TEXT_ZERO_QUANTITY, 'Call for Price'); in includes/english/prod_info.php so you could customize such a beast.

 

Anyone up to the challenge? I'm still waiting for my MySQL and Php books/videos to download :(

 

Brad

Posted
Is anyone crafty enought to make it say for 0 quanity a message like "Call for information?"

 

something like....

 

Would be nice to have a define (TEXT_ZERO_QUANTITY, 'Call for Price'); in includes/english/prod_info.php so you could customize such a beast.

 

Anyone up to the challenge? I'm still waiting for my MySQL and Php books/videos to download :(

 

Brad

I am reasonable sure there is Contribution already made for that.

Have you had a look in the contributions? I have read either in this forum or came across it in the contributions about people wanting that done.

Posted
Is anyone crafty enought to make it say for 0 quanity a message like "Call for information?"

 

something like....

 

Would be nice to have a define (TEXT_ZERO_QUANTITY, 'Call for Price'); in includes/english/prod_info.php so you could customize such a beast.

 

Anyone up to the challenge? I'm still waiting for my MySQL and Php books/videos to download :(

 

Brad

I am reasonable sure there is Contribution already made for that.

Have you had a look in the contributions? I have read either in this forum or came across it in the contributions about people wanting that done.

Yeah, have that intstalled already long ago. How would you make it work with this one?

Posted
WARNING: DO NOT PUT THIS CODE IN YOUR SITE. IT WILL FUBAR IT!

 

Is anyone crafty enought to make it say for 0 quanity a message like "Call for information?"

 

something like....

 

if ($products_quantity [products_qty=>0]) { echo TEXT_ZERO_QUANTITY}

else {

(tep_not_null($product_info['products_model'])) {

$products_name = $product_info['products_name'] . '<span class="smallText"><br>Manufacturer: ' . $product_info['manufacturers_name'] . '<span class="smallText"><br>Manufacturer# ' . $product_info['products_model'] . '<br>Available: ' . $product_info['products_quantity'] . '</span>';

} else {

$products_name = $product_info['products_name'];

}

 

 

Would be nice to have a define (TEXT_ZERO_QUANTITY, 'Call for Price'); in includes/english/prod_info.php so you could customize such a beast.

 

Anyone up to the challenge? I'm still waiting for my MySQL and Php books/videos to download :(

 

Brad

osjunkie

 

Change this echo

echo TEXT_ZERO_QUANTITY

To something like

echo TEXT_ZERO_CALL

And then put a "define" line in the appropriate PHP file where ever the TEXT_ZERO_QUANTITY is being drawn from.

eg: catalog/includes/languages/english/filename.php

 

define('TEXT_ZERO_CALL', 'Call for Price');

 

OR you can simply just change the text that the echo is displaying for TEXT_ZERO_QUANTITY in the same file.

 

Sorry I kind of missed this note before.

 

I'm sure this should work without a hitch.

  • 1 year later...
Posted
I tried and it works.

 

Here You have something to file product_info.php

I use this to place some infos in tables.

 

<? echo $product_info['products_quantity']; ?>

 

<? $r = mysql_fetch_array(mysql_query("SELECT * FROM " . TABLE_MANUFACTURERS . " WHERE manufacturers_id='$product_info[manufacturers_id]'"));
echo $r['manufacturers_name'];
?>

 

<? echo '['.$product_info['products_model'].']'; ?>

 

its simply and works. In this way I makle many other things.

 

bye

Thanks! made it really simple indeed

 

~Barbara~

  • 2 weeks later...
  • 1 month later...
Posted
osjunkie

 

Change this echo

echo TEXT_ZERO_QUANTITY

To something like

echo TEXT_ZERO_CALL

And then put a "define" line in the appropriate PHP file where ever the TEXT_ZERO_QUANTITY is being drawn from.

eg: catalog/includes/languages/english/filename.php

 

define('TEXT_ZERO_CALL', 'Call for Price');

 

OR you can simply just change the text that the echo is displaying for TEXT_ZERO_QUANTITY in the same file.

 

Sorry I kind of missed this note before.

 

I'm sure this should work without a hitch.

 

 

Then, how can I put manufacturer's image bottom of the product image? Please help.

Archived

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

×
×
  • Create New...