OS Property support center

Extra query not working

  • Marco Lombardo
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 3 months ago #24123 by Marco Lombardo
Extra query not working was created by Marco Lombardo
Hello everyone.
i'm having trouble adding an extra query to the page "com_osproperty/templates/default/listing.html.tpl.php"

i need to show an extra info to the property preview (i mean this page yourwebiste/index.php?option=com_osproperty&view=ltype&type_id=&category_id=12&country_id=92&company_id=&Itemid=172) and the problem is that query gives results only once, then all the other properties are not shown.
I've executed all queries in phpmyadmin and they all work (of course if WHERE clause is verified), i don't understand why the code inside page doesn't work.

here it is the code i added
Code:
$db = JFactory::getDbo(); $query = "SELECT `field_option` FROM `#__osrs_extra_field_options` AS tab1 INNER JOIN `#__osrs_property_field_opt_value` AS tab2 ON tab1.id = tab2.oid WHERE (tab2.fid = 114 OR tab2.fid = 115) AND tab2.pid = '".$row->id."' GROUP BY tab2.fid;"; $db->setQuery($query); //prepara la query da eseguire $db->query(); //esegue la query $count = $db->getNumRows(); $rows = $db->loadAssocList(); if($count > 0) { $i = 0; echo "<span> <img src='http://www.unicasa24.it/components/com_osproperty/images/assets/bathroom.gif' width='25' class='png' />".$rows[$i]['field_option']."</span>"; echo "<span> <img src='http://www.unicasa24.it/components/com_osproperty/images/assets/bedrooms.gif' width='25' class='png'/>".$rows[$i+1]['field_option']."</span>"; } }

what i see is that the $row->id has null value from the second element in the result's list. So only the first in the list is shown.

am i doing something wrong? am i editing the right page?

i am attaching the file i've edited (see lines 116-145).
listing.html.tpl.php


thank you for your help

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

  • Mr. Dam
  • Away
  • Administrator
  • Administrator
More
11 years 3 months ago #24141 by Mr. Dam
Replied by Mr. Dam on topic Re: Extra query not working
Hi,
First, you need to zip the file before attach it.
Second, it seems you modified wrong position, you can only edit the the file bellow line 198, after the for command.
Thanks
Dam

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

  • Marco Lombardo
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 3 months ago #24239 by Marco Lombardo
Replied by Marco Lombardo on topic Re: Extra query not working
i'm sorry, here it is the zip file.
i've searched for line 198, but i didn't find any command for. can you please take a look to the file (lines 112-142).
thank you.
Attachments:

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

  • Mr. Dam
  • Away
  • Administrator
  • Administrator
More
11 years 3 months ago #24247 by Mr. Dam
Replied by Mr. Dam on topic Re: Extra query not working
Hi Marco,
can you please send the file to damdt@joomservices.com directly?
Dam

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

Moderators: Mr. DamNguyen Phu Quan