Keyword

Errors, missing extrafield data after update to 3.8.x

  • Kelsey Brookes
  • Kelsey Brookes's Avatar Topic Author
  • Offline
  • Elite Member
More
6 years 5 months ago #164867 by Kelsey Brookes
Hi All,

Having some weird issues since updating to 3.8.x with K2 2.8, then 2.8.1.

I have a mod_k2_content module that picks 3 items at random from a category, grabs the title, link, introtext and an image extraField. It was working prior to updates. Now, it's not, but in a very odd way.

Here's the code.
<?php
/**
 * @version    2.8.x
 * @package    K2
 * @author     JoomlaWorks https://www.joomlaworks.net
 * @copyright  Copyright (c) 2006 - 2017 JoomlaWorks Ltd. All rights reserved.
 * @license    GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
 */

// no direct access
defined('_JEXEC') or die;
?>

<div id="feature-icons-<?php echo $module->id; ?>" class="feature-icons">
<?php if(count($items)): ?>
	<div class="container-sm">
		<div class="row">
		<?php foreach ($items as $key=>$item):	?>
		<div class="col-sm-4 feature-icons__item text-center">
			<?php if($item->extraFields->FeatureIcon->value !=''): ?>
			<a class="moduleItemTitle" href="<?php echo $item->link; ?>">
				<?php echo $item->extraFields->FeatureIcon->value; ?>
			</a>
			<?php endif; ?>
			<?php if($params->get('itemTitle')): ?>
			<h4 class="feature-icons__item-title"><a href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a></h4>
			<?php endif; ?>
			<?php if($params->get('itemIntroText')): ?>
		      	<?php echo $item->introtext; ?>
			<?php endif; ?>
		</div>
	    <?php endforeach; ?>
		</div>
	</div>
  <?php endif; ?>
</div>

It should output the data in three columns. Instead the first extraField element appears, then nothing else. Here's the live output.
<div id="feature-icons-116" class="feature-icons">
	<div class="container-sm">
		<div class="row">
			<div class="col-sm-4 feature-icons__item text-center">
				<a class="moduleItemTitle" href="/features/property-accounting/reconciliation">
					<img src="/images/features/icons/icon-reconciliation.png" alt="Feature Icon">
				</a>
			</div>
			<div class="col-sm-4 feature-icons__item text-center">
			</div>
			<div class="col-sm-4 feature-icons__item text-center">
			</div>
		</div>
	</div>
</div>

Before you ask, every item in the category has a title, introtext and an image extrafield with data.

If I turn on error reporting, I get this:

Notice: Undefined property: stdClass::$extraFields in /home/propertyme/public_html/templates/frontend/html/mod_k2_content/feature-icons/default.php on line 20

You can see it appearing across all three rows.

www.dropbox.com/s/h0zal9fnk9tolyr/Screenshot%202017-10-23%2020.07.54.png?dl=0

What's super weird, is that if I remove all my conditional statements, except those to do with the loop, the output looks like this:
<div id="feature-icons-116" class="feature-icons">
	<div class="container-sm">
		<div class="row">
			<div class="col-sm-4 feature-icons__item text-center">
				<a class="moduleItemTitle" href="/features/service-support/support">
					<img src="/images/features/icons/icon-support.png" alt="Feature Icon">
				</a>
				<h4 class="feature-icons__item-title"><a href="/features/service-support/support">Support</a></h4>
				<p>Knowledge base and support forum, with video tutorials and getting started guides.</p>
			</div>
			<div class="col-sm-4 feature-icons__item text-center">
				<a class="moduleItemTitle" href="/features/service-support/data-migration">
				</a>
				<h4 class="feature-icons__item-title"><a href="/features/service-support/data-migration">Data Migration</a></h4>
			</div>
			<div class="col-sm-4 feature-icons__item text-center">
				<a class="moduleItemTitle" href="/features/property-management/client-view">
				</a>
				<h4 class="feature-icons__item-title"><a href="/features/property-management/client-view">Client View</a></h4>
			</div>
		</div>
	</div>
</div>

It's now pulling the first image, title, link and introtext, and all subsequent titles and links, but not subsequent images or introtexts.

It's really got me stumped and help would be appreciated!

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

  • Kelsey Brookes
  • Kelsey Brookes's Avatar Topic Author
  • Offline
  • Elite Member
More
6 years 5 months ago #164868 by Kelsey Brookes
Replied by Kelsey Brookes on topic Errors, missing extrafield data after update to 3.8.x
Figured it out.

Weirdly, it was the module chrome - set to 'inherited' it throws that problem, set to 'none' and it works as expected.

Odd, because I'm not sure which layout it's inheriting.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 5 months ago #164881 by Krikor Boghossian
Replied by Krikor Boghossian on topic Errors, missing extrafield data after update to 3.8.x
Hello Kelsey,

Let me know if the template you developed uses a custom chrome.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Kelsey Brookes
  • Kelsey Brookes's Avatar Topic Author
  • Offline
  • Elite Member
More
6 years 5 months ago #164902 by Kelsey Brookes
Replied by Kelsey Brookes on topic Errors, missing extrafield data after update to 3.8.x
Hi Krikor,

It does use custom chrome, mostly written by me.

It's odd because it's only on the 'inherited' setting. Items with custom chrome seem to be fine - although I've never use 'well' and most of them are used for single-item layouts:
<?php defined('_JEXEC') or die;

function modChrome_well($module, &$params, &$attribs) {
	if ($module->content) {
		echo "<div class=\"well well-sm" . htmlspecialchars($params->get('moduleclass_sfx')) . "\">";
		if ($module->showtitle) {
			echo "<h3>" . $module->title . "</h3>";
		}
		echo $module->content;
		echo "</div>";
	}
}

function modChrome_container($module, &$params, &$attribs) {
	if ($module->content) {
		echo "<div class=\"container" . htmlspecialchars($params->get('moduleclass_sfx')) . "\">";
		if ($module->showtitle) { ?>
		<div class="section-header">
			<h2><?php echo $module->title;?></h2>
		</div>
		<?php }
		echo $module->content;
		echo "</div>";
	}
}

function modChrome_strippedWithHeader($module, &$params, &$attribs) {
	if ($module->content) {
		echo "<div class=\"" . htmlspecialchars($params->get('moduleclass_sfx')) . "\">";
		if ($module->showtitle) { ?>
		<div class="section-header">
			<h2><?php echo $module->title;?></h2>
		</div>
		<?php }
		echo $module->content;
		echo "</div>";
	}
}

function modChrome_matchHeightCols($module, &$params, &$attribs) {
	if ($module->content) {
		echo "<div class=\"" . htmlspecialchars($params->get('moduleclass_sfx')) . "\" data-mh=\"footer-cols\">";
		if ($module->showtitle) { ?>
		<div class="section-header">
			<h3><?php echo $module->title;?></h3>
		</div>
		<?php }
		echo $module->content;
		echo "</div>";
	}
}

?>

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 5 months ago #164919 by Krikor Boghossian
Replied by Krikor Boghossian on topic Errors, missing extrafield data after update to 3.8.x
This is indeed really strange,
Have you run into this issue in other sites?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum