This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

kriskoyk

  • *****
  • 381 posts
Displaying posts in category blocks in random order on the homepage in the beta theme

I have placed in the beta theme this code in main.php, the category blocks is displayed correctly, but the random order is not working.

Code: [Select]
<div class="home-container latest">
    <div class="inner">

      <!-- LATEST LISTINGS BLOCK -->
      <div id="latest" class="products grid">
        <h2><?php _e('Lately added on our classifieds''beta'); ?></h2>

       
<?php
   osc_query_item
(array(
    
"category" => "1","results_per_page" => "4""order" => "RAND()" )); ?>

 
 
        <?php if( osc_count_custom_items() > 0) { ?>
          <div class="block">
            <div class="prod-wrap">
              <?php $c 1?>
              <?php while( osc_has_custom_items() ) { ?>
                <?php bet_draw_item($c); ?>
               
                <?php $c++; ?>
              <?php ?>
            </div>
          </div>
       
        <?php } else { ?>
          <div class="home-empty">
            <img src="<?php echo osc_current_web_theme_url('images/home-empty.png'); ?>" />
            <strong><?php _e('No listing in category yet''beta'); ?></strong>
          </div>
        <?php ?>

        <?php View::newInstance()->_erase('items') ; ?>
      </div>
    </div>
  </div>
« Last Edit: April 20, 2025, 08:52:45 PM by kriskoyk »

*

MB Themes

Maybe you dont have enough listings or result from database is not really random. Try to enable DB debug log and check query, then run it on database.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

kriskoyk

  • *****
  • 381 posts
The code I entered is correct?

*

MB Themes

Code does not look wrong but you should verify SQL query generated. Also no cache should be enabled to have random data.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

Marked as best answer by frosticek on April 24, 2025, 03:36:19 PM
*

kriskoyk

  • *****
  • 381 posts
I upgraded to Osclass 8.3.0 and the random order worked immediately.

*

MB Themes

Possible, there were many updates including this functionality.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

kriskoyk

  • *****
  • 381 posts
Okay, the test was done on a test site, so we will wait for the final version of Oclass 8.3.0 to upgrade to the official one site.