Advertisement:

Author Topic: [Tuturial]Show all countries,regions and cities in sidebar  (Read 29649 times)

joeyv

  • Jr. Member
  • **
  • Posts: 82
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #30 on: November 19, 2013, 08:11:06 pm »
FYI - I am new to PHP and figuring this out as I go.

Can someone help me out on pasting the exact code I need to add to on the Main.php for the latest Bender theme? I'd like to just have the U.S. regions show up from Alabama all the way down to Wyoming - similar to my screenshot sample.

I just grabbed the code chunk that is for the Locations. Here is what I have from oc-content/themes/bender

line 71 - 87

--------------------------

</div><!-- main -->
<div id="sidebar">
    <div class="widget-box">
        <?php if(osc_count_list_regions() > 0 ) { ?>
        <div class="box location">
            <h3><strong><?php _e("Location", 'bender') ; ?></strong></h3>
            <ul>
            <?php while(osc_has_list_regions() ) { ?>
                <li><a href="<?php echo osc_list_region_url(); ?>"><?php echo osc_list_region_name() ; ?> <em>(<?php echo osc_list_region_items() ; ?>)</em></a></li>
            <?php } ?>
            </ul>
        </div>
        <?php } ?>
    </div>
</div>
<div class="clear"><!-- do not close, use main clossing tag for this case -->
<?php osc_current_web_theme_path('footer.php') ; ?>


--------------------------



Thanks
JV

Husa64

  • Newbie
  • *
  • Posts: 33
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #31 on: February 01, 2014, 11:23:39 am »
Hi all how we can assign a selected region name to a php variable?

abatahir

  • Newbie
  • *
  • Posts: 21
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #32 on: February 12, 2014, 11:25:41 pm »
hi,
If i select a region or city how to apply that search on main page.. just like apply a filter on main page

maxeem

  • Newbie
  • *
  • Posts: 13
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #33 on: February 18, 2014, 04:11:33 pm »
it is possible with Ajax ;)

Code: [Select]
<h3><strong><?php _e("Region"'modern') ; ?></strong></h3>
<ul>
                        <?php while(osc_has_list_regions() ) { ?>
                            <li><a href="<?php echo osc_list_region_url() ; ?>"><?php echo osc_list_region_name() ; ?></a> <em>(<?php echo osc_list_region_items() ; ?>)</em></li>
                        <?php ?>
                        </ul>

MaX
« Last Edit: February 18, 2014, 04:41:09 pm by maxeem »

Zen Team

  • Jr. Member
  • **
  • Posts: 51
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #34 on: May 06, 2014, 08:55:17 pm »
Hi
i am trying to use this code to show country with regions on the sidebar:

Code: [Select]
<?php View::newInstance()->_exportVariableToView('list_regions'Search::newInstance()->listRegions('US''>=''region_name ASC') ) ; ?>
                        <?php if(osc_count_list_regions() > 0) {?>
                        <div class="box location">
                            <h3><strong><?php _e("Maqedonia"'modern'); ?></strong></h3>
                            <ul>
                            <?php while(osc_has_list_regions()) { ?>
                                <li><a href="<?php echo osc_search_url(array('sRegion' => osc_list_region_name()));?>"><?php echo osc_list_region_name();?></a> <em>(<?php echo osc_list_region_items();?>)</em></li>
                            <?php ?>
                            </ul>
                        </div>
                        <?php ?>

It works perfect for showing the regions for the given country on the sidebar.

But my problem is that i have 3 countries and want to show regions for all 3 countries on the sidebar separated from each other.

When i put the code 3 times it still only show the country and region from the first code.

How can i use this code so i can show region from the 3 countries separated?

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #35 on: May 06, 2014, 09:09:49 pm »
Hi,

Easy, just repeat that block two more times, just changing:

Code: [Select]
<?php View::newInstance()->_exportVariableToView('list_regions'Search::newInstance()->listRegions('US''>=''region_name ASC') ) ; ?>
Replace each time 'US' with a new country code (anyway, I guess you don't really have "US" there to show Macedonia). ???

Regards

Zen Team

  • Jr. Member
  • **
  • Posts: 51
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #36 on: May 06, 2014, 09:21:46 pm »
It's because i have copied the code from here from a reply and since it was the thirt time i copied the code i never mannaged to change US on this one.

But i have changed the other to the slug that the country has in my location settings.  But it does not show the regions from the country i have written to show.

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #37 on: May 06, 2014, 09:52:48 pm »
It should work. ??? The only explanation I could think of is that you're not using the correct ISO country codes (2-letter):

http://countrycode.org/

Regards

Zen Team

  • Jr. Member
  • **
  • Posts: 51
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #38 on: May 06, 2014, 10:04:16 pm »
Yeah. I was mistaking the letter v and w. So it is fine and working now :). Just have to wait someone to post a listing on my site so it can show.. hehe
Since it's a new site.

nektm

  • Newbie
  • *
  • Posts: 15
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #39 on: May 10, 2014, 02:51:05 am »
How to I make these show as two columns in the div(s)?

http://dancameron.org/code/splitting-content-into-two-columns-e-g-word-wrap-with-php-or-css-javascript/  (second solution)
gives me an idea but I'm not very good with CSS.  I would need the two divs to look like they're on box with location spanning both divs

div
{
column-count:2;
column-gap:40px;
}

eric03

  • Newbie
  • *
  • Posts: 17
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #40 on: August 19, 2014, 07:26:16 pm »
Hello,
i have tried all code but for me it doesnt work.
I would like to show all Regions with and withouts ads.
I use the theme France and osclass 3.4.1
One have an idea or can help?
thanks

soundmatrix2003

  • Newbie
  • *
  • Posts: 8
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #41 on: September 05, 2014, 06:04:58 pm »
Hello, okay well im trying to show all the countries but the code does not seem to work for me, im using the latest version of osclass.
:) should it not be easier to have a button in the admin to select if you want to show all countries, regions, cities? just saying :)
thx
« Last Edit: September 05, 2014, 06:32:56 pm by soundmatrix2003 »

thedaigle

  • Jr. Member
  • **
  • Posts: 81
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #42 on: October 13, 2014, 11:12:47 pm »
I've been attempting to include a CITY link with each item in the grid view that end users could click to see only items from that city (like I've also done with the categories )... I've tried the following helpers:

osc_city_url()
osc_item_city()

But I'm probably missing something simple and have been unsuccessful. Can someone point me in the right direction?

I'm using this for the category link..

Code: [Select]
<a href="<?php echo tf_osc_item_category_url(osc_item_category_id()) ; ?>"><?php echo osc_item_category() ; ?></a>

thedaigle

  • Jr. Member
  • **
  • Posts: 81
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #43 on: October 14, 2014, 01:07:51 am »
Hm. Or actually how could I link to search list of only items in that category & city instead of simple city listings link... ?

Thanks in advance.

friend4chams

  • Newbie
  • *
  • Posts: 9
Re: [Tuturial]Show all countries,regions and cities in sidebar
« Reply #44 on: November 14, 2014, 01:18:15 pm »
hello
Thank you for this tutorial
but how is it to display all the cities of a particular region

I have posted the same idea on http://osclass.uservoice.com/forums/183966-general/suggestions/6714009-side-bar-cities-under-regions-selections-region

Please vote for it.