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)

hansmoen 03-08-2006 07:10 AM

Quote:

Originally Posted by civictuner
I have the problem that some of my categories' title are the same as the hidden categorie??

anyone who has a solution for this?

thnx


http://forum.x-cart.com/viewtopic.php?p=128691

If you did the modification in categories.php you are probably only missing a '(' and a ')'

Where it used to say
Quote:

$search_condition = "AND avail='Y' AND (membership=blabla

it should now say
Quote:

$search_condition = "AND (avail='Y' OR avail = 'H') AND (membership=blabla

If not the SQL query will always return more than 1 row, including the hidden category, and if the hidden category was created before the category you're viewing, the title will reflect the hidden category.



HK

stevebag 04-11-2006 03:11 AM

Quote:

Originally Posted by fablot
is the include/search.php code for version 4.0.16

Change:

Code:

$search_condition .= " AND $sql_tbl[categories].membership IN ('','".addslashes(@$user_account['membership'])."') AND $sql_tbl[categories].avail = 'Y'";

to:

Code:

$search_condition .= " AND $sql_tbl[categories].membership IN ('','".addslashes(@$user_account['membership'])."') AND ($sql_tbl[categories].avail = 'Y' OR $sql_tbl[categories].avail='H')";


to see the products
it is corrected?


I found I had to add an 'if' too. Without it if you mark a category as hidden, then products in this category can be searched for.

Try changing

FROM:
if($current_area == 'C') {
$search_condition .= " AND $sql_tbl[categories].membership IN ('','".addslashes(@$user_account['membership'])."') AND $sql_tbl[categories].avail = 'Y'";
}

TO:
if($current_area == 'C' and !empty($condition)) {
$search_condition .= " AND $sql_tbl[categories].membership IN ('','".addslashes(@$user_account['membership'])."') AND ($sql_tbl[categories].avail = 'Y' )";
}
else
{
$search_condition .= " AND $sql_tbl[categories].membership IN ('','".addslashes(@$user_account['membership'])."') AND ($sql_tbl[categories].avail = 'Y' OR $sql_tbl[categories].avail='H')";
}

-- Basically, only show 'H'idden category products if the search string is empty... ie; not searched for.

MOC 04-21-2006 12:08 PM

Hi,
i installed this mod for version 3.5.14

How can the Hidden categories be excluded out of the Drop down menu (Category) in the advance search?

TIA
Saskia

hansmoen 04-23-2006 01:28 PM

Good questions and questions
 
Quote:

Originally Posted by MOC
Hi,
i installed this mod for version 3.5.14

How can the Hidden categories be excluded out of the Drop down menu (Category) in the advance search?

TIA
Saskia


Hmmm... Thats a good question Saskia. As you see I'm a bit of a newbie, and I was introduced to xcart in version 4.0.17.
In this version they do not show up (as you can see on http://www.pchealth.ie ).

Hopefully some of the oldboys can help you out.


Hasse

DataViking 03-09-2007 12:25 PM

Re: Hidden Categories
 
can you hide category in v 4.1.6

Jerrad 04-19-2007 04:31 AM

Re: Hidden Categories
 
Quote:

Originally Posted by HWT
An extension of the page title "bug", the description also gets taken only from the 1st hidden category. Tried to work around by giving the first hidden category a general name, and use the description to differentiate the categories. Didn't work. Every category (hidden or not) displays the same title and description as the 1st hidden category. Anyone figured it out yet?


Anybody ever found a solution for that page title "bug"?
I've got everything working with the exception of the category title & page title.
All the hidden categories display the category & page title of the first hidden category... 8O


Any help would be very welcomed! :D
Thanks in advance!

UPDATE: I fixed it by changing line 179 from include/categories.php from

$search_condition = "AND avail='Y' OR $sql_tbl[categories].avail='H' AND (membership='".addslashes($user_account["membership"])."' OR membership='')";

to

$search_condition = "AND (avail='Y' OR avail = 'H') AND (membership='".addslashes($user_account["membership"])."' OR membership='')";

Page and category title of hidden categories are now displaying correctly :D/

Jon 04-20-2007 03:52 PM

Re: Hidden Categories
 
Just piping in to confirm that the "brackets" are the solution to the title issue.

sakeena 05-04-2007 09:57 AM

Re: Hidden Categories
 
I want to apply the 501 solution but cant find that code to replace in my categories.tpl (this is in "the customer directory correct?)
here is my code can someone explain what to change
Quote:

{* $Id: categories.tpl,v 1.26 2005/11/17 06:55:37 max Exp $ *}
{capture name=menu}
{if $active_modules.Fancy_Categories ne ""}
{include file="modules/Fancy_Categories/categories.tpl"}
{assign var="fc_cellpadding" value="0"}
{else}
{if $config.General.root_categories eq "Y"}
<div class="categories">
{foreach from=$categories item=c}
<a href="home.php?cat={$c.categoryid}">{$c.category}< /a>
{/foreach}
</div>
{else}
<div class="categories">
{foreach from=$subcategories item=c key=catid}
<a href="home.php?cat={$catid}">{$c.category}</a>
{/foreach}
</div>
{/if}
{/if}
{/capture}
{ include file="menu_cat.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu cellpadding=$fc_cellpadding}

nfc5382 05-05-2007 05:59 AM

Re: Hidden Categories
 
This works good. I'm using it for MAP pricing (one distributor complained that the only way to discount is with "entering an email address to see products"). MAP for other products are not displayed until the customer logs in.

So I modified my cart so that the customer can enter their email address, then an automated email is sent with the direct link to the hidden category (with hidden products in it).

delphi 05-20-2007 08:27 PM

Re: Hidden Categories
 
Quote:

Originally Posted by Jon
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 :)


Has anyone used this for 4.1.17? I tried to follow the codes, but the codes are not there anymore in this latest version


All times are GMT -8. The time now is 03:26 AM.

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