RSS
Home Forum v3
Welcome, Guest
Please Login or Register.    Lost Password?

include category property in module location
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: include category property in module location
*
#4939
include category property in module location 1 Year, 8 Months ago Karma: 0
Hi there,
actually i have something to ask..

let say i have two menu, "for sell" and "for rent" as my main menu..

if i want to use 2 different module property location in both page which one show item "for sale" and another show item "for rent"

eg. at page "for sale"
------------------------------
the module will show

new york (3)
kansas (4)
miami (5)

and at page "for rent"
------------------------------
the module will show

new york (7)
kansas (15)
miami (10)

---------------------------------
this should something query from sql rite..

i try to find out at helper.php (in module mod_prop_location)
~

this should something we need to add &cid=1 or &cid=2 at url isnt it..i'll try to find out how, (i'mnot really good at php but will try)

if someone can help, please assist me..thank you..
lochoe
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#4941
Re:include category property in module location 1 Year, 8 Months ago Karma: 0
I use this query to filter category on the location..

let say "for sale" page (module_prop_location) /helper.php at "state"
--------------------------------------
Code:

$query = 'SELECT s.*,count(p.id) as tot, '
    . ' CASE WHEN CHAR_LENGTH(cy.alias) THEN CONCAT_WS(":", cy.id, cy.alias) ELSE cy.id END as CYslug, '
. ' CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(":", s.id, s.alias) ELSE s.id END as Sslug '
. ' FROM #__properties_state as s '
. ' left join #__properties_products as p on p.sid = s.id '
. ' left join #__properties_country as cy on cy.id = p.cyid '
                . ' left join #__properties_category as c on c.id = p.cid '

. ' WHERE c.id = 1 AND s.published = 1 AND p.published = 1 AND s.parent = '.$cyid
. ' group by s.id ORDER BY s.name';



instead of default
Code:

$query = 'SELECT s.*,count(p.id) as tot, '
    . ' CASE WHEN CHAR_LENGTH(cy.alias) THEN CONCAT_WS(":", cy.id, cy.alias) ELSE cy.id END as CYslug, '
. ' CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(":", s.id, s.alias) ELSE s.id END as Sslug '
. ' FROM #__properties_state as s '
. ' left join #__properties_products as p on p.sid = s.id '
. ' left join #__properties_country as cy on cy.id = p.cyid '

. ' WHERE s.published = 1 AND p.published = 1 AND s.parent = '.$cyid
. ' group by s.id ORDER BY s.name';



now i get result i want..which is..at the "for sale" page, the state and location show as

new york (3)
kansas (4)
miami (5)

(which indicate "for sale" properties)

but the list which appear when click state or location wont change.. i need to find out, how to add &cid=1 to the url..

should i edit mod_prop_location.php using

$cid = JRequest::getVar('cid', 0, '', 'int');

ermm..no idea yet... <--i just new in PHP, perhaps something to learn here..

wish some assist..
lochoe
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#4942
Re:include category property in module location 1 Year, 8 Months ago Karma: 0
ok, i solved this little bit..

Info: in my prop categories, category 1 is "for rent" and category 2 is "for sell" if you use different category, you should customize little bit.

let say if you want to put locality only "for sale" ...

1. Need to filter state query. Open ../modules/mod_prop_location/helper.php

after this code
Code:

. ' WHERE s.published = 1 AND p.published = 1 AND s.parent = '.$cyid


add
Code:

. ' AND p.cid = 2 ' 


this will filter state only "for sale"

2. Need to filter localities query. on same file as above

after this code
Code:

. ' WHERE l.published = 1 AND p.published = 1 AND l.parent = '.$sid  


add
Code:

. ' AND p.cid = 2 '

this will filter localites only "for sale"

3. Now we need to change for the link (simple customize)

open ../modules/mod_prop_location/tmpl/default.php

change
Code:

href="<?php echo $linkState; ?>"
to
Code:

href="<?php echo $linkState; ?>&cid=2"


and

change
Code:

href="<?php echo $linkLocality; ?>"
to
Code:

href="<?php echo $linkLocality; ?>&cid=2"


this is simple customization..but will face another problem..

how about for rent-page, we cant copy the module to create new file..so this should be done with parameter.. ermmm..

so i need to adjust this module parameter little bit to work for both pages.. anyway i need some time to think..

anyway, with above customize, your module will only show state and localities based on the properties category..
lochoe
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#7852
Re:include category property in module location 1 Year, 5 Months ago Karma: 0
I am new to this forum,



I changed the helper.php a little bit in.

<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
class Modprop_locationHelper

{

function getCountries()
{

global $mainframe, $option;
$cid= JRequest::getVar('cid', 0, '', 'int');
$db = &JFactory::getDBO();

if($cid == NULL){
$query = 'SELECT c.*,count(p.id) as tot, '
. ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as CYslug '

. ' FROM #__properties_country as c '
. ' left join #__properties_products as p on p.cyid = c.id '


. ' WHERE c.published = 1 AND p.published = 1 '
. ' group by c.id ORDER BY c.name';
}else{
$query = 'SELECT c.*,count(p.id) as tot, '

. ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as CYslug,'
. ' CASE WHEN CHAR_LENGTH(y.alias) THEN CONCAT_WS(":", y.id, y.alias) ELSE y.id END as Cslug '

. ' FROM #__properties_country as c '
. ' left join #__properties_products as p on p.cyid = c.id '
. ' left join #__properties_category as y on y.id = p.cid '

. ' WHERE c.published = 1 AND p.published = 1 AND p.cid='.$cid
. ' group by c.id ORDER BY c.name';}


$db->setQuery($query);

$items = $db->loadObjectList();
//$items = ($items = $db->loadObjectList())?$items:array();
return $items;
}


function getStates($cyid)
{
global $mainframe, $option;
$cid = JRequest::getVar('cid', 0, '', 'int');
//$cyid = JRequest::getVar('cyid', 0, '', 'int');
jimport('joomla.application.component.helper');
$db = &JFactory::getDBO();


if($cid == NULL){
$query = 'SELECT s.*,count(p.id) as tot, '
. ' CASE WHEN CHAR_LENGTH(cy.alias) THEN CONCAT_WS(":", cy.id, cy.alias) ELSE cy.id END as CYslug, '
. ' CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(":", s.id, s.alias) ELSE s.id END as Sslug '

. ' FROM #__properties_state as s '
. ' left join #__properties_products as p on p.sid = s.id '

. ' left join #__properties_country as cy on cy.id = p.cyid '


. ' WHERE s.published = 1 AND p.published = 1 AND s.parent = '.$cyid

. ' group by s.id ORDER BY s.name';
}else{
$query = 'SELECT s.*,count(p.id) as tot, '
. ' CASE WHEN CHAR_LENGTH(cy.alias) THEN CONCAT_WS(":", cy.id, cy.alias) ELSE cy.id END as CYslug, '
. ' CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(":", s.id, s.alias) ELSE s.id END as Sslug, '
. ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as Cslug '

. ' FROM #__properties_state as s '

. ' left join #__properties_products as p on p.sid = s.id '
. ' left join #__properties_country as cy on cy.id = p.cyid '
. ' left join #__properties_category as c on c.id = p.cid '

. ' WHERE s.published = 1 AND p.published = 1 AND s.parent = '.$cyid
. ' AND p.cid ='.$cid
. ' group by s.id ORDER BY s.name';}


$db->setQuery($query);
$States = $db->loadObjectList();
// echo str_replace('#_','jos',$query);
return $States;
}

function getLocalities()
{
$db = &JFactory::getDBO();
$sid = JRequest::getVar('sid', 0, '', 'int');
$cid= JRequest::getVar('cid', 0, '', 'int');

if($cid == NULL){
$query = 'SELECT l.*,count(p.id) as tot, '
. ' CASE WHEN CHAR_LENGTH(l.alias) THEN CONCAT_WS(":", l.id, l.alias) ELSE l.id END as Lslug '

. ' FROM #__properties_locality as l '
. ' left join #__properties_products as p on p.lid = l.id '

. ' WHERE l.published = 1 AND p.published = 1 AND l.parent = '.$sid

. ' group by l.id ORDER BY l.name';
}else{
$query = 'SELECT l.*,count(p.id) as tot, '
. ' CASE WHEN CHAR_LENGTH(l.alias) THEN CONCAT_WS(":", l.id, l.alias) ELSE l.id END as Lslug, '
. ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as Cslug '
. ' FROM #__properties_locality as l '
. ' left join #__properties_products as p on p.lid = l.id '
. ' left join #__properties_category as c on c.id = p.cid '
. ' WHERE l.published = 1 AND p.published = 1 AND l.parent = '.$sid
. ' AND p.cid ='.$cid
. ' group by l.id ORDER BY l.name';}

$db->setQuery($query);
$Localities = $db->loadObjectList();
return $Localities;
}


function getLocalitiesByCountry()
{
$db = &JFactory::getDBO();
$cyid = JRequest::getVar('cyid', 0, '', 'int');
$cid= JRequest::getVar('cid', 0, '', 'int');
if($cid == NULL){

$query = 'SELECT l.*,count(p.id) as tot, '
. ' CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(":", s.id, s.alias) ELSE s.id END as Sslug, '
. ' CASE WHEN CHAR_LENGTH(l.alias) THEN CONCAT_WS(":", l.id, l.alias) ELSE l.id END as Lslug '

. ' FROM #__properties_locality as l '
. ' LEFT JOIN #__properties_state AS s ON s.id = l.parent '
. ' left join #__properties_products as p on p.lid = l.id '

. ' WHERE l.published = 1 AND p.published = 1 AND s.parent = '.$cyid

. ' group by l.id ORDER BY l.name';
}else{
$query = 'SELECT l.*,count(p.id) as tot, '
. ' CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(":", s.id, s.alias) ELSE s.id END as Sslug, '
. ' CASE WHEN CHAR_LENGTH(l.alias) THEN CONCAT_WS(":", l.id, l.alias) ELSE l.id END as Lslug, '
. ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as Cslug '
. ' FROM #__properties_locality as l '
. ' LEFT JOIN #__properties_state AS s ON s.id = l.parent '
. ' left join #__properties_products as p on p.lid = l.id '
. ' left join #__properties_category as c on c.id = p.cid '
. ' WHERE l.published = 1 AND p.published = 1 AND s.parent = '.$cyid
. ' AND p.cid ='.$cid
. ' group by l.id ORDER BY l.name';}

//echo str_replace('#_','jos',$query);
$db->setQuery($query);
$Localities = $db->loadObjectList();
return $Localities;
}
}
?>


