Zen Cart Logo
Forums / General Questions / Need help with a query

Need help with a query

Views: 2,692

Results 21 to 36 of 36
10 Mar 2016, 1:54 PM
#21
mc12345678 avatar

mc12345678

Totally Zenned

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

Need help with a query

clint6998:

Looks pretty good after the css. Might need just a little more tweaking of it. I do have one concern though. When you click a letter, it does go down to it as it should, however, it removes everything above it so you can't scroll back up. ANy ideas on that?

Thanks,

Clint

Remove everything? Not seeing that, but then again also on a cell phone where currently seeing only two columns and the second column is being cut off...

Could though add a "back to top" link adjacent to each letter and the applicable link code around the list of letters. (Btw, last letter visible on my cell phone is: U in full and half of V...)

10 Mar 2016, 2:15 PM
#22
clint6998 avatar

clint6998

Zen Follower

Join Date:
Aug 2012
Posts:
106
Plugin Contributions:
0

Re: Need help with a query

mc12345678:

Remove everything? Not seeing that, but then again also on a cell phone where currently seeing only two columns and the second column is being cut off...

Could though add a "back to top" link adjacent to each letter and the applicable link code around the list of letters. (Btw, last letter visible on my cell phone is: U in full and half of V...)

That's strange that it cuts off at "U". My phone sees it all but it also cuts off the second column instead of floating left like it should. Any ideas why it would float from 3 columns to 2 but not 2 to 1?

Also, I want to put a line "|" between each letter. I can do that but them it puts one after the last one. Can you help on how to NOT put on after the last one?

Also, still trying to replace the numbers with a #. Could you help with the script? I cant write it but something like "if first character does not start with a letter, then show "#" and then list all numerical values under the "#"?"

10 Mar 2016, 3:25 PM
#23
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Need help with a query

clint6998:

That's strange that it cuts off at "U". My phone sees it all but it also cuts off the second column instead of floating left like it should. Any ideas why it would float from 3 columns to 2 but not 2 to 1?

Also, I want to put a line "|" between each letter. I can do that but them it puts one after the last one. Can you help on how to NOT put on after the last one?

Also, still trying to replace the numbers with a #. Could you help with the script? I cant write it but something like "if first character does not start with a letter, then show "#" and then list all numerical values under the "#"?"

The issue, and not sure how/where you are adding the pipe character |, but if you wrap it in an if statement such that:

 if ($i < (last value of applicable $i - 1)) { 

So, I've addressed three issues in one below, doesn't take care of any "float" issues, though that is likely more because of the various CSS that would probably be involved. Currently the display is linear from left to right, instead of being columnar with each column being in its own div/span or each item being in its own container like an odd/even scenario and therefore can't slide into the list to maintain alphabetic order in a single column. BTW, my second column is also cut short on my cell phone. Anyways, The below "highlighted" code is what has been changed:

<?php
     echo '<div id="alphanumericWrapper"><a name="attop">';
     echo 'Manufacturers ';
     echo '<a href="'. $_SERVER['REQUEST_URI'] . '#hash">#</a>';
     for ($i=65; $i<91; $i++) {
     echo '|';
     echo '<a href="'. $_SERVER['REQUEST_URI'] . '#' . chr($i).'">' . chr($i) . '</a>';
     }
     echo '</a></div>';

 echo '<br class="clearBoth" />';


 $manufacturers_query = "SELECT distinct manufacturers_id, manufacturers_name FROM " . TABLE_MANUFACTURERS . " ORDER BY manufacturers_name"; 

 $manufacturers = $db->Execute($manufacturers_query);
 $numeric_displayed = false;

 while (!$manufacturers->EOF) {

     if (!is_numeric(strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1))) && $initial !== strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1))) {
         $initial = strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1));

         echo '<br class="clearBoth" />';
         echo '<a name="'.$initial.'" class="bold bigger defaultColor">' . $initial . '</a>';
         echo ' <a href="'.$_SERVER['REQUEST_URI'] . '#attop">Back to Top</a>';
         echo '<br class="clearBoth" />';
     } elseif (!$numeric_displayed && is_numeric(strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1)))) {
         $initial = strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1));

         echo '<br class="clearBoth" />';
         echo '<a name="hash" class="bold bigger defaultColor">#</a>';
         echo ' <a href="'.$_SERVER['REQUEST_URI'] . '#attop">Back to Top</a>';
         echo '<br class="clearBoth" />';
         $numeric_displayed = true;
     }

 echo '<div style="width: 33.3%; float: left;"><a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . (int) $manufacturers->fields['manufacturers_id'], $request_type) . '">' . $manufacturers->fields['manufacturers_name'] . '</a></div>';


       $manufacturers->MoveNext();
     }

         echo '<br class="clearBoth" />';
 ?> 

This resequenced the # symbol to the beginning (such businesses appear first), which allows the pipe symbol (|) to be inserted before the next "letter" and therefore there is never a symbol that follows another letter, it always precedes the next letter. Then it (untested) displays the # symbol one time with all of the businesses that begin with a number, then once a letter is encountered, it switches to displaying the original code with each letter being displayed followed by the manufacturers that begin with that letter until the end. Also, have added a Back to Top link that should return back to the list of characters and is displayed adjacent to each main divider character.

10 Mar 2016, 5:12 PM
#24
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Need help with a query

Fyi, just checked in on changes, looks like the numbers have been moved to the front of the pick list at top but that doesn't match any of the code provided here... Is a change since earlier post, so know that it has since been touched.

10 Mar 2016, 7:04 PM
#25
clint6998 avatar

clint6998

Zen Follower

Join Date:
Aug 2012
Posts:
106
Plugin Contributions:
0

Re: Need help with a query

ok so I have made a few changes to the page and css. Here is the new php and a screen shot as it seems that in a the listings are in teh following order:

div-->manufacturers-->clearBoth-->Next alpha-->attop link. Any ideas? See image below php

<?php 
    echo '<div id="alphanumericWrapper"><span class="buttonRow btn"><div style="float: left; padding: 0;margin:4,0"><a name="attop">'; 
    echo '<a href="'. $_SERVER['REQUEST_URI'] . '#hash">#</a></div>';
    for ($i=65; $i<91; $i++) {
    echo '<div style="float: left; padding: 0;margin:4,0"><a href="'. $_SERVER['REQUEST_URI'] . '#' . chr($i).'">' . chr($i) . '</a></div>'; 
    }
    echo '</span></div>'; 

echo '<br class="clearBoth" /><br class="clearBoth" />'; 


$manufacturers_query = "SELECT distinct manufacturers_id, manufacturers_name FROM " . TABLE_MANUFACTURERS . " ORDER BY manufacturers_name";  

$manufacturers = $db->Execute($manufacturers_query); 
$numeric_displayed = false;

while (!$manufacturers->EOF) { 

    if (!is_numeric(strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1))) && $initial !== strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1))) { 
        $initial = strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1)); 
        echo '<br class="clearBoth" /><br class="clearBoth" />'; 
        echo '<h4 class="manufacturers" style="width: 100%"><a name="'.$initial.'" class="bold bigger defaultColor">' . $initial . '</a><span style="align: right;" class="btn buttonRow"><a href="'.$_SERVER['REQUEST_URI'] . '#attop">Back to Top</a></span></h4>'; 
       

        echo '<br class="clearBoth" /><br class="clearBoth" />'; 
    } elseif (!$numeric_displayed && is_numeric(strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1)))) {
         $initial = strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1));

         echo '<br class="clearBoth" />';
         echo '<h4 class="manufacturers" style="width: 100%"><a name="hash" class="bold bigger defaultColor">#</a>';
         echo ' <span style="align: right;" class="btn buttonRow"><a href="'.$_SERVER['REQUEST_URI'] . '#attop">Back to Top</a></span></h4>';
         echo '<br class="clearBoth" />';
         $numeric_displayed = true;
     }

echo '<div style="width: 33.3%; float: left; min-width:200px"><a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . (int) $manufacturers->fields['manufacturers_id'], $request_type) . '">' . $manufacturers->fields['manufacturers_name'] . '</a></div>'; 


      $manufacturers->MoveNext(); 
    } 

        echo '<br class="clearBoth" />'; 
?>

screenshot
Attachment 16095

10 Mar 2016, 7:11 PM
#26
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Need help with a query

Missing a matching close for the attop a tag.```

<?php echo '<div id="alphanumericWrapper"><span class="buttonRow btn"><div style="float: left; padding: 0;margin:4,0"><a name="attop">'; echo '<a href="'. $_SERVER['REQUEST_URI'] . '#hash">#</a></div>'; for ($i=65; $i<91; $i++) { echo '<div style="float: left; padding: 0;margin:4,0"><a href="'. $_SERVER['REQUEST_URI'] . '#' . chr($i).'">' . chr($i) . '</a></div>'; } echo '</a></span></div>'; ``` Weird, I posted the code. Last line modified.
10 Mar 2016, 7:22 PM
#27
clint6998 avatar

clint6998

Zen Follower

Join Date:
Aug 2012
Posts:
106
Plugin Contributions:
0

Re: Need help with a query

mc12345678:

Missing a matching close for the attop a tag.```

<?php echo '<div id="alphanumericWrapper"><span class="buttonRow btn"><div style="float: left; padding: 0;margin:4,0"><a name="attop">'; echo '<a href="'. $_SERVER['REQUEST_URI'] . '#hash">#</a></div>'; for ($i=65; $i<91; $i++) { echo '<div style="float: left; padding: 0;margin:4,0"><a href="'. $_SERVER['REQUEST_URI'] . '#' . chr($i).'">' . chr($i) . '</a></div>'; } echo '</a></span></div>'; ``` > > Weird, I posted the code. Last line modified. I must have deleted by accident when making style changes and rearranging to put the hash tag in the front. No matter what I do with the css I cannot seem to get a margin between the alpha and manufacturers above it... Great work getting me where I am!!! Thank you all so much!!
10 Mar 2016, 7:30 PM
#28
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Need help with a query

Three things I see. One, adaptive tactical appears twice, not sure what the background is for the entered information, but it became obvious when it went single column.
Two, the back to top clickable link I would suggest having adjacent the letter rather than below it. It takes up a lot of screen space.
Three, the letter row doesn't wrap and is now truncated at T.

10 Mar 2016, 7:39 PM
#29
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Need help with a query

clint6998:

I must have deleted by accident when making style changes and rearranging to put the hash tag in the front. No matter what I do with the css I cannot seem to get a margin between the alpha and manufacturers above it...

Great work getting me where I am!!! Thank you all so much!!

These days I'm rarely in a position to evaluate the css, because my phone though powerful doesn't offer that type of review. But, hopefully you are "testing" the css by use of tools like firebug for firefox (ie pressing f12) and or clearing your cache, though that doesn't always immediately fix the loaded page as css can be cached in the internet and take a bit to get displayed... Maybe as much as a day. But if you use a local tool like rbarbour did, you can see how it ought to be. :P

10 Mar 2016, 7:50 PM
#30
clint6998 avatar

clint6998

Zen Follower

Join Date:
Aug 2012
Posts:
106
Plugin Contributions:
0

Re: Need help with a query

mc12345678:

These days I'm rarely in a position to evaluate the css, because my phone though powerful doesn't offer that type of review. But, hopefully you are "testing" the css by use of tools like firebug for firefox (ie pressing f12) and or clearing your cache, though that doesn't always immediately fix the loaded page as css can be cached in the internet and take a bit to get displayed... Maybe as much as a day. But if you use a local tool like rbarbour did, you can see how it ought to be. :P

Yeah this redesign is being more of a pain in the a$$ than I had expected. Didnt realize how much languages have evolved over the last 4 years. Having trouble getting the back to top button moved to the right side instead of under...All in good time I guess.

Thanks for also pointing out the duplicate manufacturer. never even noticed that.

