Astanda.com forums Forum Index

Rate ADP:   
Astanda.com forums

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

directory is displaying contents of wrong category

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Astanda.com forums Forum Index -> ADP general forum
View previous topic :: View next topic  
Author Message
RonInMaine
Private


Joined: 15 Jan 2008
Posts: 10
Location: Maine, USA

PostPosted: Tue Jan 15, 2008 1:51 pm    Post subject: directory is displaying contents of wrong category Reply with quote

I downloaded the software a couple days ago and have been working on putting together a directory using it. I have liked what I have seen of the script, but I have come across a problem that I'm hoping someone else has encountered and solved.

My directory has several similar directory structures.

Organization #1
...Education
......Colleges, Universities, & Seminaries

Organization #2
...Education
......Colleges, Universities, & Seminaries

etc., Where "Organization" is on the top level of the directory, "Education" is on the next level (along with many other sub categories), and "Colleges, Universities, & Seminaries" is on the third level, within the "Education" directory. There are about 12 organizations listed.

On the admin site, everything works fine with this category structure. However, on the public side there is a problem when someone clicks down to the third level. When someone clicks an organization name, then the "Education" category, then the "Colleges, Universities, & Seminaries" directory, the "Colleges, Universities, & Seminaries" directory for organization #12, the last in the listing, is always displayed. It does not matter what organization the user is trying to view, it always displays the category structure and links for the last organization in the list once the user gets to the third level of categories.

Has anyone encountered this issue before?

Thank you,
Ron.
Back to top
View user's profile Send private message
RonInMaine
Private


Joined: 15 Jan 2008
Posts: 10
Location: Maine, USA

PostPosted: Tue Jan 15, 2008 10:35 pm    Post subject: fyi ... Reply with quote

fyi ...

I have applied the code fix detailed in the development forum in the issue titled "Duplicate Category Names Issue ..." ( http://www.astanda.com/forums/viewtopic.php?t=421 ).

The fix has changed the behavior of the directory, but not solved the issue. Instead of substituting the contents of the last category in the category structure, it is now pulling the contents from a category in the middle.

So, using the example category structure I mentioned in my original post:

Organization #1
...Education
......Colleges, Universities, & Seminaries

Organization #2
...Education
......Colleges, Universities, & Seminaries

Organization #3
...Education
......Colleges, Universities, & Seminaries

... etc. ...

There are 32 Organizations in all.

The original problem was that no matter which "College, Universities, & Seminaries" category users clicked on, it would always display the contents of the one from Organization #32 (the last in the list of organizations).

Now, with the code fix, it always displays the contents of the "College, Universities, & Seminaries" category from Organization #10. Always. no matter which organization the user is browsing.

If anyone has any insight into this issue, please let me know. Meanwhile I'll look at the code for that function and see if I can figure anything out.

Thanks!
Ron.
Back to top
View user's profile Send private message
RonInMaine
Private


Joined: 15 Jan 2008
Posts: 10
Location: Maine, USA

PostPosted: Wed Jan 16, 2008 1:29 am    Post subject: a solution Reply with quote

Okay, here's what finally worked for me...

I replaced the block of code in functions.php that begins with

Code:
 if($r_path)
and ends with
Code:
$relusts = mysql_query($sql);


with this:
Code:
 if($r_path)
   {
   $path_parts = split("/",$r_path);
   $selectedCategory_found = 0;
   $parentID = 0;
   $path_index = 0;
   while ($path_index < count($path_parts))
      {
      $findCategory_query = "SELECT `id` FROM `categories` WHERE path = '$path_parts[$path_index]' and `parent` = 0$parentID";
      $findCategory_result = mysql_query($findCategory_query);
      echo mysql_error();
      $CategoriesFound = mysql_num_rows($findCategory_result);
      if ($CategoriesFound == 1)
         {
         $parentID = mysql_result($findCategory_result,0,"id");
         if ($path_index == (count($path_parts)-1))
            {
            $categoryID = $parentID;
            $selectedCategory_found = 1;
            }
         }
      else
         {
         $path_index = count($path_parts);
         }
      ++$path_index;
      }
$sql = "SELECT `title`, `description`, `keywords`, `id` FROM `categories` WHERE id = $categoryID LIMIT 1";
$relusts = mysql_query($sql);


This solution is currently working for me, and it should be good for an unlimited depth of directory structure. If I run into any problems with it, I'll post here.

Thanks,
Ron.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Astanda.com forums Forum Index -> ADP general forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group