Loading


Advertisement:

Author Topic: osclass Cities dropdown based on selected Region  (Read 1904 times)

khudro-soft

  • Newbie
  • *
  • Posts: 4
osclass Cities dropdown based on selected Region
« on: June 30, 2014, 07:06:45 pm »
 0 down vote favorite
   

Im using osclass for a local classifieds website and im facing the following problem.

For the Regions and Cities im using the code in inc.search.php

The problem is that the above code brings all cities and all egion when page loads and does not check what region is selected first. That means that the city dropdown will be filled with all cities when page loads.

I want at first select regeion then the cities dropdown appear based on selected region.

code is

    <?php
Code: [Select]
   <?php


 $sQuery 
osc_get_preference('keyword_placeholder''usa');
?>

<script type="text/javascript">
var sQuery = '<?php echo osc_esc_js$sQuery ); ?>';

$(document).ready(function(){
    if($('input[name=sPattern]').val() == sQuery) {
        $('input[name=sPattern]').css('color', 'gray');
    }
    $('input[name=sPattern]').click(function(){
        if($('input[name=sPattern]').val() == sQuery) {
            $('input[name=sPattern]').val('');
            $('input[name=sPattern]').css('color', '');
        }
    });
    $('input[name=sPattern]').blur(function(){
        if($('input[name=sPattern]').val() == '') {
            $('input[name=sPattern]').val(sQuery);
            $('input[name=sPattern]').css('color', 'gray');
        }
    });
    $('input[name=sPattern]').keypress(function(){
        $('input[name=sPattern]').css('background','');
    })
});
</script>

