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)
-   -   Hidden Categories (https://forum.x-cart.com/showthread.php?t=8276)

Jon 06-28-2004 08:37 AM

Hidden Categories
 
3.5.8-3.5.9 but may work on others

In the older version of x-cart, disabled categories were still viewable so you could have hidden categories. This was good for hidden categories, not so good if you actually wanted to disable the category.

In the newer x-carts I've noticed they actually disable the category, but you can't have hidden categories.

This mod just allows you to create a hidden category using the admin section. The category won't show up in the navigation, and will still accessible by direct link.

Mod is pretty basic, was just difficult finding where the exclusion took place :)

-----

First lets get it to allow the hidden categories.
Open up /include/categories.php

FIND:
$categories_data = func_query("select $sql_tbl[categories].*, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', -1) as category_name, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', 1) as root_category_name from $sql_tbl[categories] ".($current_area=="C"?"where $sql_tbl[categories].avail='Y' $membership_condition ":"")." group by $sql_tbl[categories].categoryid order by ".($current_area=="C" ? "order_by" : "category"));

REPLACE WITH:
$categories_data = func_query("select $sql_tbl[categories].*, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', -1) as category_name, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', 1) as root_category_name from $sql_tbl[categories] ".($current_area=="C"?"where $sql_tbl[categories].avail='Y' OR $sql_tbl[categories].avail='H' $membership_condition ":"")." group by $sql_tbl[categories].categoryid order by ".($current_area=="C" ? "order_by" : "category"));

The key here is just adding the: OR $sql_tbl[categories].avail='H'

-----

Lets make hidden categories creatable from the admin
Open /skin1/admin/category_modify.tpl

FIND:
<select name=avail>
<option value='Y' {if ($current_category.avail eq 'Y')} selected {/if}>Enabled</option>
<option value='N' {if ($current_category.avail eq 'N')} selected {/if}>Disabled</option>
</select>

REPLACE WITH:
<select name=avail>
<option value='Y' {if ($current_category.avail eq 'Y')} selected {/if}>Enabled</option>
<option value='N' {if ($current_category.avail eq 'N')} selected {/if}>Disabled</option>
<option value='H' {if ($current_category.avail eq 'H')} selected {/if}>Hidden</option>
</select>

-------------------------

Everything is working now, except they are still on the side navigation, so lets remove them.
Open /skin1/customer/categories.tpl

FIND BOTH INSTANCES OF:
<font class=CategoriesList>{$categories[cat_num].category_name}</font>


CHANGE TO:
{if $categories[cat_num].avail ne "H"}<font class=CategoriesList>{$categories[cat_num].category_name}</font>
{/if}

NOTE: There are two links in this file, the categories and the subcategories. The modification needs to be made to both.
-------------------------

That should do it. Feel free to paypal a donation to jon@hitemup.com if you feel this mod has saved you cost of some development time :)

Jon 06-28-2004 06:34 PM

NOTE: A small edit has been made to the categories.tpl modification. It needs to be implemented twice, once for the categories and once for the subcategories.

If your using this, please let me know so I know posting these mods isn't a waste of my time. Thanks :)

thundernugs 06-29-2004 11:13 AM

is there any way this can work in conjunction with fancy categories?

Jon 06-29-2004 11:16 AM

I don't have the fancy categories module. I imagine it's just a matter of putting in the if statement. If you send me the module files I will have a look and see if I can implement for you.

Can I see what the fancy categories look like on your site? I'm not even really sure what they are.

thundernugs 07-07-2004 02:29 PM

jon, any luck on making this work with fancy cats?

thx :)

Jon 07-07-2004 02:36 PM

None yet. Haven't had the chance to really get into it though, I should have a chance before the weekend.

thundernugs 07-07-2004 02:42 PM

nice!

no rush of course. i think there are a lot of folks who could use this mod.

mike

thundernugs 08-10-2004 02:19 PM

jon,

any progress?

Jon 08-10-2004 03:01 PM

Sorry I haven't had any time to address this.

I opened up the fancy categories code and it looks complex. Haven't had any time to go any further than that. Don't know if I will.

elitedimension 08-19-2004 12:04 AM

Thanks Jon! I was just about to write this but luckily found your post.


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

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