I used firefox and chromes dev tools to inspect and clear cache quite often. nothing sucks more than making the change the does work and you just cant see it bcz of cache. talk about driving you crazy.

14 Mar 2016, 11:18 AM
#31
cvhainb avatar

cvhainb

Zen Follower

Join Date:
Sep 2008
Posts:
212
Plugin Contributions:
19

Re: Need help with a query

clint6998:

I created a page from the ezpages for my manufacturers. I have over 300. What I would like to do is have A-Z at the top, and then a section for each letter and have the query list all manufacturers for that letter but I have no clue how to go about it.

This is what I had in mind:
Attachment 16088

Can anyone assist with a script?

Thanks,

Clint

When you see the same question, you only should discuss about the idea how to do, don't help them to do it because it is not good for them :)

Regarding this question, this is my idea:

  1. Query all manufacturers.
  2. Create an array and detect the first character.
  3. If the manufacturer name has the first character, push it into array.
$array['A'] = array('A Brand', 'AB brand');
$array['B'] = array('B Brand', 'BB brand');
  1. Loop and show it.
14 Mar 2016, 1:17 PM
#32
clint6998 avatar

clint6998

Zen Follower

Join Date:
Aug 2012
Posts:
106
Plugin Contributions:
0

Re: Need help with a query

cvhainb:

When you see the same question, you only should discuss about the idea how to do, don't help them to do it because it is not good for them :)

Regarding this question, this is my idea:

  1. Query all manufacturers.
  2. Create an array and detect the first character.
  3. If the manufacturer name has the first character, push it into array.

$array['A'] = array('A Brand', 'AB brand');
$array['B'] = array('B Brand', 'BB brand');

> 
> 4. Loop and show it.

Is this not a community?  Communities help each other.   You say it is not good for coders to help write for someone in need?  Its because of people like the ones who have helped me and others that bring ideas to life and help bet peoples sites online.  I know how to drive a car but I am no mechanic.  Talking to people on a forum would not get my car fixed unless someone told me exactly what was wrong and how to fix it.  Otherwise I would have to take it to a mechanic.  Thank you for your input and code, but this issue has already been resolved with many thanks to the few people who contributed in writing the code for me.
14 Mar 2016, 8:21 PM
#33
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,290
Plugin Contributions:
39

Re: Need help with a query

Would be incredibly simpler to use link anchors to a div for each letter and maybe a little javascript affect.

Found a simple tutorial, below, saved a ton of typing =)

1.) Name the Target
Choose the exact spot you want to send your link to, choose and element near it (a div, header tag, paragraph.. whatever as long as it's in the right spot), add id="something", you can call them anything you like as long as the names are the same in the link and the target ID and preferably no spaces (spaces change to %20 in the address bar and look a tad messy).

An example would look like this:

<div id="whatever-you-want-to-call-it"> The content of your div here. </div>

2.) Link To Your Anchor Target
To link to your anchor simply use:
<a href="#whatever-you-want-to-call-it">Link Text Here</a>

or if it's on another page:
<a href="pagename.html#whatever-you-want-to-call-it">Link Text Here</a>

Sometimes simpler is far better,

~Melanie

14 Mar 2016, 9:12 PM
#34
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Need help with a query

mprough:

Would be incredibly simpler to use link anchors to a div for each letter and maybe a little javascript affect.

Found a simple tutorial, below, saved a ton of typing =)

Sometimes simpler is far better,

~Melanie

Not sure what ton of typing is being saved, the solution that was previously provided used a very similar approach allowing/using ascii character codes as the link identifier (modifiable to whatever value/span desired) and the list of items was/is generated from live store data which therefore could then be used on any such store and would change on the fly rather than having to be "maintained". Looking at the end result, although there was php code support needed to get the process done, there has been other web effects added.

I mean if there was anything I might change about the provided code would be that the header list would exclude letters that are not to be found in the below list. At the same time if a company say in Germany has an umlauted first letter, it will not show up properly in the list as it doesn't start with one of the prescribed letters and not a number... But, overall it's a robust solution for the vast majority of situations and relatively easy to maintain. The worst case by not having the above "change", is that there isn't a letter on which to click to go to the applicable company grouping, but the company (manufacturer) is still listed.

