<?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>Webmaster Bulletin &#187; magento</title>
	<atom:link href="http://www.webmasterbulletin.net/tag/magento/feed" rel="self" type="application/rss+xml" />
	<link>http://www.webmasterbulletin.net</link>
	<description>Rambling around the web publishing industry</description>
	<lastBuildDate>Wed, 10 Mar 2010 15:29:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Magento : how to learn from free templates</title>
		<link>http://www.webmasterbulletin.net/2009/10/magento-how-to-learn-from-free-templates/1030</link>
		<comments>http://www.webmasterbulletin.net/2009/10/magento-how-to-learn-from-free-templates/1030#comments</comments>
		<pubDate>Thu, 29 Oct 2009 11:08:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[E commerce]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=1030</guid>
		<description><![CDATA[The power of Magento is great but it requires long days of learning and suffering to get through relative simple features, such as the now common front page slide banner. I had a quick look at magento free templates on google and was conquered by Magento &#8217;s classic theme, the kind of  stuff that&#8217;s really [...]]]></description>
			<content:encoded><![CDATA[<p>The power of Magento is great but it requires long days of learning and suffering to get through relative simple features, such as the now common front page slide banner. I had a quick look at magento free templates on google and was conquered by Magento &#8217;s classic theme, the kind of  stuff that&#8217;s really given free of charge when I would have paid for it. It actually comes with an interesting development of Magento&#8217;s block systems, and demonstrates how to add a custom block between navigation and content : the prototype glider that scrolls images is defined a cms static block, which is then called in the home page CMS  custom xml definition, with a reference to the slider block that&#8217;s positionned in phtml files and declared in the xml layouts as a core/text_list type . Impressive stuff : that&#8217;s pure  magento design and illustrates how versatile the system is.</p>
<p>Links : <a href="http://www.smashingmagazine.com/2009/05/05/25-magento-templates-for-your-e-commerce-business/" target="_blank">25 free templates for Magento</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webmasterbulletin.net/2009/10/magento-how-to-learn-from-free-templates/1030/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento log cleaner</title>
		<link>http://www.webmasterbulletin.net/2009/10/magento-log-cleaner/1013</link>
		<comments>http://www.webmasterbulletin.net/2009/10/magento-log-cleaner/1013#comments</comments>
		<pubDate>Mon, 12 Oct 2009 09:41:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[E commerce]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=1013</guid>
		<description><![CDATA[Magento, in earlier versions, does not seem to handle log cleaning very well. A lot of configuration options are vailable under the configuration  / Advanced / System menu, that seem to have an impact on the cron.php process. But trying to remove logs this way is a complicated task that involves full log counting (select [...]]]></description>
			<content:encoded><![CDATA[<p>Magento, in earlier versions, does not seem to handle log cleaning very well. A lot of configuration options are vailable under the configuration  / Advanced / System menu, that seem to have an impact on the cron.php process. But trying to remove logs this way is a complicated task that involves full log counting (select count on mage_log_visitor) and the result is not always there, don&#8217;t know why. A full truncate on log tables seems more appropriate, as described on the knowledge base, to use with caution obviously : <a href="http://www.magentocommerce.com/wiki/groups/227/maintenance_script" target="_blank">Magento Maintenance Script</a> was posted a few days ago but I tried it and it&#8217;s pretty efficient. Let us know how it performed on your install, on mine it works well. Go ahead after you&#8217;ve performed the appropriate backups !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webmasterbulletin.net/2009/10/magento-log-cleaner/1013/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento email configuration pain and how to solve it</title>
		<link>http://www.webmasterbulletin.net/2009/09/magento-email-configuration-pain-and-how-to-solve-it/1011</link>
		<comments>http://www.webmasterbulletin.net/2009/09/magento-email-configuration-pain-and-how-to-solve-it/1011#comments</comments>
		<pubDate>Mon, 28 Sep 2009 14:41:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[E commerce]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=1011</guid>
		<description><![CDATA[It&#8217;s nice to setup a magento shop, but one particular task is painful and time consuming : the modification  of automatic email templates . By defautl, email tempaltes in Magento are well designed as a sample given out to the developer, but when you expect to have your shop running in a few hours  time, [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s nice to setup a magento shop, but one particular task is painful and time consuming : the modification  of automatic email templates . By defautl, email tempaltes in Magento are well designed as a sample given out to the developer, but when you expect to have your shop running in a few hours  time, it is really a pain to go through all emails jsut to change phone numbers, shop name, and opening times especially when this information could be centralized in the database.  The subject is not new and here a few hacks to let you work faster when setting up a shop</p>
<ul>
<li>You can use a linux script to automatically modify magento email template files in your language / email folder
<ul>
<li>script 1<br />
<a href="http://www.osetemplates.com/?p=138">http://www.osetemplates.com/?p=138</a></li>
<li>script 2 (slightly better because incorporates store specific vairables in the script)<br />
<a href="http://www.pridedesign.ie/content/magento-email-template-script">http://www.pridedesign.ie/content/magento-email-template-script</a></li>
</ul>
</li>
<li>You can also use the<a href="http://www.magentocommerce.com/extension/1692/email-template-adapter" target="_blank"> email template adapter extension</a> to get the job done via magento&#8217;s administration interface</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.webmasterbulletin.net/2009/09/magento-email-configuration-pain-and-how-to-solve-it/1011/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento / facebook : display new products on your wall</title>
		<link>http://www.webmasterbulletin.net/2009/08/magento-facebook-display-new-products-on-your-wall/982</link>
		<comments>http://www.webmasterbulletin.net/2009/08/magento-facebook-display-new-products-on-your-wall/982#comments</comments>
		<pubDate>Mon, 31 Aug 2009 13:01:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=982</guid>
		<description><![CDATA[Using the RSS feature of Mangeto to update your wall automatically is an easy task that you can finish in ea few inutes tuime, when you know where to go.

Magento&#8217;s default layout is shipped with a rss page that requires activation in the admin, in the system-&#62;configuration, check rss feed to activate the /rss page that [...]]]></description>
			<content:encoded><![CDATA[<p>Using the RSS feature of Mangeto to update your wall automatically is an easy task that you can finish in ea few inutes tuime, when you know where to go.</p>
<ul>
<li>Magento&#8217;s default layout is shipped with a rss page that requires activation in the admin, in the system-&gt;configuration, check rss feed to activate the /rss page that displays available feeds (<a href="http://www.ruedesiam.com/rss">check out our example on Rue de Siam</a>)</li>
<li>Import your feed to your facebook page or profile to get new produtcs or product special published automatically on your wall :
<ol>
<li>Connect to facebook, and click  &#8221;My Notes&#8221; from the navigational menu. If you have already entered notes on your page, then they will load for you to preview or edit.</li>
<li>If you have not written an article, write one that announces the rss publication (e.g. new articles coming soon), in order to enable the settings menu. Select the &#8220;Import Blog&#8221; or &#8220;Edit Import Settings&#8221; link in the Notes Setting section. If you are already importing from a blog, the URL will appear here. Remeber that in the Notes applications, you can only import from 1 source at a time.  To change the url of the feed, click  &#8221;Stop Importing&#8221;</li>
<li>Enter the URL for the RSS feed in the box. Check the box next to the statement that you actually own the content.</li>
<li>Click the &#8220;Start Importing&#8221; button. Facebook will import the content of the RSS feed for you to preview. If everything looks good, then go ahead and hit the &#8220;Continue&#8221; button. Now your RSS feed is automatically imported into your &#8220;Notes&#8221; section.</li>
<li>Administrators note : Facebook RSS in articles application will not put a heavy load on your server , as they are pulled every 2 hours, but be careful of heavy loads if you have a larger reader base as images will be loaded from full article display in facebook</li>
</ol>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.webmasterbulletin.net/2009/08/magento-facebook-display-new-products-on-your-wall/982/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento : display product image on invoice + shipping PDF</title>
		<link>http://www.webmasterbulletin.net/2009/06/magento-display-product-image-on-invoice-shipping-pdf/873</link>
		<comments>http://www.webmasterbulletin.net/2009/06/magento-display-product-image-on-invoice-shipping-pdf/873#comments</comments>
		<pubDate>Thu, 04 Jun 2009 14:36:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Components]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=873</guid>
		<description><![CDATA[Magento&#8217;s wiki has a few articles on the subject of Magento&#8217;s PDF generation, which is not very efficient in its default version : one of the main critics I&#8217;ve seen is the size of the generated PDF, which can fly to more than 1MB, where a simple font replacement can bring the weight to less [...]]]></description>
			<content:encoded><![CDATA[<p>Magento&#8217;s wiki has a few articles on the subject of Magento&#8217;s PDF generation, which is not very efficient in its default version : one of the main critics I&#8217;ve seen is the size of the generated PDF, which can fly to more than 1MB, where <a href="http://www.magentocommerce.com/wiki/how-to/editing_an_invoice_pdf">a simple font replacement</a> can bring the weight to less than a few KBs ! The subject of the article below is to illustrate how to display images on each line of the generated invoice and shipping PDF.<br />
The product line display occurs in specific PHP classes within  the app/code/core/Mage/sales/Model/order/pdf folder</p>
<p>there is one folder for shipment, one for invoice, and one for credit. The product display occurs in the DEfault file where the Mage_Sales_Model_Order_Pdf_Items_Abstract is defined. What I did was simply instanciate a product object using the id from order / items, and get the image file using the following code in the draw function :</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="co1">//&lt;display image&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$id</span> = Mage::<span class="me2">getModel</span><span class="br0">&#40;</span><span class="st0">&#8216;catalog/product&#8217;</span><span class="br0">&#41;</span>-&gt;<span class="me1">getIdBySku</span><span class="br0">&#40;</span><span class="re0">$this</span>-&gt;<span class="me1">getSku</span><span class="br0">&#40;</span><span class="re0">$item</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$product</span>= &nbsp;Mage::<span class="me2">getModel</span><span class="br0">&#40;</span><span class="st0">&#8216;catalog/product&#8217;</span><span class="br0">&#41;</span>-&gt;<span class="me1">load</span><span class="br0">&#40;</span><span class="re0">$id</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$imageUrl</span> = <span class="re0">$product</span>-&gt;<span class="me1">getSmallImageUrl</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$imageFile</span>= &nbsp;<a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">&#40;</span>Mage::<span class="me2">getBaseUrl</span><span class="br0">&#40;</span><span class="st0">&#8216;media&#8217;</span><span class="br0">&#41;</span>,<span class="st0">&quot;media/&quot;</span>,<span class="re0">$imageUrl</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// $page-&gt;drawText($imageFile , 65, $pdf-&gt;y-$shift{1}, &#8216;UTF-8&#8242;);</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$imageWidth</span> = <span class="nu0">100</span>; <span class="re0">$imageHeight</span> = <span class="nu0">50</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$image</span> = Zend_Pdf_Image::<span class="me2">imageWithPath</span><span class="br0">&#40;</span><span class="re0">$imageFile</span>,<span class="re0">$imageWidth</span>,<span class="re0">$imageHeight</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$y</span>=<span class="re0">$pdf</span>-&gt;<span class="me1">y</span> &#8211; <span class="re0">$imageHeight</span> /<span class="nu0">3</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$page</span>-&gt;<span class="me1">drawImage</span><span class="br0">&#40;</span><span class="re0">$image</span>, <span class="nu0">35</span>,<span class="re0">$y</span>, <span class="nu0">35</span>+ <span class="re0">$imageWidth</span> / <span class="nu0">2</span>, <span class="re0">$y</span> + <span class="re0">$imageHeight</span>/<span class="nu0">2</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//&lt;/display image&gt;</span></div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.webmasterbulletin.net/2009/06/magento-display-product-image-on-invoice-shipping-pdf/873/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Magento one page checkout : display shopping cart details in sidebar</title>
		<link>http://www.webmasterbulletin.net/2009/05/magento-one-page-checkout-display-shopping-cart-details-in-sidebar/867</link>
		<comments>http://www.webmasterbulletin.net/2009/05/magento-one-page-checkout-display-shopping-cart-details-in-sidebar/867#comments</comments>
		<pubDate>Wed, 27 May 2009 14:20:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Web Components]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=867</guid>
		<description><![CDATA[
There are a lot of discussions going on about Magento&#8217;s one page checkout procedure : it is supposed to enhance customer payment experience by probviding ajax based single page order progress. But there are alos some discussions in the forum on how to enhance this process which is quite unusual and might discourage some customers. [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.webmasterbulletin.net/wp-content/uploads/2009/05/magentoonepagecheckoutorder.jpg"><img class="size-full wp-image-869 aligncenter" title="magentoonepagecheckoutorder" src="http://www.webmasterbulletin.net/wp-content/uploads/2009/05/magentoonepagecheckoutorder.jpg" alt="magentoonepagecheckoutorder" width="500" height="318" /></a></p>
<p>There are a lot of discussions going on about Magento&#8217;s one page checkout procedure : it is supposed to enhance customer payment experience by probviding ajax based single page order progress. But there are alos some discussions in the forum on how to enhance this process which is quite unusual and might discourage some customers. In a previous post I reviewed the code that produces sidebar shopping cart in default pages with right margin. The solution below explains how to add a full shopping cart display for the customer&#8217;s that trying to complete an order.</p>
<p><span id="more-867"></span></p>
<p><strong>Full template vs AJAX based loading</strong></p>
<p>The code that builds the one page checkout (checkout/onepage/) sidebar display is made of two separate components :</p>
<ul>
<li>the first loading of the page is a full template loading, meaning every component of the page is loaded at once, and returned to the browser via a standard HTTP request, returning HTML. The HTML produced at this stage for the right column is described in the <strong>checkout_onepage_index section of the layout/checkout.xml </strong>configuration file. I added the shopping cart display by  simply adding a block to the right :
<pre>       &lt;reference name="right"&gt;
            &lt;action method="unsetChildren"&gt;&lt;/action&gt;
            &lt;block type="checkout/onepage_progress" name="checkout.progress" before="-" template="checkout/onepage/progress.phtml"/&gt;
            &lt;block type="checkout/cart_sidebar" before="-" name="catalog.cart.sidebar"    template="checkout/cart/sidebarCheckout.phtml"/&gt;
      &lt;/reference&gt;</pre>
</li>
<li>Following steps are processed via AJAX calls (function reloadProgressBlock in opcheckout.js) that invoke the the<strong> checkout_onepage_progress section of the layout/checkout.xml </strong>configuration file. Below you&#8217;ll find the same code added to this section, that adds a cart block to the raw HTML returned by this AJAX call.
<pre>   &lt;checkout_onepage_progress&gt;
        &lt;!-- Mage_Checkout --&gt;
        &lt;remove name="right"/&gt;
        &lt;remove name="left"/&gt;
 &lt;block type="checkout/cart_sidebar" output="toHtml"  name="catalog.cart.sidebar"    template="checkout/cart/sidebarCheckout.phtml"/&gt;

        &lt;block type="checkout/onepage_progress" name="root" output="toHtml" template="checkout/onepage/progress.phtml"&gt;
            &lt;block type="checkout/onepage_payment_info" name="payment_info"&gt;
                &lt;action method="setInfoTemplate"&gt;&lt;method&gt;&lt;/method&gt;&lt;template&gt;&lt;/template&gt;&lt;/action&gt;
            &lt;/block&gt;
        &lt;/block&gt;

    &lt;/checkout_onepage_progress&gt;</pre>
</li>
</ul>
<p>You will notice that we deliberately position the sidebar cart XML block , in the first case after, and in the second case before other blocks, so that this block always appears first on your <strong>one page chcekout right margin</strong>. What you finally need now in order for this to work is to code the sidebarCheckout template : take the checkout/cart/sidebar.phtml  template and modify the display to produce best reassuring order total for your customer before he finally decides to pay !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webmasterbulletin.net/2009/05/magento-one-page-checkout-display-shopping-cart-details-in-sidebar/867/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Magento showcase : Rue de Siam</title>
		<link>http://www.webmasterbulletin.net/2009/04/magento-showcase-rue-de-siam/773</link>
		<comments>http://www.webmasterbulletin.net/2009/04/magento-showcase-rue-de-siam/773#comments</comments>
		<pubDate>Mon, 20 Apr 2009 21:15:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design showcase]]></category>
		<category><![CDATA[E commerce]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=773</guid>
		<description><![CDATA[
I&#8217;ve finally released my first Magento website, and it proves to be a  real SEO winner (100% increase in visits after 2 weeks). RuedeSiam is a furniture importer based in Brittany. Now you know why I bothered comparing commercial and opensource Flash based zoomers : Rue de Siam&#8217;s website site features an implementation of image  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.webmasterbulletin.net/wp-content/uploads/2009/04/screenshot1.jpg"><img class="aligncenter size-full wp-image-778" title="screenshot1" src="http://www.webmasterbulletin.net/wp-content/uploads/2009/04/screenshot1.jpg" alt="screenshot1" width="500" height="359" /></a></p>
<p>I&#8217;ve finally released my first Magento website, and it proves to be a  real SEO winner (100% increase in visits after 2 weeks). RuedeSiam is a <a href="http://www.ruedesiam.com">furniture importer based in Brittany</a>. Now you know why I bothered<a href="http://www.webmasterbulletin.net/2009/02/zoom-and-pan-with-flash/663"> comparing commercial and opensource Flash based zoomers</a> : Rue de Siam&#8217;s website site features an implementation of image  a flash based zoom within a prototype lightbox gallery   (<a title="chaise design chair" href="http://www.ruedesiam.com/collection/patrick-robert/meuble-patrick-robert/p-robert-chaise-medaillon.html">check out this one</a>) . Interesting too is the specific template for the &#8220;<a href="http://www.ruedesiam.com/chez-vous.html/">At your home</a>&#8221; showcase category that uses products with  specific layout. Magento is really great for customising layouts, I suppose that&#8217;s partly a big feature of Zend Framework expressed at its best. One technique I used a lot is the <a href="http://www.webmasterbulletin.net/2008/07/laying-text-over-title-image-in-wordpress/148">css based text over image transparency effect </a>that I detailed a while ago for Wordpress on this blog. Works fine with Magento images categories except that the background image really has to be adjusted perfectly so I used <a href="http://phpthumb.sourceforge.net/">phpthumbs</a> instead of Magento&#8217;s resizing helpers that seemed to complicated to understand at first.   I&#8217;ve also covered  various development challenges that I shared on this blog during the development :</p>
<ul>
<li> <a title="Magento products specials" href="http://www.webmasterbulletin.net/2009/04/product-specials-on-home-page/757">products special display on home page</a>,</li>
<li><a href="http://www.webmasterbulletin.net/2009/03/magento-product-display-new-product-icon-on-product-list/740">display new product icon on product list</a></li>
<li><a href="http://www.webmasterbulletin.net/2009/02/magento-product-page-how-to-display-other-products-from-same-category/647">how to display products from other categories on the product view page</a></li>
</ul>
<p><strong>And a few tips :</strong></p>
<ul>
<li><a href="http://www.webmasterbulletin.net/2009/03/magento-custom-attributes-display-on-product-page/693">Display custom attributes on product page</a></li>
<li><a href="http://www.webmasterbulletin.net/2009/02/magento-cms-2-methods-for-static-blocks/657">Magento static blocks display</a></li>
</ul>
<p><strong>One advice : </strong>once you&#8217;re running a Magento production web site, be careful with upgrades. The Sales extension did not work with 1.3.0 on my development server and I&#8217;m sticking to 1.2.x for the moment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webmasterbulletin.net/2009/04/magento-showcase-rue-de-siam/773/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Product specials on home page</title>
		<link>http://www.webmasterbulletin.net/2009/04/product-specials-on-home-page/757</link>
		<comments>http://www.webmasterbulletin.net/2009/04/product-specials-on-home-page/757#comments</comments>
		<pubDate>Wed, 01 Apr 2009 22:04:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[E commerce]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=757</guid>
		<description><![CDATA[This tutorial explains briefly how to display one product on sale on the right column of thehome page, but that could be any page in fact.The code below is inspired from the front page featured product tutorial.

Step 1 : create the product special block  class/ Note that the getSpecialProducts function is inspired from the sales [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial explains briefly how to display one product on sale on the right column of thehome page, but that could be any page in fact.The code below is inspired from the <a href="http://inchoo.net/ecommerce/magento/featured-products-on-magento-frontpage/">front page featured product tutorial</a>.<span id="more-757"></span></p>
<ul>
<li><strong>Step 1</strong> : create the product special block  class/ Note that the getSpecialProducts function is inspired from the <a href="http://www.magentocommerce.com/extension/841/catalog-sale-items">sales catalog list</a> extension<br />
create the file app\code\local\PoleOuest\Catalog\Block\Product\Special.php</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">class</span> PoleOuest_Catalog_Block_Product_Special <span class="kw2">extends</span> Mage_Catalog_Block_Product_Abstract</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">protected <span class="kw2">function</span> _getStoreId<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$storeId</span> = <span class="kw2">null</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$storeId</span> == <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$storeId</span> = Mage::<span class="me2">app</span><span class="br0">&#40;</span><span class="br0">&#41;</span>-&gt;<span class="me1">getStore</span><span class="br0">&#40;</span><span class="br0">&#41;</span>-&gt;<span class="me1">getId</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">return</span> <span class="re0">$storeId</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">protected <span class="kw2">function</span> _getCustomerGroupId<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$custGroupID</span> = <span class="kw2">null</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$custGroupID</span> == <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$custGroupID</span> = Mage::<span class="me2">getSingleton</span><span class="br0">&#40;</span><span class="st0">&#8216;customer/session&#8217;</span><span class="br0">&#41;</span>-&gt;<span class="me1">getCustomerGroupId</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">return</span> <span class="re0">$custGroupID</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// POLEOUEST Method from salescatalog</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">function</span> getSpecialProducts<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span><a href="http://www.php.net/is_null"><span class="kw3">is_null</span></a><span class="br0">&#40;</span><span class="re0">$this</span>-&gt;_productCollection<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$storeId</span> = <span class="re0">$this</span>-&gt;_getStoreId<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$websiteId</span> = Mage::<span class="me2">app</span><span class="br0">&#40;</span><span class="br0">&#41;</span>-&gt;<span class="me1">getStore</span><span class="br0">&#40;</span><span class="re0">$storeId</span><span class="br0">&#41;</span>-&gt;<span class="me1">getWebsiteId</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$custGroup</span> = <span class="re0">$this</span>-&gt;_getCustomerGroupId<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$product</span> = Mage::<span class="me2">getModel</span><span class="br0">&#40;</span><span class="st0">&#8216;catalog/product&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$todayDate</span> = <span class="re0">$product</span>-&gt;<span class="me1">getResource</span><span class="br0">&#40;</span><span class="br0">&#41;</span>-&gt;<span class="me1">formatDate</span><span class="br0">&#40;</span><a href="http://www.php.net/time"><span class="kw3">time</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>, <span class="kw2">false</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$rulePriceWhere</span> = <span class="st0">&quot;({{table}}.rule_date is null) or ({{table}}.rule_date=&#8217;$todayDate&#8217; and {{table}}.website_id=&#8217;$websiteId&#8217; and {{table}}.customer_group_id=&#8217;$custGroup&#8217;)&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$productAttributes</span> = <a href="http://www.php.net/array_flip"><span class="kw3">array_flip</span></a><span class="br0">&#40;</span>Mage::<span class="me2">getSingleton</span><span class="br0">&#40;</span><span class="st0">&#8216;catalog/config&#8217;</span><span class="br0">&#41;</span>-&gt;<span class="me1">getProductAttributes</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">&#40;</span><span class="re0">$productAttributes</span><span class="br0">&#91;</span><span class="st0">&#8216;price_type&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">&#40;</span><span class="re0">$productAttributes</span><span class="br0">&#91;</span><span class="st0">&#8216;price_view&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$productAttributes</span> = <a href="http://www.php.net/array_flip"><span class="kw3">array_flip</span></a><span class="br0">&#40;</span><span class="re0">$productAttributes</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$specials</span> = <span class="re0">$product</span>-&gt;<span class="me1">setStoreId</span><span class="br0">&#40;</span><span class="re0">$storeId</span><span class="br0">&#41;</span>-&gt;<span class="me1">getResourceCollection</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">-&gt;<span class="me1">addAttributeToFilter</span><span class="br0">&#40;</span><span class="st0">&#8217;special_price&#8217;</span>, <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&#8216;gt&#8217;</span>=&gt;<span class="nu0">0</span><span class="br0">&#41;</span>, <span class="st0">&#8216;left&#8217;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">-&gt;<span class="me1">addAttributeToFilter</span><span class="br0">&#40;</span><span class="st0">&#8217;special_from_date&#8217;</span>, <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&#8216;date&#8217;</span>=&gt;true, <span class="st0">&#8216;to&#8217;</span>=&gt; <span class="re0">$todayDate</span><span class="br0">&#41;</span>, <span class="st0">&#8216;left&#8217;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">-&gt;<span class="me1">addAttributeToFilter</span><span class="br0">&#40;</span><a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1"><a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&#8216;attribute&#8217;</span>=&gt;<span class="st0">&#8217;special_to_date&#8217;</span>, <span class="st0">&#8216;date&#8217;</span>=&gt;true, <span class="st0">&#8216;from&#8217;</span>=&gt;<span class="re0">$todayDate</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li2">
<div class="de2"><a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&#8216;attribute&#8217;</span>=&gt;<span class="st0">&#8217;special_to_date&#8217;</span>, <span class="st0">&#8216;is&#8217;</span> =&gt; <span class="kw2">new</span> Zend_Db_Expr<span class="br0">&#40;</span><span class="st0">&#8216;null&#8217;</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span>, <span class="st0">&#8221;</span>, <span class="st0">&#8216;left&#8217;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">-&gt;<span class="me1">addAttributeToSort</span><span class="br0">&#40;</span><span class="st0">&#8217;special_from_date&#8217;</span>, <span class="st0">&#8216;desc&#8217;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">-&gt;<span class="me1">addAttributeToSelect</span><span class="br0">&#40;</span><span class="re0">$productAttributes</span>, <span class="st0">&#8216;inner&#8217;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">-&gt;<span class="me1">joinTable</span><span class="br0">&#40;</span><span class="st0">&#8216;catalogrule/rule_product_price&#8217;</span>, <span class="st0">&#8216;product_id=entity_id&#8217;</span>, <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&#8216;rule_price&#8217;</span>=&gt;<span class="st0">&#8216;rule_price&#8217;</span>, <span class="st0">&#8216;rule_start_date&#8217;</span>=&gt;<span class="st0">&#8216;latest_start_date&#8217;</span>, <span class="st0">&#8216;rule_date&#8217;</span>=&gt;<span class="st0">&#8216;rule_date&#8217;</span><span class="br0">&#41;</span>, <span class="re0">$rulePriceWhere</span>, <span class="st0">&#8216;left&#8217;</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$specials</span>-&gt;<span class="me1">getSelect</span><span class="br0">&#40;</span><span class="br0">&#41;</span>-&gt;<span class="me1">order</span><span class="br0">&#40;</span><span class="kw2">new</span> Zend_Db_Expr<span class="br0">&#40;</span><span class="st0">&#8216;RAND()&#8217;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>-&gt;<span class="me1">limit</span><span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span>; ;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$rulePriceCollection</span> = Mage::<span class="me2">getResourceModel</span><span class="br0">&#40;</span><span class="st0">&#8216;catalogrule/rule_product_price_collection&#8217;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">-&gt;<span class="me1">addFieldToFilter</span><span class="br0">&#40;</span><span class="st0">&#8216;website_id&#8217;</span>, <span class="re0">$websiteId</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">-&gt;<span class="me1">addFieldToFilter</span><span class="br0">&#40;</span><span class="st0">&#8216;customer_group_id&#8217;</span>, <span class="re0">$custGroup</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">-&gt;<span class="me1">addFieldToFilter</span><span class="br0">&#40;</span><span class="st0">&#8216;rule_date&#8217;</span>, <span class="re0">$todayDate</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$productIds</span> = <span class="re0">$rulePriceCollection</span>-&gt;<span class="me1">getProductIds</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">if</span> <span class="br0">&#40;</span>!<a href="http://www.php.net/empty"><span class="kw3">empty</span></a><span class="br0">&#40;</span><span class="re0">$productIds</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$specials</span>-&gt;<span class="me1">getSelect</span><span class="br0">&#40;</span><span class="br0">&#41;</span>-&gt;<span class="me1">orWhere</span><span class="br0">&#40;</span><span class="st0">&#8216;e.entity_id in (&#8217;</span>.<a href="http://www.php.net/implode"><span class="kw3">implode</span></a><span class="br0">&#40;</span><span class="st0">&#8216;,&#8217;</span>,<span class="re0">$productIds</span><span class="br0">&#41;</span>.<span class="st0">&#8216;)&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">Mage::<span class="me2">getSingleton</span><span class="br0">&#40;</span><span class="st0">&#8216;catalog/product_status&#8217;</span><span class="br0">&#41;</span>-&gt;<span class="me1">addVisibleFilterToCollection</span><span class="br0">&#40;</span><span class="re0">$specials</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">Mage::<span class="me2">getSingleton</span><span class="br0">&#40;</span><span class="st0">&#8216;catalog/product_visibility&#8217;</span><span class="br0">&#41;</span>-&gt;<span class="me1">addVisibleInCatalogFilterToCollection</span><span class="br0">&#40;</span><span class="re0">$specials</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$this</span>-&gt;_productCollection = <span class="re0">$specials</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">return</span> <span class="re0">$this</span>-&gt;_productCollection;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">?&gt;</span></div>
</li>
</ol>
</div>
</li>
<li><strong>Step 2 :</strong> add new block to your etc/config.xml in global/blocks/catalog<br />
&lt;rewrite&gt;<br />
&lt;product_special&gt;PoleOuest_Catalog_Block_Product_Special&lt;/product_special&gt;<br />
&lt;/rewrite&gt;</li>
<li><strong>Step 3 :</strong> create your template catalog/product/PoleOuestSpecial.phtml with the loop inspired from the catalog/product/list.phtml</li>
<li><strong>Step 4 :</strong> declare your block in your layout/catalog.xml in the right.permanent.callout block<br />
&lt;block type=&#8221;catalog/product_special&#8221; name=&#8221;product_special&#8221; as=&#8221;product_special&#8221; template=&#8221;catalog/product/PoleOuestSpecial.phtml&#8221; /&gt;</li>
<li><strong>Step 5 :</strong> call your child HTML where you want it in \template\callouts\right_col.phtml :<br />
&lt;?php echo $this-&gt;getChildHtml(&#8217;product_special&#8217;) ?&gt;</li>
</ul>
<p>and let us know how it went for you</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webmasterbulletin.net/2009/04/product-specials-on-home-page/757/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Magento product : display new product  icon on product list</title>
		<link>http://www.webmasterbulletin.net/2009/03/magento-product-display-new-product-icon-on-product-list/740</link>
		<comments>http://www.webmasterbulletin.net/2009/03/magento-product-display-new-product-icon-on-product-list/740#comments</comments>
		<pubDate>Wed, 25 Mar 2009 18:17:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[E commerce]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=740</guid>
		<description><![CDATA[If you&#8217;re working on Magento Ecommerce layouts and template design, you might have had a look at some nasty bugs, such the sort by price bug that&#8217;s occuring on Magento&#8217;s latest release (1.2..1). If you&#8217;ve spent a few minutes reading the fix for that bug on Magento&#8217;s forums, you know what product collection means. Product [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re working on Magento Ecommerce layouts and template design, you might have had a look at some nasty bugs, such the sort by price bug that&#8217;s occuring on Magento&#8217;s latest release (1.2..1). If you&#8217;ve spent a few minutes reading the <a href="http://www.magentocommerce.com/boards/viewthread/28155/">fix for that bug on Magento&#8217;s forums</a>, you know what product collection means. Product Collection in Magento means an easy way of listing products for specific blocks : the big drawback is that product collections store arrays of products, and products inside don&#8217;t always come fully loaded of details. That&#8217;s why the few hacks below are useful to get the very basic attribute of every product on a decent ecommerce store : is that product new or not, and should I tell my customer which products are new ???</p>
<p><a href="http://www.webmasterbulletin.net/wp-content/uploads/2009/03/magento-new-product.png"></a><a href="http://www.webmasterbulletin.net/wp-content/uploads/2009/03/magento-new-product490.png"><img class="aligncenter size-full wp-image-744" title="magento-new-product490" src="http://www.webmasterbulletin.net/wp-content/uploads/2009/03/magento-new-product490.png" alt="magento-new-product490" width="490" height="363" /></a></p>
<p>How to load new attribute : in Magento the new attribute is defined by two database fields (or attributes) : new from and new to .</p>
<ul>
<li>Using these parameters in list.phtml requires you to modify the attribute set returned by the <strong>Mage_Catalog_Block_Product_List</strong> class to be found in app\code\core\Mage\Catalog\Block\Product\List.php</li>
<li>in function _getProductCollection, paste the following line<br />
$this-&gt;_productCollection<br />
-&gt;addAttributeToSelect(&#8217;news_from_date&#8217;)<br />
-&gt;addAttributeToSelect(&#8217;news_to_date&#8217;);</li>
<li>obvisouly this comes just after the product collection definition around line 75 of the List.php<br />
$this-&gt;_productCollection = $layer-&gt;getProductCollection();</li>
<li>your list.phtml template now has access to the data and checking that a product is new is as simple as performing PHP based date comparisons. We provide here basic comparison that will only work for products where both news_from and news_to have been filled. Add the following PHP code somewhere in your productcollection loop and the work is done !<br />
<strong>$now = date(&#8221;Y-m-d&#8221;);<br />
$newsFrom= substr($_product-&gt;getData(&#8217;news_from_date&#8217;),0,10);<br />
$newsTo=  substr($_product-&gt;getData(&#8217;news_to_date&#8217;),0,10);<br />
if ($now&gt;=$newsFrom &amp;&amp; $now&lt;=$newsTo)<br />
{?&gt; &lt;h3 class=&#8221;nouveauteProductList&#8221; &gt;NEW PRODUCT!&lt;h3&gt;&lt;?};<br />
?&gt;</strong></li>
</ul>
<p><strong><a href="http://www.ruedesiam.com">This hack will be used on RueDeSiam&#8217;s website (to be released next month,bookmark it now!)</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webmasterbulletin.net/2009/03/magento-product-display-new-product-icon-on-product-list/740/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Magento custom attributes display on product page</title>
		<link>http://www.webmasterbulletin.net/2009/03/magento-custom-attributes-display-on-product-page/693</link>
		<comments>http://www.webmasterbulletin.net/2009/03/magento-custom-attributes-display-on-product-page/693#comments</comments>
		<pubDate>Wed, 11 Mar 2009 17:03:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hosted applications]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Web Components]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=693</guid>
		<description><![CDATA[The flexibility created by the attribute feature in Magento allows limitless possibilities : vairous product types can be created and each of them can go with specific attributes, meaning specific form fields for the admin, that are inserted in the product view (template/product/view.phtml) for public display. The functions availble for each user defined attributes are [...]]]></description>
			<content:encoded><![CDATA[<p>The flexibility created by the attribute feature in Magento allows limitless possibilities : vairous product types can be created and each of them can go with specific attributes, meaning specific form fields for the admin, that are inserted in the product view (template/product/view.phtml) for public display. The functions availble for each user defined attributes are very simple to guess : they are dynamically created for each attribute create using , as explained in the <a href="http://devzone.pratthost.com/2008/11/03/magento-displaying-custom-attributes-on-product-view/" target="_blank">Pratthost developer zone blog</a>&#8230;<br />
<span id="more-693"></span></p>
<blockquote><p>
<span style="color: #000000; font-weight: bold;">&#8220;<em>&lt;?php</em></span><em> <span style="color: #990000;">echo</span> <span style="color: #000088;">$_product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAttributeName</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></em><br />
<em>There is one thing different here though. If your Attribute Code is “shirt_size”, then you would use getShirtSize(). Remove the underscores and capitalize the first letter of each word. It is picky that way. if you use getshirtsize(), it won’t work.</em></p>
<p><em>If you are using a dropdown or a multiple select, you have to call it a little differently:</em></p>
<div class="wp_syntax">
<table border="0">
<tbody>
<tr>
<td class="line_numbers">
<pre><em>
</em></pre>
</td>
<td class="code">
<em><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$_product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAttributeText</span><span style="color: #009900;">(</span><span style="color: #0000ff;">&#8217;shirt_size&#8217;</span><span style="color: #009900;">)</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></em>
</td>
</tr>
</tbody>
</table>
</div>
<p><em>This method requires the actual Attribute Code. If you are displaying the value from a dropdown, you’ll get exactly what you need with this call. If you are wanting to display the values from a multiple select, it will return an array.</em>&#8220;</p></blockquote>
<p><strong>Inner workings</strong></p>
<p>How does this work ? well the attribute function is a method of the Mage_Catalog_Model_Product, which isn extension of Mage_Catalog_Model_Abstract, itself extending Mage_Core_Model_Abstract, itself extending Varien_Object where we find the famous __call function that traps all undeclared or undefined  functions from the class : this is where the logic is implemented and we see that any undeclared function starting with get is defined to fin the associated data , optionnally using provided arguments :</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp;<span class="kw2">public</span> <span class="kw2">function</span> __call<span class="br0">&#40;</span><span class="re0">$method</span>, <span class="re0">$args</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">switch</span> <span class="br0">&#40;</span><a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">&#40;</span><span class="re0">$method</span>, <span class="nu0">0</span>, <span class="nu0">3</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> <span class="st0">&#8216;get&#8217;</span> :</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Varien_Profiler::start(&#8217;GETTER: &#8216;.get_class($this).&#8217;::&#8217;.$method);</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$key</span> = <span class="re0">$this</span>-&gt;_underscore<span class="br0">&#40;</span><a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">&#40;</span><span class="re0">$method</span>,<span class="nu0">3</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$data</span> = <span class="re0">$this</span>-&gt;<span class="me1">getData</span><span class="br0">&#40;</span><span class="re0">$key</span>, <a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$args</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span> ? <span class="re0">$args</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> : <span class="kw2">null</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Varien_Profiler::stop(&#8217;GETTER: &#8216;.get_class($this).&#8217;::&#8217;.$method);</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$data</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> <span class="st0">&#8217;set&#8217;</span> :</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Varien_Profiler::start(&#8217;SETTER: &#8216;.get_class($this).&#8217;::&#8217;.$method);</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$key</span> = <span class="re0">$this</span>-&gt;_underscore<span class="br0">&#40;</span><a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">&#40;</span><span class="re0">$method</span>,<span class="nu0">3</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$result</span> = <span class="re0">$this</span>-&gt;<span class="me1">setData</span><span class="br0">&#40;</span><span class="re0">$key</span>, <a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$args</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span> ? <span class="re0">$args</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> : <span class="kw2">null</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Varien_Profiler::stop(&#8217;SETTER: &#8216;.get_class($this).&#8217;::&#8217;.$method);</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$result</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> <span class="st0">&#8216;uns&#8217;</span> :</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Varien_Profiler::start(&#8217;UNS: &#8216;.get_class($this).&#8217;::&#8217;.$method);</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$key</span> = <span class="re0">$this</span>-&gt;_underscore<span class="br0">&#40;</span><a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">&#40;</span><span class="re0">$method</span>,<span class="nu0">3</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$result</span> = <span class="re0">$this</span>-&gt;<span class="me1">unsetData</span><span class="br0">&#40;</span><span class="re0">$key</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Varien_Profiler::stop(&#8217;UNS: &#8216;.get_class($this).&#8217;::&#8217;.$method);</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$result</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> <span class="st0">&#8216;has&#8217;</span> :</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Varien_Profiler::start(&#8217;HAS: &#8216;.get_class($this).&#8217;::&#8217;.$method);</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$key</span> = <span class="re0">$this</span>-&gt;_underscore<span class="br0">&#40;</span><a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">&#40;</span><span class="re0">$method</span>,<span class="nu0">3</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Varien_Profiler::stop(&#8217;HAS: &#8216;.get_class($this).&#8217;::&#8217;.$method);</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$this</span>-&gt;_data<span class="br0">&#91;</span><span class="re0">$key</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; throw <span class="kw2">new</span> Varien_Exception<span class="br0">&#40;</span><span class="st0">&quot;Invalid method &quot;</span>.<a href="http://www.php.net/get_class"><span class="kw3">get_class</span></a><span class="br0">&#40;</span><span class="re0">$this</span><span class="br0">&#41;</span>.<span class="st0">&quot;::&quot;</span>.<span class="re0">$method</span>.<span class="st0">&quot;(&quot;</span>.<a href="http://www.php.net/print_r"><span class="kw3">print_r</span></a><span class="br0">&#40;</span><span class="re0">$args</span>,<span class="nu0">1</span><span class="br0">&#41;</span>.<span class="st0">&quot;)&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.webmasterbulletin.net/2009/03/magento-custom-attributes-display-on-product-page/693/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
