#183 Posted in ‘Econa’

Latest post by Lefteris Kavadas on Wednesday, 13 June 2018 15:01 EEST

Egger Claudia
Good evening first of all!
I already read Ticket Nr 158 and tried both solutions. But unfortunately no success.
I shorted the code for you. Perhaps you can help me. I would like to show my custom econa field "Einleitungsbild" (intro image).

 
<?php foreach ($list as $item) : 

	$item->jcfields = FieldsHelper::getFields('com_content.article', $item, true);
	foreach($item->jcfields as $field) {
		echo FieldsHelper::render('com_content.article', 'field.render', array('field'=> $field));
	}

/*$item->jcfields = FieldsHelper::getFields('com_content.article', $item, true);
echo FieldsHelper::render('com_content.article', 'field.render', array('field'=> $item->jcfields[0]));*/

/*
 if (isset($myCustomFields['einleitungsbild']) and !empty($myCustomFields['einleitungsbild'])) : 
         echo $myCustomFields['einleitungsbild']; 
  endif;
*/

	if ($params->get('show_introtext', '1')) :
		echo $item->introtext; 
	endif; 


 endforeach; ?>


Thx in advance

Lefteris Kavadas
Hi,

All you need is:
<?php echo FieldsHelper::render('com_content.article', 'field.render', array('field'=> $item->jcfields[1])); ?>


Just create an override for the mod_article_news and place this code inside the file _item.php.

Note that you have to change the number 1 with the ID of your custom field.

Regards

Egger Claudia
Hi,
this solution is followed by Error "0 - Call to a member function get() on null". The Id of the intro image is 2. And I also tried with other Id's, but nothing is working - except of error code and site crash.

Do u have another solution?
Thank you in advance

Lefteris Kavadas
Just tested and the code works fine for me. Can you please check the custom field settings? What's the value of the "Automatic Display" option?

Are you using the standard mod_article_news module? What's your Joomla version?

Finally make sure that you placed this code in the correct file.

Regards

Egger Claudia
Hey,
I checked the settings once again and the module is actually displayed (http://www.spitzen-schnitt.at/ abstract "Aktuelles"), but without the econa image field.
My settings are:
I'm using the mod_article_news module. My Joomla Version is 3.8.8.
I placed the code in the correct file.

I look forward to your reply ;-)

Lefteris Kavadas
Have you checked the field display options as I suggested in my previous reply?

The file that need to be modified is /templates/YOUR_TEMPLATE/mod_article_news/_item.php

Regards

Egger Claudia
sry, the automatic display option is set to "no" - and I found out your solution works with module_articles_popular

Egger Claudia
After hours of testing I found out that the problem is caused by the layout of com_content/feature. On the category blog layout everything is displayed as expected. So I made a workaround )-: Not really pretty, but in the moment okay.

Do you have a solution for the featured layout?

Lefteris Kavadas
Do you mean the the featured layout of the module? I don't see such a layout in the core mod_article_news. Can you please clarify?

Regards

Egger Claudia
No I mean com_content view featured; with com_content view category everything is okay. But when you have a menu item with type "featured articles" the module override is not working.

Lefteris Kavadas
I have found the issue. Try to go to the field options and select at least one image size for all the available views and it should work.

We will try to add an option for selecting image sizes for the modules in the next update to avoid such conflicts.

Regards

Egger Claudia
Thank you - everything is now working as aspected!

Lefteris Kavadas
You are welcome.

Regards

Note: An active subscription is required in order to get support for our paid extensions. For our free extensions, if you don't have an account, register and then submit your support request.  In case you just want to ask a question, you can also use the contact form .

Firecoders
Are you using our extensions? Please post a review at the Joomla extensions directory!
Post a review