Support Forums - Classified Ads Script Osclass
Osclass theme support => Sigma Osclass Theme => Topic started by: mheston on December 08, 2021, 11:24:08 AM
-
When I click on select category drop down menu it shows all categories. I would like to be able to click on a category and it takes me to that category without using search button. can this code be modified to do that.
<?php osc_categories_select('sCategory', null, __('Select a category', 'sigma')) ; ?>
-
@mheston
This can be achieved via jQuery, try this one:
<script>
$(document).ready(function() {
$('#cat_id').on('change', function() {
window.location.href = "https://yoursite.com/index.php?page=search&sCategory=" + $(this).val();
});
});
</script>
Selector (#cat_id) and redirect url (yoursite.com) should be updated.
-
k thanks, ill try that if i can find where to put it.
-
With script tags to any HTML file, without script tags to any .js file.
-
Thank you very much. I also have another mod I am trying to figure out. In search sidebar I removed "your search" and "subscribe to this search" sections to only show the sub categories. On mobile view only when I click on a main category I would like it to automatically show the filter first so they can select a sub category to go to. Desktop view I want to leave normal.
Can I add something like <div class="wrap isDesktop Ismobile"> to main.php home-cats section.
I think this is the code for the filter toggle, I am not sure how to implement it. I added a pic of my search sidebar.
<div class="actions">
<a href="#" class="resp-toogle show-filters-btn btn btn-secondary"><?php _e('Show filter','sigma'); ?></a>
<!-- START sort by -->
<span class="see_by btn btn-secondary">
<span><?php _e('Sort by', 'sigma'); ?>:</span>
<?php
$orders = osc_list_orders();
$current = '';
foreach($orders as $label => $params) {
$orderType = ($params['iOrderType'] == 'asc') ? '0' : '1';
if(osc_search_order() == $params['sOrder'] && osc_search_order_type() == $orderType) {
$current = $label;
}
}
?>
<label><?php echo $current; ?> <i class="fa fa-angle-down"></i></label>
<?php $i = 0; ?>
<ul>
<?php
foreach($orders as $label => $params) {
$orderType = ($params['iOrderType'] == 'asc') ? '0' : '1'; ?>
<?php if(osc_search_order() == $params['sOrder'] && osc_search_order_type() == $orderType) { ?>
<li><a class="current" href="<?php echo osc_esc_html(osc_update_search_url($params)); ?>"><?php echo $label; ?></a></li>
<?php } else { ?>
<li><a href="<?php echo osc_esc_html(osc_update_search_url($params)); ?>"><?php echo $label; ?></a></li>
<?php } ?>
<?php $i++; ?>
<?php } ?>
</ul>
</span>
-
@mheston
Ideal way to hide something or hide something just on mobile is via CSS and media queries.
https://www.w3schools.com/css/css_rwd_mediaqueries.asp
-
I dont want to hide the filter I just want it to show first right after clicking on a main category on mobile view
-
@mheston
There are just limited options to realign elements between desktop & mobile.
Easiest way is to change float:left; to float:right; on all elements in same level.
-
code im trying to mod -
<div id="home-cats">
<h2><?php _e('Main Categories', 'sigma'); ?></h2>
<div class="wrap "example" isDesktop isMobile">
<?php while(osc_has_categories()) { ?>
<a href="<?php echo osc_search_category_url(); ?>">
<div class="icon" <?php if(osc_category_color() <> '') { ?>style="color:<?php echo osc_category_color(); ?>;"<?php } ?>>
<i class="<?php echo (osc_category_icon() <> '' ? osc_category_icon() : 'far fa-share-square'); ?>"></i>
</div>
<strong><?php echo osc_category_name(); ?></strong> " example" if ismobile show filter or show div class="refine"> after clicking on category name
-
@mheston
Unfortunately it is not possible to debug issues just from parts of codes when talking about HTML and design :'(