Keyword

? Featured items in the order

  • Meymen
  • Meymen's Avatar Topic Author
  • Offline
  • New Member
More
14 years 5 months ago #82517 by Meymen
? Featured items in the order was created by Meymen
Hello dear developers.Featured items in the order of items in categories first exit possible?The following section;Category Edit >> Category item layout >> Item ordering >>-Default-Oldest first-Most recent first-Title Alphabetical-Title Reverse-Alphabetical-Ordering-Ordering Reverse-Most popular-Highest rated-Random orderingFeatured items firs. ( If you add this option would be better for K2 component )Thank you for your interest

Please Log in or Create an account to join the conversation.

More
14 years 5 months ago #82518 by Simon Wells
Replied by Simon Wells on topic ? Featured items in the order
This has been added to the list, thanks.

Simon
K2 Support

Please Log in or Create an account to join the conversation.

  • Meymen
  • Meymen's Avatar Topic Author
  • Offline
  • New Member
More
14 years 5 months ago #82519 by Meymen
Replied by Meymen on topic ? Featured items in the order
K2Joom said:This has been added to the list, thanks.
Simon
K2 Support


Thank you for your interest Simon.
Good luck

Please Log in or Create an account to join the conversation.

More
13 years 7 months ago #82520 by Kibekas
Replied by Kibekas on topic ? Featured items in the order
I'm wondering whether this is already possible to do? I.e. featured in top and others sort by date?

Please Log in or Create an account to join the conversation.

More
13 years 7 months ago #82521 by Terry Britton
Replied by Terry Britton on topic ? Featured items in the order
Yes it is possible, if you are comfortable with php.  Duplicate the code that calls each item (the foreach statement) and surround each chunk of code as follows.  You should do this in template overrides.

<?php if ($this->item->featured) : ?>

first chunk of code

<?php endif; ?>

<?php if !($this->item->featured): ?>

second chunk of code

<?php endif; ?>

Please Log in or Create an account to join the conversation.

More
13 years 4 months ago #82522 by Markus Maier
Replied by Markus Maier on topic ? Featured items in the order
I can't get it to work. My code looks like this. But what I get is no item at all. Any suggestions?:

 

<?php if ($this->item->featured) : ?>            <?php foreach($this->secondary as $key=>$item): ?>                        <?php            // Define a CSS class for the last container on each row            if( (($key+1)%($this->params->get('num_secondary_columns'))==0) || count($this->secondary)<$this->params->get('num_secondary_columns') )                $lastContainer= ' itemContainerLast';            else                $lastContainer='';            ?>                        <div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->secondary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_secondary_columns'), 1).'%;"'; ?>>                <?php                    // Load category_item.php by default                    $this->item=$item;                    echo $this->loadTemplate('item');                ?>            </div>            <?php if(($key+1)%($this->params->get('num_secondary_columns'))==0): ?>            <div class="clr"></div>            <?php endif; ?>            <?php endforeach; ?>            <?php endif; ?>


Terry A Britton said:

Yes it is possible, if you are comfortable with php.  Duplicate the code that calls each item (the foreach statement) and surround each chunk of code as follows.  You should do this in template overrides.

<?php if ($this->item->featured) : ?>

first chunk of code

<?php endif; ?>

<?php if !($this->item->featured): ?>

second chunk of code

<?php endif; ?>

Please Log in or Create an account to join the conversation.

More
13 years 4 months ago #82523 by Terry Britton
Replied by Terry Britton on topic ? Featured items in the order
Sorry my explanation wasn't very good.  The test for the featured status goes inside the foreach loop.

 

            <?php foreach($this->secondary as $key=>$item): ?>

                    <?php if ($this->item->featured) : ?>

...

 

                   <?php endif; ?>            <?php endforeach; ?>

Please Log in or Create an account to join the conversation.

More
13 years 4 months ago #82524 by Markus Maier
Replied by Markus Maier on topic ? Featured items in the order
Thanks for getting back so quickly. Unfortunately this doesn't help either. I'm not getting any items. Of course I checked that the "show featured items" is enabled and indeed it is displaying featured items in the overview when I commented out your code. Any other suggestions?

 

<?php foreach($this->secondary as $key=>$item): ?>            <?php if ($this->item->featured) : ?>            <?php            // Define a CSS class for the last container on each row            if( (($key+1)%($this->params->get('num_secondary_columns'))==0) || count($this->secondary)<$this->params->get('num_secondary_columns') )                $lastContainer= ' itemContainerLast';            else                $lastContainer='';            ?>            <div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->secondary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_secondary_columns'), 1).'%;"'; ?>>                <?php                    // Load category_item.php by default                    $this->item=$item;                    echo $this->loadTemplate('item');                ?>            </div>            <?php if(($key+1)%($this->params->get('num_secondary_columns'))==0): ?>            <div class="clr"></div>            <?php endif; ?>            <?php endif; ?>            <?php endforeach; ?>

Please Log in or Create an account to join the conversation.

More
13 years 4 months ago #82525 by Terry Britton
Replied by Terry Britton on topic ? Featured items in the order
Depending on your category layout you can have leading, primary and secondary items, which are each called separately.  The code above will only affect secondary items.  Make the same change to the primary and leading sections ($this->primary and $this-secondary).   As I mentioned earlier in the post you will also have to duplicate the code to call the non-featured items.

Please Log in or Create an account to join the conversation.

More
13 years 4 months ago #82526 by Markus Maier
Replied by Markus Maier on topic ? Featured items in the order
I set the primary, leading and links count to 0. Only secondary items are visible right now (featured and non-featured).

 

For testing purposes I didn't dublicate the code I just sourrended the code that calls the secondary items (see above) with your statement. If I'm correct then it should force the code to only show featured items as secondary items. But the area for the secondary items is just empty.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum