<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
  <channel>
    <title><![CDATA[Sitesquak Blog]]></title><meta http-equiv="X-UA-Compatible" content="IE=8" />
    <link>http://www.sitesquad.net/squak/</link>
    <description><![CDATA[Sitesquak Blog]]></description>
    <pubDate>Wed, 19 Jun 2013 17:30:28 +0000</pubDate>
    <generator>Zend_Feed</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <item>
      <title><![CDATA[Magento Collection Paging and Deletion]]></title><meta http-equiv="X-UA-Compatible" content="IE=8" />
      <link>http://www.sitesquad.net/squak/magento-collection-paging-deletion/</link>
      <description><![CDATA[<p>When working with Collections in Magento, it is often desirable to split the data into "Pages", whether you use them as literal pages or you just want to divide the data into subsets.  This helps with memory management on large collections, as well as better ability to tell where something has gone wrong if you're trying to debug a collection function.</p>

<p>However, there seems to be a significant issue in Magento's Paging code when you attempt to use a collection as a source for deleting items.  Let's look at a piece of example code: </p>

<pre class="prettyprint"><code class="language-php">$myCollection = Mage::getModel('test/model')->getCollection()->setPageSize(10);
for($page = 1; $page <= $myCollection->getLastPageNumber(); $page++)
{
    $myCollection->clear()->setCurPage($page)->load();
    //delete all items on this page
    foreach($myCollection->getItems() as $_item)
    {
        $_item->delete();
    }
}
</code></pre>

<p>What this code does is load up a collection, tell it that each page should only load 10 items at a time, and then attempt to loop through each page.  Unfortunately, the collection object does not have a built-in Iterator for pages themselves, or for items not on the current page, which could alleviate the issue we're discussing.</p>

<p>The problem here is that collections in Magento are lazy-loaded, which is a good thing: it means that unnecessary data is left behind, and allows for your memory usage to remain low on high-count operations if you split the operations properly.  Each time load() is called above, the following SQL is called: </p>

<pre class="prettyprint"><code class="language-sql">SELECT * FROM test_model_item_table LIMIT 10 OFFSET (calculated_offset_start)</code></pre>
<p>"calculated_offset_start" is a variable determined by Magento to be the start of the next page and sent into the SQL query.  Those with a keen eye for bad SQL will probably see the issue immediately: </p>
<p><img src="http://www.sitesquad.net/media/wysiwyg/magento_data_error.png" alt="" /></p>

<p>The Collection's current page offset calculator does not account for deleted data, because the collection itself doesn't manage the data.  While this is technically not a failing of the collection object, it causes a massive gotcha when deletes are done during the iteration.  This is enhanced by an actual bug in the collection, however, because it does not recalculate the value of getLastPageNumber(), so even if you use that as a guiding point, you will receive an incorrect number of pages.</p>

<p>The workaround to handle this is to always use Page 1 until you know that all operations have been performed, even on new entries to that page.  The Collection's walk function only addresses items within the currently loaded page, so it is unfortunately not an option.</p>

<p>Hopefully at some point in the future, the Collection object will build in a Page iterator to better handle these issues.  The ideal solution would be for aggregate functions to be available in the Collection itself, so it is not completely blind to the data inside.  I hope this post helped any strange collection deletion bugs you were having!</p>]]></description>
      <pubDate>Fri, 19 Oct 2012 14:25:00 +0000</pubDate>
    </item>
    <item>
      <title><![CDATA[Multi-Store Wishlist Bugfix for Magento]]></title><meta http-equiv="X-UA-Compatible" content="IE=8" />
      <link>http://www.sitesquad.net/squak/multistore-wishlist-magento-bugfix/</link>
      <description><![CDATA[<p>Magento just released a security bug fix bringing its community edition release number up to 1.7.0.2 (or if you&rsquo;re using Enterprise 1.12.0.2). Yes, you should upgrade, especially if you&rsquo;re using 1.7.0.0. If you are still running 1.6.x then ideally you&rsquo;ve at least made it to 1.6.2.0. You can get those security fixes from Magento <a title="Magento Blog" href="http://www.magentocommerce.com/blog/comments/update-zend-framework-vulnerability-security-update/" target="_blank">here</a> or you can drop by our slowly growing bug-fix repository <a title="Sitesquash - Magento Bug Fixes" href="https://github.com/Sitesquad/Sitesquash" target="_blank">SiteSquash</a> for the security update &ndash; and more.<br /> <br /> One of the Magento bug-fixes in the repository is a correction for how wishlists display in customer&rsquo;s accounts. It&rsquo;s been around since--- well, for a long time and hasn&rsquo;t been addressed. It&rsquo;s not a bug you&rsquo;d notice if you aren&rsquo;t running multiple store views in which a product has a different name or other detail set in the store views. We&rsquo;ve seen this with people running a Magento installation with multiple languages wherein each store view is set as different language and product names and other details are modified in the catalog on a store view level to be in the respective language of the store. In this, or a similar multi-view store, when a customer adds an item to their wishlist, that items doesn&rsquo;t always show in the wishlist product list in the store language they are using.<br /> <br /> This Magento bug occurs because products are essentially website based, so any product is the same throughout the store views (i.e. inventory-wise). The wishlist however goes through the product-collection with a filter of an array of stores. Now the wishlist resource collection does have a filter for an array of stores, however the product collection does not &ndash; and the wishlist model attempts to get the product collection with an array of stores.<br /> <br /> Now often the tricky part of fixing bugs, is determining how to fix them. The wishlist items are stored based on store views, however products themselves are essentially grounded in websites. So the question is - Do we show the wishlist items as they were added &ndash; according to the store view? Or do we show them as they would be seen in the current store view of the customer? The fix in <a title="Sitesquash - Magento Bug Fixes" href="https://github.com/Sitesquad/Sitesquash" target="_blank">Sitesquash</a> goes with the latter &ndash; keeping the consistency of the store view display intact.<br /> <br /> Magento bugs related to this:<br /> <a href="http://www.magentocommerce.com/bug-tracking/issue?issue=13876">http://www.magentocommerce.com/bug-tracking/issue?issue=13876</a><br /> <a href="http://www.magentocommerce.com/bug-tracking/issue?issue=13624">http://www.magentocommerce.com/bug-tracking/issue?issue=13624</a><br /> <a href="http://www.magentocommerce.com/bug-tracking/issue?issue=11262">http://www.magentocommerce.com/bug-tracking/issue?issue=11262</a> (sortof)<br /> and probably others&hellip;</p>]]></description>
      <pubDate>Wed, 11 Jul 2012 18:59:10 +0000</pubDate>
    </item>
    <item>
      <title><![CDATA[Our own Magento 1.6.1 upgrade notes ]]></title><meta http-equiv="X-UA-Compatible" content="IE=8" />
      <link>http://www.sitesquad.net/squak/161-magento-upgrade/</link>
      <description><![CDATA[<p>A couple weeks ago we upgraded our Magento site and another one to 1.6.1. So we're down with 1.6.1, if you <a href="/magento-upgrades">need an upgrade</a>.  As usual, we stumbled into some things. Enjoy. </p> 

<h3>SQL Error 150 - Can't create table ....</h3>

<p>You might run into this error when Magento is trying to create tables with foreign key assignments to tables that do not yet exist. When this happens find the line in the setup script triggering that error and surround it with the following commands:</p>

<pre class="prettyprint linenums:77 lang-js">
$installer->run("
 set foreign_key_checks = 0 ;"
);


.... other installer code ...


$installer->run("
 set foreign_key_checks = 1 ;"
);
</pre>
<br />
<p>Then, trigger the installation again and after successful execution remove the modifications.</p>

<h3>Code Changes</h3>

<ul>
<li>If you extend / overwrote Customer/controllers/AccountController.php, you must update any code involving the Forgot Password system. It has been changed considerably. Your code now must call a different function to send the email, and must include the code to generate an authorization token for reset. </li>
<li>If your changes involve latching onto the Forgot Password events, be sure to update them accordingly to listen for the new Reset Password actions.</li>
</ul>

<h3>Configuration Changes</h3>

<p><strong>Forgot Password Email Template Assignment:</strong></p>

<p>The template set for "Forgot Password" under System > Configuration > Customers:Customer Configuration must be changed to a new template based off of the new Forgot Password template.  If it is not changed, all forgot password emails will be blank, as the forgot-password system in Magento has been completely changed. (see also Design Changes, next)</p>

<h3>Design Changes</h3>

<p>Templates:</p>

<p>New templates:<br />
/customer/form/resetforgottenpassword.phtml</p>

<p>Email templates:<br />
If the Forgot Password email template had been customized, a new template will need to be created and customized, as the forgot-password system in Magento has completely changed (see also Configuration Changes).</p>

<p>XML Updates:<br />
If you have a custom "customer.xml" in your theme, it must be updated with the customer_account_resetpassword section from the base-default XML. It will not pick this up automatically. If you do not make this change, all attempts to reset a customer password will fail with a 500 server error.</p>

<h3>Extension Issues</h3>

<p>We're only running the AheadWorks blog, so our exposure here is rather limited.</p> 

<p>AheadWorks Blog v1.0.22 (AW All v2.1.2)<br />
Version numbers above 1.6 for Magento are not properly recognized, and may cause the extension to think you are running a bad version of Magento (and disable itself).  You must change the version number defined in app/code/local/AW/All/Helper/Config.php .</p>

<p>Various Unknowns<br/>
Magento 1.6 tightens it's reins when it comes to table storage types and foreign key constraints. Any module which modifies a core table, index, or key constraint has a good chance to run into (or cause) problems (before or after) when upgrading.</p>]]></description>
      <pubDate>Sat, 12 Nov 2011 15:03:06 +0000</pubDate>
    </item>
    <item>
      <title><![CDATA[Magento Security - Where'd that E-mail Go?]]></title><meta http-equiv="X-UA-Compatible" content="IE=8" />
      <link>http://www.sitesquad.net/squak/magento-email-security/</link>
      <description><![CDATA[<p>Remember when you accidentally sent that e-mail of the quiz cheat sheet to your professor instead of your classmate? Well, sometimes security (or privacy depending on how you look at it) isn't just making sure your site isn't open to an injection attack. It can also be as simple as making sure a tiny mistake isn't made. If you're using a Magento version that isn't at least 1.6, here's one configuration item we need to correct immediately.</p>

<p>Magento allows administrators to create orders that do not include an e-mail address. This makes sense as there are certainly situations where such an order would be placed without one. In cases such as these Magento will create a fictitious e-mail address for the order. By default (up through Magento 1.5.x) that e-mail address will look something like 234234252@emaildomain.com.<br/>
See the problem?</p>

<p>Sure, we could be thinking - "But it's just for customer orders" or "I don't check the box to send the order e-mail" or "Who makes an order in the admin?" or any number of thoughts which seem to make this a non-issue.</p>

<p>Unfortunately, it's a huge issue. A simple click in the wrong place and we just sent out our customers private information to a stranger. Specifically with this default setting it's entirely possible to send out a customers order information to the owners of "emaildomain.com". It makes me cringe to imagine how many they may have received.</p>

<p>It's all fine and good when speaking to give an example like user@domain.com or me@mycompany.com because we have a high hope of conveying that it is an example and not to be used literally. With a default configuration however, what is or isn't to be used is not so clear cut. We kind of expect that a default configuration is either acceptable or will in no way work without changing. To know what is an acceptable default value we should know that there are only four 'reserved' top-level domains. That is, domains which are not able to be resolved over public networks (and that includes e-mail). These domains are: example, invalid, localhost, and test (read more about <a href="http://tools.ietf.org/html/rfc2606#section-2" target="_mc">reserved TLDs here</a>). Which means an e-mail address of user@example.com will never (should never) go anywhere, but user@emaildomain.com will go to someone, just as user@gmail.com will - except not the person we intend or not intend as the case may be<sup style="font-size:75%">1</sup>. </p>

<p>Thankfully this was noticed (how it took so long will be an untold story) and reported in this <a href="http://www.magentocommerce.com/bug-tracking/issue?issue=11556" target="_mc">bug report</a>. In the 1.6.x branch of Magento we don't have to worry about this little item. For those of us who haven't upgraded yet - the fix is pretty simple. In the Magento configuration go to:<br/>
<strong>Configuration-&#62;Customer Configuration-&#62;Create New Account Options</strong><br/>
and change <strong>Default Email Domain</strong> from "emaildomain.com" to "example.com" and save.</p>

<p>Alternatively we can change the file: app/code/core/Mage/Customer/etc/config.xml looking for a line like:<br/>
&#60;email_domain&#62;emaildomain.com&#60;/email_domain&#62;<br/>
and changing it to:<br/>
&#60;email_domain&#62;example.com&#60;/email_domain&#62;<br/>
Just in case, we'll want to check the configuration in the admin of Magento to make sure it sticks.</p>

<p>We could set this to a different domain such as 'invalid.com' or 'test.com' or even our own company domain. With the last we need to still keep in mind what is happening - as it has consequences. The use of 'example.com' is probably best in any case.</p>

<p>That's all there is to it. We and our customers can now rest just a bit easier tonight.</p>

<p style="font-size:75%"><sup>1</sup> Technically, the MX record for emaildomain.com does not resolve at the time of this writing, so a misplaced e-mail still won't get anywhere. That doesn't mean it couldn't - and that's what we want to prevent.</p>]]></description>
      <pubDate>Wed, 26 Oct 2011 21:05:45 +0000</pubDate>
    </item>
    <item>
      <title><![CDATA[Two (more) Magento Checkout Bugs for the Price of One]]></title><meta http-equiv="X-UA-Compatible" content="IE=8" />
      <link>http://www.sitesquad.net/squak/two-magento-checkout-js-bugs/</link>
      <description><![CDATA[<p>Depending on the shipping methods configured for your store, your customers may be running into a few javascript errors. Unfortunately occurrences of various errors as part of the purchase transaction isn't anything new. The good news is the two here aren't show-stoppers, which may explain why the core code has remained unchanged over so many releases. </p>

<p>For a little background we can read that the two issues are in Magento's field of vision with <a href="http://www.magentocommerce.com/bug-tracking/issue?issue=11241" target="_mc" rel="nofollow">this bug 25547</a> which still seems open and <a href="http://www.magentocommerce.com/bug-tracking/issue?issue=12060" target="_mc" rel="nofollow">this bug 26296</a> which hints that perhaps, just maybe, a fix will be in 1.6.1. A Magento forum discussion to this can be found <a href="http://www.magentocommerce.com/boards/viewthread/238233" target="_mc" rel="nofollow">here</a> and as well <a href="http://www.magentocommerce.com/boards/viewthread/234230/" target="_mc" rel="nofollow">here</a> among other places. </p>

<p>Let's just fix it. The file giving grief we'll find here:<br/>
app/design/frontend/base/default/template/checkout/onepage/shipping_method/available.phtml<br/>
or your theme's version of it. If you don't have one in your theme, you'll probably want to copy the base/default one now. Towards the end of the file you'll see a javascript function <strong>includingShipping</strong>:</p>
<pre class="prettyprint linenums:77 lang-js">
function includingShipping(getShippingCode)
{
	&#60;?php if (!empty($shippingMe)): ?&#62;
	var newPrice = shippingMe[getShippingCode];
	if (!lastPrice) {
		lastPrice = newPrice;
		quoteBaseGrandTotal += newPrice;
	}
	if (newPrice != lastPrice) {
		quoteBaseGrandTotal += (newPrice-lastPrice);
		lastPrice = newPrice;
	}
</pre>
<p>The lines we're interested in are 81, 83, and 86. There are a few ways to rewrite this code depending on your tastes. For example In line 81 we are given:</p>
<pre class="prettyprint linenums:81 lang-js">
	if (!lastPrice) {
</pre>
<p>While such a conditional may pass muster with PHP, it doesn't with Javascript. This line has the chance to produce the error: <strong>lastPrice is not defined</strong> because, straightforwardly, lastPrice is not always defined. 'Not always' meaning lastPrice is conditionally defined earlier in this file at around line 50. We can work with this pretty easily either by ensuring lastPrice is always set, or re-writing the conditional which checks it to be a bit more stable like so:</p>
<pre class="prettyprint linenums:81 lang-js">
	if (typeof lastPrice === 'undefined') {
</pre>
<p>Which brings us to the other occurrence of an undefined variable - quoteBaseGrandTotal. Like lastPrice, it isn't necessarily defined. So doing any math with it has a chance of ending with a bit of a sting. quoteBaseGrandTotal may be called on line 83 or 86 (or possibly both). Following the lastPrice change above, we add a check for it to see if it is defined, and from that decide how to do the math. After a bit of tape and solder we arrive with:</p>
<pre class="prettyprint linenums:77 lang-js">
function includingShipping(getShippingCode)
{
	&#60;?php if (!empty($shippingMe)): ?&#62;
	var newPrice = shippingMe[getShippingCode];
	if (typeof lastPrice === 'undefined') {
		lastPrice = newPrice;
		if(typeof quoteBaseGrandTotal === 'undefined') {
			quoteBaseGrandTotal = newPrice;
		} else {
			quoteBaseGrandTotal += newPrice;
		}
	}
	if (newPrice != lastPrice) {
		if(typeof quoteBaseGrandTotal === 'undefined') {
			quoteBaseGrandTotal = (newPrice-lastPrice);
		} else {
			quoteBaseGrandTotal += (newPrice-lastPrice);
		}
		lastPrice = newPrice;
	}
</pre>
<p>Which should keep the math as intended and remove two possible errors from our customers shopping experience. Keep your fingers crossed for 1.6.1!</p>
<script type="text/javascript">prettyPrint();</script>]]></description>
      <pubDate>Tue, 11 Oct 2011 12:31:51 +0000</pubDate>
    </item>
    <item>
      <title><![CDATA[Guide: Packaging a Magento Extension]]></title><meta http-equiv="X-UA-Compatible" content="IE=8" />
      <link>http://www.sitesquad.net/squak/guide-packaging-magento-extension/</link>
      <description><![CDATA[<p>To use Magento Connect's Extension Packaging tool, open the Admin Panel where you have the extension installed that you want to package.  Then, navigate to <em>System > Magento Connect > Package Extensions</em>.  Once there, you will be greeted with a screen similar to the one below.  In our example, I'll be packaging up an early version of <strong>Sitesquad InPageReviews</strong>, so that we can install it on separate development sites easily.</p>


<h2>Page 1: Package Information</h2>
<a href="http://www.sitesquad.net/media/wysiwyg/blog_images/guides/extension_packaging/Page1.png" class="blog-image"><img src="http://www.sitesquad.net/media/wysiwyg/blog_images/guides/extension_packaging/Page1_s.png" alt="" class="blog-image center" id="blog-image-0" width="650px" /></a>

<p>The first page is fairly straightforward.  First, you have <strong>Name</strong>, which is the name of the package you're releasing. There's also <strong>Channel</strong>, which can vary, but should probably be the name of the company/team you're releasing it under.</p>

<p><strong>Supported Releases</strong> is an option to signify the compatibility of your extension.  With the release of Magento 1.6.0, I wouldn't be surprised to see a third option appear in that list, due to all the large changes that have taken place.  <strong>Summary</strong> and <strong>Description</strong> should be filled with, respectively, short and detailed descriptions of the functions your extension offers, and who it is aimed at.  <strong>License</strong> will store your license agreement version, with an option <strong>License URI</strong> to directly link to the terms</p>

<p>All the information on this page will be stored in a Metadata XML file that will be created along with your packaged extension.</p>

<h2>Page 2: Release Information</h2>
<a href="http://www.sitesquad.net/media/wysiwyg/blog_images/guides/extension_packaging/Page2.png" class="blog-image" ><img src="http://www.sitesquad.net/media/wysiwyg/blog_images/guides/extension_packaging/Page2_s.png" alt="" class="blog-image center" id="blog-image-1" width="650px" /></a>

<p>Just as page 1 was about your extension as a whole, page 2 focuses on this specific release, since a growing extension can have several.  <strong>Release Version</strong> should match the extension version you have defined in <em>etc/config.xml</em>, though that is not directly enforced by Magento.  <strong>Notes</strong> allow you to add specific details about this release, which in most extensions should probably list new features, fixed errors, known bugs, or any other information that is especially important to a user who could be upgrading from a previous version.</p>

<p><strong>Release Stability</strong> is an important field - it allows you to show which stage of release this version is!  The options are:
<ul>
<li><em>Development</em> - Generally an internal build, being packaged for testing</li>
<li><em>Alpha</em> - A "first release" possibly, or more often the first development build where all the core features are complete</li>
<li><em>Beta</em> - The extension is nearing full release, and you may want to put out a more publicly available Beta version for experienced users to test</li>
<li><em>Stable</em> - Your extension is ready for the public, with minimal bugs or errors known.</li>
</ul>

<h2>Page 3: Authors</h2>
<a href="http://www.sitesquad.net/media/wysiwyg/blog_images/guides/extension_packaging/Page3.png" class="blog-image"><img src="http://www.sitesquad.net/media/wysiwyg/blog_images/guides/extension_packaging/Page3_s.png" alt="" class="blog-image center" id="blog-image-2" width="650px" /></a>

<p>Page 3 is very simple - you just list out all the developers/authors for this extension!  You can add as many authors here as you would like.</p>

<h2>Page 4: Dependencies</h2>
<a href="http://www.sitesquad.net/media/wysiwyg/blog_images/guides/extension_packaging/Page4.png" class="blog-image"><img src="http://www.sitesquad.net/media/wysiwyg/blog_images/guides/extension_packaging/Page4_s.png" alt="" class="blog-image center" id="blog-image-3" width="650px" /></a>

<p>Dependencies are a step that many extensions will probably need to pay very little attention to, but is also an incredibly important detail to some!  If you don't properly define what your extension depends on, users without proper requirements may try and use it to no avail, resulting in bad reviews or a very bad user experience.</p>

<p><strong>Minimum and Maximum PHP Versions</strong> are fairly direct.  The minimum should be the earliest version that your most modern PHP language feature was introduced - in most cases, a rough milestone version like 5.1.0 or 5.2.0 is good enough if you do not know exactly when the feature was introduced, but you should try your best to find the exact release.  Maximum version is usually of much less concern, as you only need to worry about it if a feature you use is marked for deprecation or has been removed.  Setting this to a future release of PHP is often an acceptable option.</p>

<p><strong>Packages</strong and <strong>Extensions</strong> are where you define the names and versions of PHP extensions or add-ons that you make use of in your Magento Extension.  A common example could be the GD Library, used for generating images - it is not a guaranteed on every user's PHP installation.  Make sure to define any external PHP libraries you make use of here, so users know what is required by your extension to use it.</p>

<h2>Page 5: Contents</h2>
<a href="http://www.sitesquad.net/media/wysiwyg/blog_images/guides/extension_packaging/Page5.png" class="blog-image"><img src="http://www.sitesquad.net/media/wysiwyg/blog_images/guides/extension_packaging/Page5_s.png" alt="" class="blog-image center" id="blog-image-4" width="650px" /></a>

<p>Finally!  The meat and bones of the extension packaging process - defining exactly what gets packaged!  This page can be a bit confusing at first.  The <strong>Target</strong> field is the section of Magento's directory structure you're pulling the files from.  Here is a direct definition of what each of those options point to:</p>
<ul>
<li><strong>Magento Local module file:</strong> ./app/code/local</li>
<li><strong>Magento Community module file:</strong> ./app/code/community</li>
<li><strong>Magento Core team module file:</strong> ./app/code/core</li>
<li><strong>Magento User Interface (layouts, templates):</strong> ./app/design</li>
<li><strong>Magento Global Configuration:</strong> ./app/etc</li>
<li><strong>Magento PHP Library file:</strong> ./lib</li>
<li><strong>Magento Locale language file:</strong> ./app/locale</li>
<li><strong>Magento Media library:</strong> ./media</li>
<li><strong>Magento Theme Skin (Images, CSS, JS):</strong> ./skin</li>
<li><strong>Magento Other web accessible file:</strong> .</li>
<li><strong>Magento PHPUnit test:</strong> ./tests</li>
<li><strong>Magento other:</strong> .</li>
</ul>

<p>The <strong>Path</strong> should be relative to the Target you selected, with the <strong>Type</strong> noting whether you've pointed to a direct file or a directory.  Most extensions will have at least 4 entries here - the path to the code, the path to the templates, the path to the module config file, and the path to the layout config file.  Of course, some modules may have more or even less - that all depends on what you're doing!</p>

<p>The <strong>Include</strong> and <strong>Ignore</strong> fields allow you to limit what gets packaged into the extension from a recursive directory input.  It takes wildcard inputs looking for filetypes or otherwise (for example, if you kept a log in an included file - you could add "*.log" to the Ignore section), and uses the "#" character as a delimiter.  If your extension properly respects the Magento design method of separating logic and output, these will most likely be unnecessary for almost all extensions.</p>

<h2>Saving and Accessing Your Extension</h2>

<p>At this point, you have defined everything Magento needs to know about your extension.  Clicking "Save As" will let you name your extension package within Magento (we'll return to this).  <strong>Save Data and Create Package</strong>  will then commit your newest version to the record, and create a packaged file for you.  You can find that file in your <em>var/connect</em> folder, named <strong>YourExtension_Version.tgz</strong>.  You will also find the file <strong>YourExtension.xml</strong>, which has all the metadata you inserted in step 1.  From here, you can use these files to import your extension easily through Magento Connect to any installation of Magento!</p>

<h2>Making Changes or a New Version (Page 6)</h2>
<a href="http://www.sitesquad.net/media/wysiwyg/blog_images/guides/extension_packaging/Page6.png" class="blog-image"><img src="http://www.sitesquad.net/media/wysiwyg/blog_images/guides/extension_packaging/Page6_s.png" alt="" class="blog-image center" id="blog-image-5" width="650px" /></a>

<p>So, you've packaged and released your extension.  But like any piece of software, it will need changes!  Fixes and new features are commonplace.  Luckily, once you've created your extension, you don't have to go through the hassle of inserting all the same information over and over again.  Once you save it, you can easily load it from Page 6: <strong>Load Local Package</strong> any time you want.  Clicking one of your packages on this screen will populate the other pages with all the information you previously saved, meaning you only have to make minor changes - version, notes, and maybe a folder change or two.  It makes rolling out new releases quick and simple.</p>

<p>Hopefully this guide helps you get your site's extensions ready to roll out.  If you have any questions I didn't address here, post them in the comments and we can try and help you out!</p>
]]></description>
      <pubDate>Fri, 07 Oct 2011 16:59:42 +0000</pubDate>
    </item>
    <item>
      <title><![CDATA[Failing Uploads in the Magento Admin]]></title><meta http-equiv="X-UA-Compatible" content="IE=8" />
      <link>http://www.sitesquad.net/squak/magento-no-upload/</link>
      <description><![CDATA[<p>Magento sure can be an insecure child. Sometimes it just wants to know that a resource it shouldn't be using exists, just for the sake of knowing it's there. I guess we've all been there at some point in our lives.</p>

<p>Not a few people have reported in various forms that uploading media files in the admin is broken. At least the appearance of being broken. If you find that when you upload a file or create a folder in the WYSIWYG editor in the admin and then it seems to disappear - then maybe we've walked the same path. What' makes this issue fun is that you don't see an error message. Folders and files just seem to vanish. We all know disappearing resources can make even the Doctor concerned, so let's get to the bottom of it.</p>

<p>You're not going to get a reminder to check your folder permissions, you've already done that (for the love of everything good please have tried that already). If you hit the forums, you've probably already read through <a href="http://www.magentocommerce.com/boards/viewthread/229717/" target="_mc">this thread</a>, or <a href="http://www.magentocommerce.com/boards/errors.php/viewthread/220720/P0/" target="_mc">this thread mentioning two fixes</a>, or any number of other discussions which talk about not being able to create folders. Again, the key to to this issue is that it appears as if they are not created, while browsing the file system shows that the uploaded files and directories created are indeed there. This might fool us into thinking that Magento is having a problem reading the file system.</p>

<p>Magento can read the file system just fine. What it can't read is a table in the database. Mostly because it hasn't created the table. Welcome to <a href="http://www.magentocommerce.com/bug-tracking/issue?issue=11242" target="_mc">your bug</a>.</p>

<p>The second thread above actually does note a fix by creating the table, however there is another way that will put things right without guessing at what code to write. The issue (in this case) is that Magento is looking for a table or two it didn't create (yet). They are 'core_file_storage' and 'core_directory_storage'. This problem is mentioned <a href="http://www.magentocommerce.com/boards/viewthread/219878/" target="_mc">here</a> directly. There is an error message stating one or both of those tables do not exist. Of course you won't find that thread so easily if you don't see an error message.</p>
<p>The problem is that the Magento module responsible (it's called core) for this storage functionality doesn't create the tables as we are taught in the 'Magento Way' with the _mysql setup files. Magento only creates the tables only if the database is set to be used as the media storage. That kind of decision makes some sense, but it's only good if it's followed through.</p>
<p>Check out app/code/core/Mage/Core/etc/config.xml and you'll notice in global/models/core_mysql/entities two tables file_storage and directory_storage noted. Then check that version number and jump over to app/code/core/Mage/Core/sql/core_setup/. Find your version number and read the setup file. See any table creation that mentions either table? Do any of the setup files? If you're using any of the 1.5 releases chances are you are shaking your head.
</p>
<p>There is a table creation in app/code/core/Mage/Core/Model/Mysql4/File/Storage/Database.php - however that is only run when the storage setting is the database, not when Magento is setup. And there is half of what we are looking for.</p>
<p>So if your folders and uploaded files seem to disappear or not show up in the Magento WYSIWYG editor, but actually do exist on the filesystem, then the following will probably work for you:
<ul>
<li>Go to System->Configuration->Advanced/System->Storage Configuration Media;</li>
<li>Change Media Storage to 'Database';</li>
<li>Click Syncronize;</li>
<li>Wait for "syncronizing message" to stop showing, refill your mug;</li>
<li>Change Media Storage back to 'File System';</li>
<li>Fini</li>
<li>Bonus: There's no need to save the configuration as nothing has changed!</li>
<li>Double Bonus: Feel free to truncate the two tables 'core_directory_storage' and 'core_files_storage' from you database if you like. They aren't actually used for storage if you are using the file system.</li>
</ul>
You don't need to 'syncronize' twice because everything should already be the same and the changes were never used to upload files. So what happened? The switching and synchronizing of the storage medium prompts Magento to create the tables in your database. So the next time Magento tries to read the files in the file system, the tables it wants to know exist in the database, will be there.</p>

<p>How does Magento fix it in 1.6? They dropped the functionality.</p>

<p>This brings up two entirely different issues. One, if the storage system is set to use the File System, why is the Magento checking the database for the files or directories to begin with? And two, why isn't an error being thrown when it can't locate a resource? The former is an enigma, the latter the subject of another article...
</p>]]></description>
      <pubDate>Fri, 07 Oct 2011 15:51:43 +0000</pubDate>
    </item>
  </channel>
</rss>
