<?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>Magento Design and Development &#187; products</title>
	<atom:link href="http://inchoo.net/tag/products/feed/" rel="self" type="application/rss+xml" />
	<link>http://inchoo.net</link>
	<description>Magento Design and Magento Development Professionals - Inchoo</description>
	<lastBuildDate>Mon, 06 Feb 2012 08:30:33 +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>View product in frontend from Magento admin</title>
		<link>http://inchoo.net/ecommerce/magento/view-product-in-frontend-from-magento-admin/</link>
		<comments>http://inchoo.net/ecommerce/magento/view-product-in-frontend-from-magento-admin/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 12:26:51 +0000</pubDate>
		<dc:creator>Ivica Tadic</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[magento administration]]></category>
		<category><![CDATA[products]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=11641</guid>
		<description><![CDATA[When you are editing some product in Magento admin and want to check it out in frontend of your Magento project, how do you find this particular product? Do you search for it, navigate to it using product url key &#8230;<p><a href="http://inchoo.net/ecommerce/magento/view-product-in-frontend-from-magento-admin/">Read more</a><p>]]></description>
			<content:encoded><![CDATA[<p>When you are editing some product in Magento admin and want to check it out in frontend of your Magento project, how do you find this particular product? Do you search for it, navigate to it using product url key or just browse to it? Well, however you do it, I’m going to give you the easiest way to get to your desired product in the frontend &#8211; view product link.<br />
<span id="more-11641"></span><br />
<a href="http://inchoo.net/wp-content/uploads/2011/11/Tadic_AVP-screenshot.png"><img src="http://inchoo.net/wp-content/uploads/2011/11/Tadic_AVP-screenshot.png" alt="Tadic_AVP screenshot" title="Tadic_AVP-screenshot" width="620" height="203" class="aligncenter size-full wp-image-11642" /></a></p>
<p>Here’s an extremely lightweight Magento extension which will provide you with a simple <em>view product</em> link next to a product name, in Magento admin. It will point to a product view page in the frontend of your Magento project. Simple and easy.</p>
<p><a href="https://github.com/ivicatadic/Tadic_AVP" title="https://github.com/ivicatadic/Tadic_AVP" target="_blank">https://github.com/ivicatadic/Tadic_AVP</a><br />
or for donwload<br />
<a href='http://inchoo.net/wp-content/uploads/2011/11/Tadic_AVP.zip'>Tadic_AVP</a></p>
<p>All you have to do is copy the content of Tadic_AVP extension (app folder) to a root folder of your Magento project &#8211; and that’s it. I hope this simple extension will prove to be useful to you.<br />
Thanks to <a href="http://inchoo.net/author/branko/">Branko Ajzele</a> for an idea.</p>
<p>Cheers</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/view-product-in-frontend-from-magento-admin/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Selective attribute sorting</title>
		<link>http://inchoo.net/ecommerce/magento/selective-attribute-sorting/</link>
		<comments>http://inchoo.net/ecommerce/magento/selective-attribute-sorting/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 10:45:44 +0000</pubDate>
		<dc:creator>Ivica Tadic</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[products]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=11042</guid>
		<description><![CDATA[When you have a large scale Magento store with thousands of products in every top-level category, dozens or even hundreds of offered filters for a single attribute in your layered navigation, certain necessities become mandatory &#8211; like selective attribute sorting. &#8230;<p><a href="http://inchoo.net/ecommerce/magento/selective-attribute-sorting/">Read more</a><p>]]></description>
			<content:encoded><![CDATA[<p>When you have a large scale Magento store with thousands of products in every top-level category, dozens or even hundreds of offered filters for a single attribute in your layered navigation, certain necessities become mandatory &#8211; like <strong>selective attribute sorting</strong>.<br />
<span id="more-11042"></span><br />
Even though Magento does offer sorting functionality for attribute values, in these situations that just might not be enough as you can not sort selectively for a specific category.</p>
<p>For instance, let’s say a customer is in a “First Category” and there he sees a <strong>brands</strong> attribute in layered navigation, filterable by these values:</p>
<ul>
<li>A &amp; A Specialties (1)</li>
<li>Abella (2)</li>
<li>Abex Friction Products (1)</li>
<li>Absco Ltd (1)</li>
<li>AC-Delco (166)</li>
<li>Accel (1)</li>
<li>Acco Ind (1)</li>
<li>…</li>
</ul>
<p>Then customer goes to a “Second Category” and again there is this <strong>brands</strong> attribute with exactly the same options offered to filter by.</p>
<p>Now, why wouldn’t you offer your customers filterable options in the order you find the most suitable, maybe boost sales by emphasizing a certain brand, or just sorted to be a bit more relevant to current category?</p>
<p>Here’s how you can do it with the least coding required.<br />
First download the Inchoo_SAS extension and copy it’s content to your Magento’s root folder. This extension will handle all the back-end logic for you.</p>
<p><em><a href="https://github.com/ivicatadic/Inchoo_SAS" target="_blank">https://github.com/ivicatadic/Inchoo_SAS</a></em><br />
or for download<br />
<em><a href='http://inchoo.net/wp-content/uploads/2011/10/Inchoo_SAS.zip'>Inchoo_SAS</a></em></p>
<p><em>(Remember to log out and then log back into admin after extension is installed.)</em></p>
<p>Now, for the fun part.<br />
Let’s go to Magento admin -&gt; CMS -&gt; Static Blocks</p>
<p>In order to manipulate the attribute values for a particular category follow these steps:<br />
1. Create a static block:<br />
Static block <strong>name</strong> example: First Category &#8211; Layer Brands<br />
Static block <strong>identifier</strong> example: first_category_layer_brands</p>
<p>2. Place the attribute values in the Content area separated by new line [enter]:<br />
example:<br />
BMW<br />
Audi</p>
<p>Note:<br />
It must be plain text and no html tags, so <strong>hide</strong> the WYSIWYG Content Editor.</p>
<p>3. In admin go to the relevant category &#8211; in our example it’s First Category<br />
a) click on the &#8220;Custom Design&#8221; tab<br />
b) Enter the following custom layout update:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!-- --&gt;

	&lt;block type=&quot;cms/block&quot; name=&quot;layer_brands&quot;&gt;
		&lt;action method=&quot;setBlockId&quot;&gt;
			&lt;block_id&gt;first_category_layer_brands&lt;/block_id&gt;
		&lt;/action&gt;
	&lt;/block&gt;

&lt;!-- --&gt;
</pre>
<p><em>Place this code outside / after any &lt;reference name=&#8221;something&#8221;&gt;&lt;/reference&gt; node.</em></p>
<p>Note:<br />
The name=&#8221;<strong>layer_brands</strong>&#8221; serves as an example, you&#8217;ll use <strong>layer_actual_attribute_code</strong><br />
instead, like <strong>layer_manufacturer</strong>. The only thing that always stays the same is the <strong>layer_</strong> prefix.</p>
<p>Inside &lt;block_id&gt;&lt;/block_id&gt; you&#8217;ll enter the <strong>identifier</strong> of the relevant static block (see No. 1)</p>
<p>4. Click on &#8220;Save Category&#8221;<br />
5. Go to Cache management and hit the &#8220;Flush Magento Cash&#8221; in order to see the changes.</p>
<p>And that’s it <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Whenever you need to alter the order of attribute values for a certain category, just go to the relevant static block and reorder values the way you like it.<br />
Another big gain you get with this extension is that if you sort products by <strong>Position</strong> in this particular category, you&#8217;ll notice that Magento will sort products the way attribute values are sorted as well.</p>
<p>Finally, if you don’t like the required prefix <strong>layer</strong>, you may change it if you go to<br />
Magento admin -&gt; System -&gt; Configuration -&gt; Inchoo Extensions -&gt; Layer Navigation &#8211; sorting</p>
<p>I hope this will prove to be helpful to you.</p>
<p>Cheers <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/selective-attribute-sorting/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>New Magento Sample Data</title>
		<link>http://inchoo.net/ecommerce/magento/magento-sample-data/</link>
		<comments>http://inchoo.net/ecommerce/magento/magento-sample-data/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 17:07:50 +0000</pubDate>
		<dc:creator>Ivan Weiler</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[Starting up]]></category>
		<category><![CDATA[catalog]]></category>
		<category><![CDATA[products]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=10853</guid>
		<description><![CDATA[Official Magento sample data is a bit old (Magento 1.2) and it takes too much time to install new Magento over them, since installation is updating too many tables at once. Also, there are some tables not present in default &#8230;<p><a href="http://inchoo.net/ecommerce/magento/magento-sample-data/">Read more</a><p>]]></description>
			<content:encoded><![CDATA[<p>Official Magento sample data is a bit old (Magento 1.2) and it takes too much time to install new Magento over them, since installation is updating too many tables at once. Also, there are some tables not present in default CE version, so we thought it would be great idea to update and clean them up a bit.<br />
<span id="more-10853"></span></p>
<p><strong><a href="http://dl.dropbox.com/u/40784982/magento-sample-data-1.6.0.0.tar.gz" target="_blank">magento-sample-data-1.6.0.0.tar.gz</a></strong></p>
<p>Magento sample data 1.6.0.0<strong> can be used only on Magento CE &gt;= 1.6.0.0</strong> (PE/EE have their own sample data). Also,<strong> do not use sample data on existing stores or existing databases</strong>, they can be used only on clean installations and Magento developers mostly use them for learning or presentation purposes.</p>
<p>How to install sample data for Magento:<br />
1. Import the sample data sql file &#8220;magento_sample_data_for_1.6.0.0.sql&#8221; into empty database<br />
2. Copy sample &#8220;media&#8221; folder over your Magento existing media folder (merge them)<br />
3. Run Magento installation and use database from step1 as install database</p>
<p>There is Magento wiki page with more detailed instructions:<br />
<a href="http://www.magentocommerce.com/knowledge-base/entry/installing-the-sample-data-for-magento" target="_blank">http://www.magentocommerce.com/knowledge-base/entry/installing-the-sample-data-for-magento</a></p>
<p>Official Magento demo site is an example of what you get when install Magento with sample data, maybe they&#8217;ll start using our updated ones from now on <img src='http://inchoo.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
<a href="http://demo.magentocommerce.com/" target="_blank">http://demo.magentocommerce.com/</a></p>
<p>Regards,<br />
Ivan</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/magento-sample-data/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Featured products Magento extension by Inchoo</title>
		<link>http://inchoo.net/ecommerce/magento/featured-products-on-magento-frontpage/</link>
		<comments>http://inchoo.net/ecommerce/magento/featured-products-on-magento-frontpage/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 14:36:03 +0000</pubDate>
		<dc:creator>Tomislav Bilic</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[configurable product]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[grouped product]]></category>
		<category><![CDATA[products]]></category>
		<category><![CDATA[simple product]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=3723</guid>
		<description><![CDATA[One of the most requested feature in Magento is the ability to have a featured products. Those of you who used osCommerce, ZenCart or some other shopping cart solution are already familiar with the way it works. You can choose &#8230;<p><a href="http://inchoo.net/ecommerce/magento/featured-products-on-magento-frontpage/">Read more</a><p>]]></description>
			<content:encoded><![CDATA[<p>One of the most requested feature in Magento is the ability to have a featured products. Those of you who used osCommerce, ZenCart or some other shopping cart solution are already familiar with the way it works. You can choose the products that are featured and those will be displayed on some home page box and in separate interface. Some of you might know that <a href="/ecommerce/magento/featured-products-on-magento-frontpage-tutorial/">we already have a post</a> on the site that speaks about adding featured products to the homepage, but we prepared something better. A free extension: <a title="View our free Magento extension: Featured Products by Inchoo" href="http://www.magentocommerce.com/extension/2513/featured-products" target="_blank">Featured Products by Inchoo</a>.<br />
<span id="more-3723"></span><br />
This extension gives your Magento ability for easy management of featured products. Frontend features include separate interface for listing of all featured products and a block usage for easy placement to the interfaces of your choice.</p>
<p><strong>Frontend features include:</strong></p>
<ul>
<li>Featured Products Interface where you can see the list of all featured products and use the options like Sort by, Show X number of products and View type choice.</li>
<li>You can view featured products page on url: www.yourstore.com/featured-products/</li>
<li>Featured Products Block gives you the ability to place the block to the interface or page of your choice. It is mostly used to display featured products o the home page.<br />
Example: put it in Home page content {{block type=&#8221;featuredproducts/listing&#8221; template=&#8221;inchoo/block_featured_products.phtml&#8221;}}</li>
</ul>
<p><strong>Backend features include:</strong></p>
<ul>
<li>Easy Management of Featured products via separate interface. You do not have to edit every single product and set it to be featured. You will get the special interface where you will be able to choose the products you want to feature from the list.</li>
<li>Go to admin menu and click on: Catalog &gt; Featured Products</li>
<li>Configuration Options You will be able to choose layout for Featured product lising interface, use SEO features, Choose the number of products in the block and choose default sort order.</li>
</ul>
<p>I really hope you will like it. Send us the feedback after you install it. Also let us know on what stores are you using it. <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>UPDATE: </strong>Version 1.1.3 (now available at the Magento Connect)</p>
<ul>
<li>Added multi store functionality</li>
<li>Improved templates</li>
</ul>
<p>Although Magento Connect listing says that extension is compatible with 1.3.2.4, it is tested and <strong>works with 1.4</strong>.</p>
<p>The extension is available via Magento Connect: <a href="http://www.magentocommerce.com/extension/2513/featured-products" target="_blank">Click here to see it on Magento Connect</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/featured-products-on-magento-frontpage/feed/</wfw:commentRss>
		<slash:comments>316</slash:comments>
		</item>
		<item>
		<title>Magento, products on sale</title>
		<link>http://inchoo.net/ecommerce/magento-products-on-sale-lis/</link>
		<comments>http://inchoo.net/ecommerce/magento-products-on-sale-lis/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 13:36:06 +0000</pubDate>
		<dc:creator>Tomas Novoselic</dc:creator>
				<category><![CDATA[E-Commerce]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[products]]></category>
		<category><![CDATA[sale]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=2927</guid>
		<description><![CDATA[Most of you probably know this, but here&#8217;s a little code snippet for every Magento beginner that needs page with products on sale listing. So, easiest way to accomplish that is to follow these steps&#8230; 1) Make CMS page called &#8230;<p><a href="http://inchoo.net/ecommerce/magento-products-on-sale-lis/">Read more</a><p>]]></description>
			<content:encoded><![CDATA[<p>Most of you probably know this, but here&#8217;s a little code snippet for every Magento beginner that needs page with products on sale listing.<br />
So, easiest way to accomplish that is to follow these steps&#8230;<span id="more-2927"></span></p>
<p>1) Make CMS page called &#8220;Products on sale&#8221;, or whatever you wanna call it&#8230;<br />
2) Put this code:
<pre class="brush: php; title: ; notranslate">{{block type=&quot;core/template&quot; template=&quot;callouts/products_on_sale.phtml&quot;}}</pre>
<p> in CMS page you created<br />
3) Make app/design/frontend/default/YOUR_THEME/template/callouts/products_on_sale.phtml<br />
4) Put this code in products_on_sale.phtml</p>
<pre class="brush: php; title: ; notranslate">
&lt; ?php
	$product    = Mage::getModel('catalog/product');
	$collection = $product-&gt;getCollection();

	foreach ($collection as $product)
	{
		$result[] = $product-&gt;getId();
	}

	$j = 0;
	$product_ = array();
	foreach ($result as $_product_id)
	{
		$in_stock = 0;

		$_product = new Mage_Catalog_Model_Product();
		$_product-&gt;load($_product_id);

		#var_dump(get_class_methods(get_class($_product)));exit();
		$time = time();
		if(strtotime($_product-&gt;getSpecialFromDate()) &lt; time() &amp;amp;amp;amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp;amp;amp;amp; strtotime($_product-&gt;getSpecialToDate()) &gt; time()) {
			$product_[$j]['price'] = $_product-&gt;getPrice();
			$product_[$j]['special_price'] = $_product-&gt;getSpecialPrice();
			$product_[$j]['name'] = $_product-&gt;getName();
			$product_[$j]['image'] = $_product-&gt;getSmallImageUrl();
			$product_[$j]['url'] = $_product-&gt;getProductUrl();

			$in_stock = $_product-&gt;isInStock();
			if($in_stock) {
				$in_stock = 'In Stock';
			}else {
				$in_stock = 'Out of Stock';
			}

			$product_[$j]['in_stock'] = $in_stock;

			$j ++;
		}
	}

	if(empty($product_)) {
		echo $this-&gt;__('There is no product on sale');
	}

	foreach($product_ as $item)
	{
?&gt;

		&lt;div class=&quot;Item&quot;&gt;
			&lt;a href=&quot;&lt;?php echo $item['url'];?&gt;&quot;&gt;&lt;img src=&quot;&lt;?php echo $item['image'];?/&gt;&quot; alt=&quot;&lt; ?php echo $item['name'];?&gt;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
			&lt;a href=&quot;&lt;?php echo $item['url'];?&gt;&quot;&gt;&lt; ?php echo $item['name'];?&gt;&lt;/a&gt;&lt;br /&gt;
			&lt;span class=&quot;RegularPrice&quot;&gt;&lt; ?php echo $item['price'];?&gt;&lt;/span&gt;
			&lt;span class=&quot;SpecialPrice&quot;&gt;&lt; ?php echo $item['special_price'];?&gt;&lt;/span&gt;
			&lt;div class=&quot;Stock&quot;&gt;&lt; ?php echo $item['in_stock'];?&gt;&lt;/div&gt;
		&lt;/div&gt;

&lt; ?php
	}
?&gt;
</pre>
<p>Style it at will <img src='http://inchoo.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Enjoy!</p>
<p>P.S. Of course you need to add some products on sale <img src='http://inchoo.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
<a href='http://inchoo.net/wp-content/uploads/2009/09/itemsonsale.zip'>itemsonsale</a></p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento-products-on-sale-lis/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Changing default category sort order in Magento</title>
		<link>http://inchoo.net/ecommerce/magento/changing-default-category-sort-order-in-magento/</link>
		<comments>http://inchoo.net/ecommerce/magento/changing-default-category-sort-order-in-magento/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 17:05:08 +0000</pubDate>
		<dc:creator>Tomislav Bilic</dc:creator>
				<category><![CDATA[Frontend]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[products]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=946</guid>
		<description><![CDATA[Category toolbar has many options. By default is shows how many items are in the category, you can choose how many products you wish to be displayed per page, you can change the listing type (List or Grid) and you &#8230;<p><a href="http://inchoo.net/ecommerce/magento/changing-default-category-sort-order-in-magento/">Read more</a><p>]]></description>
			<content:encoded><![CDATA[<p>Category toolbar has many options. By default is shows how many items are in the category, you can choose how many products you wish to be displayed per page, you can change the listing type (List or Grid) and you may choose Sort Order. This &#8220;Sort Order&#8221; can be confusing. The default &#8220;Sort Order&#8221; is &#8220;Best Value&#8221;. What does it mean? How is the Best value determined? Can we change the default sort order?</p>
<p><span id="more-946"></span></p>
<h2>What is &#8220;Best Value&#8221; filed?</h2>
<p>When you go to Category page in Magento administration, you will see &#8220;Category Products&#8221; tab. From there, you will see the list of products that are associated to this category. The last column in &#8220;Position&#8221;. That is how &#8220;Best Value&#8221; is determined. So, best value is not something that is dynamically calculated. You can tailor it to your likings.<br />
<img class="alignnone size-full wp-image-949" title="Magento Category Product List Position" src="http://inchoo.net/wp-content/uploads/2009/02/category_product_list_position.png" alt="Magento Category Product List Position" width="637" height="405" /></p>
<h2>How to change default Sort Order</h2>
<p>The file you need to look at is: <strong>/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php</strong> Since we&#8217;ll modify it, make a copy to <strong>/app/code/local/Mage/Catalog/Block/Product/List/Toolbar.php</strong></p>
<p>One there, you will notice this code at the beginning of the file:</p>
<pre class="brush: php; title: ; notranslate">
$this-&gt;_availableOrder = array(
'position'  =&gt; $this-&gt;__('Best Value'),
'name'      =&gt; $this-&gt;__('Name'),
'price'     =&gt; $this-&gt;__('Price')
);
</pre>
<p>Default order takes the first value available. So, all you have to do is to either:</p>
<ul>
<li>reorder it if you want to have a selection in the Toolbar or</li>
<li>set only one value of choice if you will remove the selection from the toolbar</li>
</ul>
<p>I hope this will help somebody.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/changing-default-category-sort-order-in-magento/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Show Magento products by month and year</title>
		<link>http://inchoo.net/ecommerce/magento/programming-magento/show-magento-products-by-month-and-year/</link>
		<comments>http://inchoo.net/ecommerce/magento/programming-magento/show-magento-products-by-month-and-year/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 12:20:36 +0000</pubDate>
		<dc:creator>Branko Ajzele</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[products]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=10297</guid>
		<description><![CDATA[For the last two days, I have been working on a &#8220;gallery like&#8221; approach to Magento. One of stores we are developing requires it. Below is a code that lists moths, from January to December, showing number of products for &#8230;<p><a href="http://inchoo.net/ecommerce/magento/programming-magento/show-magento-products-by-month-and-year/">Read more</a><p>]]></description>
			<content:encoded><![CDATA[<p>For the last two days, I have been working on a &#8220;gallery like&#8221; approach to Magento. One of stores we are developing requires it. Below is a code that lists moths, from January to December, showing number of products for each month. You can reuse function to list products for any given month. Just extract the code from within the function and place it inside some foreach loop and deal with product object. This way you can have one block listing months with appropriately generated links and clicking that link leads you to another page that loads products for given month and year.<span id="more-10297"></span></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

/**
 * Returnes string (HTML list) of months with total count of producst they hold
 *
 * @param string $year String representing the year, like '2008' or '2009'
 * @return string Returnes string, HTML stuff like &lt;ul&gt; &lt;li&gt;...&lt;/li&gt; ... &lt;li&gt;...&lt;/li&gt; &lt;/ul&gt;
 */

/* @var $this Mage_Core_Block_Template */

/*
 * Calling from CMS Pages
 * {{block type=&quot;core/template&quot; template=&quot;activecodeline/month_list.phtml&quot;}}
 * or something like
 * {{block type=&quot;core/template&quot; template=&quot;activecodeline/month_list.phtml&quot; year=&quot;2007&quot; galleryLink=&quot;some-url-key&quot;}}
 *
 * Calling from layout files
 * &lt;block type=&quot;core/template&quot; template=&quot;activecodeline/month_list.phtml&quot; /&gt;
 *
 * you can even set some params like
 * &lt;block type=&quot;core/template&quot; template=&quot;activecodeline/month_list.phtml&quot; /&gt;
 */

?&gt;

&lt;?php

/**
 * Check to see if the year has been set on $this object
 * Enables you to set year from CMS pages or layout files or...
 */
$year = isset($this-&gt;year)? $this-&gt;year : null;
$galleryLink = isset($this-&gt;year)? $this-&gt;year : $this-&gt;getUrl('gallery');

/**
 * List displays months as links. You can assing general url part of a path
 * but you cannot assign variable names for GET. This function works by sending 2 GET variables
 * Those variables are 'month' = some value, and 'year' = some value
 *
 * @param string $year String representing a year, like '2007'
 * @param string $galleryLink Part of a url string, url key of page we wish to go to
 * @return string HTML content, ul wrapped by div
 */
function monthsListForCurrentYear($year = null, $galleryLink = null)
{
    $monthList = null;

    $monthList .= '&lt;div&gt;';
    $monthList .= '&lt;ul&gt;';

    for($i = 1; $i &lt;= 12; $i++)
    {
        $date = new Zend_Date();
        $date-&gt;setMonth($i);

        if(is_null($year))
        {
            $year = $date-&gt;getYear()-&gt;get('y');
        }

        $month = $date-&gt;getMonth()-&gt;get('MMMM');

        $rangeFrom = $year.'-'.$date-&gt;getMonth()-&gt;get('MM').'-01';

        /**
         * Check out the '31'... does not matter even if it's, let's say '36'
         * Result returned is propagastes down to lowest day in month <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
         */
        $rangeTo = $year.'-'.$date-&gt;getMonth()-&gt;get('MM').'-31';       

        /**
         * Get product collection in $rangeFrom - $rangeTo dates
         */
        $_productCollection = Mage::getResourceModel('catalog/product_collection');
        $_productCollection-&gt;addFieldToFilter('created_at', array(array('from' =&gt; $rangeFrom)));
        $_productCollection-&gt;addFieldToFilter('created_at', array(array('to' =&gt; $rangeTo)));

        $_productCollection-&gt;setVisibility(array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH));

        $monthList .= '&lt;li id=&quot;'.strtolower($month).'&quot; class=&quot;month-name&quot;&gt;';
        $monthList .= '&lt;a href=&quot;'.$galleryLink.'?month='.$date-&gt;getMonth()-&gt;get('MM').'&amp;year='.$year.'&quot; title=&quot;Showcase view&quot;&gt;';
        $monthList .= $month.' ('.$_productCollection-&gt;count().')';
        $monthList .= '&lt;/a&gt;';
        $monthList .= '&lt;/li&gt;';
        unset($date);
    }

    $monthList .= '&lt;/ul&gt;';
    $monthList .= '&lt;/div&gt;';

    return (string)$monthList;
}

?&gt;

&lt;div class=&quot;block block-month-list&quot;&gt;
    &lt;div class=&quot;block-title&quot;&gt;&lt;?php echo $this-&gt;__('Product Galleries') ?&gt;&lt;/div&gt;
    &lt;div class=&quot;block-content&quot;&gt;&lt;?php echo monthsListForCurrentYear($year, $galleryLink) ?&gt;&lt;/div&gt;
&lt;/div&gt;&lt;?php /* END OF block-month-list */ ?&gt;
</pre>
<p>That&#8217;s it. Hope some of you find it useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/programming-magento/show-magento-products-by-month-and-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento 1.2. is out (with downloadable products)</title>
		<link>http://inchoo.net/ecommerce/magento/downloadable-products-magento/</link>
		<comments>http://inchoo.net/ecommerce/magento/downloadable-products-magento/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 19:00:56 +0000</pubDate>
		<dc:creator>Tomislav Bilic</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[products]]></category>
		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=584</guid>
		<description><![CDATA[Just at the dawn of 2008, Varien launched a new version of Magento: 1.2. Upgrading previous Magento versions was sometimes not an easy task since Varien used to change standard function names which caused themes to break. We backup the &#8230;<p><a href="http://inchoo.net/ecommerce/magento/downloadable-products-magento/">Read more</a><p>]]></description>
			<content:encoded><![CDATA[<p>Just at the dawn of 2008, Varien launched a new version of Magento: 1.2. Upgrading previous Magento versions was sometimes not an easy task since Varien used to change standard function names which caused themes to break. We backup the site, made a copy, took a deep breath, expected the worse, and&#8230; Nothing <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  The upgrade went smoothly. Wow, that felt good.</p>
<p><span id="more-584"></span><br />
We were joking at the company today.</p>
<blockquote><p>Zeljko: You know what&#8217;s easy in Magento?<br />
Branko: There is nothing easy in Magento!</p></blockquote>
<p>Zeljko is an front end interface developer, while Branko is a programmer. Although creating Magento theme is a clear process if you follow <a title="Designer's Guide to Magento (available in PDF)" href="/ecommerce/magento/designers-guide-to-magento-pdf-download/" target="_self">designer&#8217;s guide</a>, programming is much more complex. Before this version, Magento upgrades used to cause troubles. Hope this is over.</p>
<p>There is always a good practice NOT to update platform to latest version immediately. Even in this case this proved to be valid. Two days after version 1.2. came version 1.2.0.1. that fixed some flaws. Keep this in mind when you wish to upgrade to newest version of the platform immediately after it appears. <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>New version sorts some issues from Magento 1.1.x versions and brings some highly requested features such as:</p>
<ul class="disc">
<li>Support for Downloadable Products. (to see this new product type in action visit the <a title="Magento Demo Store" rel="external nofollow" href="http://demo.magentocommerce.com/">Magento Demo Store</a>. We added an example of an <a title="MP3 product" rel="external nofollow" href="http://demo.magentocommerce.com/nusantara.html">MP3 product</a> and an <a title="eBook " rel="external nofollow" href="http://demo.magentocommerce.com/pivot-table-excel.html">eBook </a>)</li>
<li>Added Layered Navigation to site search result page, with control on the attribute level to include or exclude attributes used on the search results page.</li>
<li>Improved site search to utilize MySQL fulltext search</li>
<li>Added support for fixed-taxes on product level for such taxes as “State Environmental Fee” in the USA and “WEEE/DEEE” in the EU.</li>
<li>Upgraded Zend Framework to the latest stable version 1.7.2</li>
<li>Added a Layered Navigation Cache for improved performance of large catalogs (currently in beta and is <strong>NOT</strong> recommended for production use).</li>
</ul>
<p>If you need to upgrade existing Magento version through the Magento Connect Manager to 1.2.0.1, follow this steps:</p>
<ul class="disc">
<li>Do <strong><span style="text-decoration: underline;">NOT</span></strong> use your live or production site. We suggest making a copy of your site and upgrading that copy first.</li>
<li>Backup your index.php and .htaccess files (if modified)</li>
<li>Log into your Magento Connect Manager.</li>
<li>Select the ‘Setting’ tab.</li>
<li>Change the Preferred State to ‘Stable’, and save settings.</li>
<li>For the  Mage_All_Latest package select upgrade.</li>
<li>Click on the ‘Commit Changes’ button. The upgrade should start.</li>
<li>After upgrade is complete click on the ‘Refresh’ button.</li>
<li>Copy your original index.php and .htaccess files back (if needed)</li>
<li>Log into your admin and rebuild search index</li>
<li>You should now have Magento 1.2.0 installed.</li>
</ul>
<p>Happy Magentizing</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/downloadable-products-magento/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>More Flexible Approach for Listing Sale Products in Magento</title>
		<link>http://inchoo.net/ecommerce/magento/more-flexible-approach-for-listing-out-products-on-sale-in-magento/</link>
		<comments>http://inchoo.net/ecommerce/magento/more-flexible-approach-for-listing-out-products-on-sale-in-magento/#comments</comments>
		<pubDate>Mon, 22 Dec 2008 13:01:13 +0000</pubDate>
		<dc:creator>Branko Ajzele</dc:creator>
				<category><![CDATA[Frontend]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[products]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=502</guid>
		<description><![CDATA[One of my recent articles was on the subject of sorting &#8220;On Sale&#8221; product in Magento. The following is a cleaner and more advanced look at how—with few tricks and smart moves—you can reuse existing Magento code and modify it &#8230;<p><a href="http://inchoo.net/ecommerce/magento/more-flexible-approach-for-listing-out-products-on-sale-in-magento/">Read more</a><p>]]></description>
			<content:encoded><![CDATA[<p>One of my recent articles was on the subject of sorting &#8220;On Sale&#8221; product in Magento. The following is a cleaner and more advanced look at how—with few tricks and smart moves—you can reuse existing Magento code and modify it to suit your needs.<span id="more-502"></span></p>
<p>Product can be &#8220;on sale&#8221; in two ways:</p>
<p>1. when an item has a special price assigned to it on the individual level, or</p>
<p>2. when a special promotion &#8220;covers&#8221; the item</p>
<p>It is important to remember that you don&#8217;t have to set up the special price on each product to get it to be on sale; you can simply create a promotion rule and say something like &#8220;Set all the products in Category X to be on sale.&#8221;</p>
<p>I provided few screenshots at the bottom of this article to provide a closer look at what I&#8217;m talking about. I will not go into too much details here since this is a bit more advanced HOW TO, but here is the process in a nutshell:</p>
<p>First, create a copy of /catalog/product/list.phtml file and name it onsale_list.phtml. Here is <a href="/wp-content/uploads/2008/12/onsale_list.zip">my version of onsale_list.phtml file</a>.</p>
<p>Second,  &#8220;activate&#8221; this new file. There are few ways you can do this. Let&#8217;s say you wish to assign this onsale_list.phtml on one of our categories, named &#8220;On Sale,&#8221; for instance.</p>
<p>We then go to Categories &gt; Manage Categories &gt; On Sale&#8230;  select Custom design and under Custom layout update, place the following:</p>
<p>product_list_toolbar</p>
<p>If you now go to your category On Sale, it should only show products you have assigned to category &#8220;On sale&#8221; that have a special price set to them.</p>
<p>If you now wish to apply Promotion rules to entire &#8220;On sale&#8221; category, then you simply assign a rule to one item, and all the items assigned to the same &#8220;On sale&#8221; category (covered by promotion rules) will be automatically listed in the grid.</p>
<p>Basically, the magic is in one simple IF statement</p>
<p><strong>&lt; ?php if(($_product-&gt;special_price !== null) or ($_product-&gt;_rule_price !== null)): ?&gt;</strong></p>
<p>for each block that lists products.</p>
<p>Check out the screenshots, they explain a lot.</p>
<p><img class="alignnone size-full wp-image-511" title="On Sale 3" src="http://inchoo.net/wp-content/uploads/2008/12/onsale31.jpg" alt="On Sale 3" width="650" height="925" /></p>
<p><img class="alignnone size-full wp-image-512" title="On Sale" src="http://inchoo.net/wp-content/uploads/2008/12/onsale41.jpg" alt="On Sale" width="650" height="531" /></p>
<p>Hope you find a way to try this out.  Feel free to provide some feedback or additional suggestions.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/more-flexible-approach-for-listing-out-products-on-sale-in-magento/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Bestseller products in Magento</title>
		<link>http://inchoo.net/ecommerce/magento/bestseller-products-in-magento/</link>
		<comments>http://inchoo.net/ecommerce/magento/bestseller-products-in-magento/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 00:01:51 +0000</pubDate>
		<dc:creator>Branko Ajzele</dc:creator>
				<category><![CDATA[Frontend]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[Marketing]]></category>
		<category><![CDATA[bestseller]]></category>
		<category><![CDATA[products]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=413</guid>
		<description><![CDATA[Bestseller or best selling product is one of the features people tend to ask for when it comes to Magento™. There are multiple ways to implement this feature. In this example, I&#8217;m not using controller or model directories at all; &#8230;<p><a href="http://inchoo.net/ecommerce/magento/bestseller-products-in-magento/">Read more</a><p>]]></description>
			<content:encoded><![CDATA[<p>Bestseller or best selling product is one of the features people tend to ask for when it comes to Magento™.</p>
<p>There are multiple ways to implement this feature.</p>
<p>In this example, I&#8217;m not using controller or model directories at all; I&#8217;m going to show you how to implement this feature using only one file: the View.<br />
<span id="more-413"></span><br />
Basically, what you need to do is to create the directory inside your template directory and place the <strong>bestseller.phtml</strong> file in it. In my example, I&#8217;m using the custom-created directory <strong>/inchoo</strong>. All of the screenshots provided here are based on that directory structure.</p>
<p>Adding this feature to your store is a matter of two simple steps:</p>
<ul>
<li> copy bestseller-phtml file to your directory</li>
<li> display the block on home page</li>
</ul>
<p>To add a block to a home page, you simply log into the Magento, CMS &gt; Manage Pages &gt; Home. Then add the following to the content area:</p>
<p><strong>{{block type=&#8221;core/template&#8221; template=&#8221;inchoo/bestseller.phtml&#8221;}}</strong></p>
<p>Notice the type attribute. I used core<strong>/template</strong> which means you can place this code anywhere in your site and it will work. Code does not inherit any collection objects from controllers since it has none. All that is necessary for the <strong>bestseller.phtml</strong> to work is defined in that single file.</p>
<p><a href="http://inchoo.net/wp-content/uploads/2008/12/fireshot-pro-capture-39-magento-admin-server_shop116_index_php_admin_cms_page_edit_page_id_2.jpg"><img class="alignnone size-medium wp-image-414" title="fireshot-pro-capture-39-magento-admin-server_shop116_index_php_admin_cms_page_edit_page_id_2" src="http://inchoo.net/wp-content/uploads/2008/12/fireshot-pro-capture-39-magento-admin-server_shop116_index_php_admin_cms_page_edit_page_id_2-637x445.jpg" alt="" width="637" height="445" /></a></p>
<p>One more thing: If you study the code in bestseller.phtml file you will see, at the very top of the file, the part that says: <strong>$this-&gt;show_total</strong>.</p>
<p>If I were to write</p>
<p><strong>{{block type=&#8221;core/template&#8221; show_total=&#8221;12&#8243; template=&#8221;inchoo/bestseller.phtml&#8221;}} </strong></p>
<p>in my home page, then <strong>$this</strong> would be assigned property <strong>show_total</strong> with a value of <strong>12</strong>.</p>
<p><a href="http://inchoo.net/wp-content/uploads/2008/12/bestseller_code.jpg"><img class="alignnone size-medium wp-image-417" title="bestseller_code" src="http://inchoo.net/wp-content/uploads/2008/12/bestseller_code-637x406.jpg" alt="" width="637" height="406" /></a></p>
<p>Therefore, the provided bestseller.phtml file provides the option of setting the number of products you wish to see listed.</p>
<p><a href="http://inchoo.net/wp-content/uploads/2008/12/bestseller_sample1.jpg"><img class="alignnone size-thumbnail wp-image-415" title="bestseller_sample1" src="http://inchoo.net/wp-content/uploads/2008/12/bestseller_sample1-150x97.jpg" alt="" width="150" height="97" /></a> <a href="http://inchoo.net/wp-content/uploads/2008/12/fireshot-pro-capture-38-home-page-server_shop116.jpg"><img class="alignnone size-thumbnail wp-image-416" title="fireshot-pro-capture-38-home-page-server_shop116" src="http://inchoo.net/wp-content/uploads/2008/12/fireshot-pro-capture-38-home-page-server_shop116-150x115.jpg" alt="" width="150" height="115" /></a></p>
<p>Here is the bestseller.phtml packed in <a href="http://inchoo.net/wp-content/uploads/2008/12/bestseller.zip">bestseller</a>.zip.</p>
<p>Hope you find this useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/bestseller-products-in-magento/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
		</item>
		<item>
		<title>Sort (show) products by sold quantity in Magento</title>
		<link>http://inchoo.net/ecommerce/magento/magento-products/sort-show-products-by-sold-quantity-in-magento/</link>
		<comments>http://inchoo.net/ecommerce/magento/magento-products/sort-show-products-by-sold-quantity-in-magento/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 05:04:26 +0000</pubDate>
		<dc:creator>Branko Ajzele</dc:creator>
				<category><![CDATA[Products]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[products]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=10314</guid>
		<description><![CDATA[Recently I wrote a post on Show products on sale in Magento. This one is somewhat of an upgrade to that post. In the previous post I mentioned, I had the case where I modified app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php There I made some &#8230;<p><a href="http://inchoo.net/ecommerce/magento/magento-products/sort-show-products-by-sold-quantity-in-magento/">Read more</a><p>]]></description>
			<content:encoded><![CDATA[<p>Recently I wrote a post on <a title="Show products on sale" href="http://activecodeline.net/2008/11/02/show-products-on-sale-in-magento/">Show products on sale in Magento</a>. This one is somewhat of an upgrade to that post. In the previous post I mentioned, I had the case where I modified</p>
<p><strong>app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php</strong></p>
<p>There I made some changes to the <strong>_construct()</strong> function. In order to implement another cool feature in our grid/list category product view I will make some additional modifications to Toolbar.php and the _construct() function.<span id="more-10314"></span></p>
<p>Your _construct() function should be modified to look something like:</p>
<p><em>$this-&gt;_availableOrder = array(<br />
‘position’  =&gt; $this-&gt;__(’Best Value’),<br />
‘name’      =&gt; $this-&gt;__(’Name’),<br />
‘price’     =&gt; $this-&gt;__(’Price’),<br />
’special_price’ =&gt;$this-&gt;__(’Special Price’),<br />
‘ordered_qty’     =&gt; $this-&gt;__(’Quantity soled’),<br />
);</em></p>
<p>Next we open the list.phtml inside /template/catalog/product/ folder. You need to find the</p>
<p><strong>$_productCollection=$this-&gt;getLoadedProductCollection();</strong></p>
<p>expression and cut &gt; paste somewhere to the top of the file. Then we add some additional logic to that same file. In general you should write something like</p>
<p><em>// Custom added<br />
$orderFilterType = $this-&gt;getRequest()-&gt;getParam(&#8216;order&#8217;);</em></p>
<p><em>// Part of original template code, just moved to top of the file<br />
$_productCollection=$this-&gt;getLoadedProductCollection();</em></p>
<p><em>// Custom added<br />
if(isset($orderFilterType) &amp;&amp; $orderFilterType === &#8216;ordered_qty&#8217;) {</em></p>
<p><em>$storeId    = Mage::app()-&gt;getStore()-&gt;getId();</em></p>
<p><em>$_productCollection = null;<br />
$_productCollection = Mage::getResourceModel(&#8216;reports/product_collection&#8217;)<br />
-&gt;addAttributeToSelect(&#8216;*&#8217;)<br />
-&gt;addOrderedQty()<br />
-&gt;setOrder(&#8216;ordered_qty&#8217;, $this-&gt;getRequest()-&gt;getParam(&#8216;dir&#8217;));<br />
}</em></p>
<p>to the top of the list.phtml file.</p>
<p>File <strong>list.phtml</strong> consists of <strong>two major parts:</strong></p>
<ul>
<li>List mode, starting with comment &lt;?php // <strong>List mode</strong> ?&gt;</li>
<li>Grid mode, starting with comment &lt;?php // <strong>Grid mode</strong> ?&gt;</li>
</ul>
<p>At the beginning of each part (mode) there is a foreach loop like</p>
<p><strong>&lt;?php foreach ($_productCollection as $_product): ?&gt;</strong></p>
<p>What we need to do now is to duplicate entire content inside that foreach loop and set it in if-else statement where if statement would go like:</p>
<p><em>&lt;?php if(isset($orderFilterType) &amp;&amp; $orderFilterType === &#8216;ordered_qty&#8217;): ?&gt;</em></p>
<p>// default template code between inside foreach  loop</p>
<p><em>&lt;?php else: ?&gt;</em></p>
<p>// duplicated default template code inside foreach loo</p>
<p><em>&lt;?php endif; ?&gt;</em></p>
<p>Now do the same for Grid mode (since grid mode is the default one).</p>
<p>To test if the grid/list is returning the right stuff you might do something like</p>
<p><strong>&lt;?php echo(&#8216;&lt;!&#8211; product &#8216;. $_product-&gt;getName() .&#8217; has been sold in qty: &#8216;.$_product-&gt;ordered_qty.&#8217; &#8211;&gt;&#8217;); ?&gt;</strong></p>
<p>inside the if statement.</p>
<p>I avoid going into some details in this article since details are covered in the previous article for similar functionality. So if there is something here you do not understand, I suggest reading the <a title="Show products on sale in Magento" href="http://activecodeline.net/2008/11/02/show-products-on-sale-in-magento/">Show product on sale in Magento</a>.</p>
<p>One notice with this sorting by quantity soled functionality. It has one major drawback. If you find yourself (your store) using Configurable product approach, then you might want to implement some additional logic into the if statement since this approach returns soled quantities on single product approach. Therefore if you soled some configurable product 9 times it wont show only that quantity but the quantities of each product inside the configurable. This might sound confusing, hope you understood what I tried to say.</p>
<p>Hope you find this useful. Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/magento-products/sort-show-products-by-sold-quantity-in-magento/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Show products on sale in Magento</title>
		<link>http://inchoo.net/ecommerce/magento/magento-products/show-products-on-sale-in-magento/</link>
		<comments>http://inchoo.net/ecommerce/magento/magento-products/show-products-on-sale-in-magento/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 04:25:32 +0000</pubDate>
		<dc:creator>Branko Ajzele</dc:creator>
				<category><![CDATA[Products]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[products]]></category>
		<category><![CDATA[sale]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=10317</guid>
		<description><![CDATA[By default Magento (up to 1.1.6 version) does not have item on sale list view. If you were to open the http://demo.magentocommerce.com link and go to Furniture &#62; Living Room you would get a grid (or a list) view of &#8230;<p><a href="http://inchoo.net/ecommerce/magento/magento-products/show-products-on-sale-in-magento/">Read more</a><p>]]></description>
			<content:encoded><![CDATA[<p>By default Magento (up to 1.1.6 version) does not have item on sale list view. If you were to open the http://demo.magentocommerce.com link and go to <strong>Furniture &gt; Living Room</strong> you would get a grid (or a list) view of all the products inside the category Living Room as displayed on the picture below.</p>
<div id="attachment_311" class="wp-caption alignnone" style="width: 310px"><a href="http://activecodeline.net/wp-content/uploads/2008/11/screen1.jpg"><img class="size-medium wp-image-311" title="screen1" src="http://activecodeline.net/wp-content/uploads/2008/11/screen1-300x256.jpg" alt="Filters available by default" width="300" height="256" /></a><p class="wp-caption-text">Filters available by default</p></div>
<p>As you can see, you have three filters available by default (Best Value, Name and Price). So what if we want to add another one here? <span id="more-10317"></span></p>
<p>Easiest way that i found is to simply copy</p>
<p><strong>app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php</strong></p>
<p>to</p>
<p><strong>app/code/local/Mage/Catalog/Block/Product/List/Toolbar.php</strong></p>
<p>Then open it and modify the <strong>_construct()</strong> function. Look for the following part of the code</p>
<p><strong>$this-&gt;_availableOrder = array( </strong>&#8230;</p>
<p>You need to insert the following into the array, <strong>&#8216;special_price&#8217; =&gt;$this-&gt;__(&#8216;Special Price&#8217;)</strong>. Final code should look like</p>
<p><strong>$this-&gt;_availableOrder = array(<br />
&#8216;position&#8217;  =&gt; $this-&gt;__(&#8216;Best Value&#8217;),<br />
&#8216;name&#8217;      =&gt; $this-&gt;__(&#8216;Name&#8217;),<br />
&#8216;price&#8217;     =&gt; $this-&gt;__(&#8216;Price&#8217;),<br />
&#8216;special_price&#8217; =&gt;$this-&gt;__(&#8216;Special Price&#8217;)<br />
);</strong></p>
<p>Now if you refresh your <strong>Furniture &gt; Living Room</strong> page you should see special price on the dropdown list among previous default filters like on the image below. I used <strong>Special Price</strong> above as a fancy title for items on sale. You can put any string here you prefer.</p>
<div id="attachment_312" class="wp-caption alignnone" style="width: 310px"><a href="http://activecodeline.net/wp-content/uploads/2008/11/screen2.jpg"><img class="size-medium wp-image-312" title="screen2" src="http://activecodeline.net/wp-content/uploads/2008/11/screen2-300x255.jpg" alt="Special price added dropdown list" width="300" height="255" /></a><p class="wp-caption-text">Special price added dropdown list</p></div>
<p>Now we have added special price (product on sale) on the dropdown. If we click on it, it wont work. Why doesn&#8217;t it work? Well, we haven&#8217;t really added any logic to it for work and we haven&#8217;t put any of our products on sale.</p>
<p>First let&#8217;s put some product on sale. Since this demo is focused on Living Room category I will login to my Magento admin and look for, let&#8217;s say, <strong>Couch</strong>. Then we set up some special price to mark the product as being on sale. See the image below.</p>
<div id="attachment_313" class="wp-caption alignnone" style="width: 310px"><a href="http://activecodeline.net/wp-content/uploads/2008/11/screen3.jpg"><img class="size-medium wp-image-313" title="screen3" src="http://activecodeline.net/wp-content/uploads/2008/11/screen3-300x176.jpg" alt="Setting up the ON SALE for product" width="300" height="176" /></a><p class="wp-caption-text">Setting up the ON SALE for product</p></div>
<p>Now if we refresh the <strong>Furniture &gt; Living Room</strong> page we would see this special price next to the Couch product. So far, so good. Now if we click the dropdown and select Special price, nothing happens. Products are show just as we would selected Price from dropdown. Obviously we are missing something here.</p>
<p>If you were to click on the Price your URL link would change to include something like &#8220;<strong>?order=price&amp;dir=asc</strong>&#8220;, clicking on Special Price changes link to something like &#8220;<strong>?order=special_price&amp;dir=asc</strong>&#8221; so we are on the right path. So why don&#8217;t we see only products we marked as having special price, like Couch in our example.</p>
<p>First let&#8217;s get back to the Toolbar.php file I mentioned above. Notice the <strong>&#8216;special_price&#8217; =&gt;$this-&gt;__(&#8216;Special Price&#8217;)</strong>. Where does this <strong>special_price</strong> come from? To find out where does <strong>&#8216;special_price&#8217;</strong> come from, we need to open</p>
<p><strong>app/design/frontend/default/mycustom/template/catalog/product/list.phtml</strong>.</p>
<p>If you have a default version of 1.1.6 file, then scroll down to line 101, and under it, on line 102 insert the following</p>
<p><strong>&lt;?php echo(&#8216;&lt;pre&gt;&#8217;); print_r($_product-&gt;debug());  echo(&#8216;&lt;pre&gt;&#8217;); ?&gt;</strong></p>
<p>Look at the image below to see my example.</p>
<div id="attachment_315" class="wp-caption alignnone" style="width: 160px"><a href="http://activecodeline.net/wp-content/uploads/2008/11/screen4.jpg"><img class="size-thumbnail wp-image-315" title="screen4" src="http://activecodeline.net/wp-content/uploads/2008/11/screen4-150x150.jpg" alt="Quickly get some of the product properties (from and array of data)" width="150" height="150" /></a><p class="wp-caption-text">Quickly get some of the product properties (from and array of data)</p></div>
<p>Now refresh your <strong>Furniture &gt; Living Room</strong> page. You should be able to see individual product properties now like in the image below.</p>
<div id="attachment_314" class="wp-caption alignnone" style="width: 160px"><a href="http://activecodeline.net/wp-content/uploads/2008/11/screen5.jpg"><img class="size-thumbnail wp-image-314" title="screen5" src="http://activecodeline.net/wp-content/uploads/2008/11/screen5-150x150.jpg" alt="Product properties" width="150" height="150" /></a><p class="wp-caption-text">Product properties</p></div>
<p>What we need to do now is tu use the fact that only products that have been assigned Special price have the property special_price. We already have the mechanism of changing URL to make the order=special price like <strong>&#8220;?order=special_price&#8221;</strong> so now we need to modify the grid that is displaying our products, that&#8217;s list,phtml file. We need to say the following to the grid: If the order is special price then show only the items that have the special_price property assigned to them.</p>
<p>Lastly, open your <strong>app/design/frontend/default/mycustom/template/catalog/product/list.phtml</strong> file. If you look closer at the file and the frontend page grid you will see you have two states Grid view and List view. We&#8217;ll do this the faster way and duplicate some of the code:</p>
<p>Put this at the very top of the list.phtml file, <strong></strong></p>
<p><strong>&lt;?php $orderFilterType = $this-&gt;getRequest()-&gt;getParam(&#8216;order&#8217;); ?&gt;</strong></p>
<p>Go to line 91 (deafault file), line that starts with</p>
<p><strong>&lt;?php $i=0; foreach ($_productCollection as $_product): ?&gt;</strong></p>
<p>you need to put the following into it</p>
<p><strong>&lt;?php if(isset($orderFilterType) &amp;&amp; $orderFilterType === &#8216;special_price&#8217;): ?&gt;</strong></p>
<p><strong>&lt;?php if($_product-&gt;getData(&#8216;special_price&#8217;) !== null): ?&gt;<br />
&lt;?php echo(&#8216;&lt;!&#8211; product &#8216;. $_product-&gt;getName() .&#8217; has been sold in qty: &#8216;.$_product-&gt;ordered_qty.&#8217; &#8211;&gt;&#8217;); ?&gt; </strong></p>
<p><strong><em>(Not complete code, look into the attachec list.phtml file)</em><br />
</strong></p>
<p>Important thing is to wrap the entire Grid View and List view outputting part with this, and in the else statement you put the original Grid View and List view. That way if this is not special_price view, out template works as it would by default.</p>
<p>Bellow I attached the working list.phtml file from my example for you to see and examine. This is not most best solution since some code in list.phtml is duplicated. I leave it up to you to clean it up.</p>
<p><a href="http://activecodeline.net/wp-content/uploads/2008/11/list.phtml">list</a></p>
<p>Remember to make modifications to Toolbar.php as described above. These are the only two files needed to make this work.</p>
<p>If you manage to implement all of the above, you should now see only the Couch product (in my example) on the list when you select Special Price from dropdown.</p>
<p>Hope some of you find this tutorial usefull.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/magento-products/show-products-on-sale-in-magento/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

