X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Show All Products in Catagory (https://forum.x-cart.com/showthread.php?t=23796)

royng 06-26-2009 10:05 AM

Re: Show All Products in Catagory
 
I guess this is not one of the feature that X-cart can have. Try other shopping cart that might be a better chance.

tacdesign 04-14-2010 01:50 AM

Re: Show All Products in Catagory
 
Has anyone managed to get the "View all products" function working on version 4.3?

Cheers

cosy 05-04-2010 11:28 PM

Re: Show All Products in Catagory
 
Hi,

Anyone got it working or share the code pls?

Thanks,

jlrentertainment 06-07-2010 12:22 PM

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.

hoosierglass 06-07-2010 02:20 PM

Re: Show All Products in Catagory
 
If you do not want to go with the View All in the stock navigation.tpl file add this to the the file just before the final {/strip}

Code:


{if $smarty.server.PHP_SELF ne '/manufacturers.php' && $smarty.server.PHP_SELF ne '/admin/orders.php' && $smarty.server.PHP_SELF ne '/orders.php' }
&nbsp;&nbsp;&nbsp;<a href="{$navigation_script}&amp;show=all">View All</a>
{/if}


This will put the "View All" three spaces to the right of the next arrow.

Result pages: 1 2 3 4 5 > View All

Dont forget the code in the init.php file from post before this post.

Phoenixone 10-22-2010 02:50 AM

Re: Show All Products in Catagory
 
Works Great thanks!!!

ScrapOrchard 01-25-2011 11:00 AM

Re: Show All Products in Catagory
 
Quote:

Originally Posted by hoosierglass
If you do not want to go with the View All in the stock navigation.tpl file add this to the the file just before the final {/strip}

Code:


{if $smarty.server.PHP_SELF ne '/manufacturers.php' && $smarty.server.PHP_SELF ne '/admin/orders.php' && $smarty.server.PHP_SELF ne '/orders.php' }
&nbsp;&nbsp;&nbsp;<a href="{$navigation_script}&amp;show=all">View All</a>
{/if}


This will put the "View All" three spaces to the right of the next arrow.

Result pages: 1 2 3 4 5 > View All

Dont forget the code in the init.php file from post before this post.



I am a little confused... which file does the above code go? Also, I am working on 4.3.2, the init.php file has 874 lines... does the init.php code still need to be placed around line 471?

ScrapOrchard 01-26-2011 07:26 AM

Re: Show All Products in Catagory
 
BCSE has a free View All mod.. I downloaded it yesterday and the instructions for v4.3 installation were actually the v4.1 instructions.. I emailed them and they promptly provided me with the correct instructions. So I am not sure if they have also, since, updated the zip file for the mod or not. But it was super easy to install and works wonderfully!


http://www.bcsengineering.com/store/view-all-mod-for-x-cart.html

DavyMac 06-28-2013 02:38 AM

Re: Show All Products in Catagory
 
This is great quick mod that even works with 4.5.4


Quote:

Originally Posted by ScrapOrchard
BCSE has a free View All mod.. I downloaded it yesterday and the instructions for v4.3 installation were actually the v4.1 instructions.. I emailed them and they promptly provided me with the correct instructions. So I am not sure if they have also, since, updated the zip file for the mod or not. But it was super easy to install and works wonderfully!


http://www.bcsengineering.com/store/view-all-mod-for-x-cart.html


BCSE have upgraded this freebee to 4.5.x and is very easy to install, however I took a dislike to the URLs that it creates so went with the mod described in this thread.


All times are GMT -8. The time now is 11:33 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.