J-BusinessDirectory - New Module using JBusiness - Latest

Support Forum

 
 

 

I needed to filter businesses by state instead of city, so I created my own module to do just that. I used the Latest Module as my foundation.

After updating I got some errors that I can't figure out. the businesses wont show up.

 

I the helper file I edited the City Param/

$city= $params->get('city');
       // dump($city);
        $whereCityCond='';
        if(!empty($city)){
            $whereCityCond=" and cp.city = '".$db->escape($city)."' ";
        }

to this/

$state = $params->get('state');
       // dump($state);
        $whereStateCond='';
        if(!empty($state)){
            $whereStateCond=" and cp.county = '".$db->escape($state)."' ";
        }

The goal is to filter out the [ cp.county ] which is the state from the database

 

shouldn't that just work? and of course I updated the model/field/...php file load class

as well as the xml file

             <field
                    name="state"
                    type="countycategories"
                    multiple="false"
                    size="10"
                    default=""
                    label="State"
                    description="Select state" >
                </field>

 

How can I pull every business from a state instead a city?

3 replies

I fugured my own issue out. I quess its great to just talk it out and revisit the issue. now instead of displaying entities from cities I can simply show all entites from a category of a specific state.

 

I modifies the helper file to pull county and category

$query = "SELECT * FROM #__jbusinessdirectory_companies where county='$county' AND  mainSubcategory='$categoryIds'";

 

I hope State is implemented in the new Build as City was in the JBusiness - Latest Mod.

Hi,

 

If you need to filter the search by state you should activate region in the search module settings and hide city in module manger on admin area.

There is no need to create other modules.

I will try those settings for my desired affect thank you.
 
 
 

4 Item(s)

Show per page