<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Nick Says</title>
	
	<link>http://www.nicksays.co.uk</link>
	<description>a magento developer based in Bath</description>
	<lastBuildDate>Thu, 05 Aug 2010 08:33:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/nicksays" /><feedburner:info uri="nicksays" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license><feedburner:emailServiceId>nicksays</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Magento 1.4.1.1 Events Cheat Sheet</title>
		<link>http://feedproxy.google.com/~r/nicksays/~3/lniqpgNbaUg/</link>
		<comments>http://www.nicksays.co.uk/2010/07/magento-1_4_1_1-events-cheat-sheet/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 22:25:26 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.nicksays.co.uk/?p=493</guid>
		<description><![CDATA[I&#8217;ve updated the events cheat sheet for Magento version 1.4.1.1.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve updated the <a href="http://www.nicksays.co.uk/magento_events_cheat_sheet/">events cheat sheet</a> for Magento version 1.4.1.1.</p>
<img src="http://feeds.feedburner.com/~r/nicksays/~4/lniqpgNbaUg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nicksays.co.uk/2010/07/magento-1_4_1_1-events-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.nicksays.co.uk/2010/07/magento-1_4_1_1-events-cheat-sheet/</feedburner:origLink></item>
		<item>
		<title>Custom Magento Module Log</title>
		<link>http://feedproxy.google.com/~r/nicksays/~3/cPlohqbs0Ds/</link>
		<comments>http://www.nicksays.co.uk/2010/07/custom-magento-module-log/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 13:31:17 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.nicksays.co.uk/?p=487</guid>
		<description><![CDATA[PHP errors and messages from other modules can clutter up your tail -f when debugging, and sometimes it&#8217;s just nice to have separate logs to the main system. Set up your own log adapter with: $my_log = Mage::getModel&#40;'core/log_adapter', 'my_module.log'&#41;; and &#8230;]]></description>
			<content:encoded><![CDATA[<p>PHP errors and messages from other modules can clutter up your <code>tail -f</code> when debugging, and sometimes it&#8217;s just nice to have separate logs to the main system.<span id="more-487"></span></p>
<p>Set up your own log adapter with:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$my_log</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/log_adapter'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_module.log'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>and log away!</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$my_log</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Extra points for wrapping it up in a class:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Nick_Module_Model_Log <span style="color: #009900;">&#123;</span>
  protected <span style="color: #000088;">$_adapter</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_adapter <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/log_adapter'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_module.log'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// It's public incase we want to use -&gt;debug(), -&gt;info(), and friends</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getAdapter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_adapter<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAdapter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$my_log</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;">'nick/log'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$my_log</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Logging away!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/nicksays/~4/cPlohqbs0Ds" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nicksays.co.uk/2010/07/custom-magento-module-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nicksays.co.uk/2010/07/custom-magento-module-log/</feedburner:origLink></item>
		<item>
		<title>Auto-populate Magento Checkout Fields</title>
		<link>http://feedproxy.google.com/~r/nicksays/~3/IM-qJV2Rya4/</link>
		<comments>http://www.nicksays.co.uk/2010/07/auto-populate-magento-checkout-bookmarklet/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 10:21:22 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.nicksays.co.uk/?p=474</guid>
		<description><![CDATA[It&#8217;s annoying having the fill out the account details whenever you&#8217;re debugging the Magento checkout, so why not have JavaScript do it for you? Here&#8217;s a handy bookmarklet to get you on your way. Magento: Auto-populate Checkout Drag it to &#8230;]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s annoying having the fill out the account details whenever you&#8217;re debugging the Magento checkout, so why not have JavaScript do it for you?  Here&#8217;s a handy bookmarklet to get you on your way.<span id="more-474"></span></p>
<p><a href="javascript:$(%27login:guest%27).checked%20=%20%22checked%22;$$(%27#opc-login%20button%27)[0].click();$(%27billing:firstname%27).value%20=%20%27Nick%27;$(%27billing:lastname%27).value%20=%20%27Jones%27;$(%27billing:email%27).value%20=%20%27nick@example.com%27;$(%27billing:street1%27).value%20=%20%22123%20Example%20Road%22;$(%27billing:street2%27).value%20=%20%22Example%20Town%22;$(%27billing:city%27).value%20=%20%22Example%22;$(%27billing:postcode%27).value%20=%20%22EX4M%20PL3%22;$(%27billing:region_id%27).value%20=%201;$(%27billing:telephone%27).value%20=%20%220900%2020%2030%2040%22;$(%27billing:use_for_shipping_yes%27).checked%20=%20%22checked%22;$$(%27#opc-billing%20button%27)[0].click();" class="button" style="width: 250px;">Magento: Auto-populate Checkout</a></p>
<p>Drag it to your bookmark toolbar and click it whenever you&#8217;re on a Magento checkout page to auto populate the form!</p>
<img src="http://feeds.feedburner.com/~r/nicksays/~4/IM-qJV2Rya4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nicksays.co.uk/2010/07/auto-populate-magento-checkout-bookmarklet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nicksays.co.uk/2010/07/auto-populate-magento-checkout-bookmarklet/</feedburner:origLink></item>
		<item>
		<title>Enabling Magento Maintenance Mode</title>
		<link>http://feedproxy.google.com/~r/nicksays/~3/Y1NIvaAIM20/</link>
		<comments>http://www.nicksays.co.uk/2010/07/enabling-magento-maintenance-mode/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 12:58:00 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.nicksays.co.uk/?p=468</guid>
		<description><![CDATA[Magento 1.4 introduced a method for quickly enabling maintenance mode on a running store. To enabled maintenance mode simply create a file called maintenance.flag file in your Magento root. The maintenance mode template is found in the errors/default/503.phtml. Integration with &#8230;]]></description>
			<content:encoded><![CDATA[<p>Magento 1.4 introduced a method for quickly enabling maintenance mode on a running store.  To enabled maintenance mode simply create a file called <code>maintenance.flag</code> file in your Magento root.<span id="more-468"></span></p>
<p>The maintenance mode template is found in the <code>errors/default/503.phtml</code>.  Integration with the &#8220;Allowed IPs&#8221; in the developer section of the configuration section would be nice but, of course, there is a way you can <a href='http://inchoo.net/ecommerce/magento/maintenance-mode-in-magento/'>hack it</a>.  Without this hack maintenance mode is enabled for everyone, even if you have an admin session.</p>
<img src="http://feeds.feedburner.com/~r/nicksays/~4/Y1NIvaAIM20" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nicksays.co.uk/2010/07/enabling-magento-maintenance-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nicksays.co.uk/2010/07/enabling-magento-maintenance-mode/</feedburner:origLink></item>
		<item>
		<title>A Developer’s Guide to using the Magento Cache</title>
		<link>http://feedproxy.google.com/~r/nicksays/~3/XMtA3v7BzVw/</link>
		<comments>http://www.nicksays.co.uk/2010/07/developers-guide-magento-cache/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 09:27:52 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.nicksays.co.uk/?p=442</guid>
		<description><![CDATA[As you&#8217;ll undoubtedly know Magento supports caching. Most of us will find that one out after 20 minutes of refreshing, checking our code, refreshing, only to find that caching was still enabled! But as a developer, how can we make &#8230;]]></description>
			<content:encoded><![CDATA[<p>As you&#8217;ll undoubtedly know Magento supports caching.  Most of us will find that one out after 20 minutes of refreshing, checking our code, refreshing, only to find that caching was still enabled!  But as a developer, how can we make use of this, obviously, in-built feature?<span id="more-442"></span></p>
<p>All of the caching functions are available through <code>Mage_Core_Model_Cache</code> which we&#8217;ll call as a singleton:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cache</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;">'core/cache'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This gives us access to whatever caching mechanism we have set up be it apc, <a href="http://memcached.org/">memcached</a>, xcache, or just a simple file.  Instructions for setting up memcached are shipped with Magento in the <code>app/etc/local.xml.additional</code> file.</p>
<p>The <code>$cache</code> object has four methods we are interested in:</p>
<ul>
<li><code>save($value, $key, $tags = array(), $lifeTime=null)</code></li>
<li><code>load($key)</code></li>
<li><code>remove($key)</code></li>
<li><code>clean($tags = array()</li>
</ul>
<p>These methods will allow us to manipulate the values that we have in the cache cleanly and with ease.</p>
<p><strong>Storing Values</strong><br />
We'll start with storing a value.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;r&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;nick_date&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nicks_cache&quot;</span><span style="color: #009900;">&#41;</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: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hello world - &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;nick_helloworld&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nicks_cache&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">60</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>With the above example I have instructed the cache to store the value of the current date with the <strong>key</strong> <em>nick_date</em>.  We'll be able to refer to this date using the key at a later date.  I've also stored the phrase <em>hello world - 601992000</em> (for the given timestamp) with the <strong>key</strong> <em>nick_helloworld</em>.</p>
<p>We'll ignore the tag <em>nicks_cache</em> for the time being, but you will notice an integer <strong>lifeTime</strong> value associated with both cache entries.  This is the amount of time, in seconds, that the value will exist in cache before being deleted.  By setting this value to null, or omitting the argument, the value will remain in cache until removed.</p>
<p><strong>Retrieving Values</strong><br />
To fetch the value of a key from cache, we simply use:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nick_date&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>If the value does not exist in cache then <code>false</code> will be returned.</p>
<p><strong>Removing Values</strong><br />
To remove individual values from the cache, we use:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nick_date&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>You'll notice that I've also applied the <em>nicks_cache</em> <strong>tag</strong> to the cache entries I initially stored.  By applying a tag to a set of values I am able to refer to them all at a later for mass removal.  We do this by:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nicks_cache&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This will delete all cache entries with the <strong>tag</strong> <em>nicks_cache</em>.</p>
<img src="http://feeds.feedburner.com/~r/nicksays/~4/XMtA3v7BzVw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nicksays.co.uk/2010/07/developers-guide-magento-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nicksays.co.uk/2010/07/developers-guide-magento-cache/</feedburner:origLink></item>
		<item>
		<title>Disable Redirect to Checkout when Adding to Cart</title>
		<link>http://feedproxy.google.com/~r/nicksays/~3/6gRk9DWiRiE/</link>
		<comments>http://www.nicksays.co.uk/2010/07/disable-redirect-to-checkout-when-adding-to-cart/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 14:16:34 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.nicksays.co.uk/?p=435</guid>
		<description><![CDATA[An administrator's config option for disabling redirecting a customer away from their current page when adding a product to their cart.]]></description>
			<content:encoded><![CDATA[<p>Sometimes it&#8217;s nice to be able to keep the customer on their original page when they add something to the checkout.  The default Magento functionality is to redirect a user to their cart page once a product as been successfully added to their cart.</p>
<p>There&#8217;s an option in System &raquo; Configuration &raquo; Checkout &raquo; Shopping Cart &raquo; &#8220;After Adding a Product Redirect to Shopping Cart&#8221; that disables this.</p>
<img src="http://feeds.feedburner.com/~r/nicksays/~4/6gRk9DWiRiE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nicksays.co.uk/2010/07/disable-redirect-to-checkout-when-adding-to-cart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nicksays.co.uk/2010/07/disable-redirect-to-checkout-when-adding-to-cart/</feedburner:origLink></item>
		<item>
		<title>Updated Magento Events Cheat Sheet</title>
		<link>http://feedproxy.google.com/~r/nicksays/~3/6oTBNi4Lg4s/</link>
		<comments>http://www.nicksays.co.uk/2010/07/updated-magento-events-cheat-sheet-1_4_1_0/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 13:49:10 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.nicksays.co.uk/?p=430</guid>
		<description><![CDATA[I&#8217;ve updated the Magento Events Cheat Sheet for version 1.4.1.0.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve updated the <a href="http://www.nicksays.co.uk/magento_events_cheat_sheet/">Magento Events Cheat Sheet</a> for version 1.4.1.0.</p>
<img src="http://feeds.feedburner.com/~r/nicksays/~4/6oTBNi4Lg4s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nicksays.co.uk/2010/07/updated-magento-events-cheat-sheet-1_4_1_0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nicksays.co.uk/2010/07/updated-magento-events-cheat-sheet-1_4_1_0/</feedburner:origLink></item>
		<item>
		<title>CSS Boolean Selectors</title>
		<link>http://feedproxy.google.com/~r/nicksays/~3/rp5E1HigcKo/</link>
		<comments>http://www.nicksays.co.uk/2010/07/css-boolean-selectors/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 10:11:13 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.nicksays.co.uk/?p=411</guid>
		<description><![CDATA[How do you only enable a CSS style when an element has two, or more, of the desired classes?  Logical AND and ORs in CSS.]]></description>
			<content:encoded><![CDATA[<p>Just a short one.</p>
<p>Have you been in the situation where you&#8217;d like to be able to enable a style <strong>only</strong> when both classes are defined for an element?  For example:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ul<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;level-0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Home<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;level-0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Electronics<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;level-1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Televisual Boxes<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;level-1 over&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Kettles<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;level-0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Furniture<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;level-0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Clearance<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ul<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>We&#8217;ll ignore the fact that we could have used the <code>:hover</code> pseudo-class, and that we could have used an additional <code>&lt;ul&gt;&lt;/ul&gt;</code> to define the <code>level-1</code> items.</p>
<p><strong>Logical AND (&#038;&#038;)</strong><br />
We can invoke a specific <code>over</code> CSS class on only the <code>level-1</code> items with the following:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">li<span style="color: #6666ff;">.level-1</span><span style="color: #6666ff;">.over</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Keeping adding additional class by chaining with the <code>.className</code> syntax.</p>
<p><strong>Logical OR (||)</strong><br />
Of course, to <em>OR</em> the classes you simply comma-separate them:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">li<span style="color: #6666ff;">.class1</span><span style="color: #00AA00;">,</span> li<span style="color: #6666ff;">.class2</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">green</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><a href="http://stackoverflow.com/questions/2144751/combining-two-or-more-css-selectors-with-a-boolean-condition">http://stackoverflow.com/questions/2144751/combining-two-or-more-css-selectors-with-a-boolean-condition</a></p>
<img src="http://feeds.feedburner.com/~r/nicksays/~4/rp5E1HigcKo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nicksays.co.uk/2010/07/css-boolean-selectors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nicksays.co.uk/2010/07/css-boolean-selectors/</feedburner:origLink></item>
		<item>
		<title>Manually Building Magento PEAR Packages</title>
		<link>http://feedproxy.google.com/~r/nicksays/~3/GctsapBq_OU/</link>
		<comments>http://www.nicksays.co.uk/2010/06/manually-building-magento-pear-packages/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 11:10:48 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://www.nicksays.co.uk/?p=393</guid>
		<description><![CDATA[The internal Magento package builder is all very well and good for getting your basic <code>package.xml</code> generated, and defining your file lists, but it is cumbersome to use and can't be integrated into a build process very easily.]]></description>
			<content:encoded><![CDATA[<p>The internal Magento package builder is all very well and good for getting your basic <code>package.xml</code> generated, and defining your file lists, but it is cumbersome to use and can&#8217;t be integrated into a build process very easily.</p>
<p>Magento extends the PEAR tool to provide a <code>mp</code> (make package) function which replaces the <code>package</code> and <code>package-validate</code> commands.  Here&#8217;s how to build your package.</p>
<p>You&#8217;ll notice that I refer to the pear program as <code>./pear</code> throughout this article.  This is because we&#8217;re using Magento&#8217;s version, with the Magento Team&#8217;s modifications applied.  The <code>./pear</code> is found in the root of your Magento installation.</p>
<p><strong>Generating your package.xml</strong></p>
<p>The first time around I like to use the Magento package builder in the Magento admin area.  You&#8217;ll find this in <em>System &raquo; Magento Connect &raquo; Package Extensions</em>.  Once you&#8217;re done you can hit <em>Save</em> save your settings for this package for the next time you want to build from this interface, making all of the fields populate from the <em>Load local Package</em> menu item.</p>
<p>The fields will be saved as <em>${your_package_name}.xml</em> in the <code>$MAGE_ROOT/var/pear/</code> directory.</p>
<p>To generate your <em>package.xml</em> you&#8217;ll need to hit the <em>Save data and Create Package</em> button.  The <em>package.xml</em> can be found in <code>$MAGE_ROOT/var/pear/</code> also.</p>
<p><strong>Building your Package</strong></p>
<p>This is the easy step.  Simply navigate to the root of your Magento installation, copy the <em>package.xml</em> there and run pear, like so:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> var<span style="color: #000000; font-weight: bold;">/</span>pear<span style="color: #000000; font-weight: bold;">/</span>package.xml .
.<span style="color: #000000; font-weight: bold;">/</span>pear mp package.xml</pre></div></div>

<p>You&#8217;ll then get a success message and your package is ready to roll.</p>
<p><strong>Installing your Package</strong></p>
<p>If you don&#8217;t have a PEAR server setup then you can install the package by simply specifying the file name when calling <code>./pear install</code>, as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>pear <span style="color: #c20cb9; font-weight: bold;">install</span> My_Package-0.9.0.tgz</pre></div></div>

<p><strong>Potential Pitfalls</strong></p>
<ol>
<li><strong><code>./pear mp package.xml</code> does not generate a valid <em>tgz</em> archive.</strong>
<p>I wasn&#8217;t getting any errors during package creation, but once I had uploaded to my PEAR server and attempted to install I was getting these funky messages.</p>
<pre>
[nrj@clifford heirloom]$ ./pear install -f meanbee/My_Package
downloading My_Package-0.9.0.tgz ...
Starting to download My_Package-0.9.0.tgz (2,132,243 bytes)
....................................................................................................................................................................................................................................................................................................................................................................................................................................done: 2,132,243 bytes
Could not get contents of package "/magento/root/downloader/pearlib/download/My_Package-0.9.0.tgz". Invalid tgz file.
Download of "meanbee/My_Package" succeeded, but it is not a valid package archive
Error: cannot download "meanbee/My_Package"
Download failed
install failed
</pre>
<p>I tested the archive that was created by simply untaring which produced various complaints about <em>base64 headers</em> and there was a lot of <em>Skipping to next header</em>.</p>
<p>This is <a href="http://pear.php.net/bugs/bug.php?id=13361">a bug</a> with the <em>Archive_Tar</em> package hosted at the official PEAR Repository.  There is already a working patch submitted, but it has not yet made it&#8217;s way into any release.  We can apply the patch manually by <a href="http://pear.php.net/bugs/bug.php?id=13361&#038;edit=12&#038;patch=archive_tar-1.3.2-end_block_fix&#038;revision=latest">downloading the patch</a> and patching the <code>Tar.php</code> file in <em>downloader/pearlib/php/Archive/</em> by running:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">patch</span> Tar.php downloaded.patch</pre></div></div>

</li>
</ol>
<img src="http://feeds.feedburner.com/~r/nicksays/~4/GctsapBq_OU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nicksays.co.uk/2010/06/manually-building-magento-pear-packages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nicksays.co.uk/2010/06/manually-building-magento-pear-packages/</feedburner:origLink></item>
		<item>
		<title>Unsupported protocol from PECL client</title>
		<link>http://feedproxy.google.com/~r/nicksays/~3/KhGRA3c_VC4/</link>
		<comments>http://www.nicksays.co.uk/2010/03/unsupported-protocol-from-pecl-client/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 18:38:00 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.nicksays.co.uk/?p=388</guid>
		<description><![CDATA[I was getting the error message pecl.php.net is using a unsupported protocal &#8211; This should never happen. while trying to install the MongoDB extension for PHP. Well it did happen. Here&#8217;s how to fix. Simply run: pear update-channels Job done. &#8230;]]></description>
			<content:encoded><![CDATA[<p>I was getting the error message <em>pecl.php.net is using a unsupported protocal &#8211; This should never happen.</em> while trying to install the <a href="http://www.mongodb.org">MongoDB</a> extension for PHP.</p>
<p>Well it did happen.  Here&#8217;s how to fix.</p>
<p><span id="more-388"></span></p>
<p>Simply run:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pear update-channels</pre></div></div>

<p>Job done.  I wonder how everyone else deals with these tiny, but useful, posts on their own blog.  Seems a waste to have it at the top of the screen on the front page.</p>
<p><a href="http://www.pear-forum.org/topic2301.html">Source</a></p>
<img src="http://feeds.feedburner.com/~r/nicksays/~4/KhGRA3c_VC4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nicksays.co.uk/2010/03/unsupported-protocol-from-pecl-client/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nicksays.co.uk/2010/03/unsupported-protocol-from-pecl-client/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 1.838 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-08-12 14:33:22 --><!-- Compression = gzip -->
