Keyword

"Copy" Item has different output to "New" Item

More
10 years 10 months ago - 10 years 10 months ago #121364 by Tim
I am creating a website for a theatre. Each show is an Item in K2 and these display on a listings page (K2 categories). Plus, if the Extra Field called "Slider" is set to "Yes", the Item also appears in a slider on the homepage.

This was originally set up 6 months ago and all seemed to be working fine. Now, when I create a new show, it no longer displays in the slider, BUT if I copy an existing show and replicate every field with the exact same info as the new show it DOES show in the slider.

So now, I have two completely identical items in K2, one that shows in the slider (the item that was originally "copied" from an existing one), and one that doesn't show in the slider (that was created "new").

Here it gets even quirkier. If I copy the new show that isn't working, the copied version now works! So it seems the "new" button is somehow creating a slightly different result than the "copy" button in K2 Items section.

The item extra fields all seem to display fine in the full item listing and I can't spot any difference in the code output - I don't know where to go from here.

I'm using Joomla 2.5.16 and K2 2.6.7. The slider functionality itself isn't the issue as I have another static position on the homepage it's not showing in. I can't remember if I created the original Items with New or Copy (I've deleted the first Item I made). The only thing I can think of that has changed in the past few months is that I updated Joomla.

My code for displaying the item in the slider is below if it helps. Any ideas greatly appreciated!
        <?php if(count($items)): ?>

    <?php foreach ($items as $key=>$item):        ?>
    
        <?php if($item->extraFields->Slider->value == ('Yes')): ?>
    
    <div class="<?php echo ($key%2) ? "odd" : "even"; if(count($items)==$key+1) echo ' lastItem'; ?>">
    
                <?php
        if (!isset($item->extraFields))
        {
        $item->extraFields = new stdClass;
        }
        foreach ($item->extra_fields as $extraField)
        {
        $tmpAlias = $extraField->alias;
        $item->extraFields->$tmpAlias = $extraField;
        }
        ?>

        <!-- Plugins: BeforeDisplay -->
        <?php echo $item->event->BeforeDisplay; ?>
               
        <!-- K2 Plugins: K2BeforeDisplay -->
        <?php echo $item->event->K2BeforeDisplay; ?>


                <?php if($params->get('itemImage')): ?>
        <?php if($params->get('itemImage') && isset($item->image)): ?>
        
        <?php if($item->extraFields->ShowOrPromo->value == ('Show')): ?>
            <a class="feature_image" href="<?php echo $item->link; ?>" title="<?php echo JText::_(''); ?> <?php echo K2HelperUtilities::cleanHtml($item->title); ?>">
                <img src="<?php echo $item->image; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($item->title); ?>"/>
            </a>
                <?php endif; ?>
        <?php if($item->extraFields->ShowOrPromo->value == ('Promo')): ?>
                <img src="<?php echo $item->image; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($item->title); ?>"/>
                                <?php if(isset($item->extraFields->PromoLink)): ?>
                        <span class="slider_image_link"><?php echo $item->extraFields->PromoLink->value ?></span>
                <?php endif; ?>
                <?php endif; ?>
        
            
        <?php endif; ?>
        <?php endif; ?>
      
        <?php if($item->extraFields->ShowOrPromo->value == ('Show')): ?><a href="<?php echo $item->link; ?>"><?php endif; ?>
            <div class="feature_info">
            
                <div class="feature_title">
                <?php if($params->get('itemTitle')): ?>
                                        <?php echo $item->title; ?>
                <?php endif; ?>
                </div><!--/feature_title-->
            
                <div class="feature_dates">
                                        <?php echo $item->extraFields->AbbreviatedShowDates->value ?>
                </div><!--/feature_dates--> 
                        <?php if($item->extraFields->ShowOrPromo->value == ('Promo')): ?><span class="slider_text_link"><?php echo $item->extraFields->PromoLink->value ?></span><?php endif; ?>        
            </div> <!--/feature_info-->
        <?php if($item->extraFields->ShowOrPromo->value == ('Show')): ?></a><?php endif; ?>        
        
                
      <!-- Plugins: AfterDisplay -->
      <?php echo $item->event->AfterDisplay; ?>

      <!-- K2 Plugins: K2AfterDisplay -->
      <?php echo $item->event->K2AfterDisplay; ?>
      
    
    </div>
    
        <?php endif; ?>

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

UPDATE: I've discovered a workaround after much experimentation. If I create sub categories of the main "Shows" category, items in this sub category now display on the homepage. However, I have to create the sub categories using "New". If I copy the parent "Shows" category initially, the items still don't show, even though the end result again looks identical to the "New" sub category.

Would still love to fix the issue though since the client will undoubtedly place some items in the parent "Shows" category at some point. I'm using K2 Content to display item content on the homepage.

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


Powered by Kunena Forum