Forums / Templates, Stylesheets, Page Layout / Advanced Search Question (limit to category box)

Advanced Search Question (limit to category box)

Views: 5,563

Results 41 to 60 of 62
21 Dec 2011, 8:23 PM
#41
gazag avatar

gazag

Zen Follower

Join Date:
Jun 2011
Posts:
195
Plugin Contributions:
0

Advanced Search Question (limit to category box)

Ajeh:

Look at your override file:
/home2/limelih7/public_html/includes/templates/your_template_dir/templates/tpl_advanced_search_default.php

and find the line that contains this:
zen_draw_pull_down_menu

What does the code in the 5 lines before it and 5 lines after it read?

My file has ```
<br class="clearBoth" />

</fieldset> <fieldset class="floatingBox back"> <legend><?php echo ENTRY_CATEGORIES; ?></legend> <div class="floatLeft"><?php echo zen_draw_pull_down_menu('categories_id', zen_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)), '0' ,'', '1'), $sData['categories_id']); ?></div> <?php echo zen_draw_checkbox_field('inc_subcat', '1', $sData['inc_subcat'], 'id="inc-subcat"'); ?><label class="checkboxLabel" for="inc-subcat"><?php echo ENTRY_INCLUDE_SUBCATEGORIES; ?></label> <br class="clearBoth" /> </fieldset> <fieldset class="floatingBox forward"> <legend><?php echo ENTRY_MANUFACTURERS; ?></legend> <?php echo zen_draw_pull_down_menu('manufacturers_id', zen_get_manufacturers(array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS)), PRODUCTS_MANUFACTURERS_STATUS), $sData['manufacturers_id']); ?> <br class="clearBoth" /> </fieldset> <br class="clearBoth" /> ```
21 Dec 2011, 11:43 PM
#42
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Advanced Search Question (limit to category box)

The contents of your template override does not look like it is the same as DivaVocals code ...

I would think about trying to reload the code to see if something has been placed in the wrong place ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

24 Dec 2011, 5:30 PM
#43
gazag avatar

gazag

Zen Follower

Join Date:
Jun 2011
Posts:
195
Plugin Contributions:
0

Re: Advanced Search Question (limit to category box)

Ajeh:

The contents of your template override does not look like it is the same as DivaVocals code ...

I would think about trying to reload the code to see if something has been placed in the wrong place ...

I tried re uploading the one from a new download and still no difference so i just removed that box and the manufacturing box off the Advanced Search page!

That solves the problem for me!

Thanks for you help!

22 Feb 2012, 4:20 PM
#44
moosesoom avatar

moosesoom

New Zenner

Join Date:
Dec 2008
Location:
Rimini, Italy, Italy
Posts:
67
Plugin Contributions:
0

Re: Advanced Search Question (limit to category box)

I think I found where the problem is (hope somebody can tell us WHAT the problem is :-) )

in /myshop/includes/functions/html_output.php , in the source of zen_draw_pull_down_menu() function

there's the following statement:

if (empty($default) && isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) ) $default = stripslashes($GLOBALS[$name]);

So, in advanced_search page, the categories pull down menu is called with a default set to 0 (zero) but the previous line of code, subsitute it with the value of $GLOBALS[$name] , actually $GLOBALS[categories_id]. This global variable contains categories_id of last category in list.

Is there any good reason why $GLOBALS[categories_id] should contain that value of categories_id?

Can we eliminate that code? Or is it necessary for some other cases of pull down menu?

22 Feb 2012, 4:37 PM
#45
moosesoom avatar

moosesoom

New Zenner

Join Date:
Dec 2008
Location:
Rimini, Italy, Italy
Posts:
67
Plugin Contributions:
0

Re: Advanced Search Question (limit to category box)

I temporarily solved this issue by modifying the following line from ../includes/functions/html_output.php from:

if (empty($default) && isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) ) $default = stripslashes($GLOBALS[$name]);

to

if ( ($name != 'categories_id') && empty($default) && isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) ) $default = stripslashes($GLOBALS[$name]);

But please tell me if that solution can break something all over the shop.

7 Dec 2012, 6:37 PM
#46
satrina avatar

satrina

New Zenner

Join Date:
Oct 2012
Posts:
21
Plugin Contributions:
0

Re: Advanced Search Question (limit to category box)

did anyone ever find a workaround for this? I am having this issue right now....

www . scarletburn . com (without the spaces)

7 Dec 2012, 10:58 PM
#47
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Advanced Search Question (limit to category box)

satrina:

did anyone ever find a workaround for this? I am having this issue right now....

www . scarletburn . com (without the spaces)Which "this" are you referring to.. a few variations of the original issue have been posted in this thread..

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

8 Dec 2012, 9:20 AM
#48
satrina avatar

satrina

New Zenner

Join Date:
Oct 2012
Posts:
21
Plugin Contributions:
0

Re: Advanced Search Question (limit to category box)

my last category shows up as the default in the advanced search categories box

8 Dec 2012, 2:32 PM
#49
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Advanced Search Question (limit to category box)

satrina:

my last category shows up as the default in the advanced search categories boxFYI, it's MORE helpful for the community if you post DETAILS (not one liners) about the issues you are having and the link to your site.. Saying "It's not working" or "I am having the same problem" without any details doesn't give folks much to go on..

That said it doesn't sound like your issue is related to original issue posted in this thread, but without details??? shrug Don't make folks guess what the issue is when you provide the link to your site. Unless there is some glaring OBVIOUS error message we are going to see, it would help if you gave us details on what the issue is you are having. We have no way of understanding the issues unless you provide details of what it is we are going to see and what it is you think we should see..

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

7 May 2013, 2:13 AM
#50
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Advanced Search Question (limit to category box)

moosesoom:

I temporarily solved this issue by modifying the following line from ../includes/functions/html_output.php from:

if (empty($default) && isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) ) $default = stripslashes($GLOBALS[$name]);

