Get whole Property Object from RETS Server using PHRETS - rets

I am getting MLNumbers from RETS Server but now I need to get all the fields of all the MLNumbers and store into my database. Could anybody help me to write query to get the whole property Object.

If you have all the Listing Numbers then you just need to write a search query to pull all the results back and process the results. I haven't ever seen a field name MLNumber but you will have to figure that out:
<?php
$search = $rets->SearchQuery("Property","RES","(MLNumber=11111,22222,33333)");
while ($listing = $rets->FetchRow($search)) {
echo "Address: {$listing['StreetNumber']} {$listing['StreetName']}, ";
echo "{$listing['City']}, ";
echo "{$listing['State']} {$listing['ZipCode']} listed for ";
echo "\$".number_format($listing['ListPrice'])."\n";
}
$rets->FreeResult($search);
I think this should return the results you need. You will need to figure out the Resource/Class/Field name you need to use for your SearchQuery().
More PHRETS examples here.

Related

How to echo multiple where clauses in a CI query on screen

I'm attempting to get the results of a database table and echo the query results.
Here is my code:
$queryDB = $this->db->select('*')
->from('dr_template_relational')
->where('value_id', $categoryDetails['value_id'])
->where('subcategory_id', $categoryDetails['subcategory_id'])
->get();
echo "<br>";
echo "here is queryDB";
echo($queryDB);
echo "that was it";
$queryDB doesn't echo even so I'm sure the data is there. I'm wondering what I'm doing wrong. I'm not getting an error, but also don't get any output with echo($queryDB); on screen it displays:
here is queryDBthat was it
Right now, your approach is just echoing out the instance of the query.
In order to see the query results, you need to create them. There are several CI functions like result() and row()
at the end it could look like this:
foreach ($queryDB ->result() as $row){
echo $row->value_id;
echo $row->subcategory_id;
}
see Generating Query Results
hint: in order to see the generated query you could use
echo $this->$db->last_query();

Yii2 how to get the length of translated message

In my project I am trying to provide dynamic sizing in one of my modules. I am trying to figure out in yii2 internationalization how can I get the string length of the translated text.
for instance:
<?php
//I am getting the name from the database. Assume name to be "Hello"
$name = $gettingNameFrom->db;
//Now $name is equal to string "Hello"
//The below function will dump the output to be int(5) as the length of hello is 5
var_dump(strlen($name));
//Now I want to apply translation to the above name in the db.
// I have all my translation configured and working fine.
echo Yii::t('app','{0}',[$name]);
//I have configured fo french language.
// the above output for "Hello" in french would be "Bonjour".
?>
Now how can I get the length of the translated text? I am unable to find any help online on this topic. Any help appreciated.
Thanks!!
$translated = Yii::t('app', $name);
var_dump(strlen($translated));

$this->getRequest()->getParam() not working in category controller

I am working on retriving the manufacturer attribute from url
localhost/magento/index.php/test-pro.html?manufacturer/4
So i used $this->getRequest()->getParam('manufacturer')
I did not get any output.
But when i changed the url as localhost/magento/index.php/test-pro.html?manufacturer=4
(/ replaced by =), i get proper output.
But i need the url should be localhost/magento/index.php/test-pro.html?manufacturer/4
and want to fetch the product related to that manufacturer id 4.
Somebody help me.
In your query string ?manufacturer=4 will give you the value for manufacturer i.e. 4, while manufacturer/4 will give you no value as its not being treated as query string.
Also the param will be and the param will be manufacturer/4 and not manufacturer.
To achieve what you require, you can do sometinhg like below.
$currentUrl = 'localhost/magento/index.php/test-pro.html?manufacturer/4';
$parts = parse_url($currentUrl);
$val = explode('/',$parts['query']);
Mage::register('manufacturer',$val[1]);
$menuVal = Mage::registry('manufacturer');
echo $menuVal; //prints 4
This is a sample code by which you can get the query string value even if you use / instead of =.

WHMCS Smarty syntax to show total clients

Is there a Syntax to display total clients in WHMCS (as a number)? If not, is there any way of doing this?
You can use this ode within your template files.
Just put this lines of code within your /templates/yourtemplate/yourfile.tpl
{php}
$query ="SELECT COUNT(id) from tblclients ";
$result = mysql_query($query);
$data = mysql_fetch_array($result);
echo "total clients :".$data[0];
{/php}
You can use getcontacts command for getting the total numbr of clients in WHMCS. You might want to have a look at this document:
http://docs.whmcs.com/API:Get_Contacts

Get Joomla! category from an URL

How can I read the section a certain URI belongs to?
I want to enhance the mod_breadcrumb to put section and category into the HTML. JApplication->getPathway() returns a JPathway which basically holds an assiciative array combining a name and an URL (as $list[]->name and $list[]->link). I think, it should be possible to get the section and category from a link, but don't know how.
A starting point could be the parsing into JURI-Object, but from there I don't know how get get further. Any ideas?
Pretty straight forward...
I assume you want to add category and section for the article and not your custom component.
Check if requested current URL is for article. If it is for article you know the article ID, use this article Id to go database and get catid from #__content, Use this cat_id to go to #__categories and get section (this is section id), go to #__sections to get the proper section name. All this can be done in 1 sql statement.
$breadcrumbs =& JFactory::getApplication()->getPathway();
$breadcrumbs->addItem("SECTION_NAME", JRoute::_("index.php?option=com_content&view=section&id=SECTION_ID"));
$breadcrumbs->addItem("CATEGOY_NAME", JRoute::_("index.php?option=com_content&view=category&id=CATEGORY_ID"));
$breadcrumbs->addItem("Article");
Alternatively, if you know the URL from the breadcrumb item. You can parse it and get IDS. The trick here is not to get the default URI object by JFactory::getURI() because things will get ugly, use JFactory::getURI('YOU_URI_NAME').
<?php
// You need to get Your own uri, you do not want to modify default URI
// because this will messup a lot of things
$uri = JFactory::getURI('MyCustomURI');
// Test # 1 [ID = SECTION_ID]
$url = "index.php?option=com_content&view=section&id=SECTION_ID";
$uri->parse($url);
echo "CURRENT SECTION = " . (int) $uri->getVar('id');
// Test # 2 [ID = 123]
$url = "index.php?option=com_content&view=section&id=123";
$uri->parse($url);
echo "CURRENT SECTION = " . (int) $uri->getVar('id');
?>

Resources