Author Topic: Modifying Advanced Search Mod- need assistance..  (Read 5215 times)

Graphic 3

  • Jr. Member
  • **
  • Posts: 203
    • Graphic 3
Modifying Advanced Search Mod- need assistance..
« on: May 20, 2008, 21:02:39 pm »
i have the advanced search as a module works fine.. it's just it sees all the categories including parent and child... i would like to modify it so it only displays the child categories.. here is the script that needs modified, just having a hard time figuring it out

Code: [Select]
<select class="inputbox" name="search_category">
              <option value="0"><?php echo $VM_LANG->_('PHPSHOP_SEARCH_ALL_CATEGORIES'?></option>
              <?php 
              
// Show only top level categories and categories that are
              // being published
             
$q "SELECT category_id,category_name FROM #__{vm}_category ";
              
$q .= "WHERE category_publish='Y' ";
              
$q .= "ORDER BY category_name ASC";
$db = new ps_DB;
              
$db->query($q);
              while (
$db->next_record()) {   ?>

                  <option value="<?php echo $db->f("category_id"); ?>">
                    <?php echo $db->f("category_name"); ?>
                    </option>
                  <?php 
              

              
?>

            </select>
 

I know it needs to be category_child_id but it doesn't show any category when inputting that..

could someone help me out here?

thanks
iPhone, Droid and Blackberry App downloads and reviews
http://www.app-talk.com

kelven905

  • Beginner
  • *
  • Posts: 28
Re: Modifying Advanced Search Mod- need assistance..
« Reply #1 on: May 22, 2008, 00:13:08 am »
I would like to modify this as well. To make the advance search to include the parent categories only. anyone can help?

Joseph Kwan

  • Advanced
  • Full Member
  • *****
  • Posts: 2344
Re: Modifying Advanced Search Mod- need assistance..
« Reply #2 on: May 22, 2008, 09:21:54 am »
kade119,
add the condition ' AND parent_category>0'

kelven905
add the condition ' AND parent_category=0'

I'm not sure whether the field name is parent_category. But it should be easy to check that from the database.

PM me if you still need help.
Joomla/VM Upgrade Services. Problems with your migration? We can help.
Custom extensions to VM. Performance Tuning. Template modifications and advices.
Pay service to make VM work according to your needs. Your Joomla/VM solutions are just a PM away.

Graphic 3

  • Jr. Member
  • **
  • Posts: 203
    • Graphic 3
Re: Modifying Advanced Search Mod- need assistance..
« Reply #3 on: May 22, 2008, 14:31:28 pm »
add on which line?  i'm still learning PHP

Code: [Select]
$q = "SELECT category_id,category_name AND parent_category>0 FROM #__{vm}_category ";


maybe there?
iPhone, Droid and Blackberry App downloads and reviews
http://www.app-talk.com

Graphic 3

  • Jr. Member
  • **
  • Posts: 203
    • Graphic 3
Re: Modifying Advanced Search Mod- need assistance..
« Reply #4 on: May 22, 2008, 14:35:36 pm »
the file ps_product_category.php uses 'category_parent_id'
iPhone, Droid and Blackberry App downloads and reviews
http://www.app-talk.com

Joseph Kwan

  • Advanced
  • Full Member
  • *****
  • Posts: 2344
Re: Modifying Advanced Search Mod- need assistance..
« Reply #5 on: May 22, 2008, 20:18:24 pm »
yep category_parent_id is probably the proper field name. The additional condition should be added to the WHERE clause:

             $q = "SELECT category_id,category_name FROM #__{vm}_category ";
              $q .= "WHERE category_publish='Y' AND category_parent_id>0 ";
 
Joomla/VM Upgrade Services. Problems with your migration? We can help.
Custom extensions to VM. Performance Tuning. Template modifications and advices.
Pay service to make VM work according to your needs. Your Joomla/VM solutions are just a PM away.

Graphic 3

  • Jr. Member
  • **
  • Posts: 203
    • Graphic 3
Re: Modifying Advanced Search Mod- need assistance..
« Reply #6 on: May 22, 2008, 21:00:51 pm »
and if that doesn't work successfully?

no categories appear now, but need the sub cats there

btw its nice to have someone assist

thanks joe
iPhone, Droid and Blackberry App downloads and reviews
http://www.app-talk.com