Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    jmc
    jmc is offline
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Joomla K2 Extension Problem.

    So i have this code changed in ../html/com_k2/template/default/item.php:
    Code:
    <?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
          <!-- Item extra fields -->
          <div class="itemExtraFields">
              <h3><?php echo JText::_('Additional Info:'); ?></h3>
              <ul>
                <?php foreach ($this->item->extra_fields as $key=>$extraField):?>
    <?php $user =& JFactory::getUser(); ?>
    <strong><?php if($extraField->name == "Price" && $user->get('Guest') ==1): ?></strong>
    
         <?php else: ?>   
                    <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
                        <span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
                        <span class="itemExtraFieldsValue"><?php echo ($extraField->type=='date')?JHTML::_('date', $extraField->value, JText::_('K2_DATE_FORMAT_LC')):$extraField->value; ?></span>
                    </li>
                    <?php endif; ?>
                <?php endforeach; ?>
                </ul>
            <div class="clr"></div>
          </div>
          <?php endif; ?>
    What I'm trying to achieve is to hide the extrafield on Guest Viewer on the front-page, and that extrafield will only be visible to certain User groups. I already tried changing these three times:
    • <strong><?php if($extraField->name == "Price" && $user->get('Guest') ==1): ?></strong>
    • <strong><?php if($extraField->name == "itemExtraFields" && $user->get('Guest') ==1): ?></strong>
    • <strong><?php if($extraField->name == "itemExtraFieldsValue" && $user->get('Guest') ==1): ?></strong>


    (I named my custom field as Price)

    So i don't know if I'm missing something on the code or i got the itemFields name wrong. Any help would be appreciated a ton. I already asked in the k2 forum and joomla forum but no one wanted to help i guess.

  • #2
    jmc
    jmc is offline
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    any idea? anyone?


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •