Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product Info - Manufacturer's Name Adding HTML Link to Name


Bobber

Recommended Posts

Hi Everyone!

 

I am having a bit of trouble trying to make a change...

 

I am using this code on my products information page to display the manufacturer's name:

    $manufacturer_info_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = " . (int)$product_info['manufacturers_id'] );
    $manufacturers_info = tep_db_fetch_array($manufacturer_info_query); 
    if (tep_not_null($manufacturers_info['manufacturers_name'])) {
      $products_name = $product_info['products_name'] . '<br /><h3>MFG: <strong>' . $manufacturers_info['manufacturers_name'] . '</strong></h3>';
    } else {
      $products_name = $product_info['products_name'];
    }

I want to change this so it is not just text, but rather a clickable link that would lead to the manufacturer's complete product offerings...

 

/index.php?manufacturers_id=

 

For example...

 

Any Ideas???

Link to comment
Share on other sites

  • 7 months later...

Here is the solution I found:

<div>
<?php $manufacturer_query = tep_db_query("select m.manufacturers_name, m.manufacturers_id from " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS . " p  where p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id"); $manufacturer = tep_db_fetch_array($manufacturer_query);?>
<?php if (tep_not_null($manufacturer['manufacturers_name'])) {echo '<h3>MFG: <strong><a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturer['manufacturers_id'] , 'NONSSL') . '">'. $manufacturer['manufacturers_name'] . '</strong></h3></a>';}?>
</div>

This is an original piece of code that I created and it works great for me!

 

What this does is make the Manufacturer's Name into a clickable link.

 

It is not underlined, but you should be able to change that depending upon your application and CSS code for your website.

 

Once you click on the link it takes you to a product root page with all of the items associated with the manufacturer.

 

I hope this addition is a positive contribution to your website as well :-)

Link to comment
Share on other sites

Is this not a standard feature in all versions. There is the ability to turn on a manufacturers info box in the left or right column which shows a logo and clickable link to a page that shows all of the manufacturers products, plus a drop down to see categories that feature the manufacturers products.

 

Whilst I am not knocking the work you did, you should really have made this into a module that needs no core code changes, and can be easily added with one click, which is the way that oscommerce is trying to head.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...