<?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>Let&#039;s Make It Go</title> <atom:link href="http://www.letsmakeitgo.com/blog/feed/" rel="self" type="application/rss+xml" /><link>http://www.letsmakeitgo.com/blog</link> <description>Making web sites work since 1996.  Duh.</description> <lastBuildDate>Thu, 21 Jul 2011 19:07:42 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3</generator> <item><title>Magento log files not showing up?</title><link>http://www.letsmakeitgo.com/blog/2011/07/magento-log-files-not-showing-up/</link> <comments>http://www.letsmakeitgo.com/blog/2011/07/magento-log-files-not-showing-up/#comments</comments> <pubDate>Thu, 21 Jul 2011 19:01:34 +0000</pubDate> <dc:creator>Clay Simmons</dc:creator> <category><![CDATA[Magento]]></category><guid
isPermaLink="false">http://www.letsmakeitgo.com/blog/?p=68</guid> <description><![CDATA[If your Magento log files aren&#8217;t showing up as expected in var/log/ on your web server, it&#8217;s probably because Magento can&#8217;t write to that directory. Even if you change all permissions to 777, Magento may still have an issue creating &#8230; <a
href="http://www.letsmakeitgo.com/blog/2011/07/magento-log-files-not-showing-up/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>If your Magento log files aren&#8217;t showing up as expected in var/log/ on your web server, it&#8217;s probably because Magento can&#8217;t write to that directory. Even if you change all permissions to 777, Magento may still have an issue creating and writing the files. I don&#8217;t know why. It&#8217;s probably due to some subtle aspect of my server&#8217;s configuration.</p><p>Anyway, if you want to know for sure where Magento is writing the log files, put this in a script:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$var_dir</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;">'core/config'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getVarDir</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$var_dir</span><span style="color: #339933;">;</span></pre></div></div><p>In my case, I discovered it was writing the files /tmp/magento/var. When I logged in via SSH as root, sure enough, there were all my missing log files.</p><p>I hope this helps someone.</p> ]]></content:encoded> <wfw:commentRss>http://www.letsmakeitgo.com/blog/2011/07/magento-log-files-not-showing-up/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Magento &#8211; Echo the URL of a CMS Page in PHP</title><link>http://www.letsmakeitgo.com/blog/2011/07/magento-echo-the-url-of-a-cms-page-in-php/</link> <comments>http://www.letsmakeitgo.com/blog/2011/07/magento-echo-the-url-of-a-cms-page-in-php/#comments</comments> <pubDate>Mon, 11 Jul 2011 18:40:55 +0000</pubDate> <dc:creator>Clay Simmons</dc:creator> <category><![CDATA[Magento]]></category> <category><![CDATA[Programming]]></category><guid
isPermaLink="false">http://www.letsmakeitgo.com/blog/?p=61</guid> <description><![CDATA[Just a quickie post that I hope helps a few people.  I wasn&#8217;t able to find anything quickly. So, in my template header.phtml file, I am setting up the navigation manually b/c the client wants all this fancy multi-column drop &#8230; <a
href="http://www.letsmakeitgo.com/blog/2011/07/magento-echo-the-url-of-a-cms-page-in-php/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Just a quickie post that I hope helps a few people.  I wasn&#8217;t able to find anything quickly.<br
/> <span
id="more-61"></span><br
/> So, in my template header.phtml file, I am setting up the navigation manually b/c the client wants all this fancy multi-column drop down nav stuff.  I obviously don&#8217;t want hard-coded URLs in the nav b/c the {{base_url}} of the site will change when the site goes live.  Plus, we might change URLs for SEO purposes down the line.</p><p>WordPress gives us the ability to do this with a simple:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$page_or_post_id</span><span style="color: #009900;">&#41;</span></pre></div></div><p>To do the same from your Magento template file, do this:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">Mage<span style="color: #339933;">::</span><span style="color: #004000;">Helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cms/page'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPageUrl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$page_id</span><span style="color: #009900;">&#41;</span></pre></div></div>]]></content:encoded> <wfw:commentRss>http://www.letsmakeitgo.com/blog/2011/07/magento-echo-the-url-of-a-cms-page-in-php/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Magento &#8211; Add Product Ratings Programmatically or Migrating Reviews and Ratings to Magento</title><link>http://www.letsmakeitgo.com/blog/2011/06/magento-add-product-ratings-programmatically-or-migrating-reviews-and-ratings-to-magento/</link> <comments>http://www.letsmakeitgo.com/blog/2011/06/magento-add-product-ratings-programmatically-or-migrating-reviews-and-ratings-to-magento/#comments</comments> <pubDate>Thu, 23 Jun 2011 21:12:39 +0000</pubDate> <dc:creator>Clay Simmons</dc:creator> <category><![CDATA[Magento]]></category> <category><![CDATA[Magento Data Migration]]></category><guid
isPermaLink="false">http://www.letsmakeitgo.com/blog/?p=55</guid> <description><![CDATA[This was originally one of my posts on the Magento forums, but I want to include it here too. This will explain how to add product ratings to Magento through php code. I was working on a shopping cart migration &#8230; <a
href="http://www.letsmakeitgo.com/blog/2011/06/magento-add-product-ratings-programmatically-or-migrating-reviews-and-ratings-to-magento/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>This was originally one of my <a
href="http://www.magentocommerce.com/boards/viewthread/231920/">posts on the Magento forums</a>, but I want to include it here too.  This will explain how to add product ratings to Magento through php code.</p><p><span
id="more-55"></span></p><p>I was working on a shopping cart migration to Magento Enterprise 1.10.0.2 and migrating customer reviews and ratings.  In the source cart, the reviews and ratings are one in the same. The user writes a review, gives it a title, then associates a star rating of 1-5 with the review.  Everything is stored in one database table.  In Magento, you can have reviews without star ratings and vice versa. The two are separate.  I was able to import the reviews from the source cart, but had more difficulty with the ratings.</p><p>In Magento, there are 3 default rating options:  Price, Quality, and Value.  All three need their “Visible In” attribute set to the store view where you want them to appear.  Since the source store only had one rating value of 1-5 associated with the product, I took that value and assigned it to all 3 rating options in Magento so that they all averaged out the same.</p><p>Here is the code I use to migrate the reviews.  This is inside a loop of reviews from the source cart:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Invoke the Magento environment</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'app/Mage.php'</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;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Set up your own loop to to go through the reviews from the source cart.</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Logic to look up customer that has already been migrated into magento.</span>
<span style="color: #666666; font-style: italic;">// So you have $_customer holding a Mage_Customer_Model_Customer</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// IMPORTANT: Set up customer session.</span>
<span style="color: #666666; font-style: italic;">// the rating/option model resource checks the customer session to get the customer ID.</span>
<span style="color: #000088;">$_session</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getSingleton</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'customer/session'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCustomer</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_customer</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCustomerAsLoggedIn</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_customer</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Add the review</span>
<span style="color: #000088;">$_review</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;">'review/review'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #339933;">-&gt;</span><span style="color: #004000;">setEntityPkValue</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_product</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;">-&gt;</span><span style="color: #004000;">setStatusId</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sc_to_mage_review_status</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$row_source_review</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Status'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row_source_review</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Title'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDetail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row_source_review</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Review'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #339933;">-&gt;</span><span style="color: #004000;">setEntityId</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</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: #009900;">&#41;</span>
    <span style="color: #339933;">-&gt;</span><span style="color: #004000;">setStores</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$store</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCustomerId</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_customer</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;">-&gt;</span><span style="color: #004000;">setNickname</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_customer</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getFirstname</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</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: #666666; font-style: italic;">// Map your rating_id to your option_id with an array or something</span>
<span style="color: #000088;">$rating_options</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// &lt;== Look at your database table `rating_option` for these vals</span>
	<span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">6</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">7</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">8</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">9</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	<span style="color: #cc66cc;">3</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">12</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">13</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">14</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Now save the ratings</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rating_options</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$rating_id</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$option_ids</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>
	try <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$_rating</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;">'rating/rating'</span><span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setRatingId</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rating_id</span><span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setReviewId</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_review</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;">-&gt;</span><span style="color: #004000;">addOptionVote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$option_ids</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$rating_value</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$_product</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: #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: #990000;">die</span><span style="color: #009900;">&#40;</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: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span></pre></div></div><p>If you execute this, your reviews will save, but your ratings won&#8217;t.  There is one more thing you need to do in order for them to save.  I don&#8217;t advocate modifying core files, but in this case, I had to.  It was in my dev environment and I only needed to make the change for the purpose of the migration script.  Once, finished, I reverted the file back to it&#8217;s default version.</p><p>Look on line 84 of this file.  This is the model resource for the rating/option model in Magento.  This is where all the db inserts/updates happen.</p><pre>app/code/core/Mage/Rating/Model/Mysql4/Rating/Option.php</pre><p>You need to replace line 84 with this:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">===</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$action</span> instanceof Mage_Core_Controller_Front_Action <span style="color: #339933;">||</span> <span style="color: #000088;">$action</span> instanceof Mage_Adminhtml_Controller_Action<span style="color: #009900;">&#41;</span></pre></div></div><p>This is a conditional check to make sure that the rating update request came from a Magento controller action.  Since they don&#8217;t, in this case, I have to force the condition to evaluate as true.  Maybe there&#8217;s a better way to spoof the request, but I don&#8217;t know how to do it.</p><p>That&#8217;s it.  You should be good to go.  Happy migration!</p> ]]></content:encoded> <wfw:commentRss>http://www.letsmakeitgo.com/blog/2011/06/magento-add-product-ratings-programmatically-or-migrating-reviews-and-ratings-to-magento/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Magento &#8211; Attach Products to Orders Programmatically</title><link>http://www.letsmakeitgo.com/blog/2011/06/magento-attach-products-to-orders-programmatically/</link> <comments>http://www.letsmakeitgo.com/blog/2011/06/magento-attach-products-to-orders-programmatically/#comments</comments> <pubDate>Thu, 23 Jun 2011 12:55:38 +0000</pubDate> <dc:creator>Clay Simmons</dc:creator> <category><![CDATA[Magento]]></category> <category><![CDATA[Magento Data Migration]]></category><guid
