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)

lachild 08-02-2006 04:51 PM

Show All Products in Catagory
 
I know there have been a couple of mods that do this but most of them require alot of hacking the system.

Heres a quick mod to give you a "Show All" link next to your page results.

Quick and painless like.

(Please note this mod is for 4.1.2! i do not know if this will work on older versions as I have never used them)


Instructions:

Locate this section in the init.php around line #329:
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];
                }
}


Add this right after the closing if statment:

Code:

#
# Show All Mod By Westin Shafer for Beach Bums Inc.
#
if ($_GET['show'] == 'all'){
        $config['Appearance']['products_per_page'] = 500;
}


Next open up /customer/main/navigation.tpl around line 4 locate:

Code:

{if $total_pages gt 2}
<table cellpadding="0">
<tr>
        <td class="NavigationTitle">{$lng.lbl_result_pages}:</td>


Add this right after the /td:
Code:

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


Hope this helps

balinor 08-03-2006 02:52 AM

Nice one!

mrkenzie 08-03-2006 09:27 AM

Works great in 4.1.0.

Thanks.!

mrkenzie 08-05-2006 08:08 AM

Did you get this to work in the admin side? It works in the customer side, but not in the admin side.

Thanks

banzai 08-07-2006 05:30 AM

Works great in 4.0.17 if you order config.php instead of init.php

Thank you very much!

gargonzo 08-08-2006 10:40 AM

hi folks. version 4.07. I cannnot find init.php.. i looked in config.php.. but the snippet of code is not the same as in init.php

can someone advise on how to make this work???
tia

garz
4.07 php linux

lachild 08-09-2006 12:45 PM

To get this to work in the admin screen... Change the following line from the mod:

Code:

# Show All Mod By Westin Shafer for Beach Bums Inc.
#
if ($_GET['show'] == 'all'){
        $config['Appearance']['products_per_page'] = 500;
}


To this:

Code:


# Show All Mod By Westin Shafer for Beach Bums Inc.
#
if ($_GET['show'] == 'all'){
        $config['Appearance']['products_per_page'] = 500;
        $config['Appearance']['products_per_page_admin'] = 500;
}


As for getting this to work in 4.0.7... I've never used it.. But all you should need to do is locate the section of code that pulls in the config info from the database... Right after it, change the varriable that sets the displayed products to some un-reachable number...

I set it to 500 as I can't see how any more then that would even load on the page. But you're welcome to set this number to any number you wish.

mrkenzie 08-24-2006 04:41 PM

Re: Show All Products in Catagory
 
One more question -

Know how to either not show the "Show All" link on the manufacturers page or have it work on the manufacturers page?

Thanks.

lachild 08-29-2006 05:20 PM

Re: Show All Products in Catagory
 
Thanks for pointing this out...

Heres the updated init.php to fix the admin orders screen and the manufaturers page.

Code:

#
# Show All Mod By Westin Shafer for Beach Bums Inc.
#
if ($_GET['show'] == 'all'){
        $config['Appearance']['products_per_page'] = 500;
        $config['Appearance']['products_per_page_admin'] = 500;
        $config["Manufacturers"]["manufacturers_per_page"] = 500;
}


To turn this off for both the orders screens and the Manufactureres screens go back to the section in /customer/main/navigation.tpl and change this:

Code:

<td>Show All |</td>

To this:

Code:

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


Skateboards.com 10-16-2006 10:52 AM

Re: Show All Products in Catagory
 
Did anybody get this mod to work for 4.0.18 on the customer side?


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

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