View Single Post
  #54  
Old 06-07-2010, 12:22 PM
 
jlrentertainment jlrentertainment is offline
 

Newbie
  
Join Date: Mar 2010
Posts: 6
 

Default Re: Show All Products in Catagory

I got this working in 4.3.2 like this;

after init.php (approx. line 471)
Code:
# # Read config variables from Database # This variables are used inside php scripts, not in smarty templates # $c_result = db_query("SELECT name, value, category FROM $sql_tbl[config] WHERE type != 'separator'"); $config = array(); if ($c_result) { while ($row = db_fetch_row($c_result)) { if (!empty($row[2])) $config[$row[2]][$row[0]] = $row[1]; else $config[$row[0]] = $row[1]; } }

I added (based on Westin Shafer's mod):

Code:
# # Show All Mod By Westin Shafer for Beach Bums Inc. # if ($_GET['show'] == 'all'){ $config['Appearance']['products_per_page'] = 999; } # # Show Less Mod JLR Entertainment LLC. # if ($_GET['show'] == 'less'){ $config['Appearance']['products_per_page'] = 6; } if ($_GET['show'] == '12'){ $config['Appearance']['products_per_page'] = 12; } if ($_GET['show'] == '24'){ $config['Appearance']['products_per_page'] = 24; } if ($_GET['show'] == '36'){ $config['Appearance']['products_per_page'] = 36; }

Then in customer/main/navigation.tpl I changed it to look like this (thanks to pcparts #35 entry):

Code:
{* $Id: navigation.tpl,v 1.16.2.1 2006/06/16 10:47:41 max Exp $ *} {assign var="navigation_script" value=$navigation_script|amp} {if $total_pages gt 2} <div id="navigation"> <ul class="navigation_pages"> <li class="NavigationTitle">{$lng.lbl_result_pages}:</li> {** View All Add on **} {if $smarty.server.PHP_SELF ne '/manufacturers.php' && $smarty.server.PHP_SELF ne '/admin/orders.php' && $smarty.server.PHP_SELF ne '/orders.php' } <li><a href="{$navigation_script}&amp;show=all">View All</a> </li> {/if} {** End View All**} {if $current_super_page gt 1} <li><a class="larrow2" href="{$navigation_script}&amp;page={math equation="page-1" page=$start_page}" title="First Page"></a></li> {/if} {section name=page loop=$total_pages start=$start_page} {if %page.first%} {if $navigation_page gt 1} <li><a class="larrow" href="{$navigation_script}&amp;page={math equation="page-1" page=$navigation_page}" title="Previous Page"></a></li> {/if} {/if} {if %page.index% eq $navigation_page} <li class="NavigationLinkSel" title="{$lng.lbl_current_page|escape}: #{%page.index%}">{%page.index%}</li> {else} {if %page.index% ge 100} {assign var="suffix" value="Wide"} {else} {assign var="suffix" value=""} {/if} <li class="NavigationLink{$suffix}"><a href="{$navigation_script}&amp;page={%page.index%}" title="{$lng.lbl_page|escape} #{%page.index%}">{%page.index%}</a><img src="{$ImagesDir}/spacer.gif" alt="" /></li> {/if} {if %page.last%} {math equation="pages-1" pages=$total_pages assign="total_pages_minus"} {if $navigation_page lt $total_super_pages*$config.Appearance.max_nav_pages} <li><a class="rarrow" href="{$navigation_script}&amp;page={math equation="page+1" page=$navigation_page}" title="Next Page"></a></li> {/if} {/if} {/section} {if $current_super_page lt $total_super_pages} <li><a class="rarrow2"href="{$navigation_script}&amp;page={math equation="page+1" page=$total_pages_minus}" title="Last Page"></a></li> {/if} </ul> </div> {if $usertype ne "C"}<p />{/if} {else} <div id="navigation"> <ul class="navigation_pages"> <li class="NavigationTitle">{$lng.lbl_result_pages}:</li> {** View Less Add on **} {if $smarty.server.PHP_SELF ne '/manufacturers.php' && $smarty.server.PHP_SELF ne '/admin/orders.php' && $smarty.server.PHP_SELF ne '/orders.php' } <li><a href="{$navigation_script}&amp;show=less">&nbsp;6 items / page&nbsp;&nbsp;|</a></li> <li><a href="{$navigation_script}&amp;show=12">&nbsp;12 items / Page&nbsp;&nbsp;|</a></li> <li><a href="{$navigation_script}&amp;show=24">&nbsp;24 items / Page&nbsp;&nbsp;|</a></li> {/if} {** End View less**} </ul> </div> {if $usertype ne "C"}<p />{/if} {/if}

It's basically #35 codes as a list (not a table) and I added an else statement that will allow the user to change page back to 6,12,24 once they are in the 'view all' state. (I wanted to add the 36 as is prepped in the init.php file but my client thought it was too many options.) I changed it to a list instead of table, so I had more leeway styling the arrows as css backgrounds with hover states. So FYI, this has to be styled with CSS and background images.

my code for that is:
Code:
#navigation { width: 100%; height: 40px; } ul.navigation_pages { clear: both; width: 100%; padding-left: 10px; text-transform: uppercase; font: bold 80% Times, "Times New Roman", Georgia, s } li.NavigationTitle, li.NavigationLinkSel { color: #ff007e; } ul.navigation_pages li a.rarrow, ul.navigation_pages li a.rarrow:visited { display: block; width: 10px; height: 15px; text-align: center; background: transparent url(images/rarrow.gif) no-repeat 0 2px; } ul.navigation_pages li a.rarrow:hover { background: transparent url(images/rarrowov.gif) no-repeat 0 2px; } ul.navigation_pages li a.larrow, ul.navigation_pages li a.larrow:visited { display: block; width: 10px; height: 15px; text-align: center; background: transparent url(images/larrow.gif) no-repeat 0 2px; } ul.navigation_pages li a.larrow:hover { background: transparent url(images/larrowov.gif) no-repeat 0 2px; } ul.navigation_pages li a.rarrow2, ul.navigation_pages li a.rarrow2:visited { display: block; width: 10px; height: 15px; text-align: center; background: transparent url(images/rarrow_2.gif) no-repeat 0 2px; } ul.navigation_pages li a.rarrow2:hover { background: transparent url(images/rarrow_2ov.gif) no-repeat 0 2px; } ul.navigation_pages li a.larrow2, ul.navigation_pages li a.larrow2:visited { display: block; width: 10px; height: 15px; margin-right: 10px; text-align: center; background: transparent url(images/larrow_2.gif) no-repeat 0 2px; } ul.navigation_pages li a.larrow2:hover { background: transparent url(images/larrow_2ov.gif) no-repeat 0 2px; } #navigation ul.navigation_pages li a { font-size: 100%; } ul.navigation_pages li { float: left; margin-right: 10px; height: 20px; }

This should be different for everyone...

Ultimately, it would be nice if the view all status could be in a dropdown menu and if the products per page could be configured from the admin side instead of being hardcoded in like that, but... I'll save that for rainier days.
__________________
X-Cart v4.3.1
Reply With Quote