Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Product list replacing dropdown manufacturer filter with images

Product list replacing dropdown manufacturer filter with images

Locked

Views: 6,080

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
25 Sep 2007, 3:18 PM
#1
roboto avatar

roboto

New Zenner

Join Date:
Apr 2007
Posts:
36
Plugin Contributions:
0

Product list replacing dropdown manufacturer filter with images

Hi zenners,

i need to replace the dropdown manufacturer sorter in the product list with the manufacturer images. so, instead of having the dropdown the user will sort per manufacturer products by clicking the appropriate manufacturer image. all the images should be listed in a columnar format.

this would be also a big style improvement in my opinion.

Any ideas on how to do this?

27 Sep 2007, 4:50 PM
#3
itmanvn avatar

itmanvn

New Zenner

Join Date:
Sep 2007
Posts:
2
Plugin Contributions:
0

Re: Product list replacing dropdown manufacturer filter with images

pls show me how you can do that :D

27 Sep 2007, 5:09 PM
#4
roboto avatar

roboto

New Zenner

Join Date:
Apr 2007
Posts:
36
Plugin Contributions:
0

Re: Product list replacing dropdown manufacturer filter with images

itmanvn:

pls show me how you can do that :D

Actually I think what i've done is not the right way to do it but it works and i coded everything without any help from this forum as usual. In my posts nobody mind to answer.

so, in tpl_index_product_list.php put the following code somewhere you want the logo to appear.

<?php
  if (!isset($_GET['manufacturers_id'])){
                             
?>
<table width="100%" border="0" cellspacing="1">
  <tr>
<?php 
        for ($i=1, $n=sizeof($options); $i<$n; $i++) {

     $manufacturer_image_sort_query = "select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image,
                                  mi.manufacturers_url
                           from " . TABLE_MANUFACTURERS . " m
                           left join " . TABLE_MANUFACTURERS_INFO . " mi
                           on (m.manufacturers_id = mi.manufacturers_id
                           and mi.languages_id = '" . (int)$_SESSION['languages_id'] . "'), " . TABLE_PRODUCTS . " p
                           where  p.manufacturers_id  = '" . (int)$options[$i]['id'] . "'
                           and p.manufacturers_id = m.manufacturers_id";
                                                  
                $manufacturer_image_sort = $db->Execute($manufacturer_image_sort_query);
                if ($manufacturer_image_sort->RecordCount() > 0) {
                
       echo '<td><a href="/index.php?main_page=index&cPath=' . $cPath . '&filter_id=' . $options[$i]['id'] . '">' . zen_image(DIR_WS_IMAGES . $manufacturer_image_sort->fields['manufacturers_image'], $manufacturer_image_sort->fields['manufacturers_name']) . '</a></td>'."\r\n";
      }
    }
?>
  </tr>
</table>    
<?php
     }
?>

The code does work but with limitations for now. if you have too many logos they will be costrained into one single line. i will fix it soon if i need that.

The ugly thing of this is that the code execute a MySQL query for every single logo displayed... very bad but for few logos is ok. I'm not that good with SQL query, i don't know how to select more than one record and put the risults in an array. i tried some solutions with no result.

20 Nov 2007, 12:39 PM
#5
svanis avatar

svanis

Zen Follower

Join Date:
May 2005
Location:
Sweden
Posts:
145
Plugin Contributions:
0

Re: Product list replacing dropdown manufacturer filter with images

Thank you, wonderful!

Also I have to :clap: your wicked design!

20 Nov 2007, 1:08 PM
#6
roboto avatar

roboto

New Zenner

Join Date:
Apr 2007
Posts:
36
Plugin Contributions:
0

Re: Product list replacing dropdown manufacturer filter with images

This an improved version with rows

<?php
 ($options[$i]['id']);
  if (!isset($_GET['manufacturers_id'])){
                             
?>
<table width="100%" border="0" cellspacing="0">
  <tr>
<?php 
        for ($i=1, $n=sizeof($options); $i<$n; $i++) {

     $manufacturer_image_sort_query = "select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image,
                                  mi.manufacturers_url
                           from " . TABLE_MANUFACTURERS . " m
                           left join " . TABLE_MANUFACTURERS_INFO . " mi
                           on (m.manufacturers_id = mi.manufacturers_id
                           and mi.languages_id = '" . (int)$_SESSION['languages_id'] . "'), " . TABLE_PRODUCTS . " p
                           where  p.manufacturers_id  = '" . (int)$options[$i]['id'] . "'
                           and p.manufacturers_id = m.manufacturers_id";
                                                  
                $manufacturer_image_sort = $db->Execute($manufacturer_image_sort_query);
                if ($manufacturer_image_sort->RecordCount() > 0) {
                
       echo '<td width="100" align="center"><span class="transparent"><a href="/index.php?main_page=index&cPath=' . $cPath . '&filter_id=' . $options[$i]['id'] . '">' . zen_image(DIR_WS_IMAGES . $manufacturer_image_sort->fields['manufacturers_image'], $manufacturer_image_sort->fields['manufacturers_name']) . '</a></span></td>'."\r\n";
      }
        if ( (($i+1) % 8) == 0 ) echo $newrow="</tr><tr>"; // change 6 to 8 and see
    }
?>
  </tr>
</table>    
<?php
     }
?>

Thanx for the compliments ;)

20 Nov 2007, 1:10 PM
#7
roboto avatar

roboto

New Zenner

Join Date:
Apr 2007
Posts:
36
Plugin Contributions:
0

Re: Product list replacing dropdown manufacturer filter with images

well... remove the class="trasparent" it's not needed

20 Nov 2007, 1:18 PM
#8
svanis avatar

svanis

Zen Follower

Join Date:
May 2005
Location:
Sweden
Posts:
145
Plugin Contributions:
0

Re: Product list replacing dropdown manufacturer filter with images

Thank you, it helped somewhat, I now managed to get it to fit in my design but its still not perfect to me.
Is it possible to make it just break the row after 3 logo's?

This is what it looks like now, leaving an empty space in the middle..
http://www.moto-x.se/utforsaljning-snoskoterdelar-c-1073_1075.html

20 Nov 2007, 1:21 PM
#9
roboto avatar

roboto

New Zenner

Join Date:
Apr 2007
Posts:
36
Plugin Contributions:
0

Re: Product list replacing dropdown manufacturer filter with images

Yep, just change "8" to "3" in the code below

  if ( (($i+1) % 8) == 0 ) echo $newrow="</tr><tr>"; // change 6 to 8 and see

hope it helps

20 Nov 2007, 1:32 PM
#10
svanis avatar

svanis

Zen Follower

Join Date:
May 2005
Location:
Sweden
Posts:
145
Plugin Contributions:
0

Re: Product list replacing dropdown manufacturer filter with images

Actually it doesn't.. it makes it worse..

20 Nov 2007, 1:36 PM
#11
roboto avatar

roboto

New Zenner

Join Date:
Apr 2007
Posts:
36
Plugin Contributions:
0

Re: Product list replacing dropdown manufacturer filter with images

Look at the HTML code, it works

<table width="100%" border="0" cellspacing="0">
  <tr>
<td width="415" align="center"><span><a href="/index.php?main_page=index&cPath=1073_1075&filter_id=13"><img src="images/air.jpg" alt="Air" title=" Air " width="135" height="50" /></a></span></td>
<td width="415" align="center"><span><a href="/index.php?main_page=index&cPath=1073_1075&filter_id=27"><img src="images/manufacturers/denso.jpg" alt="Denso" title=" Denso " width="135" height="50" /></a></span></td>
</tr><tr><td width="415" align="center"><span><a href="/index.php?main_page=index&cPath=1073_1075&filter_id=62"><img src="images/manufacturers/gates.jpg" alt="Gates" title=" Gates " width="135" height="50" /></a></span></td>
<td width="415" align="center"><span><a href="/index.php?main_page=index&cPath=1073_1075&filter_id=43"><img src="images/kimpex.jpg" alt="Kimpex" title=" Kimpex " width="135" height="50" /></a></span></td>
<td width="415" align="center"><span><a href="/index.php?main_page=index&cPath=1073_1075&filter_id=35"></a></span></td>
</tr><tr><td width="415" align="center"><span><a href="/index.php?main_page=index&cPath=1073_1075&filter_id=102"><img src="images/manufacturers/ntn.jpg" alt="NTN" title=" NTN " width="135" height="50" /></a></span></td>
<td width="415" align="center"><span><a href="/index.php?main_page=index&cPath=1073_1075&filter_id=72"></a></span></td>
<td width="415" align="center"><span><a href="/index.php?main_page=index&cPath=1073_1075&filter_id=46"><img src="images/sportech.jpg" alt="Sportech" title=" Sportech " width="135" height="50" /></a></span></td>
</tr><tr><td width="415" align="center"><span><a href="/index.php?main_page=index&cPath=1073_1075&filter_id=48"><img src="images/ufo.jpg" alt="UFO" title=" UFO " width="135" height="50" /></a></span></td>
  </tr>
</table>   

try to resize the logos

cheers

17 May 2009, 11:11 AM
#12
alvalong avatar

alvalong

New Zenner

Join Date:
Feb 2008
Posts:
74
Plugin Contributions:
0

Re: Product list replacing dropdown manufacturer filter with images

what is $options do? my &options return empty arrary. why?
i already set options name and value.

what does filter_id stand for? for categories id or manufactories id?

2 Jun 2009, 5:09 PM
#13
wilsonm5 avatar

wilsonm5

New Zenner

Join Date:
Nov 2008
Posts:
21
Plugin Contributions:
0

Re: Product list replacing dropdown manufacturer filter with images

I understand this is an old thread but I can't find any other thread that comes close to what I need.

I need to list the Manufacturers in a list, such as the Categories list, instead of a Drop Down list.

There is a Manufacturers_Form form somewhere but I am not sure how to edit it and even where it is.

Can anyone help?

30 Jul 2009, 1:14 AM
#14
edwardtilbury avatar

edwardtilbury

Zen Follower

Join Date:
Sep 2007
Posts:
169
Plugin Contributions:
0

Re: Product list replacing dropdown manufacturer filter with images

I am also looking for this.. any ideas? It's hard to understand this deep code.

8 Sep 2009, 10:07 AM
#15
zarenya avatar

zarenya

New Zenner

Join Date:
Sep 2009
Location:
South Africa
Posts:
9
Plugin Contributions:
0

Re: Product list replacing dropdown manufacturer filter with images

Can someone please assist me how to show all the logos below on the main page of my shop. I have them logos updated to the Manufacturers directory.

I don't know PHP, can you help :blink:

12 Sep 2009, 5:37 PM
#16
zarenya avatar

zarenya

New Zenner

Join Date:
Sep 2009
Location:
South Africa
Posts:
9
Plugin Contributions:
0

Re: Product list replacing dropdown manufacturer filter with images

I have found a solution to my question above. How can I delete my posts here.