<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Pratthost Developer Zone</title>
	
	<link>http://devzone.pratthost.com</link>
	<description>A resource for web developers</description>
	<lastBuildDate>Mon, 15 Mar 2010 21:32:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/pratthostdevzone" /><feedburner:info uri="pratthostdevzone" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Magento:  Table Rate Shipping &amp; Shopping Cart Price Rules with Free Shipping</title>
		<link>http://feedproxy.google.com/~r/pratthostdevzone/~3/GS0ohhVKstc/</link>
		<comments>http://devzone.pratthost.com/2010/03/15/magento-table-rate-shipping-shopping-cart-price-rules-with-free-shipping/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 21:32:41 +0000</pubDate>
		<dc:creator>Josh Pratt</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://devzone.pratthost.com/?p=390</guid>
		<description><![CDATA[
I am working with a possible client about a new website, and one of the features that they have requested is to have table rate shipping based upon order total, and to have free shipping for $100 or more.  This is normally easy and setup directly in the table rates.  But there&#8217;s a [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-60" title="Magento Icon" src="http://devzone.pratthost.com/wp-content/uploads/2008/09/magento_icon.jpg" alt="Magento Icon" width="67" height="67" /></p>
<p>I am working with a possible client about a new website, and one of the features that they have requested is to have table rate shipping based upon order total, and to have free shipping for $100 or more.  This is normally easy and setup directly in the table rates.  But there&#8217;s a catch.</p>
<p>There are a number of products that need to negate the free shipping if any of them are in the cart.  Fortunately, this is doable using Shopping Cart Price rules.  Here is how to do it:</p>
<p><strong>Step 1:</strong><br />
Enable your table rates, download the CSV (making sure you are viewing the config on the website level), modify it and then upload your rates.  Do not offer any free shipping in your CSV.  Keep the Free Shipping method disabled.</p>
<p><strong>Step 2:</strong><br />
Create your Shopping Cart Price rule.  I&#8217;ve included images below to help explain it.  Essentially, you need to set it up to look for a cart subtotal that is equal or greater than $100, and to make sure that there are no excluded products in the cart.  You do this under the conditions tab.  (Just change the &#8220;sku1, sku2, sku3&#8243; etc. to the SKU&#8217;s of the products you want to exclude)</p>
<div style="width: 300px; height: 78px; border: 1px solid #999; margin: 0 auto"><a href="http://devzone.pratthost.com/wp-content/uploads/2010/03/price-rule1.png" rel="lightbox[390]"><img src="http://devzone.pratthost.com/wp-content/uploads/2010/03/price-rule1-300x68.png" alt="" title="price-rule1" width="300" height="68" class="alignleft size-medium wp-image-391" /></a></div>
<p><br style="clear: both" /></p>
<div style="width: 300px; height: 160px; border: 1px solid #999; margin: 0 auto"><a href="http://devzone.pratthost.com/wp-content/uploads/2010/03/price-rule2.png" rel="lightbox[390]"><img src="http://devzone.pratthost.com/wp-content/uploads/2010/03/price-rule2-300x152.png" alt="" title="price-rule2" width="300" height="152" class="alignleft size-medium wp-image-392" /></a></div>
<p><br style="clear: both" /></p>
<p>What this does is offers the free shipping method (even though it is disabled) if the shopping cart total is $100 or more and does not include any excluded products.  If there are any excluded products in the cart, the free shipping method will never be offered.</p>
<img src="http://feeds.feedburner.com/~r/pratthostdevzone/~4/GS0ohhVKstc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://devzone.pratthost.com/2010/03/15/magento-table-rate-shipping-shopping-cart-price-rules-with-free-shipping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://devzone.pratthost.com/2010/03/15/magento-table-rate-shipping-shopping-cart-price-rules-with-free-shipping/</feedburner:origLink></item>
		<item>
		<title>Magento: Add Manufacturer Column to Admin Product Grid</title>
		<link>http://feedproxy.google.com/~r/pratthostdevzone/~3/na2-bgYCsyg/</link>
		<comments>http://devzone.pratthost.com/2010/03/11/magento-add-manufacturer-column-to-admin-product-grid/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 20:43:46 +0000</pubDate>
		<dc:creator>Josh Pratt</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://devzone.pratthost.com/?p=386</guid>
		<description><![CDATA[
A client requested to add a column to the product grid in the admin so that they could filter by manufacturer.  It would be great if Magento made this more simple to do, but it&#8217;s not that bad to just do it manually.  Instead of creating a whole module to do this, I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-60" title="Magento Icon" src="http://devzone.pratthost.com/wp-content/uploads/2008/09/magento_icon.jpg" alt="Magento Icon" width="67" height="67" /></p>
<p>A client requested to add a column to the product grid in the admin so that they could filter by manufacturer.  It would be great if Magento made this more simple to do, but it&#8217;s not that bad to just do it manually.  Instead of creating a whole module to do this, I&#8217;m just overriding one file.  You can make a module with it quite easily if you want.</p>
<p><em>The following was used and tested with Magento 1.3.2.4</em></p>
<p><strong>Step 1:</strong><br />
Copy this file:  /app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php and paste it here:  /app/code/local/Mage/Adminhtml/Block/Catalog/Product/Grid.php.  This will override the core file with your own without actually modifying core code.</p>
<p><strong>Step 2:</strong><br />
By looking at this file, you will clearly see how Magento is setting up the columns.  Find where you want to put the Manufacturer column, and paste the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$manufacturer_items</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getModel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'eav/entity_attribute_option'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCollection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setStoreFilter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">join</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'attribute'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'attribute.attribute_id=main_table.attribute_id'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'attribute_code'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$manufacturer_items</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$manufacturer_item</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$manufacturer_item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAttributeCode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'manufacturer'</span><span style="color: #009900;">&#41;</span> 
                <span style="color: #000088;">$manufacturer_options</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$manufacturer_item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getOptionId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$manufacturer_item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addColumn</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'manufacturer'</span><span style="color: #339933;">,</span>
            <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
                <span style="color: #0000ff;">'header'</span><span style="color: #339933;">=&gt;</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'catalog'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Manufacturer'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">'width'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'100px'</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">'type'</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'options'</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">'index'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'manufacturer'</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">'options'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$manufacturer_options</span>
        <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>Step 3:</strong><br />
Enjoy your new column.  Props to <a href="http://www.magentocommerce.com/boards/member/56783/">wolfdog85</a> for helping me figure out the code.  The original forum post can be found <a href="http://www.magentocommerce.com/boards/viewthread/20877/P0/">here</a>.</p>
<img src="http://feeds.feedburner.com/~r/pratthostdevzone/~4/na2-bgYCsyg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://devzone.pratthost.com/2010/03/11/magento-add-manufacturer-column-to-admin-product-grid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://devzone.pratthost.com/2010/03/11/magento-add-manufacturer-column-to-admin-product-grid/</feedburner:origLink></item>
		<item>
		<title>Magento: Add Javascript to Home Page Only (Or Any CMS Page)</title>
		<link>http://feedproxy.google.com/~r/pratthostdevzone/~3/MSTtA2U3Ocs/</link>
		<comments>http://devzone.pratthost.com/2010/03/08/magento-add-javascript-to-home-page-only-or-any-cms-page/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 19:49:26 +0000</pubDate>
		<dc:creator>Josh Pratt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://devzone.pratthost.com/?p=382</guid>
		<description><![CDATA[
Have you ever needed to include a javascript file to the home page only to run that sweet slideshow you have displayed (or any other reason)?  Fortunately, you don&#8217;t have to modify any of the layout files, or add it to your head.phtml file.  CMS pages in Magento allow you to modify the [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-60" title="Magento Icon" src="http://devzone.pratthost.com/wp-content/uploads/2008/09/magento_icon.jpg" alt="Magento Icon" width="67" height="67" /></p>
<p>Have you ever needed to include a javascript file to the home page only to run that sweet slideshow you have displayed (or any other reason)?  Fortunately, you don&#8217;t have to modify any of the layout files, or add it to your head.phtml file.  CMS pages in Magento allow you to modify the layout XML specific to that page.  So, all you need to do is open up the CMS page in Magento that you want to add the javascript to, click on the &#8220;Custom Design&#8221; tab on the left, and in the &#8220;Layout Update XML&#8221; field add the following:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;reference</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;head&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">&quot;addItem&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>skin_js<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>yourfile.js<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/action<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/reference<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Or, if you want to just put the javascript in the /js/ directory of your app, you can change the &#8220;skin_js&#8221; to just &#8220;js&#8221;.  </p>
<img src="http://feeds.feedburner.com/~r/pratthostdevzone/~4/MSTtA2U3Ocs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://devzone.pratthost.com/2010/03/08/magento-add-javascript-to-home-page-only-or-any-cms-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://devzone.pratthost.com/2010/03/08/magento-add-javascript-to-home-page-only-or-any-cms-page/</feedburner:origLink></item>
		<item>
		<title>Magento:  Import Tier Pricing using API</title>
		<link>http://feedproxy.google.com/~r/pratthostdevzone/~3/hv-fJ0TQHDc/</link>
		<comments>http://devzone.pratthost.com/2010/03/04/magento-import-tier-pricing-using-api/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 16:52:41 +0000</pubDate>
		<dc:creator>Josh Pratt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://devzone.pratthost.com/?p=367</guid>
		<description><![CDATA[
Yet another thing that would be nice if Magento allowed you to import through the admin interface.  But, at least there is the API to utilize, and fortunately importing Tier Pricing for products is quite easy.  I will provide you with a script and CSV format to get started quickly.
Important Note: Be sure [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-60" title="Magento Icon" src="http://devzone.pratthost.com/wp-content/uploads/2008/09/magento_icon.jpg" alt="Magento Icon" width="67" height="67" /></p>
<p>Yet another thing that would be nice if Magento allowed you to import through the admin interface.  But, at least there is the API to utilize, and fortunately importing Tier Pricing for products is quite easy.  I will provide you with a script and CSV format to get started quickly.</p>
<p><strong>Important Note:</strong> Be sure that wherever you are running the script, you have SOAP installed/enabled.  You can run it from anywhere that has it, as you are providing the script with a URL of a Magento installation.  If your server doesn&#8217;t have it, you can install PHP and SOAP on your local machine and run it off of there if you&#8217;d like.</p>
<p>First thing you are going to need to do, if you haven&#8217;t done it already, is to setup an API user in your installation of Magento.  Go to System &gt;&gt; Web Services &gt;&gt; Users and setup an account.  Be sure that the role you give that user has access to tier pricing.</p>
<p>Next, create a PHP file where ever you want.  I chose to put it in /api-scripts/ and I called it &#8220;tier-pricing-import.php&#8221;.  Be sure to replace the four values I&#8217;ve highlighted with your own values:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">E_ALL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'display_errors'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$proxy</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SoapClient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://[YOUR-WEBSITE-URL]/api/soap/?wsdl'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sessionId</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$proxy</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">login</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'[YOUR-WEBSERVICE-USERNAME]'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[YOUR-WEBSERVICE-PASSWORD]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$handle</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'[YOUR-CSV-FILENAME].csv'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'r'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fgetcsv</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">30</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">','</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$tierPrices</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$sku</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$tierPrices</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'website'</span>           <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'customer_group_id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'qty'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'price'</span>             <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        try <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$proxy</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">call</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sessionId</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'product_tier_price.update'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sku</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tierPrices</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> catch <span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$errors</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'Error for SKU '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$sku</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">': '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$e</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000088;">$row</span><span style="color: #339933;">++;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Finally, create your CSV.  You&#8217;ll want 5 columns:</p>
<ul>
<li>website_id: Integer value for your website id.  Use &#8216;all&#8217; for all websites</li>
<li>cust_group: Integer value for the customer group it will be applied to.  Use &#8216;all&#8217; to apply it to all groups</li>
<li>sku: The product sku that the tier pricing will be applied to</li>
<li>price_qty: The quantity the price is applied to (x and above)</li>
<li>price: The price</li>
</ul>
<p>Be sure to include the header row.  Here is an example of how the csv should look:</p>
<table border="1">
<tr>
<td>website_id</td>
<td>cust_group</td>
<td>sku</td>
<td>price_qty</td>
<td>price</td>
</tr>
<tr>
<td>1</td>
<td>3</td>
<td>XB60</td>
<td>10</td>
<td>25.99</td>
</tr>
<tr>
<td>1</td>
<td>3</td>
<td>XB60</td>
<td>50</td>
<td>20.99</td>
</tr>
<tr>
<td>all</td>
<td>all</td>
<td>RDX300</td>
<td>15</td>
<td>8</td>
</tr>
</table>
<p>
Just include the csv in the same directory as your php file, then in your browser, type in the URL of the php file and run it.  It will import your tier pricing very quickly.  I haven&#8217;t built in any sort of messages that let you know when it&#8217;s done, or if there were any errors or anything.  This is as bare-bones as it gets, but it works as needed.  I hope you find it useful.</p>
<img src="http://feeds.feedburner.com/~r/pratthostdevzone/~4/hv-fJ0TQHDc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://devzone.pratthost.com/2010/03/04/magento-import-tier-pricing-using-api/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://devzone.pratthost.com/2010/03/04/magento-import-tier-pricing-using-api/</feedburner:origLink></item>
		<item>
		<title>Magento 1.4 Released</title>
		<link>http://feedproxy.google.com/~r/pratthostdevzone/~3/QthizqDKhU4/</link>
		<comments>http://devzone.pratthost.com/2010/03/02/magento-1-4-released/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 14:44:46 +0000</pubDate>
		<dc:creator>Josh Pratt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://devzone.pratthost.com/?p=365</guid>
		<description><![CDATA[
It&#8217;s a bit late to be posting this, as 1.4 was released at least a couple weeks ago now.  But, I just wanted to at least comment on it.  I am extremely thrilled at some of the improvements.  There are too many to list and discuss now, so if you want a [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://devzone.pratthost.com/wp-content/uploads/2008/09/magento_icon.jpg" alt="Magento Icon" title="Magento Icon" width="67" height="67" class="alignleft size-full wp-image-60" /></p>
<p>It&#8217;s a bit late to be posting this, as 1.4 was released at least a couple weeks ago now.  But, I just wanted to at least comment on it.  I am extremely thrilled at some of the improvements.  There are too many to list and discuss now, so if you want a full list, you can check it out on <a href="http://www.magentocommerce.com/download/release_notes">Magento&#8217;s website</a>.</p>
<p>Perhaps the best improvement has been done with the addition of the WYSIWYG built-in to Magento (we finally don&#8217;t have to use the Fontis or Bouncing Orange extensions!).  The widgets are also awesome, and really extends the usability and flexibility for clients.</p>
<p>Another much appreciated, but small fix, is the ability for Magento to remember what you were trying to do in the backend.  Pre-1.4, if your admin session timed out and you had to log back in, you would be sent to the dashboard, no matter where you were at before.  1.4 now knows what you were clicking on, and sends you there after you login.</p>
<p>They also finally added what they call &#8220;custom variables&#8221;.  This allows you to create variables such as a company phone number or address.  You can then use the variable call on your transactional email templates and if you ever need to edit the phone number or address, you only have to do it in one place, instead of on every email.</p>
<p>There will always be a list of things that the community wishes Magento had that 1.4 still doesn&#8217;t have.  But, let&#8217;s look at what it does have (which is quite impressive), remember that it just keeps getting better over time, and also remember that the price tag is $0.  Don&#8217;t forget that you don&#8217;t have to use OSCommerce or ZenCart anymore too.</p>
<img src="http://feeds.feedburner.com/~r/pratthostdevzone/~4/QthizqDKhU4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://devzone.pratthost.com/2010/03/02/magento-1-4-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://devzone.pratthost.com/2010/03/02/magento-1-4-released/</feedburner:origLink></item>
		<item>
		<title>Trying It Again</title>
		<link>http://feedproxy.google.com/~r/pratthostdevzone/~3/2WYNz-ffRJg/</link>
		<comments>http://devzone.pratthost.com/2010/03/01/trying-it-again/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 04:11:29 +0000</pubDate>
		<dc:creator>Josh Pratt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://devzone.pratthost.com/?p=363</guid>
		<description><![CDATA[My boss today encouraged all of us to make a point to contribute more frequently to the web community at our staff meeting.  I&#8217;ve been back in more development, especially with Magento lately, so it seems that I should try and revive the blog.  This will be my second attempt to get back [...]]]></description>
			<content:encoded><![CDATA[<p>My boss today encouraged all of us to make a point to contribute more frequently to the web community at our staff meeting.  I&#8217;ve been back in more development, especially with Magento lately, so it seems that I should try and revive the blog.  This will be my second attempt to get back into regular updates, so no promises.  I am glad to see though that over 200 people regularly visit my website each day, so it&#8217;s still useful.  That is encouraging.</p>
<img src="http://feeds.feedburner.com/~r/pratthostdevzone/~4/2WYNz-ffRJg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://devzone.pratthost.com/2010/03/01/trying-it-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://devzone.pratthost.com/2010/03/01/trying-it-again/</feedburner:origLink></item>
		<item>
		<title>Magento: How To Remove The “Position” Sort Option</title>
		<link>http://feedproxy.google.com/~r/pratthostdevzone/~3/Dy7WnTqtcpM/</link>
		<comments>http://devzone.pratthost.com/2009/11/30/magento-how-to-remove-the-position-sort-option/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 00:03:47 +0000</pubDate>
		<dc:creator>Josh Pratt</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://devzone.pratthost.com/?p=359</guid>
		<description><![CDATA[
I had a client ask me today to remove the &#8220;Position&#8221; option from the toolbar on the category product listing.  I realized that there are probably a lot of people that don&#8217;t ever utilize position, and therefore it is basically useless and should be removed so it doesn&#8217;t cause any confusion for the people [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://devzone.pratthost.com/wp-content/uploads/2008/09/magento_icon.jpg" alt="Magento Icon" title="Magento Icon" width="67" height="67" class="alignleft size-full wp-image-60" /></p>
<p>I had a client ask me today to remove the &#8220;Position&#8221; option from the toolbar on the category product listing.  I realized that there are probably a lot of people that don&#8217;t ever utilize position, and therefore it is basically useless and should be removed so it doesn&#8217;t cause any confusion for the people browsing the store.</p>
<p>Unfortunately, this is not a listed attribute that you can easily turn on or off as far as sorting goes.  So, we have to do it the harder way and dive into the code.</p>
<p>There may be a &#8220;better&#8221; way to do this, I&#8217;m not sure, but this is super easy and it works.  All you have to do is edit the file /app/design/frontend/yourpackage/yourtheme/template/catalog/product/list/toolbar.phtml.  Towards the bottom, you&#8217;ll find the sort by code that outputs a select element.  It looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Sort by'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> &lt;select onchange=&quot;setLocation(this.value)&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAvailableOrders</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$_key</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$_order</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;option value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getOrderUrl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_key</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'asc'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isOrderCurrent</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_key</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> selected=&quot;selected&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;
        <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_order</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;/option&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/select&gt;</pre></div></div>

<p>Change that to this (just adds an if statement):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Sort by'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> &lt;select onchange=&quot;setLocation(this.value)&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAvailableOrders</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$_key</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$_order</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_order</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'Position'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Remove &quot;Position&quot; from the sort option list ?&gt;</span>
        &lt;option value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getOrderUrl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_key</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'asc'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isOrderCurrent</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_key</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> selected=&quot;selected&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;
            <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_order</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        &lt;/option&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// End for removing &quot;Position&quot; sort option ?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/select&gt;</pre></div></div>

<p>And that all it takes.  If anyone knows of a better/easier way to do it, please let me know.</p>
<img src="http://feeds.feedburner.com/~r/pratthostdevzone/~4/Dy7WnTqtcpM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://devzone.pratthost.com/2009/11/30/magento-how-to-remove-the-position-sort-option/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://devzone.pratthost.com/2009/11/30/magento-how-to-remove-the-position-sort-option/</feedburner:origLink></item>
		<item>
		<title>Google Voice: Anyone Have Any Invites?</title>
		<link>http://feedproxy.google.com/~r/pratthostdevzone/~3/qjbkPTFJops/</link>
		<comments>http://devzone.pratthost.com/2009/11/17/google-voice-anyone-have-any-invites/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 02:03:22 +0000</pubDate>
		<dc:creator>Josh Pratt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://devzone.pratthost.com/?p=352</guid>
		<description><![CDATA[
I was recently invited by a friend to join Google Voice.  I am quite shocked at how cool this service is, and how easy it is to use.  Perhaps I just haven&#8217;t experienced something like this before (well, I haven&#8217;t), but it seemed like I jumped 10 years into the future as far [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://devzone.pratthost.com/wp-content/uploads/2009/11/google-voice-logo.png" alt="Google Voice" title="Google Voice" width="67" height="27" class="alignleft size-full wp-image-60" /></p>
<p>I was recently invited by a friend to join Google Voice.  I am quite shocked at how cool this service is, and how easy it is to use.  Perhaps I just haven&#8217;t experienced something like this before (well, I haven&#8217;t), but it seemed like I jumped 10 years into the future as far as the process in setting it up.</p>
<p>I won&#8217;t go into detail now about it, as I&#8217;m still learning the ropes.  Maybe another post later.  But, I have a few people that I know that could really use it, and I know there are plenty of unused invites out there still.  So, if you would be willing to part with one or two, please let me know!</p>
<img src="http://feeds.feedburner.com/~r/pratthostdevzone/~4/qjbkPTFJops" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://devzone.pratthost.com/2009/11/17/google-voice-anyone-have-any-invites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://devzone.pratthost.com/2009/11/17/google-voice-anyone-have-any-invites/</feedburner:origLink></item>
		<item>
		<title>Magento: Doesn’t Work Well For Warehouse Processing</title>
		<link>http://feedproxy.google.com/~r/pratthostdevzone/~3/GhLpvTGFDUM/</link>
		<comments>http://devzone.pratthost.com/2009/10/15/magento-doesnt-work-well-for-warehouse-processing/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 00:39:52 +0000</pubDate>
		<dc:creator>Josh Pratt</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://devzone.pratthost.com/?p=349</guid>
		<description><![CDATA[
I had a long phone conversation with a gentleman that handles the warehouse processing for one of our Magento clients.  They are quite disappointed with the way Magento handles the order fulfillment process.  Perhaps there is a better method than what this guy is suggesting, but perhaps Magento needs to be able to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://devzone.pratthost.com/wp-content/uploads/2008/09/magento_icon.jpg" alt="Magento Icon" title="Magento Icon" width="67" height="67" class="alignleft size-full wp-image-60" /></p>
<p>I had a long phone conversation with a gentleman that handles the warehouse processing for one of our Magento clients.  They are quite disappointed with the way Magento handles the order fulfillment process.  Perhaps there is a better method than what this guy is suggesting, but perhaps Magento needs to be able to flexible in terms of how orders are processed.</p>
<p>Here is the problem:  The warehouse tells me that they need to print of the packing slips so that they can go and put the order together.  Apparently that&#8217;s how they&#8217;ve always done things.  Magento considers the packing slip printing to be the last step in the process, and therefore marks the order complete.  However, that is not the end of the process for this warehouse.  There are plenty of times that they need to go in and edit or cancel an order after the packing slip has been printed out, but once an order is completed in Magento, that is no longer possible.</p>
<p>I&#8217;d like to think that they aren&#8217;t the only warehouse out there that does things this way, and according to the guy I talked with, that&#8217;s the way most people do it.  If that is the case, I&#8217;m going to have to try and write a module that allows you to print off a packing slip at any time for an order, without changing the status of the order.  If this guy is right though, I think Magento needs to add in some flexibility for different types of order processing.</p>
<img src="http://feeds.feedburner.com/~r/pratthostdevzone/~4/GhLpvTGFDUM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://devzone.pratthost.com/2009/10/15/magento-doesnt-work-well-for-warehouse-processing/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<feedburner:origLink>http://devzone.pratthost.com/2009/10/15/magento-doesnt-work-well-for-warehouse-processing/</feedburner:origLink></item>
		<item>
		<title>Magento: Import Multiple Images for Products Module</title>
		<link>http://feedproxy.google.com/~r/pratthostdevzone/~3/QNXrwOJqWNI/</link>
		<comments>http://devzone.pratthost.com/2009/10/09/magento-import-multiple-images-for-products-module/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 13:01:23 +0000</pubDate>
		<dc:creator>Josh Pratt</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://devzone.pratthost.com/?p=344</guid>
		<description><![CDATA[
I still am confused as to why Magento hasn&#8217;t built-in the ability to upload multiple images for each product.  After scoping it out, finally, I discovered that the modification was quite simple.  I haven&#8217;t put the module up on Magento Connect yet (not sure if I will), but here I will lay out [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://devzone.pratthost.com/wp-content/uploads/2008/09/magento_icon.jpg" alt="Magento Icon" title="Magento Icon" width="67" height="67" class="alignleft size-full wp-image-60" /></p>
<p>I still am confused as to why Magento hasn&#8217;t built-in the ability to upload multiple images for each product.  After scoping it out, finally, I discovered that the modification was quite simple.  I haven&#8217;t put the module up on Magento Connect yet (not sure if I will), but here I will lay out how to do it, which for some of you may help you understand how modules work, if you don&#8217;t know already.</p>
<p>I&#8217;ve seen some solutions out there that modify core code, some that just take a file and move it to your /app/code/local/ retaining the same directory structure, so as to just override the file.  I don&#8217;t recommend either of these methods (especially the first), as with a true module you are setting up a much better environment over time for this to last.  And a module allows you to ONLY override the methods you need to modify, instead of entire classes.  Plus, you can easily disable the module right in the admin (Admin >> System >> Configuration >> Advanced).</p>
<p>Be sure you replace all of the &#8220;YOURSTUFF&#8221; with your name or company name.</p>
<p><em>I have only tested this with 1.3.2.4</em></p>
<h4>Step 1:</h4>
<p>Create the file:  /app/etc/modules/YOURSTUFF_ImportMultipleImages.xml.  This file tells Magento that you have this module and where it is located.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;YOURSTUFF_ImportMultipleImages<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;active<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/active<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;codePool<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>local<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/codePool<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/YOURSTUFF_ImportMultipleImages<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h4>Step 2:</h4>
<p>Create the file:  /app/code/local/YOURSTUFF/ImportMultipleImages/etc/config.xml.  This file is the configuration file for your module.  It tells Magento which class we are going to override.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;YOURSTUFF_ImportMultipleImages<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>0.1.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/YOURSTUFF_ImportMultipleImages<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;global<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;models<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;catalog<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rewrite<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #808080; font-style: italic;">&lt;!-- Override Mage_Catalog_Model_Convert_Adapter_Product --&gt;</span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;convert_adapter_product<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>YOURSTUFF_ImportMultipleImages_Model_Convert_Adapter_Product<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/convert_adapter_product<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/rewrite<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/catalog<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/models<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/global<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h4>Step 3:</h3>
<p>Create the file:  /app/code/local/YOURSTUFF/ImportMultipleImages/Model/Convert/Adapter/Product.php.  Important note:  When creating a module, you only want to include the methods that you are actually modifying.  As you can see, we are extending the original class, so we&#8217;ll have all of the methods from the original, but since we have the saveRow() method in our class, ours will take precedence.  We do it this way because when you upgrade Magento, you&#8217;ll only need to make sure you check the one method for changes, instead of the entire class.</p>
<p><strong>Again, be sure to replace the &#8220;YOURSTUFF&#8221; in the class name to your name or company name.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009933; font-style: italic;">/**
 * Import Multiple Images during Product Import
 *
 */</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> YOURSTUFF_ImportMultipleImages_Model_Convert_Adapter_Product <span style="color: #000000; font-weight: bold;">extends</span> Mage_Catalog_Model_Convert_Adapter_Product
<span style="color: #009900;">&#123;</span>
    <span style="color: #009933; font-style: italic;">/**
     * Save product (import)
     *
     * @param array $importData
     * @throws Mage_Core_Exception
     * @return bool
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> saveRow<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span> <span style="color: #000088;">$importData</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$product</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getProductModel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">-&gt;</span><span style="color: #004000;">reset</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'store'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getBatchParams</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'store'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$store</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStoreById</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getBatchParams</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'store'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'catalog'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Skip import row, required field &quot;%s&quot; not defined'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'store'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                Mage<span style="color: #339933;">::</span><span style="color: #004000;">throwException</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$store</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStoreByCode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'store'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$store</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'catalog'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Skip import row, store &quot;%s&quot; field not exists'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'store'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            Mage<span style="color: #339933;">::</span><span style="color: #004000;">throwException</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sku'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'catalog'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Skip import row, required field &quot;%s&quot; not defined'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'sku'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            Mage<span style="color: #339933;">::</span><span style="color: #004000;">throwException</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setStoreId</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$store</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$productId</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getIdBySku</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sku'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$productId</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$productId</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$productTypes</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getProductTypes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$productAttributeSets</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getProductAttributeSets</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #009933; font-style: italic;">/**
             * Check product define type
             */</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$productTypes</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'catalog'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Skip import row, is not valid value &quot;%s&quot; for field &quot;%s&quot;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                Mage<span style="color: #339933;">::</span><span style="color: #004000;">throwException</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTypeId</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$productTypes</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009933; font-style: italic;">/**
             * Check product define attribute set
             */</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attribute_set'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$productAttributeSets</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attribute_set'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attribute_set'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attribute_set'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'catalog'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Skip import row, is not valid value &quot;%s&quot; for field &quot;%s&quot;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'attribute_set'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                Mage<span style="color: #339933;">::</span><span style="color: #004000;">throwException</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAttributeSetId</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$productAttributeSets</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attribute_set'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_requiredFields <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$attribute</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$attribute</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$attribute</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getIsRequired</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'catalog'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Skip import row, required field &quot;%s&quot; for new products not defined'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    Mage<span style="color: #339933;">::</span><span style="color: #004000;">throwException</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setProductTypeInstance</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$product</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'category_ids'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCategoryIds</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'category_ids'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_ignoreFields <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$store</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$websiteIds</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getWebsiteIds</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$websiteIds</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$websiteIds</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$store</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getWebsiteId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$websiteIds</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$websiteIds</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$store</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getWebsiteId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setWebsiteIds</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$websiteIds</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'websites'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$websiteIds</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getWebsiteIds</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$websiteIds</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$websiteIds</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000088;">$websiteCodes</span> <span style="color: #339933;">=</span> <span style="color: #990000;">split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'websites'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$websiteCodes</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$websiteCode</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                try <span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$website</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">app</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getWebsite</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$websiteCode</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$website</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$websiteIds</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #000088;">$websiteIds</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$website</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
                catch <span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setWebsiteIds</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$websiteIds</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$websiteIds</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_inventoryFields<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_imageFields<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #000088;">$attribute</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$attribute</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #000088;">$isArray</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$setValue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$attribute</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getFrontendInput</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'multiselect'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #990000;">split</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">MULTI_DELIMITER</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$isArray</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$setValue</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$attribute</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getBackendType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'decimal'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$setValue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getNumber</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$attribute</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">usesSource</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$attribute</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getSource</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAllOptions</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$isArray</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$item</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'label'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                            <span style="color: #000088;">$setValue</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'value'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$setValue</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
                    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$item</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'label'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                            <span style="color: #000088;">$setValue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'value'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setData</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">,</span> <span style="color: #000088;">$setValue</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getVisibility</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setVisibility</span><span style="color: #009900;">&#40;</span>Mage_Catalog_Model_Product_Visibility<span style="color: #339933;">::</span><span style="color: #004000;">VISIBILITY_NOT_VISIBLE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000088;">$stockData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$inventoryFields</span> <span style="color: #339933;">=</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_inventoryFieldsProductTypes<span style="color: #009900;">&#91;</span><span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTypeId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
            ? <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_inventoryFieldsProductTypes<span style="color: #009900;">&#91;</span><span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTypeId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span>
            <span style="color: #339933;">:</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$inventoryFields</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_toNumber<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$stockData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getNumber</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$stockData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setStockData</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$stockData</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$imageData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_imageFields <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'no_selection'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$imageData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$imageData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000088;">$imageData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$field</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$imageData</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$file</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$fields</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            try <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addImageToMediaGallery</span><span style="color: #009900;">&#40;</span>Mage<span style="color: #339933;">::</span><span style="color: #004000;">getBaseDir</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'media'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #0000ff;">'import'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fields</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            catch <span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #009933; font-style: italic;">/**
		 * Allows you to import multiple images for each product.
		 * Simply add a 'gallery' column to the import file, and separate
		 * each image with a semi-colon.
		 */</span>
	        try <span style="color: #009900;">&#123;</span>
	                <span style="color: #000088;">$galleryData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">';'</span><span style="color: #339933;">,</span><span style="color: #000088;">$importData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;gallery&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	                <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$galleryData</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$gallery_img</span><span style="color: #009900;">&#41;</span>
					<span style="color: #009933; font-style: italic;">/**
					 * @param directory where import image resides
					 * @param leave 'null' so that it isn't imported as thumbnail, base, or small
					 * @param false = the image is copied, not moved from the import directory to it's new location
					 * @param false = not excluded from the front end gallery
					 */</span>
	                <span style="color: #009900;">&#123;</span>
	                        <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addImageToMediaGallery</span><span style="color: #009900;">&#40;</span>Mage<span style="color: #339933;">::</span><span style="color: #004000;">getBaseDir</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'media'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #0000ff;">'import'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$gallery_img</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	                <span style="color: #009900;">&#125;</span>
	            <span style="color: #009900;">&#125;</span>
	        catch <span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>        
		<span style="color: #666666; font-style: italic;">/* End Modification */</span>
&nbsp;
        <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setIsMassupdate</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setExcludeUrlRewrite</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h4>Step 4:</h4>
<p>Test it out!  This is how it works:  Use the Magento product import functionality (Admin >> System >> Import/Export >> Profiles >> Import All Products).  Add a column to your CSV called &#8216;gallery&#8217;.  In that column, simply put all the images you&#8217;d like that product to have, separated by semi-colons.  The same exact rules apply for these images as do the &#8216;image&#8217;, &#8217;small_image&#8217;, and &#8216;thumbnail&#8217; columns, in that if you are putting all your images in the /media/import/ directory, you&#8217;ll have to include the forward-slash in the image names.  Here&#8217;s an example (be sure to leave out any spaces):</p>
<p>Your gallery column could look like:  /image1.jpg;/image2.jpg;/image3.jpg</p>
<p>These images will all show up just as if you were to go into the product edit in the admin and upload them.  They&#8217;ll be copied from the /media/import/ directory into the proper media directory structure, and they&#8217;ll show up as thumbnails below your main product image on the product view page.</p>
<p>Comment if you have any questions.  Enjoy!</p>
<img src="http://feeds.feedburner.com/~r/pratthostdevzone/~4/QNXrwOJqWNI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://devzone.pratthost.com/2009/10/09/magento-import-multiple-images-for-products-module/feed/</wfw:commentRss>
		<slash:comments>61</slash:comments>
		<feedburner:origLink>http://devzone.pratthost.com/2009/10/09/magento-import-multiple-images-for-products-module/</feedburner:origLink></item>
	</channel>
</rss>
