Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-16-2011, 05:14 AM   PM User | #1
jmc
New to the CF scene

 
Join Date: Sep 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
jmc is an unknown quantity at this point
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.
jmc is offline   Reply With Quote
Old 09-16-2011, 10:22 AM   PM User | #2
jmc
New to the CF scene

 
Join Date: Sep 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
jmc is an unknown quantity at this point
any idea? anyone?
jmc is offline   Reply With Quote
Reply

Bookmarks

Tags
extrafield visibility, joomla, k2 extension

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:05 PM.


Advertisement
Log in to turn off these ads.