<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mike D&#039;s SharpBlog</title>
	<atom:link href="http://www.sharpdotinc.com/mdost/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sharpdotinc.com/mdost</link>
	<description>Just another Sharpdot weblog</description>
	<lastBuildDate>Mon, 19 Dec 2011 16:11:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Magento: How to create a fragment url(pound sign in the url)</title>
		<link>http://www.sharpdotinc.com/mdost/2011/11/21/magento-how-to-create-a-fragment-urlpound-sign-in-the-url/</link>
		<comments>http://www.sharpdotinc.com/mdost/2011/11/21/magento-how-to-create-a-fragment-urlpound-sign-in-the-url/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 21:58:24 +0000</pubDate>
		<dc:creator>Mike D</dc:creator>
						<category domain="http://www.sharpdotinc.com/mdost/category/php/"><![CDATA[PHP]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/magento/"><![CDATA[magento]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/e-commerce/"><![CDATA[E-Commerce]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/open-source/"><![CDATA[open-source]]></category>

		<guid isPermaLink="false">http://www.sharpdotinc.com/mdost/?p=332</guid>
		<description><![CDATA[This is just a quick information post. If you use Magento and want to &#8220;bookmark&#8221; parts of a page that is all well and good, but how do you generate a url to go to it? there is a good question. Here is the simple answer.
You just need to pass the &#8220;_fragment&#8221; parameter to the [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick information post. If you use Magento and want to &#8220;bookmark&#8221; parts of a page that is all well and good, but how do you generate a url to go to it? there is a good question. Here is the simple answer.</p>
<p>You just need to pass the &#8220;_fragment&#8221; parameter to the getUrl method.<br />
Here is an example that would link to the customer account page to a bookmark called &#8220;test&#8221;.</p>
<p>Mage::getUrl(&#8216;customer/account&#8217;, array(&#8216;_fragment&#8217; =&gt; &#8216;test))</p>
<p>The url generated by the above code would be www.YourMagentoSite.com/customer/account#test</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharpdotinc.com/mdost/2011/11/21/magento-how-to-create-a-fragment-urlpound-sign-in-the-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento: Disable Sending Emails</title>
		<link>http://www.sharpdotinc.com/mdost/2011/10/28/magento-disable-sending-emails/</link>
		<comments>http://www.sharpdotinc.com/mdost/2011/10/28/magento-disable-sending-emails/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 17:14:05 +0000</pubDate>
		<dc:creator>Mike D</dc:creator>
						<category domain="http://www.sharpdotinc.com/mdost/category/php/"><![CDATA[PHP]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/category/uncategorized/"><![CDATA[Uncategorized]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/magento/"><![CDATA[magento]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/e-commerce/"><![CDATA[E-Commerce]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/open-source/"><![CDATA[open-source]]></category>

		<guid isPermaLink="false">http://www.sharpdotinc.com/mdost/?p=330</guid>
		<description><![CDATA[Have you ever wanted to disable email sending on Magento so that you do not need to worry about accidentally sending emails out when you are testing your store. Well there is an easy way to do this.
Log into the admin of you store and go to: System -&#62; Configuration -&#62; System -&#62; Mail Sending [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wanted to disable email sending on Magento so that you do not need to worry about accidentally sending emails out when you are testing your store. Well there is an easy way to do this.</p>
<p>Log into the admin of you store and go to: System -&gt; Configuration -&gt; System -&gt; Mail Sending Settings -&gt; Disable Email Communications</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharpdotinc.com/mdost/2011/10/28/magento-disable-sending-emails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento Meetup: WYSIWYG Widgets</title>
		<link>http://www.sharpdotinc.com/mdost/2011/10/18/magento-meetup-wysiwyg-widgets/</link>
		<comments>http://www.sharpdotinc.com/mdost/2011/10/18/magento-meetup-wysiwyg-widgets/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 00:31:46 +0000</pubDate>
		<dc:creator>Mike D</dc:creator>
						<category domain="http://www.sharpdotinc.com/mdost/category/php/"><![CDATA[PHP]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/category/uncategorized/"><![CDATA[Uncategorized]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/magento/"><![CDATA[magento]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/e-commerce/"><![CDATA[E-Commerce]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/open-source/"><![CDATA[open-source]]></category>

		<guid isPermaLink="false">http://www.sharpdotinc.com/mdost/?p=328</guid>
		<description><![CDATA[Here is a link to the Widgets Install zip.
]]></description>
			<content:encoded><![CDATA[<p>Here is a link to the Widgets <a href="http://www.sharpdotinc.com/wp-content/uploads/magentoWidgets.zip">Install zip</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharpdotinc.com/mdost/2011/10/18/magento-meetup-wysiwyg-widgets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento: How to add an image for a custom widget in the admin wysiwyg</title>
		<link>http://www.sharpdotinc.com/mdost/2011/08/10/magento-how-to-add-an-image-for-a-custom-widget-in-the-admin-wysiwyg/</link>
		<comments>http://www.sharpdotinc.com/mdost/2011/08/10/magento-how-to-add-an-image-for-a-custom-widget-in-the-admin-wysiwyg/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 01:52:43 +0000</pubDate>
		<dc:creator>Mike D</dc:creator>
						<category domain="http://www.sharpdotinc.com/mdost/category/php/"><![CDATA[PHP]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/category/uncategorized/"><![CDATA[Uncategorized]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/magento/"><![CDATA[magento]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/e-commerce/"><![CDATA[E-Commerce]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/open-source/"><![CDATA[open-source]]></category>

		<guid isPermaLink="false">http://www.sharpdotinc.com/mdost/?p=325</guid>
		<description><![CDATA[This is just a quick How-to, I do not detail how to create a new widget.
All you need to do is add a gif with the correct file name to the following directory:
/skin/adminhtml/default/default/images/widget/
Now, to name the gif. In you widgets.xml file you set the widget &#8220;type&#8221;, which is the block class for the widget. Just [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick How-to, I do not detail how to create a new widget.</p>
<p>All you need to do is add a gif with the correct file name to the following directory:<br />
/skin/adminhtml/default/default/images/widget/</p>
<p>Now, to name the gif. In you widgets.xml file you set the widget &#8220;type&#8221;, which is the block class for the widget. Just replace the &#8220;/&#8221; slash with a double underscore and that is the file name. so if I had a widget with the type set to &#8220;custommodule/wigets_customwidget&#8221; I just create a gif with the name &#8220;custommodule__wigets_customwidget.gif&#8221;.</p>
<p>End result:<br />
/skin/adminhtml/default/default/images/widget/custommodule__wigets_customwidget.gif</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharpdotinc.com/mdost/2011/08/10/magento-how-to-add-an-image-for-a-custom-widget-in-the-admin-wysiwyg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento: Authorize .Net Refunds</title>
		<link>http://www.sharpdotinc.com/mdost/2011/07/08/magento-authorize-net-refunds/</link>
		<comments>http://www.sharpdotinc.com/mdost/2011/07/08/magento-authorize-net-refunds/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 16:55:29 +0000</pubDate>
		<dc:creator>Mike D</dc:creator>
						<category domain="http://www.sharpdotinc.com/mdost/category/php/"><![CDATA[PHP]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/category/uncategorized/"><![CDATA[Uncategorized]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/magento/"><![CDATA[magento]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/e-commerce/"><![CDATA[E-Commerce]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/open-source/"><![CDATA[open-source]]></category>

		<guid isPermaLink="false">http://www.sharpdotinc.com/mdost/?p=322</guid>
		<description><![CDATA[In most releases of magento the auth.net payment module has online refunds disabled by default. This post is not about how to enable online refunds for auth.net, but how to fix bug that I have hit after enabling online refunds.
If you just edit the Authorizenet Class and enable refunds and partial refunds, you may still [...]]]></description>
			<content:encoded><![CDATA[<p>In most releases of magento the auth.net payment module has online refunds disabled by default. This post is not about how to enable online refunds for auth.net, but how to fix bug that I have hit after enabling online refunds.</p>
<p>If you just edit the Authorizenet Class and enable refunds and partial refunds, you may still hit some bugs. I recently found that partial refunds were being recorded by Magento corectly, but auth.net was actually refunding the entire order amount, not just the partial amount. This was because Magento was pulling the amount to refund from the payment object which in most cases will be the entire order total. Inorder to fix this I had to tell auth.net to use the refund amount from the credit memo request.</p>
<pre class="brush: php">
//In the refund method in /Paygate/model/Authorizenet.php we need to modify the x_amount in the request
//Notice the one line i added after the call to $this-&gt;_buildRequest
public function refund(Varien_Object $payment, $amount)
    {
        if ($payment-&gt;getRefundTransactionId() &amp;&amp; $amount &gt; 0) {
            $payment-&gt;setAnetTransType(self::REQUEST_TYPE_CREDIT);
            $request = $this-&gt;_buildRequest($payment);

            //added to get the proper amount to be refunded
            $request-&gt;setXAmount($amount,2);
            //END Custom

            $request-&gt;setXTransId($payment-&gt;getRefundTransactionId());

            /**
             * need to send last 4 digit credit card number to authorize.net
             * otherwise it will give an error
             */
            $request-&gt;setXCardNum($payment-&gt;getCcLast4());

            $result = $this-&gt;_postRequest($request);
            if ($result-&gt;getResponseCode()==self::RESPONSE_CODE_APPROVED) {
                $payment-&gt;setStatus(self::STATUS_SUCCESS);
                return $this;
            }
            Mage::throwException($this-&gt;_wrapGatewayError($result-&gt;getResponseReasonText()));
        }
        Mage::throwException(Mage::helper(&#039;paygate&#039;)-&gt;__(&#039;Error in refunding the payment.&#039;));
    }
</pre>
<p>Now your online refunds will use the correct amount.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharpdotinc.com/mdost/2011/07/08/magento-authorize-net-refunds/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Dual Boot Ubuntu and Windows</title>
		<link>http://www.sharpdotinc.com/mdost/2011/06/23/dual-boot-ubuntu-and-windows/</link>
		<comments>http://www.sharpdotinc.com/mdost/2011/06/23/dual-boot-ubuntu-and-windows/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 20:07:06 +0000</pubDate>
		<dc:creator>Mike D</dc:creator>
						<category domain="http://www.sharpdotinc.com/mdost/category/uncategorized/"><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.sharpdotinc.com/mdost/?p=320</guid>
		<description><![CDATA[I recently decided to wipe my old windows xp laptop and install Windows 7 and a version of Ubuntu(backtrack 4r2). I ran into an issue after installing both OS&#8217;s. Grub was throwing an error 18. After quite a bit of digging here is what I found.
The version of Ubuntu I was installing used Grub Legacy [...]]]></description>
			<content:encoded><![CDATA[<p>I recently decided to wipe my old windows xp laptop and install Windows 7 and a version of Ubuntu(backtrack 4r2). I ran into an issue after installing both OS&#8217;s. Grub was throwing an error 18. After quite a bit of digging here is what I found.</p>
<p>The version of Ubuntu I was installing used Grub Legacy not Grub2. Apparently this version of Grub has a limit of where it can find bootloaders. This means that the grub bootloader needs to exist early on the disk. Here is how I got things working.</p>
<p>I was using a 250GB HD and installed windows 7 first to a partion sized at 70Gigs. Then I installed Ubuntu to a partition(60 Gigs) directly after the Windows 7 partition. This is how I circumvented the Error Mentioned above. Now I have some unused disk space I can create extra NTFS of Linux partitions.</p>
<p>Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharpdotinc.com/mdost/2011/06/23/dual-boot-ubuntu-and-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento: How to Delete a credit memo</title>
		<link>http://www.sharpdotinc.com/mdost/2011/06/07/magento-how-to-delete-a-credit-memo/</link>
		<comments>http://www.sharpdotinc.com/mdost/2011/06/07/magento-how-to-delete-a-credit-memo/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 16:31:57 +0000</pubDate>
		<dc:creator>Mike D</dc:creator>
						<category domain="http://www.sharpdotinc.com/mdost/category/php/"><![CDATA[PHP]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/magento/"><![CDATA[magento]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/e-commerce/"><![CDATA[E-Commerce]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/open-source/"><![CDATA[open-source]]></category>

		<guid isPermaLink="false">http://www.sharpdotinc.com/mdost/?p=304</guid>
		<description><![CDATA[If you find yourself in the unfortunate position of having to delete a credit memo or order in Magento then take a deep breath and keep reading. I found my self in this very position. At first I was just going to run some sql to remove the orders and credit memo, but that started [...]]]></description>
			<content:encoded><![CDATA[<p>If you find yourself in the unfortunate position of having to delete a credit memo or order in Magento then take a deep breath and keep reading. I found my self in this very position. At first I was just going to run some sql to remove the orders and credit memo, but that started getting pretty messy. So Below is my solution for deleting an order and Deleting a credit memo attached to an order(but not deleting the order).</p>
<p><strong>Before proceeding Please Note:</strong> This was written using Magento Version 1.4.1.1. Because of the vast differences between version this may or may not work on other version. Test anything on a staging site before trying to apply to a production site.</p>
<p>To run the following code snippets you need to add them to an Admn controller action, then go to this action in the admin area. What controller you temporarily add this to is your choice.</p>
<pre class="brush: php">
        //Delete two orders
    	/* */
    	$orders = Mage::getModel(&#039;sales/order&#039;)-&gt;getCollection()
    		-&gt;addAttributeToFilter(&#039;increment_id&#039;, array(&#039;in&#039;, array(&#039;XXX000700&#039;, &#039;XXX000700-1&#039;)));
    	if(count($orders) delete();
	    	}
    	} else {
    		Die(&quot;incorect number of orders to delete.&quot;);
    	}
</pre>
<p>Now We Delete a Credit Memo we did not want</p>
<pre class="brush: php">
        //Now Delete the Refund for an order but do not delete the order.
    	$order = Mage::getModel(&#039;sales/order&#039;)-&gt;loadByIncrementId(&#039;XXX000320&#039;);
    	//Delete Credit Memo
    	$creditMemos = $order-&gt;getCreditmemosCollection();
    	foreach($creditMemos as $cm){	//cancel each credit memo for the order
    		$state = $cm-&gt;getState();
    		if($state == 3){//Cancled
    			continue;
    		}
    		$cm-&gt;cancel()
    			-&gt;save()
    			-&gt;getOrder()-&gt;save();	//Needed to save the order to apply the canceled credit memo to all order items.

    		$cm-&gt;delete();
    	}
</pre>
<p>After running the above code I did need to edit the refund values for the order in this table: sales_flat_order</p>
<p>when canceling the credit memo it changed the offline refund amount instead of the online refund amount.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharpdotinc.com/mdost/2011/06/07/magento-how-to-delete-a-credit-memo/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Magetno: Display out of stock products</title>
		<link>http://www.sharpdotinc.com/mdost/2011/05/10/magetno-display-out-of-stock-products/</link>
		<comments>http://www.sharpdotinc.com/mdost/2011/05/10/magetno-display-out-of-stock-products/#comments</comments>
		<pubDate>Tue, 10 May 2011 14:03:24 +0000</pubDate>
		<dc:creator>Mike D</dc:creator>
						<category domain="http://www.sharpdotinc.com/mdost/category/php/"><![CDATA[PHP]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/magento/"><![CDATA[magento]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/e-commerce/"><![CDATA[E-Commerce]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/open-source/"><![CDATA[open-source]]></category>

		<guid isPermaLink="false">http://www.sharpdotinc.com/mdost/?p=301</guid>
		<description><![CDATA[This article was written using Magento version 1.4.1.1.
Somewhere along the line Magento added a config setting called &#8220;Display Out of Stock Products&#8221;. This setting will remove products from the sites search and category lists, if the product is out of stock. You can still go directly to the products details page if you know the [...]]]></description>
			<content:encoded><![CDATA[<p>This article was written using Magento version 1.4.1.1.</p>
<p>Somewhere along the line Magento added a config setting called &#8220;Display Out of Stock Products&#8221;. This setting will remove products from the sites search and category lists, if the product is out of stock. You can still go directly to the products details page if you know the url, but it will not be found in the search with this setting enabled. I recently needed to show out of stock products for a site that has been running for a while. When I Change this config setting to show out of stock items and saved the config page, the browser just sat there spinning and never completed. In order for me to update this config I needed to manually edit the database table &#8220;core_config_data&#8221; and update the value for this setting. Then an Index refresh was needed.</p>
<p>If you find you self trying to change this setting but cant, try just doing it through the database directly. If you happen to have issues because the database says there are locks on the table, you need to get rid of the locks. One way to accomplish this is to restart the database service. Please take care when doing this because it will temporary affect any sites using the databases while they restart.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharpdotinc.com/mdost/2011/05/10/magetno-display-out-of-stock-products/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento: How to Log UPS Rate Requests</title>
		<link>http://www.sharpdotinc.com/mdost/2011/03/29/magento-how-to-log-ups-rate-requests/</link>
		<comments>http://www.sharpdotinc.com/mdost/2011/03/29/magento-how-to-log-ups-rate-requests/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 21:42:38 +0000</pubDate>
		<dc:creator>Mike D</dc:creator>
						<category domain="http://www.sharpdotinc.com/mdost/category/php/"><![CDATA[PHP]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/magento/"><![CDATA[magento]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/e-commerce/"><![CDATA[E-Commerce]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/open-source/"><![CDATA[open-source]]></category>

		<guid isPermaLink="false">http://www.sharpdotinc.com/mdost/?p=297</guid>
		<description><![CDATA[If you have ever needed to debug UPS shipping prices then this may come in handy. I will show you how to log the xml request you send to UPS to generate rate quotes, and also log the response from ups.

Enable Logging in the admin
Copy /app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php             to      /app/code/local/Mage/Usa/Model/Shipping/Carrier/Ups.php
Now make the following edits to the file [...]]]></description>
			<content:encoded><![CDATA[<p>If you have ever needed to debug UPS shipping prices then this may come in handy. I will show you how to log the xml request you send to UPS to generate rate quotes, and also log the response from ups.</p>
<ol>
<li>Enable Logging in the admin</li>
<li>Copy /app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php             to      /app/code/local/Mage/Usa/Model/Shipping/Carrier/Ups.php</li>
<li>Now make the following edits to the file you just created.</li>
</ol>
<p>Edit the following code in _getCgiQuotes method</p>
<pre class="brush: php">
        //Comment out original code
        //return $this-&gt;_parseCgiResponse($responseBody);

        //Log Request
        $result = $this-&gt;_parseCgiResponse($responseBody);
        foreach($result -&gt;getRatesByCarrier($this-&gt;_code) as $upsRate){
        	if($upsRate instanceof Mage_Shipping_Model_Rate_Result_Error){
        		$timeCode = time();
		        Mage::log($params, null, &#039;ups-request-&#039;.$timeCode.&#039;.log&#039;);
		        Mage::log($response, null, &#039;ups-response-&#039;.$timeCode.&#039;.log&#039;);
		        Mage::log($responseBody, null, &#039;ups-response-body-&#039;.$timeCode.&#039;.log&#039;);
        	}
        }
        return $result ;
        //END Changes
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sharpdotinc.com/mdost/2011/03/29/magento-how-to-log-ups-rate-requests/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Magento: Bulk Update Product Attribute (using sql file or from a controller)</title>
		<link>http://www.sharpdotinc.com/mdost/2011/03/29/magento-bulk-update-product-attribute-using-sql-file-or-from-a-controller/</link>
		<comments>http://www.sharpdotinc.com/mdost/2011/03/29/magento-bulk-update-product-attribute-using-sql-file-or-from-a-controller/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 16:57:05 +0000</pubDate>
		<dc:creator>Mike D</dc:creator>
						<category domain="http://www.sharpdotinc.com/mdost/category/php/"><![CDATA[PHP]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/magento/"><![CDATA[magento]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/e-commerce/"><![CDATA[E-Commerce]]></category>
		<category domain="http://www.sharpdotinc.com/mdost/tag/open-source/"><![CDATA[open-source]]></category>

		<guid isPermaLink="false">http://www.sharpdotinc.com/mdost/?p=295</guid>
		<description><![CDATA[After creating a New Module to add special functionality to catalog products I needed to set the value for this product to all downloadable products that were already created because this is a required attribute and the site would not function correctly with out it. So here is how you can update an attribute(s) for [...]]]></description>
			<content:encoded><![CDATA[<p>After creating a New Module to add special functionality to catalog products I needed to set the value for this product to all downloadable products that were already created because this is a required attribute and the site would not function correctly with out it. So here is how you can update an attribute(s) for a given set of products. Please note that this will update a text attribute. If you are trying to update a select or multiselect attribute you may need to format you values differently.</p>
<p>If you can not figure out the exact format you need you can test it by doing a bulk attribute update from the admin and edit the file for Mage_Catalog_Model_Product_Action class and in the updateAttributes method just print the value for $attrData. Then mimic this in you update script.</p>
<pre class="brush: php">
//Get the product Ids you want to affect. For me it was all downloadable products
$downloadableProductIds = Mage::getResourceModel(&#039;catalog/product_collection&#039;)
	-&gt;addAttributeToFilter(&#039;type_id&#039;, Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE)
	-&gt;getAllIds();

//Now create an array of attribute_code =&gt; values
$attributeData = array(&#039;my_attribute_code&#039; =&gt; &#039;my_attribute_value);
//Set the store to affect. I used admin to change all default values
$storeId = 0; //A.K.A Admin
//Now Update the attribute(s) for the given products.
Mage::getSingleton(&#039;catalog/product_action&#039;)
	-&gt;updateAttributes($downloadableProductIds, $attributeData, $storeId);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sharpdotinc.com/mdost/2011/03/29/magento-bulk-update-product-attribute-using-sql-file-or-from-a-controller/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

