On the category page how can we change the alpha sorter from a drop down menu in to a text links like so:
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
On the category page how can we change the alpha sorter from a drop down menu in to a text links like so:
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
Maybe something like this?:
sperling.com/examples/menuh/
Ok there is probably a cleaner way of doing this but, I got this to work on the category page.
Is there a way to adapt these links to work on the products all page (tpl_products_all_default.php)?PHP Code:
<div id="alpha_filter">
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=65" class="alpha_filter">A</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=66" class="alpha_filter">B</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=67" class="alpha_filter">C</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=68" class="alpha_filter">D</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=69" class="alpha_filter">E</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=70" class="alpha_filter">F</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=71" class="alpha_filter">G</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=72" class="alpha_filter">H</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=73" class="alpha_filter">I</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=74" class="alpha_filter">J</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=75" class="alpha_filter">K</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=76" class="alpha_filter">L</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=77" class="alpha_filter">M</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=78" class="alpha_filter">N</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=79" class="alpha_filter">O</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=80" class="alpha_filter">P</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=81" class="alpha_filter">Q</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=82" class="alpha_filter">R</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=83" class="alpha_filter">S</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=84" class="alpha_filter">T</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=85" class="alpha_filter">U</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=86" class="alpha_filter">V</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=87" class="alpha_filter">W</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=88" class="alpha_filter">X</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=89" class="alpha_filter">Y</a>|
<a href="index.php?main_page=index&cPath=<?=$_GET['cPath']?>&sort=20a&alpha_filter_id=90" class="alpha_filter">Z</a>
</div>
Is it even posible to add an alpha sorter to the all products page? I have been playing with this code now for days
Is it posible to add the alpha sorter to the all products page?
Message me if you are still looking for help.
Ryan Cloke
Flipside Technology Services
just wanted to say thanx for the great post, this was suggested to me to try on our site and i started scratchin my head, thinking of how involved it would be.
i found this post, and it took all but 5 minutes to setup, and it looks and works great.
thanks again!!!
Never be afraid to try something new, remember that amateurs built the ark, professionals built the Titanic
Thanks for the reply zskiman
I have updated the above code and cleaned it up:
PHP Code:
function GetAlphabet($type='string',$lower=false){
$spacer = " | ";
$r = ($type == 'string') ? '' : array();
// chr 65 => A, chr 90 => Z
for ($c=65; $c <= 90; $c++){
if (!isset($alpha_filter_id)){$alpha_filter_id = 65;}
$ch = ($lower) ? strtolower(chr($c)) : '<a href="index.php?main_page=index&cPath='.$_GET['cPath'].'&alpha_filter_id='.$alpha_filter_id.'">'.chr($c)."</a>$spacer";
if ($type == 'string'){ $r .= $ch; }
else { $r[] = $ch; }
$alpha_filter_id = $alpha_filter_id+1;
}
return $spacer.$r;
}
echo GetAlphabet();
I made an update to this code, I added some css when a letter is active it will be bold and black, so that the user knows what page they are on.
PHP Code:
function GetAlphabet($type='string',$lower=false){
$spacer = " | ";
$r = ($type == 'string') ? '' : array();
// chr 65 => A, chr 90 => Z
for ($c=65; $c <= 90; $c++){
if (!isset($alpha_filter_id)){$alpha_filter_id = 65;}
if ($alpha_filter_id == $_GET['alpha_filter_id']){$style = ' style="font-weight:bold; font-size:12px; color:#000000;"';}else{$style = '';}
$ch = ($lower) ? strtolower(chr($c)) : '<a href="index.php?main_page=index&cPath='.$_GET['cPath'].'&alpha_filter_id='.$alpha_filter_id.'"'.$style.'>'.chr($c)."</a>$spacer";
if ($type == 'string'){ $r .= $ch; }
else { $r[] = $ch; }
$alpha_filter_id = $alpha_filter_id+1;
}
return $spacer.$r;
}
echo GetAlphabet();
Bookmarks