Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

manufacturer's logos


Guest

Recommended Posts

Hi everyone

 

I have a need for this and I just wondered if there was already a contribution to do it?

 

As the manufacturers and their respective images (logos), are already in the database is it possible to write something that will just output ALL these images to a page? This page could could simply list the manuacturers you use and link through to the products that they have in your site?

 

I can't be the first person to think this would be useful, so I'd appreacite it if someone could point me in the right direction.

 

Cheers

 

Neil :)

Link to comment
Share on other sites

i can't found it in the contributions section, why?

 

contribute it!!!

 

cheers

emiliano

That would be because there is not contribution for it....I wrote it! I believe it would be hard for me to contribute it since as you can see my site is very custom and this php page contains some code that does not apply to your sites.

 

I basically took the all products contrib and re-worked it.

 

Should I jsut post that section of code that does this?

Link to comment
Share on other sites

Here is the "meat" of it.... I think this part should be generic for most of you. Hope this helps someone. But like I said, I just tweaked the "all products" contrib:

 

             <?php	
   $languages_query = tep_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " order by sort_order");
   while ($languages = tep_db_fetch_array($languages_query)) {
   $languages_array[] = array('id' 	 => $languages['languages_id'],
            'name'  => $languages['name'],
                                     'code'  => $languages['code'],
                                     'image'  => $languages['image'],
                                          'directory'	=> $languages['directory']);
   }
           for ($i=0; $i<sizeof($languages_array); $i++) {    
             $this_language_id = $languages_array[$i]['id'];
   $this_language_name = $languages_array[$i]['name'];
   $this_language_code = $languages_array[$i]['code'];
   $this_language_image = $languages_array[$i]['image'];
   $this_language_directory = $languages_array[$i]['directory'];
   echo " <tr>\n";
   $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name, manufacturers_image from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
   $manufacturers_array = array();
   while($manufacturers = tep_db_fetch_array($manufacturers_query)) {
      $manufacturers_array[] = array('id'   => $manufacturers['manufacturers_id'],
              'name' => $manufacturers['manufacturers_name'],
           'image' => $manufacturers['manufacturers_image']);
   }
   for ($j=0; $j<NR_COLUMNS; $j++) {
  	 echo "   <td class=main valign=\"top\" align=\"center\">\n";
  	 for ($k=$j; $k<sizeof($manufacturers_array); $k+=NR_COLUMNS) {
     $this_manufacturers_id   = $manufacturers_array[$k]['id'];
     $this_manufacturers_name = $manufacturers_array[$k]['name'];
     $this_manufacturers_image = $manufacturers_array[$k]['image'];
     echo "     <a href=\"" . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $this_manufacturers_id . (($this_language_code == DEFAULT_LANGUAGE) ? '' : ('&language=' . $this_language_code)), 'NONSSL', false) . "\"><img src=\"/catalog/images/" . $this_manufacturers_image . "\" border=\"0\" align=\"center\" alt=\" $this_manufacturers_name \"></a><br>\n";
     echo "<br />";
     }
  	 echo "   </td>\n";
   }
      echo " </tr>\n";
	 }
?>

Link to comment
Share on other sites

Thanks so much for the code, I am looking for just that.

Though Im not getting it correctly. I copied your code and made a file named allmanuf.php as you had. Placed it in my main catalog directly and just tried to view it with url catalog/allmanuf.php. I get the follwoing error.

Fatal error: Call to undefined function: tep_db_query() in /usr/local/www/vhosts/worldconspiracy.org/htdocs/dev/loaded6.015b_beta/allmanuf.php on line 2

 

Also would it be possible to have both your manufacturers logo page and the orignal drop down menu for the manufacturers?

 

Any help?

 

PS, love your site, probably one of the best looking OSC sites Ive seen.

Link to comment
Share on other sites

You are probably missing some code. The code I posted above is just one component of that whole file. Posting my whole file would be useless since I deviated from the standard structure and would only confuse everyone (ex. I do not use a header.php or column_right.php, etc.)

 

Make sure you have the application_top.php and other common files that are loaded on every page included in your allmanuf.php

 

hope that helps

Link to comment
Share on other sites

Very helpful stuff ... this is what worked for me .. based on carrerarod's code of course ..

 

<?php 
? ? $info_box_contents = array();
? ?$info_box_contents[] = array('text' => sprintf("TABLE_HEADING_MANUFACTURER_LIST", strftime('%B')));
?
?	new contentBoxHeading($info_box_contents);
?
? $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name, manufacturers_image from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
? $manufacturers_array = array();
? ? $row = 0;
?$col = 0;
?	$k=0;
? while($manufacturers = tep_db_fetch_array($manufacturers_query)) {
? ? ?$manufacturers_array[] = array('id' ? => $manufacturers['manufacturers_id'],
? ? ? ? ? ? ?'name' => $manufacturers['manufacturers_name'],
? ? ? ? ? 'image' => $manufacturers['manufacturers_image']);
? //}

? ?//for ($k=0; $k<sizeof($manufacturers_array); $k++) {
? ? $this_manufacturers_id ? = $manufacturers_array[$k]['id'];
? ? $this_manufacturers_name = $manufacturers_array[$k]['name'];
? ? $this_manufacturers_image = $manufacturers_array[$k]['image'];
? ? //echo " ? ? <a href=\"" . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $this_manufacturers_id . (($this_language_code == DEFAULT_LANGUAGE) ? '' : ('&language=' . $this_language_code)), 'NONSSL', false) . "\"><img src=\"images/" . $this_manufacturers_image . "\" border=\"0\" align=\"center\" alt=\" $this_manufacturers_name \"></a><br>\n";
? ? //echo "<br />";
? ? $k++;
?$info_box_contents[$row][$col] = array('align' => 'center',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'params' => 'class="smallText" width="33%" valign="top"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $this_manufacturers_id) . '">'.tep_image(DIR_WS_IMAGES . $this_manufacturers_image, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) .'</a><br>');

? ?$col ++;
? ?if ($col > 3) {
? ? ?$col = 0;
? ? ?$row ++;
? ?}
?}

?new contentBox($info_box_contents);
?>

note: The number of columns is hardcoded for 4 columns here

I put the above in the modules folder as a separate file .. manufacturers_listing.php

 

and then i include it anywhere using

<?php
? ?include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);
?>

