Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Hidden Categories

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #51  
Old 03-08-2006, 07:10 AM
 
hansmoen hansmoen is offline
 

Member
  
Join Date: Dec 2005
Posts: 12
 

Default

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
Reply With Quote
  #52  
Old 04-11-2006, 03:11 AM
 
stevebag stevebag is offline
 

Member
  
Join Date: Jul 2003
Posts: 23
 

Default

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.
__________________
Version 4.0.18
Reply With Quote
  #53  
Old 04-21-2006, 12:08 PM
 
MOC MOC is offline
 

Senior Member
  
Join Date: Oct 2002
Posts: 171
 

Default

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
Reply With Quote
  #54  
Old 04-23-2006, 01:28 PM
 
hansmoen hansmoen is offline
 

Member
  
Join Date: Dec 2005
Posts: 12
 

Default 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
Reply With Quote
  #55  
Old 03-09-2007, 12:25 PM
  DataViking's Avatar 
DataViking DataViking is offline
 

eXpert
  
Join Date: Jan 2003
Location: Las Vegas, NV
Posts: 361
 

Default Re: Hidden Categories

can you hide category in v 4.1.6
__________________
Web Design Web Design and Custom X-Cart Projects

http://www.dataviking.com

Mention the forums for discounts!
x-cart Version 4.1.8
Reply With Quote
  #56  
Old 04-19-2007, 04:31 AM
 
Jerrad Jerrad is offline
 

X-Adept
  
Join Date: Nov 2004
Location: The Netherlands
Posts: 484
 

Default 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...


Any help would be very welcomed!
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
__________________
X-Cart 4.0.12
Heavy modified with paid, free and forum mods.
PHP 5.2.5 | MYSQL 5.0.51a
Reply With Quote
  #57  
Old 04-20-2007, 03:52 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: Hidden Categories

Just piping in to confirm that the "brackets" are the solution to the title issue.
Reply With Quote
  #58  
Old 05-04-2007, 09:57 AM
 
sakeena sakeena is offline
 

Advanced Member
  
Join Date: Mar 2007
Posts: 44
 

Default 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}
__________________
xcart 4.1.6 unix server
Reply With Quote
  #59  
Old 05-05-2007, 05:59 AM
 
nfc5382 nfc5382 is offline
 

X-Adept
  
Join Date: Nov 2002
Posts: 481
 

Default 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).
__________________
-----------------------
x-cart v4.7.6 [LIVE]
x-cart v4.0.18 [retired 2004-2016]
x-cart v3.5.13 [retired]
x-cart v3.4.14 [retired]
Reply With Quote
  #60  
Old 05-20-2007, 08:27 PM
 
delphi delphi is offline
 

Senior Member
  
Join Date: Jul 2004
Posts: 185
 

Default 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
__________________
X-Cart Gold version 4.4.4
X-Cart directory /home/web/u/ugchweb/cart
PHP 5
MySQL server 5
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:49 PM.

   

 
X-Cart forums © 2001-2020