> 
> to
> 
> ```php
if ( ($name != 'categories_id') && empty($default) && isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) ) $default = stripslashes($GLOBALS[$name]);

But please tell me if that solution can break something all over the shop.

I hate to resurrect such an old post, but in testing a Zen Cart v1.5.1 update to the hideCategories add-on, I was FINALLY able to replicate the issue reported by the creator of this post.. For whatever reason, this issue ONLY occurs when the hideCategories add-on is installed.. I tried the solution posted a while back (see above) and it does indeed resolve the issue.. What I need to know before I claim victoru and add this to the hideCategories fileset is what will this break??

Calling out to Ajeh as she was the one trying to help resolve/troubleshoot this before..

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

7 May 2013, 7:13 AM
#51
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Advanced Search Question (limit to category box)

DivaVocals:

I hate to resurrect such an old post, but in testing a Zen Cart v1.5.1 update to the hideCategories add-on, I was FINALLY able to replicate the issue reported by the creator of this post.. For whatever reason, this issue ONLY occurs when the hideCategories add-on is installed.. I tried the solution posted a while back (see above) and it does indeed resolve the issue.. What I need to know before I claim victoru and add this to the hideCategories fileset is what will this break??

Calling out to Ajeh as she was the one trying to help resolve/troubleshoot this before..

More information.. As was pointed out previously by gazag, if one is using the includes/templates/custom_template/sideboxes/tpl_categories.php file with the code modified for the hideCategories add-on, the categories dropdown on the Advanced Search page will default to the last category on the dropdown list instead of "All Categories". Once I restore to the Zen Cart default for the includes/templates/custom_template/sideboxes/tpl_categories.php file, the dropdown defaults to "All Categories" as it should.. If I use the includes/templates/custom_template/sideboxes/tpl_categories.php file with the code modified for the hideCategories add-on, and then use the code posted by moosesoom, then all is right with the world..

Here is the relevant categories sidebox code if anyone is interested..

//  Begin hideCategories code
    list($nada, $mycpath)= split('=', $box_categories_array[$i]['path']);
    $mycid = split('_', $mycpath);
    $categories_id = array_pop($mycid);
    $hide_status = $db->Execute("select visibility_status 
                    FROM " . TABLE_HIDE_CATEGORIES . "
                    WHERE categories_id = " . $categories_id . "
                    LIMIT 1");
    if ($hide_status->fields['visibility_status'] < 1) {
//  End hideCategories code
    switch(true) {
// to make a specific category stand out define a new class in the stylesheet example: A.category-holiday
// uncomment the select below and set the cPath=3 to the cPath= your_categories_id
// many variations of this can be done
//      case ($box_categories_array[$i]['path'] == 'cPath=3'):
//        $new_style = 'category-holiday';
//        break;
      case ($box_categories_array[$i]['top'] == 'true'):
        $new_style = 'category-top';
        break;
      case ($box_categories_array[$i]['has_sub_cat']):
        $new_style = 'category-subs';
        break;
      default:
        $new_style = 'category-products';
      }
     if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
        // skip if this is for the document box (==3)
      } else {
      $content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';

      if ($box_categories_array[$i]['current']) {
        if ($box_categories_array[$i]['has_sub_cat']) {
          $content .= '<span class="category-subs-parent">' . $box_categories_array[$i]['name'] . '</span>';
        } else {
          $content .= '<span class="category-subs-selected">' . $box_categories_array[$i]['name'] . '</span>';
        }
      } else {
        $content .= $box_categories_array[$i]['name'];
      }

      if ($box_categories_array[$i]['has_sub_cat']) {
        $content .= CATEGORIES_SEPARATOR;
      }
      $content .= '</a>';

      if (SHOW_COUNTS == 'true') {
        if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) {
          $content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX;
        }
      }

      $content .= '<br />' . "\n";
    }
  }
  } //  hideCategories code

I just need to know if moosesoom's code is okay to use. It appears to fix the issue reported.. I just don't know what other "damage" it might do, and just need some feedback..

gazag:

Ajeh,

By process of elimination i have discovered where the error was for the advanced search issue i am having - it is in the tpl_Categories file in my_template/sideboxes:yes:

Have you got any ideas at what to change????:wacko:

I have attached the two documents - the one that says moddedforhiddencategories is the one that works fine with advanced search but the categories aren't hidden in the categories sidebox

the other one works fine for hidden but not for the advanced search!!

Your help is much appreciated!

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

7 May 2013, 4:16 PM
#52
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Advanced Search Question (limit to category box)

DivaVocals:

I just need to know if moosesoom's code is okay to use. It appears to fix the issue reported.. I just don't know what other "damage" it might do, and just need some feedback..
You asked if this code is safe to use, so I'm reviewing it from a coding perspective, not from whether it "works" or is the "best" way to do it. You said it works, so I won't concern myself with the functionality.

  1. But the code is using the deprecated split() function, so the code will not work on PHP 5.3.0 or newer.
    Those references to split() should be replaced with explode(). See more detail here: http://www.zen-cart.com/entry.php?2-Is-your-code-safe-to-use-on-PHP-5-3

  2. If there is no valid result returned from the query (again, only in the part of the code you had highlighted), you're triggering PHP Notices needlessly.
    So, changing this line, by adding the part in bold, would be suggested:```
    if ([B]![/B][B]$hide_status->EOF && [/B]$hide_status->fields['visibility_status'] < 1) {

But that's getting into optimization, instead of merely "will it work".

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

7 May 2013, 4:37 PM
#53
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Advanced Search Question (limit to category box)

:laugh:> DrByte:

You asked if this code is safe to use, so I'm reviewing it from a coding perspective, not from whether it "works" or is the "best" way to do it. You said it works, so I won't concern myself with the functionality.

  1. But the code is using the deprecated split() function, so the code will not work on PHP 5.3.0 or newer.
    Those references to split() should be replaced with explode(). See more detail here: http://www.zen-cart.com/entry.php?2-Is-your-code-safe-to-use-on-PHP-5-3

  2. If there is no valid result returned from the query (again, only in the part of the code you had highlighted), you're triggering PHP Notices needlessly.
    So, changing this line, by adding the part in bold, would be suggested:```
    if ([B]![/B][B]$hide_status->EOF && [/B]$hide_status->fields['visibility_status'] < 1) {

> But that's getting into optimization, instead of merely "will it work".
Thanks DrByte.. I haven't a CLUE how to do the optimization you suggest, but I do understand why it needs to be done..:laugh:

Now let me go back to a corner and see if I can wrap my head around HALF of what you've just said..:unsure: I'm sure I'll be back with more questions..:laugh:

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

7 May 2013, 4:45 PM
#54
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Advanced Search Question (limit to category box)

DrByte:

You asked if this code is safe to use, so I'm reviewing it from a coding perspective, not from whether it "works" or is the "best" way to do it. You said it works, so I won't concern myself with the functionality.

  1. But the code is using the deprecated split() function, so the code will not work on PHP 5.3.0 or newer.
    Those references to split() should be replaced with explode(). See more detail here: http://www.zen-cart.com/entry.php?2-Is-your-code-safe-to-use-on-PHP-5-3

  2. If there is no valid result returned from the query (again, only in the part of the code you had highlighted), you're triggering PHP Notices needlessly.
    So, changing this line, by adding the part in bold, would be suggested:```
    if ([B]![/B][B]$hide_status->EOF && [/B]$hide_status->fields['visibility_status'] < 1) {

> But that's getting into optimization, instead of merely "will it work".

So I do have one more question.. if I make the code change you suggest above as follows:

// Begin hideCategories code
list($nada, $mycpath)= [B]explode[/B]('=', $box_categories_array[$i]['path']);
$mycid = [B]explode[/B]('_', $mycpath);
$categories_id = array_pop($mycid);
$hide_status = $db->Execute("select visibility_status
FROM " . TABLE_HIDE_CATEGORIES . "
WHERE categories_id = " . $categories_id . "
LIMIT 1");
if ([B]![/B][B]$hide_status->EOF && [/B]$hide_status->fields['visibility_status'] < 1) {
// End hideCategories code

switch(true) {
// to make a specific category stand out define a new class in the stylesheet example: A.category-holiday
// uncomment the select below and set the cPath=3 to the cPath= your_categories_id
// many variations of this can be done
// case ($box_categories_array[$i]['path'] == 'cPath=3'):
// $new_style = 'category-holiday';
// break;
case ($box_categories_array[$i]['top'] == 'true'):
$new_style = 'category-top';
break;
case ($box_categories_array[$i]['has_sub_cat']):
$new_style = 'category-subs';
break;
default:
$new_style = 'category-products';
}
if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
// skip if this is for the document box (==3)
} else {
$content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';

  if ($box_categories_array[$i]['current']) {
    if ($box_categories_array[$i]['has_sub_cat']) {
      $content .= '<span class="category-subs-parent">' . $box_categories_array[$i]['name'] . '</span>';
    } else {
      $content .= '<span class="category-subs-selected">' . $box_categories_array[$i]['name'] . '</span>';
    }
  } else {
    $content .= $box_categories_array[$i]['name'];
  }

  if ($box_categories_array[$i]['has_sub_cat']) {
    $content .= CATEGORIES_SEPARATOR;
  }
  $content .= '</a>';

  if (SHOW_COUNTS == 'true') {
    if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) {
      $content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX;
    }
  }

  $content .= '<br />' . "\n";
}

}
} // hideCategories code