isPermaLink="false">http://www.letsmakeitgo.com/blog/?p=45</guid> <description><![CDATA[I&#8217;ve been heads down on a project recently where I&#8217;ve had to migrate a ton of legacy data from two cart systems into Magento.  The client discontinued use of the Cart A two years ago, but there were ~21,000 orders &#8230; <a
href="http://www.letsmakeitgo.com/blog/2011/06/magento-attach-products-to-orders-programmatically/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I&#8217;ve been heads down on a project recently where I&#8217;ve had to migrate a ton of legacy data from two cart systems into Magento.  The client discontinued use of the Cart A two years ago, but there were ~21,000 orders in that system that were imported into Cart B, which holds the remaining ~15,000 orders.</p><p><span
id="more-45"></span></p><p>When Cart A was imported into Cart B, the orders had products that did not yet exist in Cart B.  The programmer responsible for that move didn&#8217;t see it necessary to create the missing products in Cart B, so Cart B ended up with around 6,000 orders with no product line items.  In other words, people called in to the client&#8217;s customer service and if that customer inquired about one of the aforementioned orders, then the client couldn&#8217;t even see what items were ordered.</p><p>I was able to achieve a 1-to-1 migration of all data in Cart B to Magento, but that meant I still had the problem of orders with no product line items.</p><p>I still had the legacy orders from Cart A in a 15 mb Excel file.  Each line in the Excel file represented one order.  All of the data on one line, fully de-normalized.  Anyway, after writing a script to parse the Excel file, find the missing products, and insert the missing products into Magento, I was ready to attach those products to their respective orders.  Here&#8217;s how that&#8217;s done.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Load the order however you wish. I had the $increment_id already.</span>
<span style="color: #000088;">$order</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;">'sales/order'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadByIncrementId</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$increment_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$rowTotal</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPrice</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$qty</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$order_item</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;">'sales/order_item'</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setStoreId</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">NULL</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuoteItemId</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">NULL</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuoteParentItemId</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">NULL</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setProductId</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$product_id</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setProductType</span><span style="color: #009900;">&#40;</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;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQtyBackordered</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">NULL</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTotalQtyOrdered</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$qty</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQtyOrdered</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$qty</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setSku</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getSku</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPrice</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPrice</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setBasePrice</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPrice</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setOriginalPrice</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPrice</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setRowTotal</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rowTotal</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setBaseRowTotal</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rowTotal</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setOrder</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$order</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Saving order item...<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$order_item</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></pre></div></div><p>I had tried at first to use the addItem() method on the $order object itself, but calling $order-&gt;save() did nothing.  No error was thrown either.  I didn&#8217;t look into it much further, but this might be due to something in the Mage core code that prevents data from being saved if the request isn&#8217;t of type Front_Controller_Action.  That&#8217;s happened to me before when attempting to save product ratings programmatically.</p><p>Hope this helps people out there!</p> ]]></content:encoded> <wfw:commentRss>http://www.letsmakeitgo.com/blog/2011/06/magento-attach-products-to-orders-programmatically/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>TextMate FTP SSH Bundle Snow Leopard FIX</title><link>http://www.letsmakeitgo.com/blog/2010/01/textmate-ftp-ssh-bundle-snow-leopard-fix/</link> <comments>http://www.letsmakeitgo.com/blog/2010/01/textmate-ftp-ssh-bundle-snow-leopard-fix/#comments</comments> <pubDate>Thu, 14 Jan 2010 03:01:35 +0000</pubDate> <dc:creator>Clay Simmons</dc:creator> <category><![CDATA[Programming]]></category><guid
isPermaLink="false">http://www.letsmakeitgo.com/blog/?p=35</guid> <description><![CDATA[I use the FTP/SSH bundle for TextMate a lot and have gotten quite used to it.  It is quirky, but it has become an invaluable part of my development process.  When I upgraded to Snow Leopard, the bundle stopped working. &#8230; <a
href="http://www.letsmakeitgo.com/blog/2010/01/textmate-ftp-ssh-bundle-snow-leopard-fix/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I use the FTP/SSH bundle for TextMate a lot and have gotten quite used to it.  It is quirky, but it has become an invaluable part of my development process.  When I upgraded to Snow Leopard, the bundle stopped working.<span
id="more-35"></span></p><p>There are two fixes you need to apply.</p><h3>The first fix</h3><p>The first fixes problems if you&#8217;re getting errors like:</p><p>PHP Notice: Undefined index TM_PROJECT_FILEPATH<br
/> PHP Notice: Undefined index TM_DIRECTORY</p><p>You need to alter your /private/etc/php.ini file.  If you don&#8217;t have one, just copy the /private/etc/php.ini.default file to /private/etc/php.ini.  Look for this line:</p><p>variables_order = &#8220;GPCS&#8221;</p><p>Change it to:</p><p>variables_order = &#8220;GPCSE&#8221;</p><h3>The second fix</h3><p>Snow Leopard ships with PHP 5.3, which, in its default configuration, doesn&#8217;t recognize the $_ENV superglobal.  You have to call getenv() instead.  Since the FTP/SSH bundle relies heavily on the $_ENV variable, it breaks under Snow Leopard.  Luckily, there&#8217;s an easy fix.</p><h3>The Solution</h3><p>Open up TextMate and open the following folder:</p><pre>/Users/your_username/Library/Application Support/TextMate/Pristine Copy/Bundles/FTP:SSH.tmbundle/</pre><p>Use shift+cmd+f to do a global find/replace. For find, enter this:</p><pre>\$_ENV\['([A-Z_]+)'\]</pre><p>For replace, enter this:</p><pre>getenv('$1')</pre><p>Make sure you check the &#8220;Regular expression&#8221; box and click Find and then Replace All.</p><p>That&#8217;s it.  The bundle should start working properly.</p> ]]></content:encoded> <wfw:commentRss>http://www.letsmakeitgo.com/blog/2010/01/textmate-ftp-ssh-bundle-snow-leopard-fix/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> </channel> </rss>
<!-- Served from: www.letsmakeitgo.com @ 2011-12-14 19:18:28 by W3 Total Cache -->
