osCmax v2.5 User Manual
Results 1 to 2 of 2

Altering code to work from a different directory

This is a discussion on Altering code to work from a different directory within the osCmax v2 Customization/Mods forums, part of the osCmax v2.0 Forums category; I have oscmax installed in public_html\catalog I have a file with the following code in public_html The code was originally ...

      
  1. #1
    New Member
    Join Date
    Jan 2011
    Posts
    19
    Rep Power
    0


    Default Altering code to work from a different directory

    I have oscmax installed in public_html\catalog
    I have a file with the following code in public_html
    The code was originally made to work from the public_html\catalog, but I have tried inserting the word 'catalog' here and there within the code, without really knowing the syntax. Please let me know if I got it right, which I don't think I did because it doesn't work.
    Code:
    <?php
       if ((USE_CACHE == 'true') && empty($SID)) {
         ;
       } else {
    
         if ( DISPLAY_DHTML_MENU == 'Dhtml' ) {
           include('catalog/' . DIR_WS_BOXES . 'categories_dhtml_dropdown.php');
       } else {
    
      function tep_show_category($counter) {
        
    // BoF - Contribution Category Box Enhancement 1.1
        global $tree, $boxContent, $cPath_array, $cat_name;
    
        $cPath_new = 'cPath=' . 'catalog/' . $tree[$counter]['path'];
        $boxContent .= '<li><a href="';
        $boxContent .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';
       
    // display category name
        $boxContent .= $tree[$counter]['name'];
    
                    if ($cat_name == $tree[$counter]['name']) {
                            $boxContent .= '</span>';
        }
    
    //         EoF Category Box Enhancement
    
        $boxContent .= '</a></li>';
    
        if (SHOW_COUNTS == 'true') {
          $products_in_category = tep_count_products_in_category($counter);
          if ($products_in_category > 0) {
            $boxContent .= '&nbsp;(' . $products_in_category . ')';
          }
        }
    
        if ($tree[$counter]['next_id'] != false) {
          tep_show_category($tree[$counter]['next_id']);
        }
      }
    ?>
    
    <!-- categories //-->
    <?php
    
      $boxContent = '';
      $tree = array();
    
      $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.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
      while ($categories = tep_db_fetch_array($categories_query))  {
        $tree[$categories['categories_id']] = array('name' => $categories['categories_name'],
                                                    'parent' => $categories['parent_id'],
                                                    'level' => 0,
                                                    'path' => $categories['categories_id'],
                                                    'next_id' => false);
    
        if (isset($parent_id)) {
          $tree[$parent_id]['next_id'] = $categories['categories_id'];
        }
    
        $parent_id = $categories['categories_id'];
    
        if (!isset($first_element)) {
          $first_element = $categories['categories_id'];
        }
      }
    
      tep_show_category($first_element); 
    
    $box_base_name = 'dropdown';
    include (bts_select('boxes', $box_base_name)); // BTS 1.5
    }
    }
    ?>

  2. #2
    New Member
    Join Date
    Jan 2011
    Posts
    19
    Rep Power
    0


    Default Re: Altering code to work from a different directory

    This is what I needed:

    <?php
    chdir('catalog');
    require('includes/application_top.php');
    ?>

    Also, the code above has an error:
    $cPath_new = 'cPath=' . 'catalog/' . $tree[$counter]['path'];

    cPath has not to do with a path, but with some kind of database ID number, so it should remain as it originally was:
    $cPath_new = 'cPath=' . $tree[$counter]['path'];
    Last edited by mraeryceos; 01-29-2011 at 08:49 AM.

Similar Threads

  1. Directory does not exist
    By whiteRabbit in forum osCommerce 2.2 Installation Help
    Replies: 2
    Last Post: 10-23-2010, 11:43 AM
  2. Will taking this category code out work ok?
    By heezay in forum osCommerce 2.2 Installation Help
    Replies: 5
    Last Post: 04-15-2009, 12:01 AM
  3. do CreLoaded templates work on oscmax? Also do oscommerce contribs work on oscmax?
    By Misery_Kitty in forum osCmax v2 Installation issues
    Replies: 7
    Last Post: 02-12-2008, 01:06 AM
  4. warning directory does not exist: /tmp.Session will not work
    By mickthefish in forum osCommerce 2.2 Installation Help
    Replies: 2
    Last Post: 09-18-2003, 04:09 PM
  5. Directory Structure
    By ativan in forum osCommerce 2.2 Installation Help
    Replies: 1
    Last Post: 11-18-2002, 05:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •