Forums / General Questions / Show Manufacturer in New Products

Show Manufacturer in New Products

Views: 1,942

Results 1 to 7 of 7
20 Sep 2008, 1:04 AM
#1
rustydutch avatar

rustydutch

New Zenner

Join Date:
Apr 2008
Posts:
3
Plugin Contributions:
0

Show Manufacturer in New Products

Is it possible to show the manufacturer in the New Products, Specials and the like areas? Basically, I would like this to show so I don't have to put the manufacturer in the product title. I can't find this info in other forums.

Thank you in advanced,

20 Sep 2008, 1:26 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show Manufacturer in New Products

If you mean the New Products Listing ... you can look in Configuration ... New Listing ...

Display Product Manufacturer Name
Do you want to display the Product Manufacturer Name?

0= off
1st digit Left or Right
2nd and 3rd digit Sort Order
4th digit number of breaks after

Default is: 2302

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

20 Sep 2008, 2:53 AM
#3
rustydutch avatar

rustydutch

New Zenner

Join Date:
Apr 2008
Posts:
3
Plugin Contributions:
0

Re: Show Manufacturer in New Products

Thank you but That's not the areas I mean. I mean on the front page where new products show on the sides and in the middle. The products show just the image and the item name. I would like to see manufacturer there.

Thanks again.

20 Sep 2008, 3:44 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show Manufacturer in New Products

You could look in any of the places where you see the manufacturers name and customize the code to fit where you need it to work ...

Example, this will call the manufacturer's name:

    $manufacturers_name= zen_get_products_manufacturers_name((int)$_GET['products_id']);

You need to find the right value for the products_id and replace:
(int)$_GET['products_id']

with that value and then if you can use the:
$manufacturers_name

where you need the name displayed ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

10 Oct 2008, 2:44 AM
#5
scudone avatar

scudone

New Zenner

Join Date:
Sep 2008
Posts:
8
Plugin Contributions:
0

Re: Show Manufacturer in New Products

here is my code to get the manufacturer name below the image :

<?php
/**
 * new_products.php module
 *
 * @package modules
 * @copyright Copyright 2003-2007 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: new_products.php 6424 2007-05-31 05:59:21Z ajeh $
 */
if (!defined('IS_ADMIN_FLAG')) {
  die('Illegal Access');
}

// initialize vars
$categories_products_id_list = '';
$list_of_products = '';
$new_products_query = '';

$display_limit = zen_get_new_date_range();

if ( (($manufacturers_id > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) {
  $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, pd.products_description, p.manufacturers_id,
                                p.products_date_added, p.products_price, p.products_type, p.master_categories_id
                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                           where p.products_id = pd.products_id
                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                           and   p.products_status = 1 " . $display_limit;
} else {
  // get all products and cPaths in this subcat tree
  $productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit);

  if (is_array($productsInCategory) && sizeof($productsInCategory) > 0) {
    // build products-list string to insert into SQL query
    foreach($productsInCategory as $key => $value) {
      $list_of_products .= $key . ', ';
    }
    $list_of_products = substr($list_of_products, 0, -2); // remove trailing comma

    $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, pd.products_description, p.manufacturers_id,
                                  p.products_date_added, p.products_price, p.products_type, p.master_categories_id
                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                           where p.products_id = pd.products_id
                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                           and p.products_id in (" . $list_of_products . ")";
  }
}

if ($new_products_query != '') $new_products = $db->ExecuteRandomMulti($new_products_query, MAX_DISPLAY_NEW_PRODUCTS);

$row = 0;
$col = 0;
$list_box_contents = array();
$title = '';

$num_products_count = ($new_products_query == '') ? 0 : $new_products->RecordCount();

// show only when 1 or more
if ($num_products_count > 0) {
  if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS == 0 ) {
    $col_width = floor(100/$num_products_count);
  } else {
    $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS);
  }

  while (!$new_products->EOF) {
  
    if (!isset($productsInCategory[$new_products->fields['products_id']])) $productsInCategory[$new_products->fields['products_id']] = zen_get_generated_category_path_rev($new_products->fields['master_categories_id']);

  
    $products_img = (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a>');
	
	$products_name = '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a>';
    
	$products_desc = substr(strip_tags($new_products->fields['products_description']), 0, 55) . '...';
	    
	$manufacturers_name= zen_get_products_manufacturers_name((int)$_GET['products_id']);  
	
	$manufacturers_name= zen_get_products_manufacturers_name($new_products->fields['products_id']);  
	
    $products_price = '<strong>' . zen_get_products_display_price($new_products->fields['products_id']) . '</strong>';
  
  
  	$img_col_w = IMAGE_PRODUCT_NEW_WIDTH + 15;
 



	if (SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS > 1 && $num_products_count > 1) {
	
		if ($col > 0 && $col < SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS) {
			$tm_param = 'style="margin-left:5px;"';
		} else {
			$tm_param = '';
		}
	
    $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => 
	
			'<div class="product_list_col" align="center" ' . $tm_param . '>
				<div class="margin_col">
					' . $products_img . '<br />
					</div>
					<div class="manu">
						' . $manufacturers_name. '<br />
					</div>
					<div class="name">
						' . $products_name . '
					</div>
						<div class="price">
						' . $products_price . '
					</div>
					<div class="clear"></div>
				</div>
			</div>'
				
				
				);
				
	} else {

    $list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => 
	
			'<div class="product_list">
				<div class="left" style="width:' . $img_col_w . 'px;">
					' . $products_img . '
				</div>
				<div class="right" style="margin-left:-' . $img_col_w . 'px;">
					<div class="margin" style="margin-left:' . $img_col_w . 'px;">
						<div class="name">
							' . $products_name . '
						</div>
						<div class="text">
							' . $products_desc . '
						</div>
						<div class="price">
							' . $products_price . '
						</div>
						<div class="button">' . $products_######## . '</div>
						<div class="clear"></div>
					</div>
				</div>
				<div class="clear"></div>
			</div>'
					
			);
	
	}





    $col ++;
    if ($col > (SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS - 1)) {
      $col = 0;
      $row ++;
    }
    $new_products->MoveNextRandom();
  }

  if ($new_products->RecordCount() > 0) {
    if (isset($new_products_category_id) && $new_products_category_id != 0) {
      $category_title = zen_get_categories_name((int)$new_products_category_id);
      $title = '

		<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>

	  ';
    } else {
      $title = '

		<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . '</h2>

	  ';
    }
    $zc_show_new_products = true;
  }
}
?>
9 May 2011, 1:59 PM
#6
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,683
Plugin Contributions:
0

