Problem with Productbook

Please use this forum for all development issues related to 3rd Party extensions or own development
Forum rules
Before posting, see the developer documentation and don't forget to search the forums.

Then check if you are running the latest available versions of Joomla! (1.5.18), Joom!Fish (2.0.4) and the extensions you're having problems with.

We need the following at least (you can find this in your Joomla! backend under help > system info):

* Joomla! version
* Joom!Fish version
* Extension version
* PHP version (e.g. 5.2.5). Note: The support for PHP4 is discontinued.
* Web Server software (Apache or IIS with version number if possible)
* Server Operating system (e.g. Linux, Windows, Solaris, Darwin ...)
* Webserver to PHP Interface
* Database version
* memory_limit from your phpinfo

Please enable error reporting and include any error messages in your posting.

Finally, please describe the steps required to recreate the problem and also please enable error reporting and give us any error messages generated.

Problem with Productbook

Postby davcom on Thu Jan 24, 2008 5:47 pm

Hi, sorry for my english.
I have some problem with Productbook, it is a component for catalog.

$database->setQuery( "SELECT *, a.id , "
. " a.catid, "
. " a.imgtitle, "
. " a.imgauthor, "
. " a.imgtext, "
. " a.imgdate, "
. " a.imgcounter, "
. " a.imgvotes, "
. " a.imgvotesum, "
. " a.published, "
. " a.imgoriginalname, "
. " a.imgfilename, "
. " a.imgthumbname, "
. " a.owner, u.id "
. " FROM #__productbook as a "
. " \n left join #__users as u on u.username = a.owner "
. " \n WHERE a.id= '$id' "
. " AND a.approved=1 ");

This query is not correct for joomfish, this return only italian and not english or espagnol.

I change "a.id" with "a.id as id" and "u.id" with u.id as id" , id is primary key of #__productbook table and #__users also.
I read this on Developer Documentation - Compatible Query Construction
In this example the primary key is "id" for both #__table1 and #__table2.
Incorrect : "SELECT t1.*, t2.* FROM #__table1 AS t1 LEFT JOIN #__table2 AS t2 ON t1.id=t2.fkey"
Correct : "SELECT t1.id AS key, t1.*, t2.id AS key2, t2* FROM #__table1 AS t1 LEFT JOIN #__table2 AS t2 ON t1.id=t2.fkey"
But return only italian! :-(
Some idea?

Thanks Davide
davcom
Newbee
 
Posts: 2
Joined: Thu Jan 24, 2008 5:38 pm

Re: Problem with Productbook

Postby Geraint on Thu Jan 24, 2008 9:16 pm

See http://www.joomfish.net/developer-docum ... ction.html

The problem you have is there are two fields with the name "id" and php only gets one of these - you must alias them (e.g. a.id as aid, c.id as cid ) so that PHP gets 2 distinct fields that Joomfish can use to find the translation.

Geraint
Joomfish club members can get priority forum support at the Support Forum. As well as access to a variety of custom Joomfish addons and benefits.

Join the Joomfish club today!
Geraint
Contributor
 
Posts: 2920
Joined: Sat Oct 20, 2007 9:13 am

Re: Problem with Productbook

Postby davcom on Fri Jan 25, 2008 3:22 pm

Thanks Geraint,
change id in db is very difficult for me.
I resolve this problem in this mode.
Delete this code.

Code: Select all
$database->setQuery( "SELECT *, a.id, "
   . " a.catid, "
   . " a.imgtitle, "
   . " a.imgauthor, "
   . " a.imgtext, "
   . " a.imgdate, "
   . " a.imgcounter, "
   . " a.imgvotes, "
   . " a.imgvotesum, "
   . " a.published, "
   . " a.imgoriginalname, "
   . " a.imgfilename, "
   . " a.imgthumbname, "
   . " a.owner, u.id "
   . " FROM #__productbook as a "
   . " \n left join #__users as u on u.username = a.owner "
   . " \n WHERE a.id= '$id' "
   . " AND a.approved=1 ");
   $result1 = $database->query();

   if (count($database->loadObjectList()) < 1) {
   mosRedirect(sefRelToAbs("index.php?option=com_productbook&func=userpannel&Itemid=$Itemid"), $PRODUBK->PRODUBK_0026 );
   }

   list($id, $catid, $imgtitle, $imgauthor, $imgtext, $descr, $note, $imgdate, $imgcounter, $imgvotes, $imgvotesum,
   $published, $imgoriginalname, $imgfilename, $imgthumbname, $pricing, $netpricing, $persone, $diff, $stock, $calorie,
   $specification01, $specvalue01, $specification02, $specvalue02, $specification03, $specvalue03,
   $specification04, $specvalue04, $specification05, $specvalue05, $specification06, $specvalue06,
   $specification07, $specvalue07, $specification08, $specvalue08, $specification09, $specvalue09,
    $specification10, $specvalue10, $specification11, $specvalue11, $specification12, $specvalue12,
     $specification13, $specvalue13, $specification14, $specvalue14, $checked_out, $imgowner, $imgownerid   ) = mysql_fetch_row($result1);


all this code i change with this:

Code: Select all
$database->setQuery( "SELECT a.* FROM #__productbook as a left join #__users as u on u.username = a.owner WHERE a.id= '$id' AND a.approved=1 ");

   $res = $database->loadObject($var);   
   
   if (!$res) {
      mosRedirect(sefRelToAbs("index.php?option=com_productbook&func=userpannel&Itemid=$Itemid"), $PRODUBK->PRODUBK_0026 );
   }
   
   foreach ($var as $key => $val) {
      ${$key} = $val;       
   }


now joom!fish work exactly.

Please, what do you think for this solution?
I am a newbie in joomla anche PHP.
Thanks Davide
davcom
Newbee
 
Posts: 2
Joined: Thu Jan 24, 2008 5:38 pm


Return to 3rd Party extensions in general

Who is online

Users browsing this forum: No registered users and 0 guests