Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

All Manufacturers Categories 1.0


mugitty

Recommended Posts

I have installed All Manufacturers and their Products Categories 1.0 (thank you Carine). Since I have some manufacturers that have products in many categories and others with just a few, the stock 3 column layout left big gaps when a manufacturer with many categories fell next to one with just a few. I changed the output so that there is just 1 column with the manufacturer name followed by its product categories. I also amended the manufacturer logo/name line to show both the logo and the name.

 

Having done that, I am left with the following problems:

 

1) The logo appears to be formatted so that any text next to it is aligned at the bottom of the logo - I need to have it aligned along the centerline of the logo

 

2) The category output will break a category name that has a space in it so that part of the name wraps to the next line - how can I prevent breaks and/or specify a given number of category names to appear before there is a break to the next line

 

My amended code is below

<!-- all manufacturers begin //-->
<?php
$row = -1;
$manufacturers_query = tep_db_query("SELECT DISTINCT count(p2c.products_id) as prodcount, cd.categories_id, cd.categories_name, m.manufacturers_id, manufacturers_name, manufacturers_image FROM " . TABLE_PRODUCTS . " p, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_MANUFACTURERS ." m, " . TABLE_PRODUCTS_TO_CATEGORIES ." p2c WHERE p.manufacturers_id = m.manufacturers_id AND p.products_id = p2c.products_id AND p.products_status = 1 AND p2c.categories_id = c.categories_id and c.categories_id = cd.categories_id and cd.language_id = " . (int)$languages_id . "  GROUP BY m.manufacturers_name, cd.categories_name");
$last_manid = '';
while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
  if ($manufacturers['manufacturers_id'] <> $last_manid ) {
	  $row++;
		  if ($last_manid) { 
			  echo '</td>';
	  if ((($row / 1) == floor($row / 1))) {
?>
	  </tr>
	  <tr>
	  <?php
	  }
	  } 
	  $last_manid = $manufacturers['manufacturers_id'];
	echo '<td align="left" valign="top" width="100%" class="main">';
	echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id'] , 'NONSSL', false) . '">';
//If you'd like to have an image shown, remove the comment slashes from the next lines
	if ($manufacturers['manufacturers_image']) { 
		echo tep_image(DIR_WS_IMAGES . $manufacturers['manufacturers_image'], $manufacturers['manufacturers_name'], '', '') . tep_draw_separator('pixel_trans.gif', '50', '1') . '<font size="+1"><b>'. $manufacturers['manufacturers_name'] . '</b></font><br>';
	  } else {
		echo '<h4>'. $manufacturers['manufacturers_name'] .'</h4>';
	  }
  		echo "</a>";
  } 
  echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id'] . '&category_id=' . $manufacturers['categories_id'], 'NONSSL', false) . '" style="text-decoration: none;">';
  echo $manufacturers['categories_name'] . ' ('.$manufacturers['prodcount'].')';
  	  echo "</a>   ";
}
?>
		<!-- all manufacturers end //-->

Any suggestions would be appreciated

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

Solved the line break problem but still no joy with the alignment

 

I've run into something else, though...

 

Has anybody who is using this found that, while the categories display correctly under each manufacturer, if you click the link to one of the categories, it doesn't filter for that category - it brings up a result page that contains all of the products from that manufacturer.

 

I am appending the code for the query and result display if anyone can tell me how to correct it so the filter is applied

<!-- all manufacturers begin //-->
<?php
$row = -1;
$manufacturers_query = tep_db_query("SELECT DISTINCT count(p2c.products_id) as prodcount, cd.categories_id, cd.categories_name, m.manufacturers_id, manufacturers_name, manufacturers_image FROM " . TABLE_PRODUCTS . " p, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_MANUFACTURERS ." m, " . TABLE_PRODUCTS_TO_CATEGORIES ." p2c WHERE p.manufacturers_id = m.manufacturers_id AND p.products_id = p2c.products_id AND p.products_status = 1 AND p2c.categories_id = c.categories_id and c.categories_id = cd.categories_id and cd.language_id = " . (int)$languages_id . "  GROUP BY m.manufacturers_name, cd.categories_name");
$last_manid = '';
while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
if ($manufacturers['manufacturers_id'] <> $last_manid ) {
	$row++;
	if ($last_manid) { 
		echo '<br><br>' . tep_draw_separator('pixel_silver.gif', '90%', '1') . '</td>';
		if ((($row / 1) == floor($row / 1))) {
?>
						</tr>
						<tr>
<?php
		}
	} 
	$last_manid = $manufacturers['manufacturers_id'];
	echo '				  <td align="center" valign="top" width="100%" class="main">';
	echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id'] , 'NONSSL', false) . '">';
//If you'd like to have an image shown, remove the comment slashes from the next lines
	if ($manufacturers['manufacturers_image']) { 
		echo tep_image(DIR_WS_IMAGES . $manufacturers['manufacturers_image'], $manufacturers['manufacturers_name'], '', '') . tep_draw_separator('pixel_trans.gif', '50', '1') . '<font size="+1"><b>'. $manufacturers['manufacturers_name'] . '</b></font><br><br>';
	} else {
		echo '<font size="+1"><b>'. $manufacturers['manufacturers_name'] .'</b></font><br><br>';
	}
	echo "</a>";
} 
echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id'] . '&category_id=' . $manufacturers['categories_id'], 'NONSSL', false) . '" style="text-decoration: none;">';
echo  '<nobr>' . $manufacturers['categories_name'] . '</nobr> ('.$manufacturers['prodcount'].')';
echo '</a>   ';
}
?>
<!-- all manufacturers end //-->

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

Well, I uploaded the original catalog/all_manufacturers_categories.php as it originally came out of the contribution download - just in case I messed something up with my amendments - and I get the same thing...

 

When you click on a category under a manufacturer's name, you get the entire catalog for that manufacturer, not just the category that was clicked on.

 

The path that is shown in the link from the all categories page is similar to:

 

The path that is shown once you are looking at the product listing for that manufacturer and use the on page filter to filter for the same category looks like:

 

...so apparently category_id in and of itself does not return a filtered listing for a category whereas filter_id seems to.

 

Anybody know how to rewrite this code to select the filtered list? (code is above in previous post)

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

I think I should stop uploading contributions :o

I customized that bit on my site and it works here ...

 

Almost at the end of the code you posted just above, just replace

 

'&category_id'

 

with

'&filter_id'

 

I think that will do the trick

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

I think I should stop uploading contributions :o

I customized that bit on my site and it works here ...

 

Almost at the end of the code you posted just above, just replace

 

'&category_id'

 

with

'&filter_id'

 

I think that will do the trick

 

Carine;

 

Thank you, that did the trick!

I thought it might be as simple as that, but wasn't sure if the initial query might need to be modified as well.

 

BTW - Don't you dare quit offering contributions...

Your name is among the top 10 that I look for when I'm looking to see if there is new and helpful information and/or contributions available

:thumbsup:

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

thank you for the compliment :)

now you make me curious - who are the other 9 ? :D

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

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...