As to providing code versus pseudo code, yeah, time and place. But someone had some kick back time while hanging out waiting for a flight and an interest to write some code.... Helped a zenner out, maybe they learned something from it and might apply it to something else in the future, maybe more ideas will come forth.

15 Mar 2016, 7:11 AM
#35
drint avatar

drint

New Zenner

Join Date:
Mar 2016
Posts:
14
Plugin Contributions:
0

Re: Need help with a query

clint6998:

ok so I have made a few changes to the page and css. Here is the new php and a screen shot as it seems that in a the listings are in teh following order:

div-->manufacturers-->clearBoth-->Next alpha-->attop link. Any ideas? See image below php

<?php echo '<div id="alphanumericWrapper"><span class="buttonRow btn"><div style="float: left; padding: 0;margin:4,0"><a name="attop">'; echo '<a href="'. $_SERVER['REQUEST_URI'] . '#hash">#</a></div>'; for ($i=65; $i<91; $i++) { echo '<div style="float: left; padding: 0;margin:4,0"><a href="'. $_SERVER['REQUEST_URI'] . '#' . chr($i).'">' . chr($i) . '</a></div>'; } echo '</span></div>'; echo '<br class="clearBoth" /><br class="clearBoth" />'; $manufacturers_query = "SELECT distinct manufacturers_id, manufacturers_name FROM " . TABLE_MANUFACTURERS . " ORDER BY manufacturers_name"; $manufacturers = $db->Execute($manufacturers_query); $numeric_displayed = false; while (!$manufacturers->EOF) { if (!is_numeric(strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1))) && $initial !== strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1))) { $initial = strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1)); echo '<br class="clearBoth" /><br class="clearBoth" />'; echo '<h4 class="manufacturers" style="width: 100%"><a name="'.$initial.'" class="bold bigger defaultColor">' . $initial . '</a><span style="align: right;" class="btn buttonRow"><a href="'.$_SERVER['REQUEST_URI'] . '#attop">Back to Top</a></span></h4>'; echo '<br class="clearBoth" /><br class="clearBoth" />'; } elseif (!$numeric_displayed && is_numeric(strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1)))) { $initial = strtoupper(substr($manufacturers->fields['manufacturers_name'], 0, 1)); echo '<br class="clearBoth" />'; echo '<h4 class="manufacturers" style="width: 100%"><a name="hash" class="bold bigger defaultColor">#</a>'; echo '##<span style="align: right;" class="btn buttonRow"><a href="'.$_SERVER['REQUEST_URI'] . '#attop">Back to Top</a></span></h4>'; echo '<br class="clearBoth" />'; $numeric_displayed = true; } echo '<div style="width: 33.3%; float: left; min-width:200px"><a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . (int) $manufacturers->fields['manufacturers_id'], $request_type) . '">' . $manufacturers->fields['manufacturers_name'] . '</a></div>'; $manufacturers->MoveNext(); } echo '<br class="clearBoth" />'; ?>
> 
> screenshot
> Attachment 16095

I agree with @cvhainb, and I have some suggestion for you:

```php
<?php
// manufacturers map page
// includes/modules/pages/manufacturers_map/header_php.php
// template: includes/templates/YOUR_TEMPLATE/templates/tpl_manufacturers_map_default.php
// store manufacturers in array
$number_list = $manufacturers_list = array();
$letter_list = range('A', 'Z');
$manufacturers_map_title = 'Manufacturers Map';
$link_format = '<li><a href="%s%s" target="_self">%s</a></li>';
$manufacturers_map_link = zen_href_link('manufacturers_map');
$manufacturers_mid_link = zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=%d');
$breadcrumb->add($manufacturers_map_title);
define(META_TAG_TITLE, $manufacturers_map_title . PRIMARY_SECTION . TITLE);
// fetch all manufacturers from db
// ORDER BY usually cause low performance problem, using PHP sort instead
$manufacturers_list_get = $db->Execute(sprintf('SELECT manufacturers_id, manufacturers_name FROM `%s`;', TABLE_MANUFACTURERS));
while (!$manufacturers_list_get->EOF) {
  $manufacturers_name = ucwords(trim($manufacturers_list_get->fields['manufacturers_name']));
  $first_letter = substr($manufacturers_name, 0, 1);
  // check if number
  if (is_numeric($first_letter)) {
    $number_list[] = array('name' => $manufacturers_name, 'id' => $manufacturers_list_get->fields['manufacturers_id']);
  }else{
    // check if duplicate
    if (!isset($manufacturers_list[$first_letter][$manufacturers_name])) {
      $manufacturers_list[$first_letter][$manufacturers_name] = $manufacturers_list_get->fields['manufacturers_id'];
    }
  }
  $manufacturers_list_get->MoveNext();
}
// now we can show manufacuters list in includes/templates/YOUR_TEMPLATE/templates/tpl_manufacturers_map_default.php
//EOF

template: includes/templates/YOUR_TEMPLATE/templates/tpl_manufacturers_map_default.php

<style>
  .clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}
  .clearfix{*+height:1%;}
  #manufacturers_map{}
  #manufacturers_letter ul{list-style: none;}
  #manufacturers_letter ul li{border-right: 1px solid #aaa; float: left; margin: 0;}
  #manufacturers_letter ul li:last-child{border: none;}
  #manufacturers_letter ul li a{display: inline-block; padding: 0 5px;}
  .manufacturers_list{margin: 15px 0;}
  .manufacturers_list .letter{margin-top: 10px;}
  .manufacturers_list .letter h3{display: inline-block;}
  .manufacturers_list .letter span{float: right;}
  .manufacturers_list .letter span a{color: #aaa}
  .manufacturers_list .list{list-style: none; border-top: 1px solid #aaa;}
  .manufacturers_list .list li{float: left; width: 33%}
</style>
<div id="manufacturers_map">
  <h1><?php echo $manufacturers_map_title;?></h1>
  <div id="manufacturers_letter">
    <ul class="clearfix">
    <?php
      echo sprintf($link_format, $manufacturers_map_link, "#hash", '#');
      foreach ($letter_list as $letter) {
        echo sprintf($link_format, $manufacturers_map_link, "#$letter", $letter);
      }
    ?>
    </ul>
  </div>
  <?php
    $block = '<div class="manufacturers_list"><div class="letter clearfix"><h3><a name="%s"></a>%s</h3><span><a href="%s#">top</a></span></div><ul class="list clearfix">%s</ul></div>';
    if (!empty($number_list)) {
      $links = array();
      foreach ($number_list as $num_item) {
        $links[] = sprintf($link_format, sprintf($manufacturers_mid_link, $num_item['id']), '', $num_item['name']);
      }
      echo sprintf($block, 'hash', '#', $manufacturers_map_link, implode('', $links));
    }
    foreach ($letter_list as $letter) {
      if (isset($manufacturers_list[$letter])) {
        $block_data = sprintf($block, $letter, $letter, $manufacturers_map_link, '%s');
        $links = array();
        foreach ($manufacturers_list[$letter] as $m_name => $m_id) {
          $links[] = sprintf($link_format, sprintf($manufacturers_mid_link, $m_id), '', $m_name);
        }
        $block_data = sprintf($block_data, implode('', $links));
        echo $block_data;
      }
    }
  ?>
</div>
15 Mar 2016, 1:39 PM
#36
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Need help with a query

A few things,

  1. Doesn't address one of the requirements of the OP, businesses that begin with a non letter first of all are not even considered in this listing let alone grouped into a single choice.
  2. Doesn't even present businesses that don't begin with anything but a letter between a and z.
  3. Styling is all within one of the files instead of in a stylesheet which would get loaded. See the help file in: includes/templates/template_default/css
  4. Capitalization is forced into a first letter of each word rather than as entered (which should reflect the captalization carried by the business itself).