which requires adding the following to includes/filenames.php

 ?define('FILENAME_MANUFACTURER_LIST', 'manufacturer_listing.php');

and the following to includes/languages/english/index.php

define('TABLE_HEADING_MANUFACTURER_LIST', 'Manufacturers');

 

There probably might be some mistakes in there ..

Edited by vinnz
Link to comment
Share on other sites

i have the ms1 installed and i have this error :

 

Fatal error: Call to undefined function: tep_db_query() in c:\program files\easyphp\www\rc\catalog\allprods.php on line 2

 

the line 2 is :

 $languages_query = tep_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " order by sort_order");

 

any advices ?

and by the way , your code is it still to have a page with a layout like http://www.lildevilmotorsports.com/catalog/allmanuf.php

 

also i dont understand :

<?php
  include(DIR_WS_MODULES . [COLOR=red][B]FILENAME_UPCOMING_PRODUCTS[/B][/COLOR]);
?>

 

upcoming products ?

MS2

Link to comment
Share on other sites

Like I mentioned when I posted the code intially it was not all inclusive since I have a bunch of extra code specific to my business that would confuse all of you.

 

My guess is you are getting the error because you are not loading /includes/application_top.php at the top of the file before that command gets executed. You should load that file as "high" as possible in your .php file.

 

hope this helps...

 

B)

Link to comment
Share on other sites

Quick question. Is there a way to display the name of the manufacturer without the image?

 

Thanks

Moneer

just replace this section:

 

'text' =>

 

with the variable for the manufacturers name.

 

B)

Link to comment
Share on other sites

havent tested but replace with:

 

'text' => $this_manufacturers_name);

 

just check your syntax to make sure all the proper parens and semicolons are where they are supposed to be

Link to comment
Share on other sites

Thanks for your help. Here is the part I replaced for future reference.

 

                                          'text' => '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $this_manufacturers_id) . '">' . $this_manufacturers_name . '</a><br>');

 

 

Thanks

Link to comment
Share on other sites

i get really lost ... i hope one of you will have patience enought to release a full code ... and post it as a contribution , i fought 3 hours , and I finally i feel really frustrated by my so low phph level

MS2

Link to comment
Share on other sites

No problem. I created a file called manall.php . Then I placed this code inside of it to show only the name of the manufacturer ( not the image).

 

<?php

/*

  $Id: allprods.php,v 1.5 2002/09/29 1

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright © 2002 osCommerce

 

  Released under the GNU General Public License

 

*/

 

  require('includes/application_top.php');

 

// Set number of columns in listing

define ('NR_COLUMNS', 4);

//

 

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

 

 

<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

  <tr>

    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="8">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

    </table></td>

<!-- body_text //-->

    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

      <tr>

        <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

          <tr>

        <td class="pageHeading"><?php echo Brands; ?></td>

            <td align="right"></td>

          </tr>

        </table></td>

      </tr>

<?php

    $info_box_contents = array();

$info_box_contents[] = array('text' => sprintf("Brands List", strftime('%B')));

 

  new contentBoxHeading($info_box_contents);

 

  $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name, manufacturers_image from " . TABLE_MANUFACTURERS . " order by manufacturers_name");

  $manufacturers_array = array();

    $row = 0;

$col = 0;

  $k=0;

  while($manufacturers = tep_db_fetch_array($manufacturers_query)) {

    $manufacturers_array[] = array('id'  => $manufacturers['manufacturers_id'],

            'name' => $manufacturers['manufacturers_name'],

          'image' => $manufacturers['manufacturers_image']);

  //}

 

  //for ($k=0; $k<sizeof($manufacturers_array); $k++) {

    $this_manufacturers_id  = $manufacturers_array[$k]['id'];

    $this_manufacturers_name = $manufacturers_array[$k]['name'];

    $this_manufacturers_image = $manufacturers_array[$k]['image'];

    //echo "    <a href=\"" . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $this_manufacturers_id . (($this_language_code == DEFAULT_LANGUAGE) ? '' : ('&language=' . $this_language_code)), 'NONSSL', false) . "\"><img src=\"images/" . $this_manufacturers_image . "\" border=\"0\" align=\"center\" alt=\" $this_manufacturers_name \"></a><br>\n";

    //echo "<br />";

    $k++;

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

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

                                          'text' => '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $this_manufacturers_id) . '">' . $this_manufacturers_name . '</a><br>');

 

  $col ++;

  if ($col > 3) {

    $col = 0;

    $row ++;

  }

}

 

new contentBox($info_box_contents);

?>

<!-- body_eof //-->

<!-- body_text_eof //-->

    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="8">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

    </table></td>

  </tr>

</table>

<!-- body_eof //--> <!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

You might have some different codes depending on how you structured your files.

Hope that helps

 

Moneer

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...