Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding a Manufacture Image to the product_info.php


johnnyosc

Recommended Posts

Hello Guys,

 

How would you hack the code to take the Manufacture image (logo) from the right column to place it in the product info page that doesnt include either a left or right column? It would be place above the title of the product and would need to have a link that connects to the Manufacture's other product page if clicked on. This would be a great and easy hack (for experience coders) to minimized all the different boxes that osc has. I agree that osc has too many boxes and anything to minimized it and be able to use it is great in my opinion.

 

Thanks in advance,

johnnyosc

Link to comment
Share on other sites

hello ajeh,

 

i search the previous post and came up with our code below but it doesn't show the image. It just shows the text. How would I edit it to show the text?

 

regards,

johnny

 

 

 

Then in product_info.php, you can call the function

 

<?php echo tep_get_manufacturers_name($HTTP_GET_VARS['products_id']); ?>

 

Place that where you are wanting the manufacture's name to appear.

Code:

////

// Return a product's manufacturer

// TABLES: manufacturer

function tep_get_manufacturers_name($products_id) {

 

$product_manufacturers_query = tep_db_query("select manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'");

$product_manufacturers = tep_db_fetch_array($product_manufacturers_query);

 

$the_manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . $product_manufacturers['manufacturers_id'] . "'");

$the_manufacturers = tep_db_fetch_array($the_manufacturers_query);

 

return $the_manufacturers['manufacturers_name'];

}

 

 

 

Then, where ever you want to use this on the products_info.php you can calling something like this:

Code:

<tr>

<td colspan="2" class="main">

<?php echo 'Manufacture: ' . tep_get_manufacturers_name($HTTP_GET_VARS['products_id']); ?>

</td>

</tr>

Link to comment
Share on other sites

Just add another function:

 

//// 

// Return a product's manufacturer 

// TABLES: manufacturer 

function tep_get_manufacturers_image($products_id) { 



$product_manufacturers_query = tep_db_query("select manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'"); 

$product_manufacturers = tep_db_fetch_array($product_manufacturers_query); 



$the_manufacturers_query = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . $product_manufacturers['manufacturers_id'] . "'"); 

$the_manufacturers = tep_db_fetch_array($the_manufacturers_query); 



return $the_manufacturers['manufacturers_image']; 

}

 

Now call it with:

tep_get_manufacturers_image($HTTP_GET_VARS['products_id'])

 

Easy eh? :D

Link to comment
Share on other sites

hello linda,

 

I tried it just like you said but it didnt work for some reason. I even put the semi colon after the tep_get_manufacturers_image($HTTP_GET_VARS['products_id']) and still didnt work. Your exapmle didnt have a semicolon after it. Not sure if it matters are not??

 

Using the text code it work fine but the image not? I did the same steps too. Must be an error with the code for the images?? Please advise.

 

thanks

johnnyosc

Link to comment
Share on other sites

With that code ... I get:

<tr>

 <td align=right class=main>

   <?php echo tep_get_manufacturers_image($products_id); ?><br>

   <?php echo tep_image(DIR_WS_IMAGES . tep_get_manufacturers_image($products_id)); ?>

 </td>

</tr>

 

The first echo is just the manufacturer's image filename, the second one is the actual display of the image.

 

It's all in how you utilize the function. Also, make sure you have a value $products_id or use the right value for when you use this function.

 

Does that help?

Link to comment
Share on other sites

thank you Linda,

 

For your quick and kind help. Much appreciated. The image work. I just used the <?php echo tep_image(DIR_WS_IMAGES . tep_get_manufacturers_image($products_id)); ?> instead of the

<?php echo tep_get_manufacturers_image($products_id); ?> Why would you call the first line if you want to display the image which was the second line of code?

 

Johnny

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...