Display premium items in Osclass

Osclass has an option to mark items as premium, manual from admin panel or by any promote plugin that allows publishing of premium items on site.

Every theme is different and most of them already display premium items but if you want to include a list of premium items in another part of your site or page, here is the code that will do this job.

 

<?php osc_get_premiums(); ?>
<?php if (osc_count_premiums() > 0) { ?>
    <div class="premium-ads">
        <?php while (osc_has_premiums()) { ?>
            <div class="item">
                <div class="image">
                    <?php if (osc_count_premium_resources()) { ?>
                        <a href="<?php echo osc_premium_url(); ?>"><img src="<?php echo osc_resource_thumbnail_url(); ?>" width="75" height="56" title="<?php echo osc_item_title(); ?>" alt="<?php echo osc_item_title(); ?>" /></a>
                    <?php } else { ?>
                        <img src="<?php echo osc_current_web_theme_url('images/no_photo.gif'); ?>" title="" alt="" />
                    <?php } ?>
                </div>
                <div class="content">
                    <?php echo osc_premium_title(); ?>
                </div>
            </div>
        <?php } ?>
    </div>
<?php } ?>

Just some minimal style for the above code

    .premium-ads{display:block;margin:10px 0px;}
    .premium-ads .item{display:block;margin-bottom:10px;width:600px;}
    .premium-ads .item .image{display:inline-block;width:100px;}
    .premium-ads .item .image img{width:100%;}
    .premium-ads .item .content{width:480px;display:inline-block;margin-left:10px;}

To change the number of displayed premium ads modify the  line from the above code

 

<?php osc_get_premiums(4); ?>

4 - will display 4 premium ads if you have 4 active premium ads on site, increase or decrease the number base of your needs

Another useful example is to use the already style code from our theme. We will user Bender theme but take notice that this structure is different from theme to theme.

The code:

 

<?php osc_get_premiums(4); ?>
<?php if (osc_count_premiums() > 0) { ?>
    <div class="premium-ads">
        <?php
        View::newInstance()->_exportVariableToView("listType", 'premiums');
        View::newInstance()->_exportVariableToView("listClass", $listClass . ' premium-list');
        osc_current_web_theme_path('loop.php');
        ?>
    </div>
<?php } ?>
Subscribe
X

Subscribe!

Subscribe to get the latest listings, updates and special offers delivered directly in your inbox.