tep_get_category_tree() with spacing

Open to all! Ask other shopowners for help.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: tep_get_category_tree() with spacing

Post by ecartz »

You might check if you have an includes/system/override/category_tree.php or admin/includes/classes/category_tree.php


Join The Code Co-op to get access to your library in the Code Co-op Forum
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: tep_get_category_tree() with spacing

Post by LeeFoster »

ecartz wrote: Wed May 18, 2022 12:15 pm You might check if you have an includes/system/override/category_tree.php
I have this one
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: tep_get_category_tree() with spacing

Post by ecartz »

So it would be using the override version rather than the core version. So it's the override version to which you need to make the changes. That's one of the challenges of overriding, that you have to keep the file up-to-date manually.
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: tep_get_category_tree() with spacing

Post by LeeFoster »

ecartz wrote: Wed May 18, 2022 1:35 pm So it would be using the override version rather than the core version. So it's the override version to which you need to make the changes. That's one of the challenges of overriding, that you have to keep the file up-to-date manually.
I've tried both amending and removing this file, neither fixes the issue. Removing does nothing, amending just shows the top level categories.
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

Re: tep_get_category_tree() with spacing

Post by loop »

hi all
I also had a "override" but for testing i overrided it with the one ecartz had linked, also nothing changed to the output with the structure. i had no error, but also nothing changed to this. still the list with categories without "spaces"
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

Re: tep_get_category_tree() with spacing

Post by loop »

Any ideas about my problem?
@LeeFoster did you found a solution to solve this issue?

i have a "dirty" fix with using the old function i had from oscommerce, with this old function it worked with the spacing, strange, i don't know wheres the problem:

Code: Select all

  function tep_get_category_tree_bde($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false) {
    global $languages_id;

    if (!is_array($category_tree_array)) $category_tree_array = array();
    if ( (sizeof($category_tree_array) < 1) && ($exclude != '0') ) $category_tree_array[] = array('id' => '0', 'text' => TEXT_TOP);

    if ($include_itself) {
      $category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . $languages_id . "' and cd.categories_id = '" . $parent_id . "'");
      $category = tep_db_fetch_array($category_query);
      $category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']);
    }

    $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . $languages_id . "' and c.parent_id = '" . $parent_id . "' order by c.sort_order, cd.categories_name");
    while ($categories = tep_db_fetch_array($categories_query)) {
      if ($exclude != $categories['categories_id']) $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name']);
      $category_tree_array = tep_get_category_tree_bde($categories['categories_id'], $spacing . '&nbsp;&nbsp;&nbsp;', $exclude, $category_tree_array);
    }

    return $category_tree_array;
  }
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: tep_get_category_tree() with spacing

Post by burt »

The "go to" dropdown is already indented using multiple &nbsp; as so;

<select name="cPath" onchange="this.form.submit();" class="form-control">
<option value="0" selected="selected">Top</option>
<option value="1">Fruit</option>
<option value="3">&nbsp;&nbsp;&nbsp;Apples & Pears</option>
<option value="4">&nbsp;&nbsp;&nbsp;Citrus Fruit</option>
<option value="2">Vegetables</option>
</select>

I'm not sure what it is that you are looking for, that is different to this?
I am not here to build for you.
I am here to build with you. Let's help each other.
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

Re: tep_get_category_tree() with spacing

Post by loop »

hi burt
my (and leeforster) problem ist, that in our shop we don't have this
<option value="1">Fruit</option>
<option value="3">&nbsp;&nbsp;&nbsp;Apples & Pears</option>
<option value="4">&nbsp;&nbsp;&nbsp;Citrus Fruit</option>

in our shop it's like
<option value="1">Fruit</option>
<option value="3">;Apples & Pears</option>
<option value="4">Citrus Fruit</option>

i tried what ecartz told me but it didn't changed the output, if you tell in the "stockshop" it works with this, it's because of a overwrite, but i tried it also like ecartz told with tthe original file and id didn't changed, so i don't know where to search for the problem


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply