Forums / General Questions / Get products from one current manufacturer

Get products from one current manufacturer

Started by perfumbg on 13 Dec 2013, 8:10 PM · Views: 1,339

Results 1 to 5 of 5
13 Dec 2013, 8:10 PM
#1
perfumbg avatar

perfumbg

Zen Follower

Join Date:
May 2010
Posts:
192
Plugin Contributions:
5

Get products from one current manufacturer

Hi is there a way to show all products from one manufacturer, and that manufaturer is manufacturer of the curently watched produt?

something simmilar to the sugestion here [ http://www.zen-cart.com/showthread.php?120738-Current-Category-Product-List-Sidebox](http://www.zen-cart.com/showthread.php?120738-Current-Category-Product-List-Sidebox)

but for manufacturers not for categories?

Many regards to all.

My most recent work: magprom.net

15 Dec 2013, 7:50 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Get products from one current manufacturer

perfumbg:

Hi is there a way to show all products from one manufacturer, and that manufaturer is manufacturer of the curently watched produt?

something simmilar to the sugestion here [ http://www.zen-cart.com/showthread.php?120738-Current-Category-Product-List-Sidebox](http://www.zen-cart.com/showthread.php?120738-Current-Category-Product-List-Sidebox)

but for manufacturers not for categories?

Many regards to all.

I haven't tried it, but I would say that the following should work... I made it based on what I think it should look like to work... There may be some extra information being returned by the select query..

in includes/modules/sideboxes create manlist.php(short for manufacturerlist) and include this code:

<?php      require($template->get_template_dir('tpl_manlist.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes') . '/tpl_manlist.php');      $title = '';     $title_link = false;      require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default); 	 ?>

And then:
Then in includes/templates/YOUR_TEMPLATE/sideboxes create tpl_manlist.php and add this:

 <?php 
/** 
 * Product Listing Sidebox by Current Manufacturer
 * 
 */ 

  $content = ''; 
  $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">'; 
     
    $prolist_query = "select  

            products.products_image, products_description.products_name, products_to_categories.*, categories_description.categories_id, categories_description.categories_name, 
            categories.categories_image, categories.categories_id, manufacturers.*, manufacturers_info.manufacturers_url 
             
            from products, products_description, products_to_categories, categories_description, categories,  manufacturers, manufacturers_info 
             
            where products.manufacturers_id = '$manufacturers_id' 
            and products.products_id = products_to_categories.products_id 
            and products_description.products_id = products_to_categories.products_id 
            and products.manufacturers_id = manufacturers.manufacturers_id
            and manufacturers.manufacturers_id = manufacturers_info.manufacturers_id
            and products.products_id = products_description.products_id 
             
            order by products_description.products_name 
            "; 
     
        $prolist = $db->Execute($prolist_query); 
         
    if (!$prolist->fields['manufacturers_image'] == null){ 
        $content .= '<div class="manimage">' . zen_image(DIR_WS_IMAGES . $prolist->fields['manufacturers_image'], '<h2>' . $prolist->fields['manufacturers_name'] . '</h2>', 'class="listingManProductImage"') . '</div>'; 
    }else{ 
        $content .= '<h2>' . $prolist->fields['manufacturers_name'] . '</h2>'; 
    } 
     
     while (!$prolist->EOF) { 
       $content .=  '<a href="' . zen_href_link(zen_get_info_page($prolist->fields['products_id']), ($_GET['cPath'] > 0 ? 'cPath=' . $_GET['cPath'] . '&' : '') . 'products_id=' . $prolist->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $prolist->fields['products_image'], $prolist->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '</a>'; 
       $prolist->MoveNext(); 
   }; 
     
  $content .= '</div>'; 
     
     
?>
```

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

21 Dec 2013, 7:44 AM
#3
perfumbg avatar

perfumbg

Zen Follower

Join Date:
May 2010
Posts:
192
Plugin Contributions:
5

Re: Get products from one current manufacturer

Thanks a lot I will try it :)

My most recent work: magprom.net

21 Dec 2013, 7:58 AM
#4
perfumbg avatar

perfumbg

Zen Follower

Join Date:
May 2010
Posts:
192
Plugin Contributions:
5

Re: Get products from one current manufacturer

It does the job but returns every product 30 or 40 times, and shows only when you are on manufacturers page, not on products_info...

I will try to modify it a bit but, i dont understand very well msql.

Thanks a lot.

My most recent work: magprom.net

30 Jan 2014, 3:32 PM
#5
perfumbg avatar

perfumbg

Zen Follower

Join Date:
May 2010
Posts:
192
Plugin Contributions:
5

Re: Get products from one current manufacturer

Hi again i tried a litle harder and here is a working sollution if somebody needs it

$prolist_query = "select 

			products.products_image, products_description.products_name, products_to_categories.*, categories_description.categories_id
			
			from products, products_description, products_to_categories, categories_description
			
			where products.manufacturers_id = '" . zen_get_products_manufacturers_id((int)$_GET['products_id']) . "'
			and categories_description.categories_id = '$current_category_id'
			and products.products_status = 1
			and categories_description.categories_id = products_to_categories.categories_id
			and products_description.products_id = products_to_categories.products_id
			and products.products_id = products_description.products_id
			
			order by products_description.products_name
			LIMIT 4
			";

If you lant more than 4 products you can change the LIMIT at the bottom to the desired number of products.

My most recent work: magprom.net