Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do I make manufacturer apear under name?


mborin

Recommended Posts

  • Replies 57
  • Created
  • Last Reply

This function will get you the manufacturer's name.

////

// Return a product's manufacturer

// TABLES: manufacturer

 function tep_get_manufacturers_name($products_id) {

   global $languages_id;



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

   $product = tep_db_fetch_array($product_query);



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

   $the_manufacturers = tep_db_fetch_array($the_manufacturers_query);



   return $the_manufacturers['manufacturers_name'];

 }

 

Then just add a tep_get_manufacturers_name($products_id) ... you need to supply the right product id ... and it will show where you want it. :D

Link to comment
Share on other sites

I'm confused as to where to add the code. What I need to do is when you view the default page there's a table that's titled New Products For September and below it there are pictures of products with their model names. What I want to do is to also display the manufacturer's name below the picture of each product. Please help me out. Thank you very much.

Link to comment
Share on other sites

I'm confused as to where to add the code. What I need to do is when you view the default page there's a table that's titled New Products For September and below it there are pictures of products with their model names. What I want to do is to also display the manufacturer's name below the picture of each product. Please help me out. Thank you very much.

 

Add the function above and then edit /catalog/includes/modules/new_products.php and change the original code of:

    $info_box_contents[$row][$col] = array('align' => 'center',

                                          'params' => 'class="smallText" width="33%" valign="top"',

                                          'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])));

To the new code:

    $info_box_contents[$row][$col] = array('align' => 'center',

                                          'params' => 'class="smallText" width="33%" valign="top"',

                                          'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '<br>' . tep_get_manufacturers_name($new_products['products_id'])   );

 

Just be sure to add that function from above for getting the manufactures name to something like /includes/functions/general.php

 

I always try to add new things like functions and definitions and such to the very end of a file just before the last ?> so that they do not interfer with existing code, are easy to find and if they happen to use existing code then they do not break so easily :shock:

Link to comment
Share on other sites

Glad that the peices came together for you.

 

Mainly just trace down where you want something and stick an . 'x' . next to it or some type of mark to make sure you are in the right location. If the x shows up on the screen, then you know you are in the right location for making changes to that particular page.

 

Most everything is handled in a nice easy to locate method by finding the filenames in upper case to tell you what is being run. The DIR_WS_something tells you the location ie. DIR_WS_INCLUDES means look in the /includes directory.

 

As you peice your way through the code, Windows File Search is pretty handy at locating any snip of text or a variable you might need. If it cannot be found, limit your search a bit as sometimes the text is peiced together or has special characters to it. Try not to look for words like Let's ... this is not written as Let's because of the appostrophe and you will never locate it unless you remember to add in the slash.

 

Meanwhile ... glad that helped you out. :D

Link to comment
Share on other sites

  • 4 weeks later...

Add this function to your /includes/functionsgeneral.php or which ever function file you usually add new functions to.

 

NOTE: there was a typo in the above function :shock:

 

 

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.

////

// 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:

<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

You have a simple mod on your site where you have a text field under the item's picture in which a shopper can specify the quantity of an item then click on add to cart button. Please show me how to do this. Thank you

Link to comment
Share on other sites

That is a combination of using Quantity, Minimum Quantity, and Quantity Units defined on a per product basis.

 

I would have to break it out of the code I have it in. Or, it will be part of the next update of the Free Call for Price v4.1

 

You can test this at:

 

http://www.thewebmakerscorner.com/working/...products_id=121

Link to comment
Share on other sites

Hi Lind,

 

I need a way to edit the product fields in the orders.php. I need a way to change quantity, shipping fee and other fields. I also need a way to add extra items to the order. Is there a simple way to mod this? If not can you make this for me, I will pay.

 

Thank you

Link to comment
Share on other sites

Linda, can you help me for this problem ?

 

I need to add the Manufacturer name near the product description in the product list (admin/categories.php) in the administration.

I'm not a PHP programmer and for me is very difficult to change the source code.

 

Thanks in advance

 

Tato

Link to comment
Share on other sites

Yes this is why I need this mod. I need a way to edit the various fields and post credits and other accounting related stuff.

 

 

Hi Linda, any chance you can do the above? Just let me know how much.

Link to comment
Share on other sites

I can probably do anything you are asking for but it would help if I really knew what you were asking for :shock:

 

You say you want the manufacture in the /admin/categories.php

 

It's already there.

 

Are you meaning on the product listing before you go to edit the product that you need to see the manufacture name?

Link to comment
Share on other sites

Linda,

 

yes, there is in insert or edit a product, but I'd like to see the manufacturer name in the "list" of products, when I enter in a category I can see all the product descriptions but not the manufacturer name.

I try to explain better, this is the header of the page:

 

Category / Product Status Action

 

 

now I'd like to put near the product description the manufacturer name.

 

Excuse me for my bad english !!

 

Bye

Tato

Link to comment
Share on other sites

Add to /admin/includes/languages/english/categories.php

 

define('TABLE_HEADING_MANUFACTURERS','Manufacture');

 

Add following function to the end of one of the function files, before the ?>, like /admin/includes/functions/general.php

 

 

////

// 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'];

 }

 

2 edits to the /admin/categories.php ...

 

Find:

                <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CATEGORIES_PRODUCTS; ?></td>

               <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>

               <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>

 

Change to:

                <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CATEGORIES_PRODUCTS; ?></td>

               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MANUFACTURERS; ?></td>

               <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>

               <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>

 

Find:

                <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id'] . '&action=new_product_preview&read=only') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> ' . $products['products_name']; ?></td>

               <td class="dataTableContent" align="center">

 

Change to:

                <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id'] . '&action=new_product_preview&read=only') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> ' . $products['products_name']; ?></td>

               <td class="dataTableContent"><?php echo tep_get_manufacturers_name($products['products_id']) ?></td>

               <td class="dataTableContent" align="center">

 

Easy, eh? :shock:

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...