Keyword

estraField does not show

  • Niels Klint
  • Niels Klint's Avatar Topic Author
  • Offline
  • New Member
  • Learning by doing
More
10 years 8 months ago - 10 years 8 months ago #123731 by Niels Klint
estraField does not show was created by Niels Klint
I am brand new with K2. It is my first site with K2 - Joomla! 3.2.1
I want to display the value from an extrafield next to the title in both item.php and categoy_item.php. I have created a sub template with other changes that works.
I have tried adding the codes below but as you can see in the attached pictures, only Kr. is displayed when I use the first code. When I use the other, you see nothing - what am I doing wrong? :huh:

<span class="catItemPrice">Kr.&nbsp;&nbsp;
<?php echo $this->item->extraFields->pricefield->value; ?></span>


<?php if(isset($this->item->extraFields->pricefield->value)): ?>
<span class="catItemPrice">Kr.&nbsp;&nbsp;
<?php echo $this->item->extraFields->pricefield->value; ?></span>
<?php endif; ?>

I've tried to add images, but it dosn't work :huh: (firefox)
Works in Crome
Attachments:

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

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #123732 by Yiota
Replied by Yiota on topic Re: estraField dos not show
Make sure that you have enabled the Extra fields setting for both the category and item.

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

  • Niels Klint
  • Niels Klint's Avatar Topic Author
  • Offline
  • New Member
  • Learning by doing
More
10 years 8 months ago - 10 years 8 months ago #123733 by Niels Klint
Replied by Niels Klint on topic Re: estraField dos not show
It is displayed together with the other extrafields on the item site
The code is category_item.php
Log in  or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #123734 by Yiota
Replied by Yiota on topic Re: estraField dos not show
Make sure that your list items are linkable, therefore the if statement gets in the first part of the code, that you have used the correct alias for the price field and that it is not empty.

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

More
10 years 8 months ago #123735 by kostas
Replied by kostas on topic Re: estraField dos not show
If I remember correctly the code to display an extra field's valuse on category_item.php is the following:
$this->item->extra_fields->value;

Maybe try this and see if you get different results.

cheers

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

  • Niels Klint
  • Niels Klint's Avatar Topic Author
  • Offline
  • New Member
  • Learning by doing
More
10 years 8 months ago - 10 years 8 months ago #123736 by Niels Klint
Replied by Niels Klint on topic Re: estraField dos not show
The link works - both on the title and text, that I've written "Kr."
The extrafield's value is displayed on the item site
The alias is correct

To kostas
Thanks, but as far as I know, this code need the alias

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

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #123737 by Yiota
Replied by Yiota on topic Re: estraField dos not show
The code you have provided is correct all you need to make sure is that you have put the correct alias of the extrafield. If you have capital letter somewhere in your alias you need to put it in the php statement.

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

  • Niels Klint
  • Niels Klint's Avatar Topic Author
  • Offline
  • New Member
  • Learning by doing
More
10 years 8 months ago #123738 by Niels Klint
Replied by Niels Klint on topic Re: estraField dos not show
It seems to be something with the database. I tried with another alias and that worked on the item site. Afterwards I tried with some others, but it still display the same result both together with the other extrafields and alone, even the value has been changed in the backend :( :(
Can you tell me where the value is saved in the database - I looked for it, but I couldn't find it
I've empted the cache and cleaned sessions - both with Joomla and Akeeba - just as info
Niels - DK

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

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #123739 by Yiota
Replied by Yiota on topic Re: estraField dos not show
Check in the k2_items table under extra_fields value.

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

  • Niels Klint
  • Niels Klint's Avatar Topic Author
  • Offline
  • New Member
  • Learning by doing
More
10 years 8 months ago - 10 years 8 months ago #123740 by Niels Klint
Replied by Niels Klint on topic Re: estraField dos not show
SORRY - B) I missunderstood your first reply.
I had not enabled Exstra fields in the category.
Everythings works perfect now, when I've set the class catItemExtraFields to display:none

Niels - DK

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