<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ITLive Web Services</title>
	<atom:link href="http://www.itliveweb.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.itliveweb.com/blog</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Sat, 12 Feb 2011 11:05:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-RC2</generator>
		<item>
		<title>How to write custom sql or query in magento</title>
		<link>http://www.itliveweb.com/blog/2011/02/15/</link>
		<comments>http://www.itliveweb.com/blog/2011/02/15/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 11:05:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.itliveweb.com/blog/?p=15</guid>
		<description><![CDATA[Table names and table prefixes $tableName = Mage::getSingleton('core/resource') -&#62;getTableName('catalog_product_entity'); // if prefix was 'mage_' then the below statement // would print out mage_catalog_product_entity echo $tableName; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; Accessing the database connection resource $read = Mage::getSingleton('core/resource')-&#62;getConnection('core_read'); $write = Mage::getSingleton('core/resource')-&#62;getConnection('core_write'); &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; For a list of functions available, copy the following code into a Magento template. $read = Mage::getSingleton('core/resource')-&#62;getConnection('core_read'); [...]]]></description>
			<content:encoded><![CDATA[<h4>Table names and table prefixes</h4>
<div>
<div><code><br />
</code></div>
<div><code>$tableName</code> <code>= Mage::getSingleton(</code><code>'core/resource'</code><code>)</code></div>
<div><code> </code><code>-&gt;getTableName(</code><code>'catalog_product_entity'</code><code>);</code></div>
<div><code>// if prefix was 'mage_' then the below statement</code></div>
<div><code>// would print out mage_catalog_product_entity</code></div>
<div><code>echo</code> <code>$tableName</code><code>;</code></div>
</div>
<div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</div>
<div>
<h4>Accessing the database connection resource</h4>
<div>
<div><code><br />
</code></div>
<div><code>$read</code> <code>= Mage::getSingleton(</code><code>'core/resource'</code><code>)-&gt;getConnection(</code><code>'core_read'</code><code>);</code></div>
<div><code>$write</code> <code>= Mage::getSingleton(</code><code>'core/resource'</code><code>)-&gt;getConnection(</code><code>'core_write'</code><code>);</code></div>
<div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</div>
<div>For a list of functions available, copy the following code into a Magento template.</div>
</div>
</div>
<div><code>$read</code> <code>= Mage::getSingleton(</code><code>'core/resource'</code><code>)-&gt;getConnection(</code><code>'core_read'</code><code>);</code></div>
<div><code>echo</code> <code>'&lt;pre&gt;'</code><code>;</code></div>
<div><code>print_r(get_class_methods(</code><code>$read</code><code>));</code></div>
<div><code>echo</code> <code>'&lt;/pre&gt;'</code><code>;</code></div>
<div><code>exit</code><code>;</code></div>
<div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</div>
<div>
<h4>Reading data from the database</h4>
<div><code>$read</code> <code>= Mage::getSingleton(</code><code>'core/resource'</code><code>)-&gt;getConnection(</code><code>'core_read'</code><code>);</code></div>
<div><code>$query</code> <code>= </code><code>'SELECT * FROM '</code> <code>. Mage::getSingleton(</code><code>'core/resource'</code><code>)-&gt;getTableName(</code><code>'catalog_product_entity'</code><code>);</code></div>
<div><code>$results</code> <code>= </code><code>$read</code><code>-&gt;fetchAll(</code><code>$query</code><code>);</code></div>
<div><code>print_r(</code><code>$results</code><code>);</code></div>
<div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</div>
<div>
<h4>Writing information to the database</h4>
<p>&nbsp;</p>
<div>
<div><code>$write</code> <code>= Mage::getSingleton(</code><code>'core/resource'</code><code>)-&gt;getConnection(</code><code>'core_write'</code><code>);</code></div>
<div><code>// Add your own query below</code></div>
<div><code>// I didn't add one as I didn't want you to run the code</code></div>
<div><code>// and me break your database!</code></div>
<div><code>$query</code> <code>= </code><code>'add your query here'</code><code>;</code></div>
<div><code>$write</code><code>-&gt;query(</code><code>$query</code><code>);</code></div>
</div>
<div></div>
</div>
<div></div>
<div>http://fishpig.co.uk/direct-sql-queries-magento/</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.itliveweb.com/blog/2011/02/15/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Looking for function setJoinCategories(true)</title>
		<link>http://www.itliveweb.com/blog/2011/02/looking-for-function-setjoincategoriestrue/</link>
		<comments>http://www.itliveweb.com/blog/2011/02/looking-for-function-setjoincategoriestrue/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 10:56:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.itliveweb.com/blog/?p=12</guid>
		<description><![CDATA[If you are looking for setJoinCategories(true) then no need to search because it is not written anywhere. Just go below of page and look for following function protected function _preparePage() { if(!$this-&#62;getJoinCategories()) { return parent::_preparePage(); } $this-&#62;getCollection()-&#62;getSelect()-&#62;reset(Zend_Db_Select::GROUP); parent::_preparePage(); $collection = $this-&#62;getCollection(); $collection -&#62;joinField(&#8216;category_id&#8217;, &#8216;catalog/category_product&#8217;, &#8216;category_id&#8217;, &#8216;product_id=entity_id&#8217;, null, &#8216;left&#8217;); $category_name_attribute_id = Mage::getModel(&#8216;eav/entity_attribute&#8217;)-&#62;loadByCode(&#8216;catalog_category&#8217;, &#8216;name&#8217;)-&#62;getId(); //@nelkaake -m 13/11/10: [...]]]></description>
			<content:encoded><![CDATA[<p>If you are looking for setJoinCategories(true) then no need to search because it is not written anywhere. Just go below of page and look for following function<br />
protected function _preparePage()<br />
{<br />
if(!$this-&gt;getJoinCategories()) {<br />
return parent::_preparePage();<br />
}</p>
<p>$this-&gt;getCollection()-&gt;getSelect()-&gt;reset(Zend_Db_Select::GROUP);</p>
<p>parent::_preparePage();</p>
<p>$collection = $this-&gt;getCollection();<br />
$collection<br />
-&gt;joinField(&#8216;category_id&#8217;,<br />
&#8216;catalog/category_product&#8217;,<br />
&#8216;category_id&#8217;,<br />
&#8216;product_id=entity_id&#8217;,<br />
null,<br />
&#8216;left&#8217;);<br />
$category_name_attribute_id = Mage::getModel(&#8216;eav/entity_attribute&#8217;)-&gt;loadByCode(&#8216;catalog_category&#8217;, &#8216;name&#8217;)-&gt;getId();</p>
<p>//@nelkaake -m 13/11/10: Added support for tables with prefixes<br />
$ccev_t = Mage::getConfig()-&gt;getTablePrefix(). &#8216;catalog_category_entity_varchar&#8217;;<br />
$collection<br />
-&gt;joinField(&#8216;categories&#8217;,<br />
$ccev_t,<br />
&#8216;GROUP_CONCAT(_table_categories.value)&#8217;,<br />
&#8216;entity_id=category_id&#8217;,<br />
&#8220;_table_categories.attribute_id={$category_name_attribute_id}&#8221;,<br />
&#8216;left&#8217;);<br />
$collection<br />
-&gt;joinField(&#8216;category&#8217;,<br />
$ccev_t,<br />
&#8216;value&#8217;,<br />
&#8216;entity_id=category_id&#8217;,<br />
&#8220;_table_category.attribute_id={$category_name_attribute_id}&#8221;,<br />
&#8216;left&#8217;);<br />
$collection-&gt;groupByAttribute(&#8216;entity_id&#8217;);</p>
<p>}</p>
<p>You can find everything here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itliveweb.com/blog/2011/02/looking-for-function-setjoincategoriestrue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get table prefixes in magento</title>
		<link>http://www.itliveweb.com/blog/2011/02/how-to-get-table-prefixes-in-magento/</link>
		<comments>http://www.itliveweb.com/blog/2011/02/how-to-get-table-prefixes-in-magento/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 10:53:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.itliveweb.com/blog/?p=10</guid>
		<description><![CDATA[Mage::getConfig()-&#62;getTablePrefix() you can use this value to get table prefixes For example Mage::getConfig()-&#62;getTablePrefix(). &#8216;catalog_category_entity_varchar&#8217;; also you can use below code to write custom query $write = Mage::getSingleton(&#8216;core/resource&#8217;)-&#62;getConnection(&#8216;core_write&#8217;);]]></description>
			<content:encoded><![CDATA[<p>Mage::getConfig()-&gt;getTablePrefix() you can use this value to get table prefixes</p>
<p>For example Mage::getConfig()-&gt;getTablePrefix(). &#8216;catalog_category_entity_varchar&#8217;;</p>
<p>also you can use below code to write custom query</p>
<p>$write = Mage::getSingleton(&#8216;core/resource&#8217;)-&gt;getConnection(&#8216;core_write&#8217;);</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itliveweb.com/blog/2011/02/how-to-get-table-prefixes-in-magento/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ITLive Web Services</title>
		<link>http://www.itliveweb.com/blog/2011/01/itliveweb/</link>
		<comments>http://www.itliveweb.com/blog/2011/01/itliveweb/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 23:31:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.itliveweb.com/blog/?p=1</guid>
		<description><![CDATA[ITLive Web Services provides wide verity of development in PHP with custom and open source (Magento, Oscommerce, Joomla and wordpress).]]></description>
			<content:encoded><![CDATA[<p>ITLive Web Services provides wide verity of development in PHP with custom and open source (Magento, Oscommerce, Joomla and wordpress).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itliveweb.com/blog/2011/01/itliveweb/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