Will this negate the need to make the changes to the **../includes/functions/html_output.php **as posted previously by moosesoom.. (referenced post below)

> **moosesoom:**
>
> I temporarily solved this issue by modifying the following line from ../includes/functions/html_output.php from:
> 
> ```php
if (empty($default) && isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) ) $default = stripslashes($GLOBALS[$name]);

to

if ( ($name != 'categories_id') && empty($default) && isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) ) $default = stripslashes($GLOBALS[$name]);

> 
> But please tell me if that solution can break something all over the shop.

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

7 May 2013, 10:15 PM
#55
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Advanced Search Question (limit to category box)

DivaVocals:

Will this negate the need to make the changes to the **../includes/functions/html_output.php **as posted previously by moosesoom.. (referenced post below)
No, but in tpl-categories, if you simply change both references of $categories_id to some other variable like $cat_to_check then that should remove the clash that was driving the need for changes to html_output.php

And, I take back my prior suggestion about adding !$hide_status->EOF && ... because I think that will negate the logic in undesired cases.

... which leads me to another, related, observation ...

Also, looking at the contribution I'm a bit confused why any template files were altered at all. It would be much more efficient for all the changes from the template files to have been done in the modules files that prepare the data for the templates .... again, separating logic from display.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

7 May 2013, 10:41 PM
#56
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Advanced Search Question (limit to category box)

DrByte:

No, but in tpl-categories, if you simply change both references of $categories_id to some other variable like $cat_to_check then that should remove the clash that was driving the need for changes to html_output.phpGot it.. will make the suggested changes.. Only thing left for me to figure out is why the code for excluding hidden products from the search results worked in Zen Cart v1.3.9 (when I tested the code provided by another community member), doesn't seem to work in Zen Cart v1.5.1
sigh

DrByte:

And, I take back my prior suggestion about adding !$hide_status->EOF && ... because I think that will negate the logic in undesired cases.

... which leads me to another, related, observation ...

Also, looking at the contribution I'm a bit confused why any template files were altered at all. It would be much more efficient for all the changes from the template files to have been done in the modules files that prepare the data for the templates .... again, separating logic from display.Dude you're asking ME??!!:laugh: I had a client who needed this capability for certain custom products (wigs for chemo and alopecia patients) that she wanted to send direct links to clients while hiding these products from other customers.. I found this add-on and simply picked this thing up as it was and compiled all the verified posted fixes from the support forum into the base fileset.. I've NO DOUBT (especially if you point it out) that it could be done better.. but as I'm not a real coder, I haven't the first bit of an idea how to go about making that happen.. (though like many things I've tackled in Zen Cart, I certainly am willing to take a slash at it..:laugh:)

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

7 May 2013, 11:21 PM
#57
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Advanced Search Question (limit to category box)

DivaVocals:

Dude you're asking ME??!!:laugh:
Haha! No, I wasn't directing that question at you specifically. More just commenting aloud about additional observations I made.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

7 May 2013, 11:37 PM
#58
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Advanced Search Question (limit to category box)

DrByte:

Haha! No, I wasn't directing that question at you specifically. More just commenting aloud about additional observations I made.
Whew!!! because I was looking the screen like this::shocking:

:laugh:

But I took a quick looksee at the files and I think I've figured out how to replace at least TWO of the template files --new products and featured products-- with the correct modules files.. (this is in theory.. I can't test this until I get home tonight)

Not sure how to do the same with the following:

  • **sideboxes/tpl_categories.php **(the module doesn't contain the actual data query, this file does or am I missing something??)
  • **templates/tpl_products_all_default.php **(not quite sure what the module file equivilent is to this.. though I admit that I looked fairly quickly)

I'm not sure if there is a better way to exclude the hidden categories from the advanced search page's category dropdown without modifying the **templates/tpl_advanced_search_default.php **file, and I STILL can't figure out why the code to **includes/modules/pages/advanced_search_result/header_php.php **doesn't work.. in theory it SHOULD (and it did in my previous testing)..

//bof hidden categories change to hide hidden categories from search function
$from_str = "FROM (" . TABLE_HIDE_CATEGORIES . " h, " . TABLE_PRODUCTS . " p
             LEFT JOIN " . TABLE_MANUFACTURERS . " m
             USING(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c )
             LEFT JOIN " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd
             ON mtpd.products_id= p2c.products_id
             AND mtpd.language_id = :languagesID";
//eof hidden categories change    
$from_str = $db->bindVars($from_str, ':languagesID', $_SESSION['languages_id'], 'integer');
if ((DISPLAY_PRICE_WITH_TAX == 'true') && ((isset($_GET['pfrom']) && zen_not_null($_GET['pfrom'])) || (isset($_GET['pto']) && zen_not_null($_GET['pto'])))) {
  if (!$_SESSION['customer_country_id']) {
    $_SESSION['customer_country_id'] = STORE_COUNTRY;
    $_SESSION['customer_zone_id'] = STORE_ZONE;
  }
  $from_str .= " LEFT JOIN " . TABLE_TAX_RATES . " tr
                 ON p.products_tax_class_id = tr.tax_class_id
                 LEFT JOIN " . TABLE_ZONES_TO_GEO_ZONES . " gz
                 ON tr.tax_zone_id = gz.geo_zone_id
                 AND (gz.zone_country_id IS null OR gz.zone_country_id = 0 OR gz.zone_country_id = :zoneCountryID)
                 AND (gz.zone_id IS null OR gz.zone_id = 0 OR gz.zone_id = :zoneID)";
  $from_str = $db->bindVars($from_str, ':zoneCountryID', $_SESSION['customer_country_id'], 'integer');
  $from_str = $db->bindVars($from_str, ':zoneID', $_SESSION['customer_zone_id'], 'integer');
}
// Notifier Point
$zco_notifier->notify('NOTIFY_SEARCH_FROM_STRING');
//bof hidden categories change to hide hidden categories from search
$where_str = " WHERE (p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
      AND (p.master_categories_id = h.categories_id and h.visibility_status !=2) 
               AND p2c.categories_id = c.categories_id ";
//eof hidden categories change

(I am supposed to writing use cases, but can ya tell I'm a little BORED!!??:laugh:)

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

8 May 2013, 12:11 AM
#59
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Advanced Search Question (limit to category box)

Reminder #1: the extra_functions file is also using split() and needs changing as mentioned in #1 from my previous post.
Reminder #2: my second suggestion in this previous post should be ignored.

DrByte:

  1. But the code is using the deprecated split() function, so the code will not work on PHP 5.3.0 or newer.
    Those references to split() should be replaced with explode(). See more detail here: http://www.zen-cart.com/entry.php?2-Is-your-code-safe-to-use-on-PHP-5-3

  2. ... changing this line, by adding the part in bold, would be suggested:```
    if ([B]![/B][B]$hide_status->EOF && [/B]$hide_status->fields['visibility_status'] < 1) {

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

8 May 2013, 12:21 AM
#60
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Advanced Search Question (limit to category box)

DrByte:

Reminder #1: the extra_functions file is also using split() and needs changing as mentioned in #1 from my previous post.
Reminder #2: my second suggestion in this previous post should be ignored.
Yes I have noted #2.. Will make sure to look out for the change required for #1.. will let you know how I make out..

One last TENSY little thing.. PRETTY PLEASE.. can you take a look at the advanced search code and tell me what I am OBVIOUSLY missing about why it doesn't work.. and let me be clear.. when I say it doesn't work, you get NO search results whatsoever with this code in place.. not just hidden products, but ALL products.. It doesn't matter if I search for hidden or "regular" products.. I get no search results, and I am TRULY stumped as to WHY..

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.