Re: Show Manufacturer in New Products

Will this code do what I want to do? Here is an image an example. Or something close to that?

9 May 2011, 4:43 PM
#7
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,683
Plugin Contributions:
0

Re: Show Manufacturer in New Products

scudone:

here is my code to get the manufacturer name below the image :

<?php /** * new_products.php module * * @package modules * @copyright Copyright 2003-2007 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: new_products.php 6424 2007-05-31 05:59:21Z ajeh $ */ if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } // initialize vars $categories_products_id_list = ''; $list_of_products = ''; $new_products_query = ''; $display_limit = zen_get_new_date_range(); if ( (($manufacturers_id > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) { $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, pd.products_description, p.manufacturers_id, p.products_date_added, p.products_price, p.products_type, p.master_categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' and p.products_status = 1 " . $display_limit; } else { // get all products and cPaths in this subcat tree $productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit); if (is_array($productsInCategory) && sizeof($productsInCategory) > 0) { // build products-list string to insert into SQL query foreach($productsInCategory as $key => $value) { $list_of_products .= $key . ', '; } $list_of_products = substr($list_of_products, 0, -2); // remove trailing comma $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, pd.products_description, p.manufacturers_id, p.products_date_added, p.products_price, p.products_type, p.master_categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' and p.products_id in (" . $list_of_products . ")"; } } if ($new_products_query != '') $new_products = $db->ExecuteRandomMulti($new_products_query, MAX_DISPLAY_NEW_PRODUCTS); $row = 0; $col = 0; $list_box_contents = array(); $title = ''; $num_products_count = ($new_products_query == '') ? 0 : $new_products->RecordCount(); // show only when 1 or more if ($num_products_count > 0) { if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS == 0 ) { $col_width = floor(100/$num_products_count); } else { $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS); } while (!$new_products->EOF) { if (!isset($productsInCategory[$new_products->fields['products_id']])) $productsInCategory[$new_products->fields['products_id']] = zen_get_generated_category_path_rev($new_products->fields['master_categories_id']); $products_img = (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a>'); $products_name = '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a>'; $products_desc = substr(strip_tags($new_products->fields['products_description']), 0, 55) . '...'; $manufacturers_name= zen_get_products_manufacturers_name((int)$_GET['products_id']); $manufacturers_name= zen_get_products_manufacturers_name($new_products->fields['products_id']); $products_price = '<strong>' . zen_get_products_display_price($new_products->fields['products_id']) . '</strong>'; $img_col_w = IMAGE_PRODUCT_NEW_WIDTH + 15; if (SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS > 1 && $num_products_count > 1) { if ($col > 0 && $col < SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS) { $tm_param = 'style="margin-left:5px;"'; } else { $tm_param = ''; } $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"', 'text' => '<div class="product_list_col" align="center" ' . $tm_param . '> <div class="margin_col"> ' . $products_img . '<br /> </div> <div class="manu"> ' . $manufacturers_name. '<br /> </div> <div class="name"> ' . $products_name . ' </div> <div class="price"> ' . $products_price . ' </div> <div class="clear"></div> </div> </div>' ); } else { $list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"', 'text' => '<div class="product_list"> <div class="left" style="width:' . $img_col_w . 'px;"> ' . $products_img . ' </div> <div class="right" style="margin-left:-' . $img_col_w . 'px;"> <div class="margin" style="margin-left:' . $img_col_w . 'px;"> <div class="name"> ' . $products_name . ' </div> <div class="text"> ' . $products_desc . ' </div> <div class="price"> ' . $products_price . ' </div> <div class="button">' . $products_######## . '</div> <div class="clear"></div> </div> </div> <div class="clear"></div> </div>' ); } $col ++; if ($col > (SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS - 1)) { $col = 0; $row ++; } $new_products->MoveNextRandom(); } if ($new_products->RecordCount() > 0) { if (isset($new_products_category_id) && $new_products_category_id != 0) { $category_title = zen_get_categories_name((int)$new_products_category_id); $title = ' <h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2> '; } else { $title = ' <h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . '</h2> '; } $zc_show_new_products = true; } } ?>

Why do you give a bad coding that will not work?