×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: php error when adding/editing location hotspot

php error when adding/editing location hotspot 11 years 8 months ago #19770

  • Kevin Swanzey
  • Kevin Swanzey's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 0
When I try to add or edit a hotspot location in the admin backend, I get this:

PHP Warning: Invalid argument supplied for foreach() in (...)\administrator\components\com_hotspots\tables\marker.php on line 138

What does this mean? All the data seems to be saved.

thank you.

php error when adding/editing location hotspot 11 years 8 months ago #19774

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Do you have any categories? those lines are actually responsible for updating the count on the markers in a category.

Regards,
Daniel

php error when adding/editing location hotspot 11 years 8 months ago #19775

  • Kevin Swanzey
  • Kevin Swanzey's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 0
Yes, I do. Thinking maybe just one category caused it I added a second and the same thing happened.

Hope that helps.

Thank you for your help.

php error when adding/editing location hotspot 11 years 8 months ago #19785

  • Kevin Swanzey
  • Kevin Swanzey's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 0
Looking into things further, it seems the category field 'count' is not being updated, but when I make a change to the locations category, the category id is changed in the location table.

php error when adding/editing location hotspot 11 years 8 months ago #19786

  • Kevin Swanzey
  • Kevin Swanzey's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 0
..and looking even further into things, when I update/save a category item, the location count gets updated correctly.

php error when adding/editing location hotspot 11 years 8 months ago #19789

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
So do you still experience this? Are you categories published?
this is not an error, but a warning - if you disable debug reporting (which you should) then you won't see it anyway.
Regards,
Daniel

php error when adding/editing location hotspot 11 years 8 months ago #19791

  • Kevin Swanzey
  • Kevin Swanzey's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 0
Yes, the categories are published, and I even tried one unpublished. The issue is still occuring.

You are saying this warning is not a problem? I do not have debugging tuned on within Joomla if that is what you are referring...

php error when adding/editing location hotspot 11 years 8 months ago #19792

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
what I meant with debugging was
Global config-> server tab -> error reporting -> set to none.
It should be set to none on production sites - this way you are not showing information that hackers could exploit.

Regards,
Daniel

php error when adding/editing location hotspot 11 years 8 months ago #19793

  • Kevin Swanzey
  • Kevin Swanzey's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 0
Ok, I undersatand now. So I should not worry about the count not getting updated? It will not impact anything?

php error when adding/editing location hotspot 11 years 8 months ago #19794

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Kevin you are on Joomla3, right? It seems that the db function we were using has been removed on this version of joomla.
The interesting part is why I haven't seen this message before.
could you please modify:
\administrator\components\com_hotspots\tables\marker.php on line 138

The countCategoryMarker function should be replaced with this:
public function countCategoryMarker($ids) {
		$db = $this->_db;
		$query = $db->getQuery(true);
		// if we have an array, then we have hotspots ids
		if(is_array($ids)) {
			$query->select('DISTINCT(catid)')->from('#__hotspots_marker')
				->where('id IN ('.implode(',', $ids).')');
			$db->setQuery($query);
			$ids = $db->loadColumn();
		} else {
			$ids = array($ids);
		}
 
		foreach($ids as $value) {
			$query->clear();
			$query->select('COUNT(*)')->from($db->qn('#__hotspots_marker'))
				->where('catid = ' . $db->q($value))
				->where('published = ' . $db->q(1));
			$db->setQuery($query);
			$count = $db->loadRow();
 
			$query->clear();
			$query->update('#__hotspots_categorie')->set( 'count = ' . $db->q($count[0]) )
					->where('id =' . $db->q($value) );
 
			$db->setQuery($query);
			$db->execute();
		}
 
	}

then also in the publish function around line 102 change $this->countCategoryMarker() with
$this->countCategoryMarker($cid);

And in the store function around line 38 change $this->countCategoryMarker() to this
$this->countCategoryMarker($this->catid);

Normally I would give you a link to a dev release that contains the changes, but I'm on a public network and I don't have access to our server. (I can create a new dev. release tomorrow that will contain the changes)

Regards,
Daniel

php error when adding/editing location hotspot 11 years 8 months ago #19796

  • Kevin Swanzey
  • Kevin Swanzey's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 0
Yes, I am using Joomla 3...

Thanks so much for your help, and I gotta tell you I think your hotspot package is fantastic.

php error when adding/editing location hotspot 11 years 8 months ago #19799

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
hehe Kevin! Don't tell it to me, tell it to the people here:
extensions.joomla.org/extensions/maps-a-...-locations/maps/9468

Cheers,
Daniel
  • Page:
  • 1
Time to create page: 0.135 seconds