<?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>My Silly Point of View</title>
	<atom:link href="http://mysillypointofview.richardferaro.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mysillypointofview.richardferaro.com</link>
	<description>it&#039;s my blog anyway</description>
	<lastBuildDate>Sun, 06 Nov 2011 05:36:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to fix the &#8220;Illegal scheme supplied, only alphanumeric characters are permitted&#8221; Magento error on Localhost using HTTP (fresh install)</title>
		<link>http://mysillypointofview.richardferaro.com/2011/11/01/how-to-fix-the-illegal-scheme-supplied-error-on-localhost-fresh-install/</link>
		<comments>http://mysillypointofview.richardferaro.com/2011/11/01/how-to-fix-the-illegal-scheme-supplied-error-on-localhost-fresh-install/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 20:56:01 +0000</pubDate>
		<dc:creator>Richard Feraro</dc:creator>
				<category><![CDATA[Feeling guru]]></category>
		<category><![CDATA[Techie Daw]]></category>

		<guid isPermaLink="false">http://mysillypointofview.richardferaro.com/?p=729</guid>
		<description><![CDATA[I want to setup a development environment for the Mage Enabler for WordPress plugin in my new desktop so I downloaded the latest copy of Magento Community Edition which is version 1.6.1.0 at the time of this writing. I used the sample data provided from the Magento download page and used all the default values. [...]]]></description>
			<content:encoded><![CDATA[<p>I want to setup a development environment for the <a href="http://wordpress.org/extend/plugins/mage-enabler/" title="Mage Enabler" target="_blank">Mage Enabler</a> for WordPress plugin in my new desktop so I downloaded the latest copy of Magento Community Edition which is version 1.6.1.0 at the time of this writing. I used the sample data provided from the Magento download page and used all the default values.</p>
<p><span id="more-729"></span></p>
<p style="text-align: center;"><a href="http://mysillypointofview.richardferaro.com/wp-content/uploads/2011/11/Magento-Installation-Wizard.png"><img class="size-medium wp-image-736" title="Magento Installation Wizard" src="http://mysillypointofview.richardferaro.com/wp-content/uploads/2011/11/Magento-Installation-Wizard-300x300.png" alt="Magento Installation Wizard" width="300" height="300" /></a></p>
<p>Everything went well during the installation except when I access the frontend (http://localhost/magento) and admin (http://localhost/magento/admin), I was greeted with the default error page like the one below:</p>
<p style="text-align: center;"><a href="http://mysillypointofview.richardferaro.com/wp-content/uploads/2011/11/There-has-been-an-error-processing-your-request.png"><img class="size-full wp-image-733 aligncenter" title="There has been an error processing your request" src="http://mysillypointofview.richardferaro.com/wp-content/uploads/2011/11/There-has-been-an-error-processing-your-request.png" alt="" width="532" height="205" /></a></p>
<p>The page itself is not helpful so I decided to check the content of the error log (htdocs\magento\var\report) record number <strong>1742231029</strong> which contains the following information:</p>
<p><code>a:5:{i:0;s:67:"Illegal scheme supplied, only alphanumeric characters are permitted";i:1;s:681:"#0 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Store.php(712): Zend_Uri::factory('{{base_url}}')<br />
#1 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Controller\Varien\Front.php(313): Mage_Core_Model_Store-&gt;isCurrentlySecure()<br />
#2 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Controller\Varien\Front.php(161): Mage_Core_Controller_Varien_Front-&gt;_checkBaseUrl(Object(Mage_Core_Controller_Request_Http))<br />
#3 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\App.php(349): Mage_Core_Controller_Varien_Front-&gt;dispatch()<br />
#4 C:\xampp\htdocs\magento\app\Mage.php(640): Mage_Core_Model_App-&gt;run(Array)<br />
#5 C:\xampp\htdocs\magento\index.php(80): Mage::run('', 'store')<br />
#6 {main}";s:3:"url";s:19:"/magento/index.php/";s:11:"script_name";s:18:"/magento/index.php";s:4:"skin";s:7:"default";}</code></p>
<p>As you can see, the cause of the error is the invalid config data format being passed during the start of a session. To fix this, we need to accomplish these tasks:
<ol type="1">
<li>Allow the admin panel to run on localhost by disabling the domain check.</li>
<li>Fix the config data value.</li>
</ol>
<h3>Allow the admin panel to run on localhost.</h3>
<p>You will need to follow the <a href="http://mysillypointofview.richardferaro.com/2010/03/24/how-to-fix-magentos-admin-login-failing-no-error-message-on-localhost/" title="How to Fix Magento’s Admin Login Failing (no error message) on Localhost">instructions in my previous post</a> but instead of using HTTP, <span style="text-decoration: underline">you must access the admin page via HTTPS</span> after you applied the code changes.</p>
<h3>Fixing the config data value.</h3>
<p>Once you are able to access the admin panel using HTTPS, go to <em>System > Configuration > General > Web</em>. Make sure that you supply the proper value for the Base URL on both Unsecure and Secure tabs then <strong>save the changes</strong>. See my example below:</p>
<p style="text-align: center;"><a href="http://mysillypointofview.richardferaro.com/wp-content/uploads/2011/11/Configuration-System-Magento-Admin.png"><img src="http://mysillypointofview.richardferaro.com/wp-content/uploads/2011/11/Configuration-System-Magento-Admin-300x157.png" alt="" title="Configuration - System - Magento Admin" width="300" height="157" class="aligncenter size-medium wp-image-758" /></a></p>
<p>Clear your browser&#8217;s cache and also Magento&#8217;s cache by deleting all the contents (not the folder itself) of the cache directory (htdocs\magento\var\cache). At this point, you should be able to access the frontend and admin panel using HTTP protocol.</p>
]]></content:encoded>
			<wfw:commentRss>http://mysillypointofview.richardferaro.com/2011/11/01/how-to-fix-the-illegal-scheme-supplied-error-on-localhost-fresh-install/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Auto-select all &lt;option&gt; items from multiple select dropdown using jQuery</title>
		<link>http://mysillypointofview.richardferaro.com/2011/04/12/auto-select-all-option-items-from-multiple-select-dropdown-using-jquery/</link>
		<comments>http://mysillypointofview.richardferaro.com/2011/04/12/auto-select-all-option-items-from-multiple-select-dropdown-using-jquery/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 16:00:00 +0000</pubDate>
		<dc:creator>Richard Feraro</dc:creator>
				<category><![CDATA[Feeling guru]]></category>
		<category><![CDATA[Techie Daw]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://mysillypointofview.richardferaro.com/2011/04/12/auto-select-all-option-items-from-multiple-select-dropdown-using-jquery/</guid>
		<description><![CDATA[I’ve been working for the past few days with jQuery and one of the task was to manipulate HTML forms before submitting it for processing. What I needed to do is to process a form having multiple submit buttons and select tags. These set of select tags requires all values to be selected on submit. [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve been working for the past few days with jQuery and one of the task was to manipulate HTML forms before submitting it for processing. What I needed to do is to process a form having multiple submit buttons and select tags. These set of select tags requires all values to be selected on submit.</p>
<p><span id="more-717"></span></p>
<p>Let’s start with creating the markup of the form. Save the HTML below and name it as <code>index.htm</code> (we won’t be needing PHP stuff for now in this exercise.)</p>
<p>
<pre class="brush: xml; title: ; notranslate">&lt;!doctype html&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;
&lt;title&gt;Sample Form&lt;/title&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
	&lt;form id=&quot;myForm&quot; action=&quot;index.html&quot; method=&quot;post&quot; onSubmit=&quot;return false;&quot;&gt;
		&lt;select id=&quot;do-not-select&quot; name=&quot;do-not-select[]&quot; multiple=&quot;multiple&quot; size=&quot;3&quot;&gt;
			&lt;option&gt;Do&lt;/option&gt;
			&lt;option&gt;not&lt;/option&gt;
			&lt;option&gt;select&lt;/option&gt;
		&lt;/select&gt;
		&lt;select id=&quot;color&quot; name=&quot;color[]&quot; multiple=&quot;multiple&quot; size=&quot;3&quot;&gt;
			&lt;option&gt;Red&lt;/option&gt;
			&lt;option&gt;Green&lt;/option&gt;
			&lt;option&gt;Blue&lt;/option&gt;
		&lt;/select&gt;
		&lt;select id=&quot;size&quot; name=&quot;size[]&quot; multiple=&quot;multiple&quot; size=&quot;3&quot;&gt;
			&lt;option&gt;Small&lt;/option&gt;
			&lt;option&gt;Medium&lt;/option&gt;
			&lt;option&gt;Large&lt;/option&gt;
		&lt;/select&gt;
		&lt;select id=&quot;category&quot; name=&quot;category[]&quot; multiple=&quot;multiple&quot; size=&quot;3&quot;&gt;
			&lt;option&gt;Children&lt;/option&gt;
			&lt;option&gt;Ladies&lt;/option&gt;
			&lt;option&gt;Men&lt;/option&gt;
		&lt;/select&gt;
		&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&gt;
	&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
</p>
<p>The markup above will create a single form with an id of <strong>myForm</strong> having four (4) multi-select field with the following ids: </p>
<ul>
<li>do-not-select</li>
<li>color</li>
<li>size</li>
<li>category</li>
</ul>
<p>At line 6, we added the jQuery file (latest version 1.5.2 as of this writing) to use it&#8217;s functionality in manipulating <a href="http://en.wikipedia.org/wiki/Document_Object_Model">DOM objects</a>. Now for the real action, copy the code below and insert it between line 6 and 7:</p>
<p>
<pre class="brush: xml; title: ; notranslate">&lt;script&gt;
$(document).ready(function() {
	$('#myForm').submit(function() {
		$('#color, #size, #category').find('option').each(function() {
			$(this).attr('selected', 'selected');
		});
	});
});
&lt;/script&gt;</pre>
</p>
<p>The script above will do the following task: </p>
<ol type="1">
<li>Instruct the browser to execute the script within <code>$(document).ready(...);</code> when the page has loaded. </li>
<li>Trigger the script within <code>$('#myForm').submit(...)</code> once the form with an id of <strong>myForm</strong> is submitted. </li>
<li>With the given <code>SELECT</code> element ids (color, size, category), find all <code>OPTION</code> tags in each of them and add the attribute and value <code>selected=&quot;selected&quot;</code> </li>
</ol>
<p>We also added at line 10 the event handler <code>onSubmit</code> with <code>return false;</code> to prevent the page on submitting while we are testing the script.</p>
<p>That&#8217;s it! Load the file on your browser and click Submit button. It should highlight all the options under color, size and category while ignoring the <strong>do-not-select</strong> option since we didn&#8217;t add them in the affected elements. See the full markup below. Remember to remove the <code>onSubmit="return false;"</code> in the <code>FORM</code> tag to enable redirection of your form on submit.</p>
<p>
<pre class="brush: xml; title: ; notranslate">&lt;!doctype html&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;
&lt;title&gt;Sample Form&lt;/title&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
$(document).ready(function() {
	$('#myForm').submit(function() {
		$('#color, #size, #category').find('option').each(function() {
			$(this).attr('selected', 'selected');
		});
	});
});
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
	&lt;form id=&quot;myForm&quot; action=&quot;index.html&quot; method=&quot;post&quot; onSubmit=&quot;return false;&quot;&gt;
		&lt;select id=&quot;do-not-select&quot; name=&quot;do-not-select[]&quot; multiple=&quot;multiple&quot; size=&quot;3&quot;&gt;
			&lt;option&gt;Do&lt;/option&gt;
			&lt;option&gt;not&lt;/option&gt;
			&lt;option&gt;select&lt;/option&gt;
		&lt;/select&gt;
		&lt;select id=&quot;color&quot; name=&quot;color[]&quot; multiple=&quot;multiple&quot; size=&quot;3&quot;&gt;
			&lt;option&gt;Red&lt;/option&gt;
			&lt;option&gt;Green&lt;/option&gt;
			&lt;option&gt;Blue&lt;/option&gt;
		&lt;/select&gt;
		&lt;select id=&quot;size&quot; name=&quot;size[]&quot; multiple=&quot;multiple&quot; size=&quot;3&quot;&gt;
			&lt;option&gt;Small&lt;/option&gt;
			&lt;option&gt;Medium&lt;/option&gt;
			&lt;option&gt;Large&lt;/option&gt;
		&lt;/select&gt;
		&lt;select id=&quot;category&quot; name=&quot;category[]&quot; multiple=&quot;multiple&quot; size=&quot;3&quot;&gt;
			&lt;option&gt;Children&lt;/option&gt;
			&lt;option&gt;Ladies&lt;/option&gt;
			&lt;option&gt;Men&lt;/option&gt;
		&lt;/select&gt;
		&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&gt;
	&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://mysillypointofview.richardferaro.com/2011/04/12/auto-select-all-option-items-from-multiple-select-dropdown-using-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to create a new Magento customer account from an external site?</title>
		<link>http://mysillypointofview.richardferaro.com/2011/02/22/create-new-magento-customer-from-external-site/</link>
		<comments>http://mysillypointofview.richardferaro.com/2011/02/22/create-new-magento-customer-from-external-site/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 16:00:08 +0000</pubDate>
		<dc:creator>Richard Feraro</dc:creator>
				<category><![CDATA[Feeling guru]]></category>
		<category><![CDATA[Techie Daw]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://mysillypointofview.richardferaro.com/?p=655</guid>
		<description><![CDATA[I&#8217;ve been receiving a lot of inquiries on how to create a new customer record on the fly using Mage.php or using the plugin Mage Enabler for WordPress. So, to save you time and also to provide a thread for this specific topic, here&#8217;s how to accomplish it. First, include the file Mage.php from your [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been receiving a lot of inquiries on how to create a new customer record on the fly using <code>Mage.php</code> or using the plugin <a href="http://wordpress.org/extend/plugins/mage-enabler/">Mage Enabler</a> for WordPress. So, to save you time and also to provide a thread for this specific topic, here&#8217;s how to accomplish it.</p>
<p><span id="more-655"></span>First, include the file <code>Mage.php</code> from your Magento installation to your PHP file. Doing this will enable you to connect to your shop using the Mage object.</p>
<p><strong>If you&#8217;re using Mage Enabler for WordPress, you may skip this part:</strong></p>
<pre class="brush: php; title: ; notranslate">&lt;?php
require_once (&quot;/your/magento/app/Mage.php&quot;);
umask(0);</pre>
<p>and here&#8217;s the rest of the code&#8230;</p>
<pre class="brush: php; first-line: 4; title: ; notranslate">// Customer Information
$firstname = &quot;John&quot;;
$lastname = &quot;Smith&quot;;
$email = &quot;johnsmith@localhost.local&quot;;
$password = &quot;myverysecretpassword&quot;;

// Website and Store details
$websiteId = Mage::app()-&gt;getWebsite()-&gt;getId();
$store = Mage::app()-&gt;getStore();

$customer = Mage::getModel(&quot;customer/customer&quot;);
$customer-&gt;website_id = $websiteId;
$customer-&gt;setStore($store);

try {
	// If new, save customer information
	$customer-&gt;firstname = $firstname;
	$customer-&gt;lastname = $lastname;
	$customer-&gt;email = $email;
	$customer-&gt;password_hash = md5($password);
	if($customer-&gt;save()){
		echo $customer-&gt;firstname.&quot; &quot;.$customer-&gt;lastname.&quot; information is saved!&quot;;
	}else{
		echo &quot;An error occured while saving customer&quot;;
	}
}catch(Exception $e){
	// If customer already exists, initiate login
	if(preg_match('/Customer email already exists/', $e)){
		$customer-&gt;loadByEmail($email);

		$session = Mage::getSingleton('customer/session');
		$session-&gt;login($email, $password);

		echo $session-&gt;isLoggedIn() ? $session-&gt;getCustomer()-&gt;getName().' is online!' : 'not logged in';
	}
}</pre>
<p>The above code tries to create a Magento customer account using the given parameters such as <code>$firstname</code>, <code>$lastname</code>, <code>$email</code> and <code>$password</code>. If the email doesn&#8217;t have a match in the database, the request proceeds. But if a match is found, it logs in the customer using the parameters <code>$email</code> and <code>$password</code> then checks if the customer is online or not logged in. There are actually more parameters that you can pass such as if you want to send confirmation message or not but these are the basic fields to help you get started.</p>
<p>I hope this will help you integrate the Magento registration to your external site <img src='http://mysillypointofview.richardferaro.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://mysillypointofview.richardferaro.com/2011/02/22/create-new-magento-customer-from-external-site/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Separating message and author in &#8216;Stray Random Quotes&#8217; WordPress plugin</title>
		<link>http://mysillypointofview.richardferaro.com/2011/01/30/separate-message-author-in-stray-random-plugin/</link>
		<comments>http://mysillypointofview.richardferaro.com/2011/01/30/separate-message-author-in-stray-random-plugin/#comments</comments>
		<pubDate>Sat, 29 Jan 2011 20:05:22 +0000</pubDate>
		<dc:creator>Richard Feraro</dc:creator>
				<category><![CDATA[Feeling guru]]></category>
		<category><![CDATA[Techie Daw]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://mysillypointofview.richardferaro.com/?p=639</guid>
		<description><![CDATA[I needed a plugin that can show random quotes with author options as well and I found Stray Random Quotes WordPress plugin could do the trick. The only problem is, the function to display the random quote directly outputs the text onscreen together with the author. What I need to do is to suppress the [...]]]></description>
			<content:encoded><![CDATA[<p>I needed a plugin that can show random quotes with author options as well and I found <a href="http://wordpress.org/extend/plugins/stray-quotes/">Stray Random Quotes</a> WordPress plugin could do the trick. The only problem is, the function to display the random quote directly outputs the text onscreen together with the author.</p>
<p><span id="more-639"></span>What I need to do is to suppress the display of the function output onscreen, pass it to a variable then do a split of the variable to separate the message and author in an array. See the code below on how I did it <img src='http://mysillypointofview.richardferaro.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="brush: php; title: ; notranslate">&lt;?php
if (function_exists('stray_random_quote'))
// turn on output buffer
ob_start();
// run the function of the plugin
stray_random_quote('feedback',false,'',true,1,0,'Category','ASC',false,'');
// get the content from the buffer
$string = ob_get_contents();
ob_end_clean();
// split the output and remove unnecessary HTML tags
$feedback = split('by',strip_tags($string));
// access the message
echo trim($feedback[0]);
// access the author
echo trim($feedback[1]);</pre>
<p>Pretty easy!</p>
]]></content:encoded>
			<wfw:commentRss>http://mysillypointofview.richardferaro.com/2011/01/30/separate-message-author-in-stray-random-plugin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My Silly Point of View won Best Technology Blog at 2010 Philippine Blog Awards</title>
		<link>http://mysillypointofview.richardferaro.com/2010/12/13/my-silly-point-of-view-won-best-tech-blog/</link>
		<comments>http://mysillypointofview.richardferaro.com/2010/12/13/my-silly-point-of-view-won-best-tech-blog/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 03:08:07 +0000</pubDate>
		<dc:creator>Richard Feraro</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[awards]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://mysillypointofview.richardferaro.com/?p=617</guid>
		<description><![CDATA[I was so nervous that night that I decided not to cite this long acceptance speech so I posted it here instead. Here it goes: Thank you for the recognition and also for allowing me to be a part of the awards night. I would like to express my sincere gratitude to the Philippine Blogger [...]]]></description>
			<content:encoded><![CDATA[<p>I was so nervous that night that I decided not to cite this long acceptance speech so I posted it here instead. Here it goes:<br />
<span id="more-617"></span></p>
<blockquote><p>Thank you for the recognition and also for allowing me to be a part of the awards night. </p>
<p>I would like to express my sincere gratitude to the Philippine Blogger Awards Inc., who organized the magnificent evening to acknowledge us, anonymous bloggers, of our contribution to the web by way of blogging through our chosen niche;</p>
<p>To the board committees and judges, well-known and are successful in their own fields of expertise, who took their time and participated in the event;</p>
<p>To the sponsors who gave their commitments to make the night happen;</p>
<p>To the untiring volunteers and supporters from the Philippine Blogging Community who helped the organization and also us in their own little ways;</p>
<p>and most of all, to the readers both here and abroad, whether its a single page view or a couple of minutes in our blog, it means a lot to me.</p>
<p>Again, thank you. Blog on!</p></blockquote>
<p>See complete list of winners <a href="http://www.philippineblogawards.com.ph/winners/2010-winners/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mysillypointofview.richardferaro.com/2010/12/13/my-silly-point-of-view-won-best-tech-blog/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>My Silly Point of View is nominated for Best Technology Blog!</title>
		<link>http://mysillypointofview.richardferaro.com/2010/11/22/my-silly-point-of-view-is-nominated-for-best-technology-blog/</link>
		<comments>http://mysillypointofview.richardferaro.com/2010/11/22/my-silly-point-of-view-is-nominated-for-best-technology-blog/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 08:04:12 +0000</pubDate>
		<dc:creator>Richard Feraro</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Techie Daw]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://mysillypointofview.richardferaro.com/?p=603</guid>
		<description><![CDATA[The event will be held on 12th of December 2010 at Carlos P. Romulo Auditorium, RCBC Plaza. Hopefully, I&#8217;ll be able to win the award but nevertheless, the ultimate goal is to be with the best Filipino bloggers in the country.]]></description>
			<content:encoded><![CDATA[<p>The event will be held on 12th of December 2010 at Carlos P. Romulo Auditorium, RCBC Plaza. Hopefully, I&#8217;ll be able to win the award but nevertheless, the ultimate goal is to be with the best Filipino bloggers in the country.</p>
]]></content:encoded>
			<wfw:commentRss>http://mysillypointofview.richardferaro.com/2010/11/22/my-silly-point-of-view-is-nominated-for-best-technology-blog/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>How to pull the list of customers from Magento to an external site?</title>
		<link>http://mysillypointofview.richardferaro.com/2010/09/07/how-to-pull-the-list-of-customers-from-magento-to-an-external-site/</link>
		<comments>http://mysillypointofview.richardferaro.com/2010/09/07/how-to-pull-the-list-of-customers-from-magento-to-an-external-site/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 09:09:16 +0000</pubDate>
		<dc:creator>Richard Feraro</dc:creator>
				<category><![CDATA[Feeling guru]]></category>
		<category><![CDATA[Techie Daw]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mysillypointofview.richardferaro.com/?p=565</guid>
		<description><![CDATA[If you&#8217;re thinking of creating a page that will display your customer list from Magento to a different PHP-based application, you can use the script below to do so. First, let&#8217;s create a file called index.php and inside it, create function (I named it getCustomers()) that will extract an array of customer list and their [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re thinking of creating a page that will display your customer list from Magento to a different PHP-based application, you can use the script below to do so.</p>
<p>First, let&#8217;s create a file called <code>index.php</code> and inside it, create function (I named it <strong>getCustomers()</strong>) that will extract an array of customer list and their information. The function should be able to access the <code>Mage.php</code> file of your Magento instance.</p>
<p><span id="more-565"></span>
<pre class="brush: php; title: ; notranslate">&lt;?php
function getCustomers() {
	/* Magento's Mage.php path
	 * Mage Enabler users may skip these lines
	 */
	require_once (&quot;../magento/app/Mage.php&quot;);
	umask(0);
	Mage::app(&quot;default&quot;);
	/* Magento's Mage.php path */

	/* Get customer model, run a query */
	$collection = Mage::getModel('customer/customer')
				  -&gt;getCollection()
				  -&gt;addAttributeToSelect('*');

	$result = array();
	foreach ($collection as $customer) {
		$result[] = $customer-&gt;toArray();
	}

	return $result;
}
?&gt;</pre>
<p>Once you&#8217;re done with the function, add the HTML tags needed to create the a page with a table for the customer information.</p>
<pre class="brush: xml; first-line: 24; title: ; notranslate">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Customers&lt;/title&gt;
&lt;style&gt;
table {
	border-collapse: collapse;
}
td {
	padding: 5px;
	border: 1px solid #000000;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table&gt;
&lt;tr&gt;
	&lt;td&gt;ID&lt;/td&gt;
	&lt;td&gt;Lastname&lt;/td&gt;
	&lt;td&gt;Firstname&lt;/td&gt;
	&lt;td&gt;Email&lt;/td&gt;
	&lt;td&gt;Is Active?&lt;/td&gt;
	&lt;td&gt;Date Created&lt;/td&gt;
	&lt;td&gt;Date Updated&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>After line 47, press return/enter key and add the following script to loop through the array result of our <code>getCustomer()</code> function:</p>
<pre class="brush: php; first-line: 48; title: ; notranslate">&lt;?php
$result = getcustomers();
if(count($result) &gt; 0){
	foreach($result as $key =&gt; $value){
		echo &quot;&lt;tr&gt;&quot;;
			echo &quot;&lt;td&gt;&quot;.$value['entity_id'].&quot;&lt;/td&gt;&quot;;
			echo &quot;&lt;td&gt;&quot;.$value['lastname'].&quot;&lt;/td&gt;&quot;;
			echo &quot;&lt;td&gt;&quot;.$value['firstname'].&quot;&lt;/td&gt;&quot;;
			echo &quot;&lt;td&gt;&quot;.$value['email'].&quot;&lt;/td&gt;&quot;;
			echo &quot;&lt;td&gt;&quot;;
			echo $value['is_active'] == 1 ? &quot;Yes&quot; : &quot;No&quot;;
			echo &quot;&lt;/td&gt;&quot;;
			echo &quot;&lt;td&gt;&quot;.$value['created_at'].&quot;&lt;/td&gt;&quot;;
			echo &quot;&lt;td&gt;&quot;.$value['updated_at'].&quot;&lt;/td&gt;&quot;;
		echo &quot;&lt;/tr&gt;&quot;;
	}
}else{
	echo &quot;&lt;tr&gt;&lt;td colspan=\&quot;7\&quot;&gt;No records found&lt;/td&gt;&lt;/tr&gt;&quot;;
}
?&gt;</pre>
<p>There are several available information within the array that you can also use. Here&#8217;s an example of a record result from our function:</p>
<pre class="brush: php; title: ; notranslate">[0] =&gt; Array
	(
		[entity_id] =&gt; 1
		[entity_type_id] =&gt; 1
		[attribute_set_id] =&gt; 0
		[website_id] =&gt; 1
		[email] =&gt; john.doe@example.com
		[group_id] =&gt; 1
		[increment_id] =&gt; 000000001
		[store_id] =&gt; 1
		[created_at] =&gt; 2007-08-30 23:23:13
		[updated_at] =&gt; 2008-08-08 12:28:24
		[is_active] =&gt; 1
		[firstname] =&gt; John
		[lastname] =&gt; Doe
		[password_hash] =&gt; 2049484a4020ed15d0e4238db22977d5:eg
		[prefix] =&gt;
		[middlename] =&gt;
		[suffix] =&gt;
		[taxvat] =&gt;
		[default_billing] =&gt; 274
		[default_shipping] =&gt; 274
	)</pre>
<p>Save the file as <code>index.php</code> and access it through your browser. It should display a table similar to the one below:</p>
<div id="attachment_574" class="wp-caption aligncenter" style="width: 501px"><a href="http://mysillypointofview.richardferaro.com/wp-content/uploads/2010/09/Customers_list.png"><img class="size-full wp-image-574   " title="Customers_list" src="http://mysillypointofview.richardferaro.com/wp-content/uploads/2010/09/Customers_list.png" alt="Sample table of customers from Magento" width="491" height="266" /></a><p class="wp-caption-text">Sample table of customers from Magento</p></div>
<p>Here&#8217;s the <code>index.php</code> for your reference:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
function getcustomers() {
	/* Magento's Mage.php path
	 * Mage Enabler users may skip these lines
	 */
	require_once (&quot;../magento/app/Mage.php&quot;);
	umask(0);
	Mage::app(&quot;default&quot;);
	/* Magento's Mage.php path */

	/* Get customer model, run a query */
	$collection = Mage::getModel('customer/customer')
				  -&gt;getCollection()
				  -&gt;addAttributeToSelect('*');

	$result = array();
	foreach ($collection as $customer) {
		$result[] = $customer-&gt;toArray();
	}

	return $result;
}
?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Customers&lt;/title&gt;
&lt;style&gt;
table {
	border-collapse: collapse;
}
td {
	padding: 5px;
	border: 1px solid #000000;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table&gt;
&lt;tr&gt;
	&lt;td&gt;ID&lt;/td&gt;
	&lt;td&gt;Lastname&lt;/td&gt;
	&lt;td&gt;Firstname&lt;/td&gt;
	&lt;td&gt;Email&lt;/td&gt;
	&lt;td&gt;Is Active?&lt;/td&gt;
	&lt;td&gt;Date Created&lt;/td&gt;
	&lt;td&gt;Date Updated&lt;/td&gt;
&lt;/tr&gt;
&lt;?php
$result = getcustomers();
if(count($result) &gt; 0){
	foreach($result as $key =&gt; $value){
		echo &quot;&lt;tr&gt;&quot;;
			echo &quot;&lt;td&gt;&quot;.$value['entity_id'].&quot;&lt;/td&gt;&quot;;
			echo &quot;&lt;td&gt;&quot;.$value['lastname'].&quot;&lt;/td&gt;&quot;;
			echo &quot;&lt;td&gt;&quot;.$value['firstname'].&quot;&lt;/td&gt;&quot;;
			echo &quot;&lt;td&gt;&quot;.$value['email'].&quot;&lt;/td&gt;&quot;;
			echo &quot;&lt;td&gt;&quot;;
			echo $value['is_active'] == 1 ? &quot;Yes&quot; : &quot;No&quot;;
			echo &quot;&lt;/td&gt;&quot;;
			echo &quot;&lt;td&gt;&quot;.$value['created_at'].&quot;&lt;/td&gt;&quot;;
			echo &quot;&lt;td&gt;&quot;.$value['updated_at'].&quot;&lt;/td&gt;&quot;;
		echo &quot;&lt;/tr&gt;&quot;;
	}
}else{
	echo &quot;&lt;tr&gt;&lt;td colspan=\&quot;7\&quot;&gt;No records found&lt;/td&gt;&lt;/tr&gt;&quot;;
}
?&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://mysillypointofview.richardferaro.com/2010/09/07/how-to-pull-the-list-of-customers-from-magento-to-an-external-site/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to add Magento blocks, CSS and Javascript to an external site</title>
		<link>http://mysillypointofview.richardferaro.com/2010/07/03/how-to-add-magento-blocks-css-and-javascript-to-an-external-site/</link>
		<comments>http://mysillypointofview.richardferaro.com/2010/07/03/how-to-add-magento-blocks-css-and-javascript-to-an-external-site/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 16:01:40 +0000</pubDate>
		<dc:creator>Richard Feraro</dc:creator>
				<category><![CDATA[Feeling guru]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mysillypointofview.richardferaro.com/?p=535</guid>
		<description><![CDATA[You might have a Magento based website running online and wanted to extend parts of it (also known as blocks, which may include some css and js in the code) to an external site which may either be a blog, another CMS or any other PHP based web application. If you have been following my [...]]]></description>
			<content:encoded><![CDATA[<p>You might have a Magento based website running online and wanted to extend parts of it (also known as blocks, which may include some css and js in the code) to an external site which may either be a blog, another CMS or any other PHP based web application. If you have been following my previous posts, you will know that by adding the Mage.php file of your Magento instance to your application, you can actually pull the needed HTML blocks at any time. The only problem is that most of the examples available online asks you to use the <strong>getChildHtml(&#8216;your-block-here&#8217;)</strong> in which most the time frustrates you because of its complexity and limited resources of how you can actually use it.</p>
<p>There are other ways of doing it. Oddly enough, some are pretty simple and straight forward.<br />
<span id="more-535"></span><br />
We will use a single HTML file which will serve as our &#8216;external&#8217; site. The source code of our <strong>index.php</strong> is shown below:</p>
<pre class="brush: xml; title: ; notranslate">&lt;html&gt;
  &lt;head&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
      WebFontConfig = {
        google: { families: [ 'Josefin Sans Std Light', 'Lobster' ] }
      };
      (function() {
        var wf = document.createElement('script');
        wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
            '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
        wf.type = 'text/javascript';
        wf.async = 'true';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(wf, s);
      })();
    &lt;/script&gt;
    &lt;style type=&quot;text/css&quot;&gt;
      .wf-active p.text {
        font-family: 'Calibri', serif;
		font-size: 16px;
		text-align: justify;
		color:#666666;
		border: 1px solid #CCCCCC;
		-moz-border-radius: 20px;
		-webkit-border-radius: 20px;
		padding: 20px
      }

	  .wf-active h2 {
	  	font-family: 'Lobster', serif;
        font-size: 20px;
		color: #666666
      }

      .wf-active h1 {
        font-family: 'Lobster', serif;
        font-size: 45px;
		color: #006699;
		margin-bottom: 10px;
      }

	  div.body {
	  	max-width: 850px;
		margin: auto;
		background-color: #FFFFFF;
		padding: 30px 50px 0px 50px;
		text-align: left;
		height: 60%;
	  }

	  p.bugs {
	  	font: 12px/1.55 Arial,Helvetica,sans-serif;
		text-align: center;
	  }

	  p.otherdata {
	  	font-family: 'Calibri', serif;
		font-size: 15px;
		color: #999999;
		margin-bottom: 20px
	  }

	  .otherdata strong {
	  	color: #000000
	  }
    &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  	&lt;div class=&quot;body&quot;&gt;
		&lt;h1&gt;How to add Magento blocks, CSS and Javascript to an external site&lt;/h1&gt;
		&lt;p class=&quot;otherdata&quot;&gt;Written by &lt;strong&gt;Richard Feraro&lt;/strong&gt; | Posted on &lt;strong&gt;July 2, 2010&lt;/strong&gt;&lt;/p&gt;
		&lt;p class=&quot;text&quot;&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis a quam massa. Nullam eget erat metus. Sed vel justo enim. Proin rhoncus laoreet bibendum. Nullam eget est nisi. In eget sem in erat sodales bibendum. Morbi gravida augue sed felis tincidunt a congue dui placerat. Aliquam purus risus, mollis sed ullamcorper non, viverra eu odio. Suspendisse nibh nisi, suscipit at viverra eu, convallis ac odio. Morbi nec sapien eros. Suspendisse nec nulla erat, ac porttitor neque. Integer felis dolor, sollicitudin sed semper et, imperdiet nec turpis. Proin blandit luctus egestas. &lt;/p&gt;
	&lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre>
<p>The code above shall produce a page like the one in the screenshot below.</p>
<div id="attachment_538" class="wp-caption aligncenter" style="width: 487px"><a href="http://mysillypointofview.richardferaro.com/wp-content/uploads/2010/07/sample_external_site.png"><img class="size-full wp-image-538     " title="Sample External Page" src="http://mysillypointofview.richardferaro.com/wp-content/uploads/2010/07/sample_external_site.png" alt="" width="477" height="239" /></a><p class="wp-caption-text">Our Sample External Page</p></div>
<p>We&#8217;ll start editing at the beginning of the file by adding a <code>require_once()</code> for our <code>Mage.php</code> file.</p>
<pre class="brush: php; title: ; notranslate">// Your Magento Mage.php
// Mage Enabler WordPress plugin users may
// skip these lines
require_once (&quot;/your/magento/app/Mage.php&quot;);
umask(0);
Mage::app(&quot;default&quot;);</pre>
<p>Proceed with adding the <code>if(class_exists('Mage')){...}</code> which encloses our Magento scripts to prevent the site from breaking if in case the Mage object failed to be instantiated. Check the inline comments for more details.</p>
<pre class="brush: php; title: ; notranslate">// Make sure to execute this block of code
// only if Mage object is present
if(class_exists('Mage')){
	// Instantiate session and generate needed cookie
	Mage::getSingleton('core/session', array('name' =&gt; 'frontend'));
	$Block = Mage::getSingleton('core/layout');

	// Start pulling the blocks
	$head = $Block-&gt;createBlock('Page/Html_Head');
	// Add default css
	// Magento adds the default skin directory
	// 'skin/frontend/default/default' before 'css/styles.css'
	// making it look like the URL below:
	// http://localhost/magento/skin/frontend/default/default/css/styles.css
	$head-&gt;addCss('css/styles.css');
	// Add Prototype JS file
	// Note that it automatically adds the 'js' directory at the beginning
	// making it look like the URL below:
	// http://localhost/magento/js/prototype/prototype.js
	$head-&gt;addJs('prototype/prototype.js');

	// Get the header's HTML
	$header = $Block-&gt;createBlock('Page/Html_Header');
	$header-&gt;setTemplate('page/html/header.phtml');

	// And the footer's HTML as well
	$footer = $Block-&gt;createBlock('Page/Html_Footer');
	$footer-&gt;setTemplate('page/html/footer.phtml');
}</pre>
<p>That&#8217;s it. The codes above will generate the Magento session, the 3 blocks for CSS/JS (which uses the default skin of Magento and adds the Prototype JS file) and the HTML tags for the header and footer.</p>
<p>To use the blocks, insert the CSS/JS block right before the end tag of <code>&lt;/HEAD&gt;</code>:</p>
<pre class="brush: php; title: ; notranslate">	&lt;?php
		// Display the needed tags for CSS and JS
		echo (class_exists('Mage')) ? $head-&gt;getCssJsHtml() : '' ;
	?&gt;
&lt;/head&gt;</pre>
<p>Proceed by adding the Magento header block right after the <code>&lt;BODY&gt;</code> tag but before the <code>&lt;DIV&gt;</code> tag.</p>
<pre class="brush: php; title: ; notranslate">&lt;body&gt;
  	&lt;?php
		// Display the Header HTML
		echo (class_exists('Mage')) ? $header-&gt;toHTML() : '' ;
	?&gt;
  	&lt;div class=&quot;body&quot;&gt;</pre>
<p>Finally, add the Magento footer block right between the end tag of <code>&lt;/DIV&gt;</code> and <code>&lt;/BODY&gt;</code> tag</p>
<pre class="brush: php; title: ; notranslate">	&lt;/div&gt;
	&lt;?php
		// Display the Footer HTML
		echo (class_exists('Mage')) ? $footer-&gt;toHTML() : '' ;
	?&gt;
  &lt;/body&gt;</pre>
<p>It should display a page of our external site which now uses the header and footer of Magento. Check the source to see the additional tags generated.</p>
<div id="attachment_544" class="wp-caption aligncenter" style="width: 483px"><a href="http://mysillypointofview.richardferaro.com/wp-content/uploads/2010/07/sample_external_site_with_magento_blocks.png"><img class="size-full wp-image-544    " title="Our Sample External Page with Magento CSS, Prototype JS, Header and Footer" src="http://mysillypointofview.richardferaro.com/wp-content/uploads/2010/07/sample_external_site_with_magento_blocks.png" alt="" width="473" height="273" /></a><p class="wp-caption-text">Our Sample External Page with Magento CSS, Prototype JS, Header and Footer</p></div>
<p>The full <strong>index.php</strong> can be found below:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
// Your Magento Mage.php
// Mage Enabler WordPress plugin users may
// skip line numbers 5, 6 and 7
require_once (&quot;/your/magento/app/Mage.php&quot;);
umask(0);
Mage::app(&quot;default&quot;);

// Make sure to execute this block of code
// only if Mage object is present
if(class_exists('Mage')){
	// Instantiate session and generate needed cookie
	Mage::getSingleton('core/session', array('name' =&gt; 'frontend'));
	$Block = Mage::getSingleton('core/layout');

	// Start pulling the blocks
	$head = $Block-&gt;createBlock('Page/Html_Head');
	// Add default css
	// Magento adds the default skin directory
	// 'skin/frontend/default/default' before 'css/styles.css'
	// making it look like the URL below:
	// http://localhost/magento/skin/frontend/default/default/css/styles.css
	$head-&gt;addCss('css/styles.css');
	// Add Prototype JS file
	// Note that it automatically adds the 'js' directory at the beginning
	// making it look like the URL below:
	// http://localhost/magento/js/prototype/prototype.js
	$head-&gt;addJs('prototype/prototype.js');

	// Get the header's HTML
	$header = $Block-&gt;createBlock('Page/Html_Header');
	$header-&gt;setTemplate('page/html/header.phtml');

	// And the footer's HTML as well
	$footer = $Block-&gt;createBlock('Page/Html_Footer');
	$footer-&gt;setTemplate('page/html/footer.phtml');
}

?&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
      WebFontConfig = {
        google: { families: [ 'Josefin Sans Std Light', 'Lobster' ] }
      };
      (function() {
        var wf = document.createElement('script');
        wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
            '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
        wf.type = 'text/javascript';
        wf.async = 'true';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(wf, s);
      })();
    &lt;/script&gt;
    &lt;style type=&quot;text/css&quot;&gt;
      .wf-active p.text {
        font-family: 'Calibri', serif;
		font-size: 16px;
		text-align: justify;
		color:#666666;
		border: 1px solid #CCCCCC;
		-moz-border-radius: 20px;
		-webkit-border-radius: 20px;
		padding: 20px
      }

	  .wf-active h2 {
	  	font-family: 'Lobster', serif;
        font-size: 20px;
		color: #666666
      }

      .wf-active h1 {
        font-family: 'Lobster', serif;
        font-size: 45px;
		color: #006699;
		margin-bottom: 10px;
      }

	  div.body {
	  	max-width: 850px;
		margin: auto;
		background-color: #FFFFFF;
		padding: 30px 50px 0px 50px;
		text-align: left;
		height: 60%;
	  }

	  p.bugs {
	  	font: 12px/1.55 Arial,Helvetica,sans-serif;
		text-align: center;
	  }

	  p.otherdata {
	  	font-family: 'Calibri', serif;
		font-size: 15px;
		color: #999999;
		margin-bottom: 20px
	  }

	  .otherdata strong {
	  	color: #000000
	  }
    &lt;/style&gt;
	&lt;?php
		// Display the needed tags for CSS and JS
		echo (class_exists('Mage')) ? $head-&gt;getCssJsHtml() : '' ;
	?&gt;
  &lt;/head&gt;
  &lt;body&gt;
  	&lt;?php
		// Display the Header HTML
		echo (class_exists('Mage')) ? $header-&gt;toHTML() : '' ;
	?&gt;
  	&lt;div class=&quot;body&quot;&gt;
		&lt;h1&gt;How to add Magento blocks, CSS and Javascript to an external site&lt;/h1&gt;
		&lt;p class=&quot;otherdata&quot;&gt;Written by &lt;strong&gt;Richard Feraro&lt;/strong&gt; | Posted on &lt;strong&gt;July 2, 2010&lt;/strong&gt;&lt;/p&gt;
		&lt;p class=&quot;text&quot;&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis a quam massa. Nullam eget erat metus. Sed vel justo enim. Proin rhoncus laoreet bibendum. Nullam eget est nisi. In eget sem in erat sodales bibendum. Morbi gravida augue sed felis tincidunt a congue dui placerat. Aliquam purus risus, mollis sed ullamcorper non, viverra eu odio. Suspendisse nibh nisi, suscipit at viverra eu, convallis ac odio. Morbi nec sapien eros. Suspendisse nec nulla erat, ac porttitor neque. Integer felis dolor, sollicitudin sed semper et, imperdiet nec turpis. Proin blandit luctus egestas. &lt;/p&gt;
	&lt;/div&gt;
	&lt;?php
		// Display the Footer HTML
		echo (class_exists('Mage')) ? $footer-&gt;toHTML() : '' ;
	?&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://mysillypointofview.richardferaro.com/2010/07/03/how-to-add-magento-blocks-css-and-javascript-to-an-external-site/feed/</wfw:commentRss>
		<slash:comments>86</slash:comments>
		</item>
		<item>
		<title>How to add a product with custom options into Magento shopping cart from an external site?</title>
		<link>http://mysillypointofview.richardferaro.com/2010/06/04/add-a-product-with-custom-options-into-magento-cart-from-external-site/</link>
		<comments>http://mysillypointofview.richardferaro.com/2010/06/04/add-a-product-with-custom-options-into-magento-cart-from-external-site/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 09:49:57 +0000</pubDate>
		<dc:creator>Richard Feraro</dc:creator>
				<category><![CDATA[Feeling guru]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mysillypointofview.richardferaro.com/?p=521</guid>
		<description><![CDATA[This is a follow up post to a previous article I wrote on how to add products into Magento but this time the script includes custom options (attributes) of the product. I used Magento version 1.4.0.1 in this example. Just copy the whole script and save it as index.php.]]></description>
			<content:encoded><![CDATA[<p>This is a follow up post to a previous <a href="http://mysillypointofview.richardferaro.com/2009/04/27/how-to-add-a-product-into-magento-from-an-external-site/">article</a> I wrote on how to add products into Magento but this time the script includes custom options (attributes) of the product. I used Magento version 1.4.0.1 in this example. Just copy the whole script and save it as <strong>index.php</strong>.</p>
<p><span id="more-521"></span>
<pre class="brush: php; title: ; notranslate">&lt;?php
require_once (&quot;/var/www/your-magento-directory/app/Mage.php&quot;);
umask(0);

// Initialize Magento
Mage::app(&quot;default&quot;);

// You have two options here,
// &quot;frontend&quot; for frontend session or &quot;adminhtml&quot; for admin session
Mage::getSingleton(&quot;core/session&quot;, array(&quot;name&quot; =&gt; &quot;frontend&quot;));

// get the current Magento cart
$cart = Mage::getSingleton('checkout/cart');

if(isset($_POST['submit'])){

	// call the Magento catalog/product model
	$product = Mage::getModel('catalog/product')
					 // set the current store ID
					 -&gt;setStoreId(Mage::app()-&gt;getStore()-&gt;getId())
					 // load the product object
					 -&gt;load($_POST['product']);

	// start adding the product
	// format: addProduct(&lt;product id&gt;, array(
	//         'qty' =&gt; &lt;quantity&gt;,
	//         'super_attribute' =&gt; array(&lt;attribute id&gt; =&gt; &lt;option id&gt;)
	//     )
	// )
	$cart-&gt;addProduct($product, array(
			'qty' =&gt; $_POST['qty'],
			'super_attribute' =&gt; array( key($_POST['super_attribute']) =&gt; $_POST['super_attribute'][525] )
			)
		);

	// save the cart
	$cart-&gt;save();

	// very straightforward, set the cart as updated
	Mage::getSingleton('checkout/session')-&gt;setCartWasUpdated(true);

	// redirect to index.php
	header(&quot;Location: index.php&quot;);

}else{
?&gt;
&lt;html&gt;
&lt;head&gt;&lt;/head&gt;
&lt;body&gt;
&lt;div style=&quot;width: 400px; margin: auto&quot;&gt;
	&lt;h3&gt;Very Nice T-shirt&lt;/h3&gt;
	&lt;hr&gt;
	&lt;div style=&quot;width: 180px; margin:auto; line-height: 30px&quot;&gt;
		&lt;form action=&quot;index.php&quot; method=&quot;post&quot;&gt;
			Size:
			&lt;select name=&quot;super_attribute[525]&quot;&gt;
				&lt;option value=&quot;&quot;&gt;Choose an option...&lt;/option&gt;
				&lt;option value=&quot;100&quot;&gt;Small&lt;/option&gt;
				&lt;option value=&quot;99&quot;&gt;Medium&lt;/option&gt;
				&lt;option value=&quot;98&quot;&gt;Large&lt;/option&gt;
			&lt;/select&gt;&lt;br&gt;
			Quantity: &lt;input type=&quot;text&quot; name=&quot;qty&quot; size=&quot;1&quot; value=&quot;1&quot;&gt;
			&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Add This&quot;&gt;
			&lt;input type=&quot;hidden&quot; name=&quot;product&quot; value=&quot;119&quot;&gt;
		&lt;/form&gt;
	&lt;/div&gt;
	&lt;hr&gt;
	&lt;strong&gt;&lt;?php echo &quot;Cart Qty: &quot;.$cart-&gt;getItemsQty();?&gt;&lt;/strong&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;?php } ?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://mysillypointofview.richardferaro.com/2010/06/04/add-a-product-with-custom-options-into-magento-cart-from-external-site/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
		</item>
		<item>
		<title>How to fix the &#8216;The plugin does not have a valid header&#8217; error when activating a WordPress plugin</title>
		<link>http://mysillypointofview.richardferaro.com/2010/05/27/fix-the-plugin-does-not-have-a-valid-header-error/</link>
		<comments>http://mysillypointofview.richardferaro.com/2010/05/27/fix-the-plugin-does-not-have-a-valid-header-error/#comments</comments>
		<pubDate>Wed, 26 May 2010 16:03:27 +0000</pubDate>
		<dc:creator>Richard Feraro</dc:creator>
				<category><![CDATA[Feeling guru]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://mysillypointofview.wordpress.com/?p=420</guid>
		<description><![CDATA[You want to extend WordPress&#8217; functionality and decided to download some plugins found in the Official WordPress Plugin repository. After searching the repo, you&#8217;ve found two plugins that accomplishes the tasks you needed to implement in your blog. Downloading the plugins gives you two ZIP files that when double-clicked, shows you the contents in the [...]]]></description>
			<content:encoded><![CDATA[<p>You want to extend WordPress&#8217; functionality and decided to download some plugins found in the <a href="http://wordpress.org/extend/plugins/">Official WordPress Plugin</a> repository. After searching the repo, you&#8217;ve found two plugins that accomplishes the tasks you needed to implement in your blog. Downloading the plugins gives you two ZIP files that when double-clicked, shows you the contents in the following format:</p>
<blockquote><p><strong>plugin-a.zip</strong></p>
<pre style="white-space: pre">plugin-a-folder
---- plugin-a-main-file.php
---- plugin-a-readme.txt</pre>
</blockquote>
<p></p>
<blockquote><p>
<strong>plugin-b.zip</strong></p>
<pre style="white-space: pre">plugin-b-folder
---- plugin-b-subfolder
-------- plugin-b-main-file.php
-------- plugin-b-readme.txt</pre>
</blockquote>
<p></p>
<p><span id="more-420"></span>There are two ways to install a plugin. <strong>Option 1</strong> is to unzip the file and upload the contents to <code>wordpress_root/wp-content/plugins/</code> directory. <strong>Option 2</strong> is to use the <code>Add New -&gt; Upload</code> option found in the left panel bar of the administrative page of WordPress. Let&#8217;s assume the two plugins went through the two installation options.</p>
<h4>Installing &#8216;plugin-a.zip&#8217; using Option 1</h4>
<ol>
<li>Unzip the file</li>
<li>Upload the contents to <code>wordpress_root/wp-content/plugins/</code></li>
<li>Login as admin and go to <code>Plugins -&gt; Installed</code>.</li>
<li>Locate plugin and click <span style="text-decoration:underline;">Activate</span> link.</li>
<li><strong>Result:</strong>
<div style="display:inline;border:1px solid #E6DB55;background:#FFFFE0;-moz-border-radius:3px 3px 3px 3px;padding:3px 10px;">Plugin <strong>activated.</strong></div>
</li>
</ol>
<h4>Installing &#8216;plugin-a.zip&#8217; using Option 2</h4>
<ol>
<li>Login as admin and go to <code>Plugins -&gt; Add New -&gt; Upload</code></li>
<li>Locate the file <code>plugin-a.zip</code> by clicking the <em>Browse</em> button.</li>
<li>Click <em>Install Now</em> button.</li>
<li><strong>Result:</strong><br />
	Unpacking the package?<br />
Installing the plugin?<br />
Plugin installed successfully.
	</li>
<li>Click <span style="text-decoration:underline;">Activate Plugin</span> link.</li>
<li><strong>Result:</strong>
<div style="display:inline;border:1px solid #E6DB55;background:#FFFFE0;-moz-border-radius:3px 3px 3px 3px;padding:3px 10px;">Plugin <strong>activated.</strong></div>
</ol>
<h4>Installing &#8216;plugin-b.zip&#8217; using Option 1</h4>
<ol>
<li>Unzip the file</li>
<li>Upload the contents to <code>wordpress_root/wp-content/plugins/</code></li>
<li>Login as admin and go to <code>Plugins -&gt; Installed</code>.</li>
<li>Locate plugin and click <span style="text-decoration:underline;">Activate</span> link.</li>
<li><span style="color:#FF0000;"><strong>Error:</strong> Plugin does not exists in the list.</span></li>
</ol>
<h4>Installing &#8216;plugin-b.zip&#8217; using Option 2</h4>
<ol>
<li>Login as admin and go to <code>Plugins -&gt; Add New -&gt; Upload</code></li>
<li>Locate the file <code>plugin-b.zip</code> by clicking the <em>Browse</em> button.</li>
<li>Click <em>Install Now</em> button.</li>
<li><strong>Result:</strong><br />
	Unpacking the package?<br />
Installing the plugin?<br />
Plugin installed successfully.
	</li>
<li>Click <span style="text-decoration:underline;">Activate Plugin</span> link.</li>
<li><span style="color:#FF0000;"><strong>WordPress ? Error</strong></span>
<div style="color:#333333;display:block;border:1px solid #DFDFDF;background:#FFFFFF;-moz-border-radius:11px 11px 11px 11px;font-family:'Lucida Grande',Verdana,Arial,'Bitstream Vera Sans',sans-serif;padding:1em 2em;">The plugin does not have a valid header.</div>
</ol>
<p>Based on our testing, <code>plugin-b.zip</code> seems to fail on both methods of installation. To find out what is causing the error, we have to understand how the plugin installation works. Upon checking the core files I found this excerpt in <strong>get_plugins()</strong> function:</p>
<blockquote><p>* WordPress only supports plugin files in the base plugins directory<br />
 * (wp-content/plugins) and in one directory above the plugins directory<br />
 * (wp-content/plugins/my-plugin). The file it looks for has the plugin data and<br />
 * must be found in those two locations. It is recommended that do keep your<br />
 * plugin files in directories.</p></blockquote>
<p>The plugin data that the function is looking for can be found below:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
/*
Plugin Name: Name Of The Plugin
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: A brief description of the Plugin.
Version: The Plugin's Version Number, e.g.: 1.0
Author: Name Of The Plugin Author
Author URI: http://URI_Of_The_Plugin_Author
License: A &quot;Slug&quot; license name e.g. GPL2
*/
?&gt;</pre>
<p>So in order to properly install and activate a plugin, the following two conditions must be satisfied:</p>
<ul>
<li>that a plugin main file (.php) must be placed in <code>plugins</code> root folder or in <strong>first-level subdirectory within plugins folder</strong></li>
<li>and it should contain the necessary plugin data for identification/validation purposes</li>
</ul>
<p>In the case of <code>plugin-b.zip</code>, although the main PHP file contains the needed plugin data, the <strong>validate_plugin()</strong> function returned an error since neither the file can be found or check if it contains the plugin data because it is placed in the <strong>second level subdirectory</strong>, <span style="text-decoration:underline;">a directory location in which the function is not designed to scan the content.</span></p>
<p>To fix the <code>plugin-b.zip</code> file, it needs to have the following content structure:</p>
<blockquote><p><strong>plugin-b.zip</strong></p>
<pre style="white-space: pre">plugin-b-folder
---- plugin-b-main-file.php
---- plugin-b-readme.txt</pre>
</blockquote>
<p></p>
<p>I hope this post will enlighten WordPress users who wants to maximize their blog&#8217;s potential <img src='http://mysillypointofview.richardferaro.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://mysillypointofview.richardferaro.com/2010/05/27/fix-the-plugin-does-not-have-a-valid-header-error/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>Mage Enabler is now available for download in the Official WordPress Plugin repository!</title>
		<link>http://mysillypointofview.richardferaro.com/2010/05/12/mage-enabler-is-now-available-for-download/</link>
		<comments>http://mysillypointofview.richardferaro.com/2010/05/12/mage-enabler-is-now-available-for-download/#comments</comments>
		<pubDate>Wed, 12 May 2010 06:48:03 +0000</pubDate>
		<dc:creator>Richard Feraro</dc:creator>
				<category><![CDATA[Techie Daw]]></category>
		<category><![CDATA[e-commerce]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://mysillypointofview.wordpress.com/?p=378</guid>
		<description><![CDATA[I&#8217;m soooo happy to see my very first plugin to be released for everyone to use. I hope it will help a lot of Magento and WordPress users! Click! click! click!]]></description>
			<content:encoded><![CDATA[<p><a href="http://mysillypointofview.files.wordpress.com/2010/05/wordpress-e280ba-newest-c2ab-wordpress-plugins_1273645824215.png"><img src="http://mysillypointofview.files.wordpress.com/2010/05/wordpress-e280ba-newest-c2ab-wordpress-plugins_1273645824215.png" alt="" title="Mage Enabler plugin" width="497" height="207" class="alignnone size-full wp-image-379" /></a></p>
<p>I&#8217;m soooo happy to see my very first plugin to be released for everyone to use. I hope it will help a lot of Magento and WordPress users!</p>
<p><a href="http://wordpress.org/extend/plugins/mage-enabler/">Click! click! click!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mysillypointofview.richardferaro.com/2010/05/12/mage-enabler-is-now-available-for-download/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

