×

php up to date

Showing posts with label osclass. Show all posts
Showing posts with label osclass. Show all posts

Osclass Mail Server Problems and solutions

1. User activation Mail Not send?


  In OSClass you need to configure mail server in osclass admin panel.

you can configure either your own localhost server or gmail server.

I) First locahost server?

   Server   :  Localhost   Email From : info@yourdomain.com   Port              : 25 for SMTP   user name  :yyyyy   password : your email id password

II) Gmail server configuration?

   Server  smtp.gmail.com
   Email From : info@gmail.com   Port              : 25 for SMTP   user name  :yyyyy   password : your email id password

Note :  If you use subdomain make sure your email id should be main domain  

Remove Category from home page osclass

Remove Category from home page  osclass

 

Open theme folder and edit functions.php file,
 find out h1 tag with categories under div with class name row 
remove from there  to closing tab of row div...
that's all categories now removed from your home page completely. 
Eg:
   <h1 class="title"><?php _e('Categories', OSCLASSWIZARDS_THEME_FOLDER);?></h1>
<div class="row">
<?php

    $total_categories   = osc_count_categories();
    $col1_max_cat       = ceil($total_categories/1);
    osc_goto_first_category();
    $catcount    =    0;
    while ( osc_has_categories() ) {
?>
<ul class="col-sm-6 col-md-3 grid_list">
  <li>
   -----
   -----
</li></ul>
<?php } ?>
</div>
It will change based on your theme. Mostly common.some customized themes may different.

subcategory display in serach page

subcategory display in serach page osclass

output



function.php

Add this code into functions.php to get subcategory list based on category selection and display into search.php

if( !function_exists('get_subcategories') ) {
         function get_subcategories( ) {
             $location = Rewrite::newInstance()->get_location() ;
             $section  = Rewrite::newInstance()->get_section() ;
            
             if ( $location != 'search' ) {
                 return false ;
             }
            
             $category_id = osc_search_category_id() ;
            
             if(count($category_id) > 1) {
                 return false ;
             }
            
             $category_id = (int) $category_id[0] ;
            
             $subCategories = Category::newInstance()->findSubcategories($category_id) ;
 
            
             foreach($subCategories as &$category) {
                 $category['url'] = get_category_url($category) ;
             }
            
             return $subCategories ;
         }
     }
     if ( !function_exists('get_category_url') ) {
         function get_category_url( $category ) {
             $path = '';
             if ( osc_rewrite_enabled() ) {
                if ($category != '') {
                    $category = Category::newInstance()->hierarchy($category['pk_i_id']) ;
                    $sanitized_category = "" ;
                    for ($i = count($category); $i > 0; $i--) {
                        $sanitized_category .= $category[$i - 1]['s_slug'] . '/' ;
                    }
                    $path = osc_base_url() . $sanitized_category ;
                }
            } else {
                $path = sprintf( osc_base_url(true) . '?page=search&sCategory=%d', $category['pk_i_id'] ) ;
            }
            
            return $path;
         }
     }
     
     if ( !function_exists('get_category_num_items') ) {
         function get_category_num_items( $category ) {
            $category_stats = CategoryStats::newInstance()->countItemsFromCategory($category['pk_i_id']) ;
            
            if( empty($category_stats) ) {
                return 0 ;
            }
            
            return $category_stats;
         }
     }

?>


//search .php

Add this code into search.php where you want to display your sub category

<ul>
    <li><?php foreach(get_subcategories() as $subcat) { echo "<a href='".$subcat["url"]."'>".$subcat["s_name"]."</a> <span>(".get_category_num_items($subcat).")</span> | " ; } ?>
     </li>
</ul>

City based search result osclass

Geting City based search result in osclass


<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="sCity"  id="sCity" value="<?php _e('Enter your city here'); ?>" />
        <?php  if ( osc_count_categories() ) { ?>
            <?php osc_categories_select('sCategory', null, __('Select a category', 'modern')); ?>
        <?php  } ?>
        <button type="submit"><?php _e('Search', 'modern'); ?></button>
    </fieldset>
    <div id="search-example"></div>
</form>

Just add this code where ever you want i place it in a header

output is



Os Class Home Page Customization

Os Class Theme Home Page Customization



output:


If you try to get like this output follow the below steps(Bender theme)


Go to functions.php and edit these line
Step 1:

      Remove Subcategory from os class

       Find  <?php if ( osc_count_subcategories() > 0 ) { ?> these code in the functions .php file and remove those section.

Step2: 

      Apply images for category

In functions .php find category section and replace with in the h1 tag with below code.
<h1>
                    <?php
                    $_slug      = osc_category_slug();
                    $_url       = osc_search_category_url();
                    $_name      = osc_category_name();
                    $_total_items = osc_category_total_items();
                    if ( osc_count_subcategories() > 0 ) { ?>
                    <span class="collapse resp-toogle"><i class="fa fa-caret-right fa-lg"></i></span>
                    <?php } ?>
                    <?php if($_total_items > 0) { ?>
                   
<img src="<?php echo osc_current_web_theme_url()?>/images/<?php echo $_slug; ?>.png">
<a class="category <?php echo $_slug; ?>" href="<?php echo $_url; ?>">   
   <?php echo $_name ; ?></a> <span>(<?php echo $_total_items ; ?>)</span>
                    <?php } else { ?>
                   
<img src="<?php echo osc_current_web_theme_url()?>/images/<?php echo $_slug; ?>.png">
<a class="category <?php echo $_slug; ?>" href="#">
<?php echo $_name ; ?></a> <span>(<?php echo $_total_items ; ?>)</span>
                    <?php } ?>
                 </h1>

Save images in the image folder. The image name should be like category names. ex: if category name is realestate the image name should be real-estate.png.

for demo visit www.adpalani.com/classifieds

How to install new theme in osClass?

How to install new theme in osClass?


01 - Where to install?


Unzip your plugin .zip file in the following folder:

{path to my website}/oc-content/themes/




01 - Go to your admin panel


Normally located at http://{my website url}/oc-admin



02 - Go to "Apearance/Themes"







06 - Find your theme on the list







07 - Click "Activate"









06 - All done!


Easy hum? Now you can try many diferent free and paid themes available on the web for Osclass platform.