 <?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>Devin R. Olsen Web Developer &#187; PHP Tutorials</title>
	<atom:link href="http://www.devinrolsen.com/category/php-tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.devinrolsen.com</link>
	<description>From Developer to Developer Information and Sharing</description>
	<lastBuildDate>Sat, 14 Jan 2012 02:25:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Combat Extreme &#8211; Facebook 3D Shooter</title>
		<link>http://www.devinrolsen.com/combat-extreme-facebook-3d-shooter-video-game/</link>
		<comments>http://www.devinrolsen.com/combat-extreme-facebook-3d-shooter-video-game/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 17:48:49 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[3D Tutorials]]></category>
		<category><![CDATA[Ajax Tutorials]]></category>
		<category><![CDATA[CSS Tutorials]]></category>
		<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[General Web Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript Tutorials]]></category>
		<category><![CDATA[Magento Tutorials]]></category>
		<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[SEO Tutorials]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[3d combat facebook]]></category>
		<category><![CDATA[3d combat game]]></category>
		<category><![CDATA[3d facebook game]]></category>
		<category><![CDATA[combat]]></category>
		<category><![CDATA[combat 3d game]]></category>
		<category><![CDATA[combat extreme]]></category>
		<category><![CDATA[extreme]]></category>
		<category><![CDATA[extreme combat facebook game]]></category>
		<category><![CDATA[extreme combat game facebook]]></category>
		<category><![CDATA[facebook 3d combat game]]></category>
		<category><![CDATA[facebook 3d game]]></category>
		<category><![CDATA[facebook combat video game]]></category>
		<category><![CDATA[facebook shooter]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[shooter game]]></category>
		<category><![CDATA[third-person]]></category>
		<category><![CDATA[video game]]></category>

		<guid isPermaLink="false">http://www.devinrolsen.com/?p=1541</guid>
		<description><![CDATA[My little brother and I have been working on this third-person shooter video game together for well over a year now, come check it out and play for free through your web browser!]]></description>
			<content:encoded><![CDATA[<p>Hi readers! I thought I would take a different pace today, and instead of teaching lets play some games shall we? For over a year now I and my little brother have been working tirelessly on our first &#8220;Third-person shooter&#8221; video game.</p>
<p><iframe src="http://www.youtube.com/embed/rhx_eJxyRv8" frameborder="0" width="420" height="315"></iframe></p>
<p><strong><a title="Combat Extreme - Third-person shooter on Facebook.com" href="https://www.combat-extreme.com/">CLICK HERE TO START PLAYING OUR GAME!</a></strong></p>
<p>So what makes this game so different you ask? Well the game is completely browser-based. That&#8217;s right, a full 3D environment third person shooting game that is playable through your web browser!</p>
<p>It&#8217;s a simple game of Marines vs. Insurgents based in a mideast town (for the BETA at least, we have three total levels for full release of the video game).</p>
<p>We used the Unity3d game engine to develop this game, and although our game is still in a official &#8220;BETA&#8221; title, I felt it was finally time to share this awesome work with the rest of my readers and the world.</p>
<p>In order to play Combat Extreme (the 3d third-person shooter) on Facebook through your web browser, you must have the unity3d web player installed. The web player is designed specifically to render geometry and post process effects directly through ones browsers (Yes even IE).</p>
<p>Combat Extreme (the 3d third-person shooter) is indeed exclusive to facebook.com right now and may or may not be opened to further social gaming markets. We really wanted to create a seamless experience for our UX, and insisting the user create a new account with an email address conformation + allow the app on their page was asking way too much. Thus, we eliminated the biggest step and allow our users to login to Combat Extreme (the 3d third-person shooter game) through their facebook account.</p>
<p><strong><a title="Combat Extreme - Third-person shooter on Facebook.com" href="https://www.combat-extreme.com/">CLICK HERE TO START PLAYING OUR GAME!</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/combat-extreme-facebook-3d-shooter-video-game/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Realtime Image Typesetting with PHP GD</title>
		<link>http://www.devinrolsen.com/realtime-image-typesetting-with-php-gd/</link>
		<comments>http://www.devinrolsen.com/realtime-image-typesetting-with-php-gd/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 07:51:35 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[Ajax Tutorials]]></category>
		<category><![CDATA[JavaScript Tutorials]]></category>
		<category><![CDATA[PHP Tutorials]]></category>

		<guid isPermaLink="false">http://www.devinrolsen.com/?p=1114</guid>
		<description><![CDATA[Learn how to use both JavaScript Ajax and PHP GD (graphical library) to perform real-time image typesetting onto a image. We will also cover how to use custom text colors, sizes, rotation and even fonts in our example demo.]]></description>
			<content:encoded><![CDATA[<p>Today I wanted to go over some of the really cool things that can be done with both jQuery and PHP&#8217;s Graphical library. To begin, let&#8217;s go ahead and take a look at the demo of what I will be breaking down over this tutorial.</p>
<div class="wp-caption alignnone" style="width: 430px"><a href="http://www.devinrolsen.com/wp-content/themes/dolsen/demos/ajax/gd-realtime/"><img src="http://www.devinrolsen.com/wp-content/themes/typebased/demos/ajax/gd-realtime/scripts/server-side.php?companyName=Developer to Developer&amp;companySlogan=Company Slogan&amp;fullName=Devin R. Olsen&amp;jobTitle=Job Title&amp;businessAddress=1234 Main Street\nSuite 101\nCity, ST 12345&amp;phoneOne=P: 954-555-1234&amp;phoneTwo=F: 954-555-5678&amp;emailAddress=devin@company.com&amp;siteUrl=www.WebSiteUrl.com&amp;" alt="" width="420" height="252" /></a><p class="wp-caption-text">Click to see demo of Business Card Builder</p></div>
<h2>The Markup</h2>
<hr />
<pre>&lt;h3&gt;Realtime Business Card Builder&lt;/h3&gt;
&lt;div class="preview"&gt;
    <strong>&lt;img src="<span style="text-decoration: underline;">scripts/server-side.php</span>" /&gt;</strong>
&lt;/div&gt;</pre>
<p>Notice how the preview image&#8217;s &#8220;src&#8221; attribute is not pointing to a graphical file, but rather a server side php script? This is important because although we could use PHP to render new images out on our web server on every change, its best to view a single rendering through a static image element.</p>
<h2>The client side code</h2>
<hr />
<p>By simply building up a query string that contains the values of our form fields, we can get a realtime performance. The first thing we want to create is a variable named &#8220;base&#8221; that will contain our preview image&#8217;s &#8220;src&#8221; orignal attribute value.</p>
<pre><strong>var base = $(".preview img").attr("src");</strong></pre>
<p>We make the &#8220;base&#8221; variable so that we may reference to the original URL of the server side file later on.</p>
<p>Next we want to gather our image from server side when the document is done loading for the first time. By utilizing jQuery&#8217;s serialize we will gather all our form&#8217;s fields and their values and request our image from php like so:</p>
<pre>var base = $(".preview img").attr("src");

<strong>//GATHER IMAGE FOR FIRST TIME
$(".preview img").attr("src",base+'?'+$("#realtime-form").serialize());</strong></pre>
<p>As you can see, we set our image&#8217;s source attribute to be that of our base url, plus a serialized string of all our form&#8217;s input names and values.</p>
<p>Finally we want to setup our keyup event so as the user types into any of our form inputs, a &#8220;change request&#8221; for our image to be updated will be sent to php.</p>
<pre>var base = $(".preview img").attr("src");

//GATHER IMAGE FOR FIRST TIME
$(".preview img").attr("src",base+'?'+$("#realtime-form").serialize());

<strong>//KEYUP EVENT AND NEW IMAGE GATHER
$("input,textarea").keyup(function(){
	$(".preview img").attr("src",base+'?'+$("#realtime-form").serialize());
});</strong></pre>
<p>Notice how within our new keyup event we are basicly repeating our previous step of gather our image the first time? This is how we both gather changes the user has made, and request a new version of our image at the same time.</p>
<h2>The server side code</h2>
<hr />
<p>Now lets take a look at our PHP image rendering file. The first thing we want to do in this file is to declare what format of image should it be rendering:</p>
<pre>header ("Content-type: image/png");</pre>
<p>We pass a content type of &#8220;image/png&#8221; to our files header so that we can have alpha transparency ability that is natural to png image formats.</p>
<p>Next we need to gather every possible value that is being sent to this file via our URI string. We do this by creating new variables and setting their value to each URI string value, like so:</p>
<pre>$companyName = $_GET["companyName"];
$companySlogan = $_GET["companySlogan"];
$fullName = $_GET["fullName"];
$jobTitle = $_GET["jobTitle"];
$businessAddress = $_GET["businessAddress"];
$businessAddress = str_replace("\\n","\n",$businessAddress);
$businessAddress = str_replace("\\","",$businessAddress);
$phoneOne = $_GET["phoneOne"];
$phoneTwo = $_GET["phoneTwo"];
$emailAddress = $_GET["emailAddress"];
$siteUrl = $_GET["siteUrl"];</pre>
<p>Notice how on some of the value gatherings I am using a str_replace() function? Again, we are replacing any instance of our hard return character (\\n) into an actual hard return upon rending our image and copy.</p>
<p>Next we are going to gather a temp image we will use to create the actual image we render on dynamically, like so:</p>
<pre>$handle = $img = imagecreatefrompng( 'template.png' );</pre>
<p>(<em>&#8216;template.png&#8217; is a image file that lives on your server.</em>)</p>
<p>Now we need to setup a few more variables that will come in handy when rendering our results:</p>
<pre>$brown = ImageColorAllocate ($handle, 84, 48, 26);
$lightBrown = ImageColorAllocate ($handle, 145, 116, 94);
$white = ImageColorAllocate ($handle, 255, 255, 255);
$peach = ImageColorAllocate ($handle, 238, 222, 200);</pre>
<p>We setup different font colors by making use of the &#8220;ImageColorAllocate()&#8221; PHP GD function and assigning it to our new &#8220;template.png&#8221; image ($handle). The array of numbers that proceeds &#8220;$handle&#8221; are RGB color values.</p>
<p>Now that we have everything (variable wise) setup to render our image, we need to place and setup our text in our image. Here is an example of how to do just that.</p>
<pre>//company name
ImageTTFText ($handle, 18, 0, 20, 35, $brown, "timesbd.TTF", $companyName);</pre>
<p>By using the &#8220;ImageTTFText()&#8221; PHP GD function, we can setup an array of parameters to place and render our copy in our image.<br />
First, we point to our &#8220;template.png&#8221; image ($handle) want to place this copy onto. Next is an array of numerical values and they are in order as follows:</p>
<ul>
<li> Font Size of Copy</li>
<li> Rotation of Copy</li>
<li> X Position to Image&#8217;s size</li>
<li> Y Position to Image&#8217;s size</li>
</ul>
<p>After the &#8220;size, rotation and position&#8221; values, we set our desired font color via our pre-defined color variables. Next we can choose to use a custom font file that live along side this php file. Last is the copy value it&#8217;s self that we gathered from our URI string and turned into variables.</p>
<p>The very last part to rending our image with PHP GD, is to do some clean up work like so:</p>
<pre>imagealphablending( $handle, false );
imagesavealpha( $handle, true );
ImagePng ($handle);
imagedestroy( $handle );</pre>
<p>We finish off our file format of &#8220;.png&#8221; and its transparency, and lastly destroy the image when completed to free up server memory.</p>
<p>(<em>Some may notice that the web address copy is rendered from an align of center on out, I show this example in the demo download.</em>)</p>
<p>That&#8217;s it everyone! With a little JavaScript and PHP GD you can do some really cool stuff, and I hope to see some great examples soon.</p>
<p>~ <a href="http://www.devinrolsen.com/wp-content/themes/dolsen/demos/ajax/gd-realtime/realtime-phpgd.zip">Download a copy of the demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/realtime-image-typesetting-with-php-gd/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Magento Determine if Current Page is Category or Not</title>
		<link>http://www.devinrolsen.com/magento-determine-if-current-page-is-category-or-not/</link>
		<comments>http://www.devinrolsen.com/magento-determine-if-current-page-is-category-or-not/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 06:22:29 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[Magento Tutorials]]></category>
		<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[Categories Page]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[Category Page]]></category>
		<category><![CDATA[Category Page Determin]]></category>
		<category><![CDATA[Determin Category Page]]></category>
		<category><![CDATA[Determine Category]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[Magento Category]]></category>
		<category><![CDATA[Magento Category Page]]></category>
		<category><![CDATA[Magento Determine Category Page]]></category>

		<guid isPermaLink="false">http://www.devinrolsen.com/?p=863</guid>
		<description><![CDATA[Sometimes you find your self in the need to determine if the current page a visitor is viewing is of a category or not. The reason for this could drastically very, but one good reason is the need for a global element not be shown on any category page.]]></description>
			<content:encoded><![CDATA[<p>Sometimes you find your self in the need to determine if the current page a visitor is viewing is of a category or not. The reason for this could drastically very, but one good reason is the need for a global element not be shown on any category page.</p>
<p>It would be much faster to simply include this element or rather custom block globally to your Magento store via your layout XML files, and have a condition in this block&#8217;s .phtml file that excluded any output on category page.</p>
<p>This is a very simple method that simply looks to our Mage registry and asks the question &#8220;Is the current page indeed a current category page or not?&#8221;.</p>
<pre>php if(!Mage::registry('current_category')):?&gt;
//OUTPUT THE GLOBAL ELEMENTS CODE ON NONE-CATEGORY PAGES
php endif; ?&gt;</pre>
<p>Simple as that, of course the correct way would be to include this block globally via your XML layout files, and then remove it via XML (Custom Layout Update) in the backend-&gt;catalog-&gt;manage categories &#8220;Custom Design&#8221; tab for each category.</p>
<p>But this method might be faster.</p>
<p>Devin R. Olsen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/magento-determine-if-current-page-is-category-or-not/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Magento Product&#8217;s Relative Parent Category Method</title>
		<link>http://www.devinrolsen.com/magento-products-relative-parent-category-method/</link>
		<comments>http://www.devinrolsen.com/magento-products-relative-parent-category-method/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 00:14:12 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[Magento Tutorials]]></category>
		<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[get parent category]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[parent categories]]></category>
		<category><![CDATA[parent category]]></category>
		<category><![CDATA[product categories]]></category>
		<category><![CDATA[products parent category]]></category>

		<guid isPermaLink="false">http://www.devinrolsen.com/?p=852</guid>
		<description><![CDATA[Today I want to quickly cover an area that I get asked about at least once a month, and that is "If a product belongs to more than one category.. how do I get the correct parent category while viewing a product through one category or the other?".]]></description>
			<content:encoded><![CDATA[<p>Today I want to quickly cover an area that I get asked about at least once a month, and that is &#8220;If a product belongs to more than one category.. how do I get the correct parent category while viewing a product through one category or the other?&#8221;.</p>
<p>With that said the, the biggest scenario for this need would be to determine the products parent category in order to perform something unique to the product&#8217;s page while viewing product&#8217;s page through one category or another.</p>
<p>This is a very simple method that assumes you have the product of question loaded up or rather, you are at the product level of your store in order to obtain some information about the products parent categories.</p>
<p>So here we go.</p>
<p>First you need to gather all the category id&#8217;s this product belongs to, so to do this we simply make a new variable called &#8220;$catIds&#8221; and gather all the category id&#8217;s like so:</p>
<pre>&lt;?php
$catIds = $_product-&gt;getCategoryIds();
?&gt;</pre>
<p>Next we simply need to point to the first category in this new &#8220;$catIds&#8221; variable array like so:</p>
<p>(Remembere the number 0 is = 1 or rather first in an array.)</p>
<pre>&lt;?php
$catIds = $_product-&gt;getCategoryIds();
$relativeCatId = $catIds[0];
?&gt;</pre>
<p>So now that we have gathered our relative parent category id, we can begin to load this category up in order to gather information from it and ultimately create a unique condition for our products page:</p>
<pre>&lt;?php
$catIds = $_product-&gt;getCategoryIds();
$relativeCatId  = $catIds[0];
$category = Mage::getModel("catalog/category")-&gt;load($relativeCatId);
?&gt;</pre>
<p>Now that we have loaded up our relative parent category into this new variable called &#8220;$category&#8221; we can then say, &#8220;Grab the category&#8217;s name, or even attributes to create some kind of condition.&#8221;, like so:</p>
<pre>&lt;?php
$catIds = $_product-&gt;getCategoryIds();
$relativeCatId   = $catIds[0];
$category =  Mage::getModel("catalog/category")-&gt;load($relativeCatId);
?&gt;

&lt;?php if($category-&gt;getName()  == "Category One"): ?&gt;
//DO THIS
&lt;?php elseif($category-&gt;getName()  == "Category Two"):?&gt;
//DO THAT
&lt;?php endif;?&gt;</pre>
<p>And that&#8217;s it!</p>
<p>So to recap, all we did was while under a product level, gathered all its parent category id&#8217;s into the variable &#8220;$catIds&#8221;. Once all category id&#8217;s we captured, we proceeded to highlight or rather grabbed our first category&#8217;s id from the array (0) and used it to load the category up. Once this category was loaded, we could access its attributes or information. We used the category&#8217;s information to build a condition and perform something unique to the product page depending on if its being viewed through one category or a completely different category.</p>
<p>Thanks Everyone!</p>
<p>Devin R. Olsen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/magento-products-relative-parent-category-method/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How to Obtain Custom Attribute Values in Magento</title>
		<link>http://www.devinrolsen.com/magento-custom-attributes-value/</link>
		<comments>http://www.devinrolsen.com/magento-custom-attributes-value/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 19:25:45 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[Magento Tutorials]]></category>
		<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[attribute value]]></category>
		<category><![CDATA[attribute values]]></category>
		<category><![CDATA[attributes]]></category>
		<category><![CDATA[custom attribute]]></category>
		<category><![CDATA[custom attribute value]]></category>
		<category><![CDATA[custom attribute values]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[magento attribute value]]></category>
		<category><![CDATA[magento attribute values]]></category>
		<category><![CDATA[magento custom attribute]]></category>
		<category><![CDATA[magento custom attributes]]></category>
		<category><![CDATA[value]]></category>
		<category><![CDATA[values]]></category>

		<guid isPermaLink="false">http://www.devinrolsen.com/?p=813</guid>
		<description><![CDATA[Today let’s talk about Magento and custom attributes. With magento you can create as many custom attributes for your products as you like, but how does one then gather the values of a custom attribute? Here I will show you how to properly gather the value of any Magento custom attribute.]]></description>
			<content:encoded><![CDATA[<p>Today let’s talk about Magento and custom attributes. With Magento you can create as many custom attributes for your products as you like, and there are different attribute types such as:</p>
<ul>
<li>Text Field</li>
<li>Text Area</li>
<li>Date</li>
<li>Yes/No</li>
<li>Multiple Select</li>
<li>Dropdown</li>
<li>Price</li>
<li>Gallery</li>
<li>Media Image</li>
<li>Fixed Product Tax</li>
</ul>
<p>Because there are different types of attributes there are also different ways of obtaining an attributes value. If we were to create a new custom attribute called &#8220;<strong>theme_color</strong>” and the attribute was of a &#8220;<strong>Text Field</strong>” type, we could do something like the following at a product level (meaning a product is loaded) to obtain its value.</p>
<pre>&lt;?php
echo $_product-&gt;getThemeColor();
?&gt;</pre>
<p>$_product is the product of question we have loaded up and ready to work with, and we use &#8220;<strong>getThemeColor();</strong>” because our attribute was named &#8220;<strong>theme_color</strong>”. It’s important to realize that when calling out the value of an attribute with this method, we start with &#8220;get” and then capitalize the first letter of each word that is divided by a &#8220;_”.</p>
<p>Now this method would give us the value of a simple &#8220;<strong>Text Field</strong>” attribute but what if the attribute was a &#8220;<strong>Dropdown or a Multiple Select</strong>&#8221; type? Well if you try to use this &#8220;<strong>getYourAttributesName()</strong>&#8221; method on a none &#8220;<strong>Text Field</strong>” or &#8220;<strong>Textarea</strong>” attribute type you will most likely get nothing.</p>
<p>So how do we obtain the value of a &#8220;<strong>Dropdown or a Multiple Select</strong>&#8221; attribute type you ask? Well some would argue that you would do so via this method:</p>
<pre>&lt;?php
echo $_product-&gt;getAttributeText('theme_color');
?&gt;</pre>
<p>However, what this would do is return an array of the &#8220;<strong>Dropdown or Multiple Select</strong>&#8221; options instead of the value of the selected option you would have set. There is another way to obtain these types of attributes selected value and it looks like this:</p>
<pre>&lt;?php
$attributes = $_product-&gt;getAttributes();
$themeColor = $attributes['theme_color']-&gt;getFrontend()-&gt;getValue($_product);
echo $themeColor;
?&gt;</pre>
<p>With this method we are simply creating a new variable called &#8220;<strong>$attributes</strong>” and pointing to our &#8220;<strong>$_product</strong>” to then using the &#8220;<strong>getAttributes()</strong>” function to gather all the attributes of this product.</p>
<p>Once we have all the product&#8217;s attributes inside of the &#8220;<strong>$attributes</strong>” variable, we make another new variable called &#8220;<strong>$themeColor</strong>”. &#8220;<strong>$themeColor</strong>” then assigns its self to our &#8220;<strong>$attributes</strong>” array that we in turn call out our custom attribute <strong>[‘theme_color’]</strong>.</p>
<p>Once we have pointed to the custom attribute in the &#8220;<strong>$attributes</strong>” array, we simply run through the front end via the function &#8220;<strong>getFrontend()</strong>” and then pull the value down via &#8220;<strong>getValue($_product)</strong>”.</p>
<p>If we then echo our &#8220;<strong>$themeColor</strong>&#8221; you should get the value of your custom Drop Down or Multiple Select attribute to do what you will with it.</p>
<p>So to recap:</p>
<pre>
&lt;?php echo $_product-&gt;getThemeColor() ?&gt;
</pre>
<p>Would get the value of an attribute wholes type is of Text Field or Text Area’s</p>
<pre>
&lt;?php echo $_product-&gt;getAttributeText('theme_color')  ?&gt;
</pre>
<p>That will not give a value of a Text Field or Text Area attribute type but rather gather an array of all options in a Drop Down or Multiple Select attribute type.</p>
<pre>
&lt;?php
$attributes = $_product-&gt;getAttributes();
$themeColor = $attributes['theme_color']-&gt;getFrontend()-&gt;getValue($_product);
?&gt;
</pre>
<p>That will give you the value of any type of attribute, even the value from &#8220;<strong>Drop Down or Multiple Select</strong>&#8221; attribute types.</p>
<p>I hope this clears some things up and helps some developers out there .</p>
<p>Thanks!</p>
<p>Devin R. Olsen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/magento-custom-attributes-value/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Magento Custom Category Listing Block</title>
		<link>http://www.devinrolsen.com/magento-custom-category-listing-block/</link>
		<comments>http://www.devinrolsen.com/magento-custom-category-listing-block/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 02:58:24 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[Magento Tutorials]]></category>
		<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[category listing]]></category>
		<category><![CDATA[category listing magento]]></category>
		<category><![CDATA[custom category list block]]></category>
		<category><![CDATA[list of magento categories]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[magento categories list]]></category>
		<category><![CDATA[magento category listing]]></category>
		<category><![CDATA[magento custom block]]></category>
		<category><![CDATA[magento tutorial]]></category>

		<guid isPermaLink="false">http://www.devinrolsen.com/?p=753</guid>
		<description><![CDATA[Here I wanted to show you how to build a custom magento category listing block that you can use on your own magento store. We will go over each step at getting a category listing of your magneto categories and even a sub category listing.]]></description>
			<content:encoded><![CDATA[<p>Here I wanted to show you how to build a custom Magento category listing block that you can use on your own Magento store. We will go over each step at getting a category listing of your magneto categories and even a sub category listing.</p>
<p><object style="display:block; margin-left:auto; margin-right:auto;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="265" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/gt1ZF8mQxk4&amp;hl=en_US&amp;fs=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /><embed style="display:block; margin-left:auto; margin-right:auto;" type="application/x-shockwave-flash" width="425" height="265" src="http://www.youtube.com/v/gt1ZF8mQxk4&amp;hl=en_US&amp;fs=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6" wmode="transparent" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Here is the finished code for your new category listing block.</p>
<pre>&lt;?php
$cats = Mage::getModel('catalog/category')-&gt;load(2)-&gt;getChildren();
$catIds = explode(',',$cats);
?&gt;
&lt;ul&gt;
&lt;?php foreach($catIds as $catId): ?&gt;
	&lt;li&gt;
    	&lt;?php
			$category = Mage::getModel('catalog/category')-&gt;load($catId);
			echo $category-&gt;getName();

			$subCats = Mage::getModel('catalog/category')-&gt;load($category-&gt;getId())-&gt;getChildren();
			$subCatIds = explode(',',$subCats);
		?&gt;
            &lt;?php if(count($subCatIds) &gt; 1):?&gt;
                &lt;ul&gt;
                &lt;?php foreach($subCatIds as $subCat) :?&gt;
                    &lt;li&gt;
                    &lt;?php
                        $subCategory = Mage::getModel('catalog/category')-&gt;load($subCat);
                        echo $subCategory-&gt;getName();
                    ?&gt;
                    &lt;/li&gt;
                &lt;?php endforeach;?&gt;
                &lt;/ul&gt;
            &lt;?php endif; ?&gt;
    &lt;/li&gt;
&lt;?php endforeach; ?&gt;
&lt;/ul&gt;</pre>
<p>And The XML Block Code:</p>
<pre>&lt;block type="catalog/navigation" name="catalog.category" template="catalog/navigation/category.phtml" /&gt;</pre>
<p>NOTE:<br />
After loading each category you have a whole array of different attributes you can use. If you wanted to make each category listing be a link, simply use the getUrl() function in a similar fashion:</p>
<pre>&lt;a href="&lt;?php echo $category-&gt;getUrl()?&gt;"&gt;
	&lt;?php echo $category-&gt;getName()?&gt;
&lt;/a&gt;</pre>
<p>Enjoy everyone!<br />
Devin R. Olsen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/magento-custom-category-listing-block/feed/</wfw:commentRss>
		<slash:comments>47</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk

Served from: www.devinrolsen.com @ 2012-02-05 12:17:57 -->