And insert in the default.php


$linkState = LinkHelper::getLink('properties','showstate','',$State->CYslug,$State->Sslug,'',$State->Cslug,'','');
$x++;

$linkLocality = LinkHelper::getLink('properties','showlocality','',$State->CYslug,$State->Sslug,$Locality->Lslug,$State->Cslug,'','');
$x++;


$linkCountry = LinkHelper::getLink('properties','showcountry','',$Country->CYslug,'','',$Country->Cslug,'','');
$x++;

And in router.php
I add $vars['cid'] = $segments

}elseif($segments[0]=='showcountry'){
$vars['task'] = 'showcountry';
if($UseCountry){
$vars['cyid'] = $segments[1];
$vars['cid'] = $segments[2];
$vars['limitstart'] = $segments[3];
}
else{
$vars['limitstart'] = $segments[1];
}

and

}elseif($segments[0]=='showstate'){
$vars['task'] = 'showstate';
if($UseCountry and $UseState){
$vars['cyid'] = $segments[1];
$vars['sid'] = $segments[2];
$vars['cid'] = $segments[3];
$vars['limitstart'] = $segments[4];


and

}elseif($segments[0]=='showlocality'){
$vars['task'] = 'showlocality';
if($UseCountry and $UseState and $UseLocality){
$vars['cyid'] = $segments[1];
$vars['sid'] = $segments[2];
$vars['lid'] = $segments[3];
$vars['cid'] = $segments[4];
$vars['limitstart'] = $segments[5];







It works perfect so you need one module.

Look here www.euro-links.nl

I hoop that anyone can use it.

Regards

Frans
fransb
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2010/12/18 09:57 By fransb.
The administrator has disabled public write access.
 
#7858
solved include category property in module locatio 1 Year, 5 Months ago Karma: 0
It works how can i delete this message.

Fransb
fransb
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2010/12/18 13:05 By fransb.
The administrator has disabled public write access.
 
#7926
Re: solved include category property in module locatio 1 Year, 4 Months ago Karma: 0
It works or not??
I don't have understand if with this code we can do that the modul works with all categories and locations in different possitions, making selection for us in automatic.
Enzo
Expert Boarder
Posts: 123
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Italy Birthday: 11/08
The administrator has disabled public write access.
 
#7949
Re: solved include category property in module locatio 1 Year, 4 Months ago Karma: 0
Yes it works when you make a normal menulink to a catergory it will filter all.

You can test it on my site www.euro-links.nl i have 3 different menu to each category and when you klik on it it only shows the one in that categorie on menu you get everything.

Regards

Frans B
fransb
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#9218
Душевные песни - Елена ваенга песня о питере 1 Year, 1 Month ago Karma: 0
toifiscuichot
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2011/04/15 17:44 By administrator.
The administrator has disabled public write access.
 
#9241
Re: Душевные песни - Елена ваенга песня о питере 1 Year, 1 Month ago Karma: 0
Hi @fransb
can u explain me better how i have to change my code so, i will trie to make it. thank u before
Enzo
Expert Boarder
Posts: 123
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Italy Birthday: 11/08
The administrator has disabled public write access.
 
#9338
Re: solved include category property in module loc 1 Year ago Karma: 0
Hi Enzo,

You have to change the helper.php and default.php in mod_location.

and the router.php in com_properties this is for sef to work.

I don't know how to put the file on the post but you can download this

By this link

file

regards,


Frans
fransb
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#9345
Re: solved include category property in module loc 1 Year ago Karma: 0
Great fransb ,
Thank u very much!!!
Now it's work fine.
Enzo
Expert Boarder
Posts: 123
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Italy Birthday: 11/08
The administrator has disabled public write access.
 
#9414
thanks 1 Year ago Karma: 0
BrianES
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2011/05/03 09:17 By administrator.
The administrator has disabled public write access.
 
#9530
Re: thanks 11 Months, 4 Weeks ago Karma: 0
It's possibile to do the same for types??

rent - category - it's change the amount in the location module

but if i click appartment in the dipend type of rent - the module don't change the amount


it's possibile to do somethink like that, can anybody explain me how i can do that?
Enzo
Expert Boarder
Posts: 123
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Italy Birthday: 11/08
The administrator has disabled public write access.
 
#9615
Re: solved include category property in module loc 11 Months ago Karma: 0
I would use this module on my site, but I'm facing an issue.
My module settings are: "Only show States and Localities by Country = Yes", "Use Country Default=1" and "Only show Localities by Country=no".

I downloaded and replaced the helper.php, default.php and router.php files

The problem is, when I click on "state", the module do not offer to me the further option between the localites/cities of that State, but as result I have the full "State" list including all the localities.
Any reason for that? Am I missing something?
pj1907
Fresh Boarder
Posts: 12
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#9658
Re: solved include category property in module loc 10 Months, 3 Weeks ago Karma: 0
Hi i have settings Country = No", "Use Country Default=1" and "Only show Localities by Country=no.

or send you website adres to me so i know what the problem is.

Regards frans
fransb
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#9659
Re: solved include category property in module loc 10 Months, 3 Weeks ago Karma: 0
Thank you Frans,
I placed the module on the home page and in "properties for sale" page of my site: www.re-activity.com
No changes if I put "yes" or "not" in Country....

Thank you for let me know

Regards
Pj
pj1907
Fresh Boarder
Posts: 12
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1