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
but for manufacturers not for categories?
Many regards to all.
Re: Get products from one current manufacturer
Quote:
Originally Posted by
perfumbg
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 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 Code:
<?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>';
?>
Re: Get products from one current manufacturer
Thanks a lot I will try it :)
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.
Re: Get products from one current manufacturer
Hi again i tried a litle harder and here is a working sollution if somebody needs it
PHP Code:
$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.