<form action="<?php echo osc_base_url(true); ?>" method="get" class="search" onsubmit="javascript:return doSearch();">
<input type="hidden" name="page" value="search" />
<fieldset class="main">
    <input type="text" name="sPattern"  id="query" value="<?php echo osc_esc_html( ( osc_search_pattern() != '' ) ? osc_search_pattern() : $sQuery ); ?>" />
    <?php  if ( osc_count_categories() ) { ?>
        <?php osc_categories_select('sCategory'null__('Select a category''usa')); ?>
    <?php  ?>

<?php // Regions
$aRegions Region :: newInstance()->listAll();?>

    <?php if (count($aRegions) > 0) {?>
    <select name="sRegion" id="sRegion">
    <option value="">Select a Region</option>
    <?php foreach ($aRegions as $region) {?>
    <option  value="<?php echo $region['s_name'];?>"><?php echo $region['s_name'];?></option>
<?php ?>
</select>
<?php ?>

    <?php $aCities City::newInstance()->listAll(); ?>
<?php if(count($aCities) > ) { ?>
<select name="sCity" id="sCity">
<option value="">Select a City</option>
<?php foreach($aCities as $City) { ?>
<option value="<?php echo $City['s_name'] ; ?>"><?php echo $City['s_name'] ; ?></option>
<?php ?>
</select>
<?php ?>
<button type="submit"><?php _e('Search''usa') ; ?></button>
</fieldset>
<div id="search-example"></div>

Pls help me its urgent

lucato

  • Full Member
  • ***
  • Posts: 182
  • [<o>] Brasil
Re: osclass Cities dropdown based on selected Region
« Reply #1 on: July 02, 2015, 11:04:53 am »
Hi there, did you get to find out how to make osclass Cities dropdown list shows only cities based on the selected Region?
I'm still searching a solution for my Brazil theme, to place in the registration form or also when inserting listing.


If you found a solution, would you share it?

Thanks.

whoopwhoopler

  • Full Member
  • ***
  • Posts: 132
  • Everything Has A Solution
Re: osclass Cities dropdown based on selected Region
« Reply #2 on: July 17, 2015, 12:00:22 am »
@khudro-soft
@lucato

Just curious if either of you two have found a solution to this dropdown by region yet?

Whoop Whoop!

lucato

  • Full Member
  • ***
  • Posts: 182
  • [<o>] Brasil
Re: osclass Cities dropdown based on selected Region
« Reply #3 on: July 17, 2015, 01:03:40 am »
@WhoopWhoopler
Not yet here.
The Own OsClass site when registering has it working, but I didn't find any solution placed in the forum that really works.

Have a nice day.
« Last Edit: July 17, 2015, 01:05:56 am by lucato »

whoopwhoopler

  • Full Member
  • ***
  • Posts: 132
  • Everything Has A Solution
Re: osclass Cities dropdown based on selected Region
« Reply #4 on: July 17, 2015, 02:04:31 am »
I understand from osclasswizards that they will be providing their country, region, city selector from their premium theme in their next update for the free theme. I want to stress that this is what I was told... however we will see if it materializes... and actually makes it to the free theme... so go check out their premium theme country, region and city selector and see if this is indeed what you are looking for.

I think it would make this theme an exceptional theme... and take care of some peoblems that people have with having to select between a region or city selector... when they have a multi-coumtry site... and from there people can upgrade to their premium theme... or have some customizations performed from that point forward.

Anyhow I hope this info helps you and has you looking forward from here...

Whoop Whoop!

theklassifieds

  • Newbie
  • *
  • Posts: 3
Re: osclass Cities dropdown based on selected Region
« Reply #5 on: August 23, 2015, 10:42:10 pm »
Absolutely stunning post here: http://forums.osclass.org/themes/trick-for-bender-theme-change-item-post-location-to-dropdown-selector/

Does what needs to be done, and then some :)

MissTS

  • Newbie
  • *
  • Posts: 32
Re: osclass Cities dropdown based on selected Region
« Reply #6 on: September 10, 2015, 09:27:38 am »
I CAN NOT UNDERSTAND for the life of me, why they put out classifieds, and locations are one of the most important foundation parts of the site!
Yet every single script i find, but the raw old xyz's and programs like that, which are suppose to be LESS of a script have it easy for script owners, and the better ones makes it almost impossible to figure out.  These creators should know when building it, that this is suppose to be an important part.
Then they make all these other plugins, and not a simple user friendly post location plugin.  LOL

the u have to spend months in the forum, where half the answers never get answered.

i mean things like location to sign in... locations you want to offer postings in....  creating special fields in post and creating special membership/uer registration should be part of the foundation or at least available from the get go I think anyway when they put them out into the market so they can make alittle ching on them but should be there, easy to get and use.

I still can not get my basic posting locations (cities) to show on right side of the page!
so frustrating
« Last Edit: September 10, 2015, 09:36:36 am by MissTS »

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2509
Re: osclass Cities dropdown based on selected Region
« Reply #7 on: September 10, 2015, 09:42:47 am »
That is why themes are created and why programmers can be hired, to make life easier for those who don't know anything about programming ;)
I always had a hard time understanding why it is so hard to change my bathroom, everybody knows my wife wants it changed every 5 years orso and still walls have to be broken down, plumming redirected, etc...... ;D

I CAN NOT UNDERSTAND for the life of me, why they put out classifieds, and locations are one of the most important foundation parts of the site!
Yet every single script i find, but the raw old xyz's and programs like that, which are suppose to be LESS of a script have it easy for script owners, and the better ones makes it almost impossible to figure out.  These creators should know when building it, that this is suppose to be an important part.
Then they make all these other plugins, and not a simple user friendly post location plugin.  LOL

the u have to spend months in the forum, where half the answers never get answered.

i mean things like location to sign in... locations you want to offer postings in....  creating special fields in post and creating special membership/uer registration should be part of the foundation or at least available from the get go I think anyway when they put them out into the market so they can make alittle ching on them but should be there, easy to get and use.

I still can not get my basic posting locations (cities) to show on right side of the page!
so frustrating

MissTS

  • Newbie
  • *
  • Posts: 32
Re: osclass Cities dropdown based on selected Region
« Reply #8 on: September 10, 2015, 10:22:32 am »
Pretty steep risky terms here.
i see now why so many questions are not answered.  i just read the terms of hiring someone.
I would never hire someone under those conditions
besides, i can not afford to pay avg of 1.000 or even half that just to give me something it says it can already do, but does not have proper instructions for that.
the small amount to change a color  (one liner, maybe 3 line area.... & setting up locations, is NOT  worth that cost to me.
Nothing personal,  just i find that a high price for such. I have redone 3 homes in past. I am women hear me roar.  LOL
i just don't have that kind of ching to toss out...
:)
« Last Edit: September 10, 2015, 10:34:10 am by MissTS »

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2509
Re: osclass Cities dropdown based on selected Region
« Reply #9 on: September 10, 2015, 11:04:20 am »
LOL... coming from a self-taught and still learning developer who knows where you are coming from, go figure ;)

Well, in the forums you ask devs to help and their rate is different I guess and they use their own terms usually in line with what customer wants/needs.

But hey, in Osclass forums sometimes you can achieve pretty much if you push the right buttons, keep up the right mindset and be patient.

So let's start with your theme, what theme are you using and what is it exactly you want??

MissTS

  • Newbie
  • *
  • Posts: 32
Re: osclass Cities dropdown based on selected Region
« Reply #10 on: September 11, 2015, 09:01:48 pm »
im trying.. lol
thanks
i just against big timeframe to do this or i have to walk.

i just want locations to show where demo shows they are like everyone else.
only i tried diff things and nothing works.  I know i followed and installed it correctly.

I have add different things and put it back when those did not work.
There has to be something else, we are not being told.  I saw a few sites asking with questions and answers but those sites are now not online. I guess they did not make it.

Love to use the script, but i left once before cause i did not think it was ready.  still do not after $100 wasted and 2 weeks trying to figure this out.
I do not have this much time for ONE basic situation.
too many issues people seem to be having like me with the basic foundation like the locations showing up.
so i give up. on to other script I was working with i guess.
too bad.  i thought it had hopes.  Maybe when osclass fixes these issues, it will be good.
Why hire someone to do only basics when i have to later hire to do other things too. Its like a double wammie money pit without the basics working.

thanks for trying though
appreicated
« Last Edit: September 12, 2015, 11:27:14 am by MissTS »

sinaps1

  • Newbie
  • *
  • Posts: 4
Re: osclass Cities dropdown based on selected Region
« Reply #11 on: October 12, 2017, 09:32:00 pm »
Hey man
I solved my problem of cities with the following statement before the call of the list of the cities
Code: [Select]
if ( !empty($region['s_name'])) ) after this continued with the code.

Maybe is different in my code as I used a different theme. I used this code in the /theme/[name of the theme]/functions.php

Try this out maybe will help you :)