Elxis CMS Forum

Extensions => Components => Topic started by: ioarvanit on October 06, 2007, 21:03:06

Title: Star Gallery counter
Post by: ioarvanit on October 06, 2007, 21:03:06
in star gallery the picture counter works OK after the ajax window is open, but the first click on the foto (before the ajax window open is not considered by the counter). So if a visitor of our site clicks on a picture and then closes the ajax window the counter of the foto is not increased as should be.

So i opened the stargallery.php file and experimented on the code until i came up with this solution of the problem. In line 233 (after the user rights are checked and a bit before the ajax window is loaded) i added the following code:

//Update counter (this part is not in the original stargallery component)

$query = "SELECT * FROM #__stargallery WHERE id='$id' AND catid=".$catid.""
. "\n AND approved=1 AND published=1";

$database->setQuery( $query, '#__', 1, 0 );
$rows = $database->loadObjectList();
$row = &$rows[0];
$newimgcounter = $row->imgcounter + 1;
$database->setQuery( "UPDATE #__stargallery SET imgcounter='$newimgcounter' WHERE id='$row->id'" );
$database->query();

Now the counter of the picture takes all clicks in consideration and seems to be working ok.

http://www.klain.gr/index.php?option=com_content&task=view&id=55&Itemid=74
Title: Re: Star Gallery counter
Post by: Farhad Sakhaei on October 06, 2007, 21:16:34
the star gallery has few another problems that they will be fixed in next release by Ioannis