DragonflyCMS Projects > Storez > [solved] block-Storez_Stores > Community Forums > Phoenix Netology
Forum Index > eCommerce > Storez

[solved] block-Storez_Stores Reply to topic


Hey guys. I noticed that the block populates the list (links) in the order that you create your stores. Is there any way to have it populate alphabetically?

I've been playing with the code but i'm still learning php and can't get it to sort. I've been crawling thru php sort tutorials but it's over my head at this point.

Also I was curious if it were possible to list an item count next to the link.
ex:
Apparel (5)
Beauty (3)

Thanks for any help.

Please enter your server specs in your user profile! 😢


The simplest solution is to replace the block's code with this, albeit an extra db query:<?php /*********************************************************************** * StorezPro * ************************************************************************ * $Source: /0cvs/Storez/blocks/block-Storez_Stores.php,v $ * * $Revision: 1.7 $ * * $Author: Phoenix $ * * $Date: 2008/10/02 13:13:48 $ * ***********************************************************************/ if (!defined('CPG_NUKE')) { exit; } if (!is_active('Storez')) { $content = 'ERROR'; return trigger_error('Storez module is inactive', E_USER_WARNING); } get_lang('Storez'); global $prefix, $db; $content = ''; $result = $db->sql_query("SELECT * FROM {$prefix}_cart_stores WHERE parentid=0 ORDER BY title ASC"); if ($result) { while ($row = $db->sql_fetchrow($result, SQL_ASSOC)) { $content .= '<b>•</b> <a href="'.getlink('Storez&store_id='.$row['store_id']).'">'.$row['title'].'</a><br />'; } $db->sql_freeresult($result); } else { $content .= _STOREZ_BLOCK_STORES_NOSTORES; }

Donations & Audit for DragonflyCMS

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


Phoenix, thank you. I much appreciate you taking the time to mod the block for me. It works perfectly.

Please enter your server specs in your user profile! 😢

All times are Australia/Adelaide


Jump to: