<?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>EYEMAGINE &#187; php</title>
	<atom:link href="http://www.eyemaginetech.com/blog/category/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.eyemaginetech.com/blog</link>
	<description>Discover the latest news in Web Design, Online Marketing, and Magento Development at EYEMAGINE&#039;s blog. For more information visit eyemaginetech.com</description>
	<lastBuildDate>Sat, 04 Feb 2012 01:49:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>OneStepCheckout</title>
		<link>http://www.eyemaginetech.com/blog/ecommerce/onestepcheckout</link>
		<comments>http://www.eyemaginetech.com/blog/ecommerce/onestepcheckout#comments</comments>
		<pubDate>Tue, 31 Aug 2010 21:24:19 +0000</pubDate>
		<dc:creator>Andy Etemadi</dc:creator>
				<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[online store]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.eyemaginetech.com/our-thoughts/?p=234</guid>
		<description><![CDATA[Everybody is doing it. <a href="http://www.eyemaginetech.com/blog/ecommerce/onestepcheckout">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>OneStepCheckout is a Magento module that enhances the customer shopping experience by combining multiple steps during checkout into a single, well-formatted checkout page.</p>
<p>EyeMagine is an authorized OneStepCheckout partner and we highly recommend the OSC to all our clients. The OSC is the new must-have Magento extension that is taking the market by storm.</p>
<p>OSC is a total revamp of the standard checkout process in Magento. The core feature is that it reduces the six standard Magento checkout steps down to one. Totals and prices are dynamically updated via AJAX when shipping/payment method is selected. The user simply fills in their address and chooses delivery/payment methods on the same page, rather than having to do a separate step for each.</p>
<p>Improving the checkout process results in more customers completing their sales, and this has an immediate impact on your bottom line. It is the single most effective technical change you can make to reduce shopping cart abandonment.</p>
<p><a href="/contact-us/">Contact us</a> to find out how to add OneStepCheckout to your Magento store today!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eyemaginetech.com/blog/ecommerce/onestepcheckout/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento: Tax By City</title>
		<link>http://www.eyemaginetech.com/blog/ecommerce/magento-tax-by-city</link>
		<comments>http://www.eyemaginetech.com/blog/ecommerce/magento-tax-by-city#comments</comments>
		<pubDate>Wed, 14 Apr 2010 18:59:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.eyemaginetech.com/our-thoughts/?p=183</guid>
		<description><![CDATA[Tax rules can be complicated; they can be even more complicated if you need tax rules based on the city while your online store tax rules are based on postal codes. <a href="http://www.eyemaginetech.com/blog/ecommerce/magento-tax-by-city">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Tax rules can be complicated; they can be even more complicated if you need tax rules based on the city while your online store tax rules are based on postal codes.<span id="more-183"></span> For example, districts in California have a higher sales tax rate than the state base tax rate.  Magento&#8217;s built-in tax rate system supports tax rates by country, state/region, and postal code. This will suffice for most stores, but the California Board Of Equalization advises against tax rate rules based on a mailing address because postal codes may cross district boundaries.  As suggested in <a title="Magento  - Tax per city - Can Magento Do... - eCommerce Software for Growth" href="http://www.magentocommerce.com/boards/viewthread/11641/" target="_blank">this Magento message board discussion</a>, store owners need another way to calculate taxes.</p>
<p>Calculating taxes based on city instead of postal code can be a straightforward process as we show in this article. We will take advantage of the tax_postcode column in the tax_calculation_rate table. This is a relatively quick and simple solution for creating a new database column and modifying the Admin HTML blocks.</p>
<h2>Directory Structure:</h2>
<pre>app/
  code/
    local/
      Eyemagine/
        Taxbycity/
          etc/
            config.xml
          Model/
            Calculation.php
            Mysql4/
              Calculation.php
          sql/
            taxbycity_setup/
              mysql-install-0.1.0.php</pre>
<h2>Configuration</h2>
<p>File: app/code/local/Eyemagine/Taxbycity/etc/config.xml</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Eyemagine_Taxbycity<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>0.1.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Eyemagine_Taxbycity<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;global<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;taxbycity_setup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;setup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Eyemagine_Taxbycity<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/setup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;connection<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;use<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>core_setup<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/use<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/connection<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/taxbycity_setup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;models<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tax<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rewrite<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;calculation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Eyemagine_Taxbycity_Model_Calculation<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/calculation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/rewrite<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tax<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tax_mysql4<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rewrite<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;calculation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Eyemagine_Taxbycity_Model_Mysql4_Calculation<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/calculation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/rewrite<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tax_mysql4<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/models<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/global<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Mage_Tax_Model_Calculation and Mage_Tax_Model_Mysql4_Calculation are the one two classes we will overload. This module will affect how the tax rate is queried from the database and the criteria used to search for the tax rate.</p>
<h2>The Setup</h2>
<p>File: app/code/local/Eyemagine/Taxbycity/sql/taxbycity_setup/mysql-install-0.1.0.php</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * mysql-install-0.1.0.php
 * @author EyeMagine
 */</span>
<span style="color: #666666; font-style: italic;">/* @var $this Mage_Core_Model_Resource_Setup */</span>
<span style="color: #000088;">$installer</span>  <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db</span>         <span style="color: #339933;">=</span> <span style="color: #000088;">$installer</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getConnection<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$installer</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>startSetup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$installer</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>run<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;
ALTER TABLE {<span style="color: #006699; font-weight: bold;">$installer</span>-&amp;gt;getTable('tax_calculation_rate')} CHANGE `tax_postcode` `tax_postcode` VARCHAR( 32 ) NOT NULL
&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The tax_postcode column by default has a 12-character limit, which presents problems for city names such as &#8220;Rancho Santa Margarita.&#8221; The setup for this module simply increases the limit to 32 characters.</p>
<h2>The Request</h2>
<p>File: app/code/local/Eyemagine/Taxbycity/Mode/Calculation.php</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Calculation.php
 * @author EyeMagine
 *
 */</span>
<span style="color: #009933; font-style: italic;">/**
 * Overload the tax calculation class
 * @author EyeMagine
 *
 */</span>
<span style="color: #000000; font-weight: bold;">class</span> Eyemagine_Taxbycity_Model_Calculation <span style="color: #000000; font-weight: bold;">extends</span> Mage_Tax_Model_Calculation
<span style="color: #009900;">&#123;</span>
    <span style="color: #009933; font-style: italic;">/**
     * override the getRateRequest to add the city information to the request
     * @see Mage_Tax_Model_Calculation::getRateRequest
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getRateRequest<span style="color: #009900;">&#40;</span><span style="color: #000088;">$shippingAddress</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$billingAddress</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$customerTaxClass</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$store</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$address</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Varien_Object<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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;">;</span>
        <span style="color: #000088;">$basedOn</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getStoreConfig</span><span style="color: #009900;">&#40;</span>Mage_Tax_Model_Config<span style="color: #339933;">::</span><span style="color: #004000;">CONFIG_XML_PATH_BASED_ON</span><span style="color: #339933;">,</span> <span style="color: #000088;">$store</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$shippingAddress</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$basedOn</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'shipping'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$billingAddress</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$basedOn</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'billing'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$basedOn</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'default'</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$billingAddress</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">||</span> <span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$billingAddress</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #000088;">$billingAddress</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getCountryId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$basedOn</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'billing'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$shippingAddress</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">||</span> <span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$shippingAddress</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #000088;">$shippingAddress</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getCountryId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$basedOn</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'shipping'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$session</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>isLoggedIn<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$basedOn</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'default'</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$defBilling</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$session</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getCustomer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getDefaultBillingAddress<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000088;">$defShipping</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$session</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getCustomer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getDefaultShippingAddress<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$basedOn</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'billing'</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$defBilling</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$defBilling</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getCountryId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #000088;">$billingAddress</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$defBilling</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$basedOn</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'shipping'</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$defShipping</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$defShipping</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getCountryId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #000088;">$shippingAddress</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$defShipping</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #000088;">$basedOn</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'default'</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$basedOn</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'billing'</span><span style="color: #339933;">:</span>
                <span style="color: #000088;">$address</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$billingAddress</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'shipping'</span><span style="color: #339933;">:</span>
                <span style="color: #000088;">$address</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$shippingAddress</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'origin'</span><span style="color: #339933;">:</span>
                <span style="color: #000088;">$address</span>
                    <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>setCountryId<span style="color: #009900;">&#40;</span>Mage<span style="color: #339933;">::</span><span style="color: #004000;">getStoreConfig</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'shipping/origin/country_id'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$store</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                    <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>setRegionId<span style="color: #009900;">&#40;</span>Mage<span style="color: #339933;">::</span><span style="color: #004000;">getStoreConfig</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'shipping/origin/region_id'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$store</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                    <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>setPostcode<span style="color: #009900;">&#40;</span>Mage<span style="color: #339933;">::</span><span style="color: #004000;">getStoreConfig</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'shipping/origin/postcode'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$store</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'default'</span><span style="color: #339933;">:</span>
                <span style="color: #000088;">$address</span>
                    <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>setCountryId<span style="color: #009900;">&#40;</span>Mage<span style="color: #339933;">::</span><span style="color: #004000;">getStoreConfig</span><span style="color: #009900;">&#40;</span>Mage_Tax_Model_Config<span style="color: #339933;">::</span><span style="color: #004000;">CONFIG_XML_PATH_DEFAULT_COUNTRY</span><span style="color: #339933;">,</span> <span style="color: #000088;">$store</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                    <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>setRegionId<span style="color: #009900;">&#40;</span>Mage<span style="color: #339933;">::</span><span style="color: #004000;">getStoreConfig</span><span style="color: #009900;">&#40;</span>Mage_Tax_Model_Config<span style="color: #339933;">::</span><span style="color: #004000;">CONFIG_XML_PATH_DEFAULT_REGION</span><span style="color: #339933;">,</span> <span style="color: #000088;">$store</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                    <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>setPostcode<span style="color: #009900;">&#40;</span>Mage<span style="color: #339933;">::</span><span style="color: #004000;">getStoreConfig</span><span style="color: #009900;">&#40;</span>Mage_Tax_Model_Config<span style="color: #339933;">::</span><span style="color: #004000;">CONFIG_XML_PATH_DEFAULT_POSTCODE</span><span style="color: #339933;">,</span> <span style="color: #000088;">$store</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$customerTaxClass</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$session</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>isLoggedIn<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$customerTaxClass</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$session</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getCustomer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getTaxClassId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$customerTaxClass</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #000088;">$session</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>isLoggedIn<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$defaultCustomerGroup</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getStoreConfig</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'customer/create_account/default_group'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$store</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$customerTaxClass</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;">'customer/group'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getTaxClassId<span style="color: #009900;">&#40;</span><span style="color: #000088;">$defaultCustomerGroup</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000088;">$request</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Varien_Object<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$request</span>
            <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>setCountryId<span style="color: #009900;">&#40;</span><span style="color: #000088;">$address</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getCountryId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>setRegionId<span style="color: #009900;">&#40;</span><span style="color: #000088;">$address</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getRegionId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>setPostcode<span style="color: #009900;">&#40;</span><span style="color: #000088;">$address</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getPostcode<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>setStore<span style="color: #009900;">&#40;</span><span style="color: #000088;">$store</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>setCustomerClassId<span style="color: #009900;">&#40;</span><span style="color: #000088;">$customerTaxClass</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>setCity<span style="color: #009900;">&#40;</span><span style="color: #000088;">$address</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getCity<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: #b1b100;">return</span> <span style="color: #000088;">$request</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The calculation method, getRateRequest(), is nearly identical to the core method.  We will add the city to the request object from the address object.</p>
<h2>The Look Up</h2>
<p>File: app/code/local/Eyemagine/Taxbycity/Mode/Mysql4/Calculation.php</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Calculation.php
 * @author EyeMagine
 *
 */</span>
<span style="color: #009933; font-style: italic;">/**
 * Overload the mysql4 calculation class
 * @author EyeMagine
 *
 */</span>
<span style="color: #000000; font-weight: bold;">class</span> Eyemagine_Taxbycity_Model_Mysql4_Calculation <span style="color: #000000; font-weight: bold;">extends</span> Mage_Tax_Model_Mysql4_Calculation
<span style="color: #009900;">&#123;</span>
    <span style="color: #009933; font-style: italic;">/**
     * override getRates method to add city to where clause
     * @see Mage_Tax_Model_Mysql4_Calculation::_getRates
     */</span>
    protected <span style="color: #000000; font-weight: bold;">function</span> _getRates<span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$storeId</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;">-&amp;</span>gt<span style="color: #339933;">;</span>getStore<span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getStore<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$select</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>_getReadAdapter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>select<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$select</span>
            <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>from<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main_table'</span><span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getMainTable<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>where<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'customer_tax_class_id = ?'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$request</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getCustomerClassId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>where<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'product_tax_class_id = ?'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$request</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getProductClassId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$select</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>join<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rule'</span><span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getTable<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tax/tax_calculation_rule'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rule.tax_calculation_rule_id = main_table.tax_calculation_rule_id'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rule.priority'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rule.position'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$select</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>join<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rate'</span><span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getTable<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tax/tax_calculation_rate'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rate.tax_calculation_rate_id = main_table.tax_calculation_rate_id'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'value'</span><span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #0000ff;">'rate.rate'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rate.tax_country_id'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rate.tax_region_id'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rate.tax_postcode'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rate.tax_calculation_rate_id'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rate.code'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$select</span>
            <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>where<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;rate.tax_country_id = ?&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$request</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getCountryId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>where<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;rate.tax_region_id in ('*', '', ?)&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$request</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getRegionId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$city</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$request</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getCity<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$city</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//add city only if we know we have it, default to old behavior otherwise</span>
            <span style="color: #000088;">$select</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>where<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;LOWER(rate.tax_postcode) in ('*', '', ?)&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getPostcode<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getCity<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$select</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>where<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;rate.tax_postcode in ('*', '', ?)&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$request</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getPostcode<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>
&nbsp;
        <span style="color: #000088;">$select</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>joinLeft<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title_table'</span><span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getTable<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tax/tax_calculation_rate_title'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;rate.tax_calculation_rate_id = title_table.tax_calculation_rate_id AND title_table.store_id = '<span style="color: #006699; font-weight: bold;">{$storeId}</span>'&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span><span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #0000ff;">'IFNULL(title_table.value, rate.code)'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$order</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rule.priority ASC'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rule.tax_calculation_rule_id ASC'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rate.tax_country_id DESC'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rate.tax_region_id DESC'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rate.tax_postcode DESC'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rate.rate DESC'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$select</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>order<span style="color: #009900;">&#40;</span><span style="color: #000088;">$order</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>_getReadAdapter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>fetchAll<span style="color: #009900;">&#40;</span><span style="color: #000088;">$select</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Minor modifications to the _getRates() method, in the Mysql Calculation Model, will be required. In this method, we will ensure that the city has been set in the request and add it to the list of values to search for in the tax_postcode column.</p>
<p>A side affect of this is that the Estimated Shipping and Tax result will no longer be as accurate. The input for this form is a postal code, which is passed to the shipping module. Taking advantage of Magento&#8217;s flexibility makes it simple to enhance its core functionality without too much code modification.</p>
<p>If this article was helpful or if you would like assistance with your customizations, please feel free to <a title="Contact Us" href="/contact-us/">contact us</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eyemaginetech.com/blog/ecommerce/magento-tax-by-city/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento Invoiced Sales Report</title>
		<link>http://www.eyemaginetech.com/blog/custom-report/magento-invoiced-sales-report</link>
		<comments>http://www.eyemaginetech.com/blog/custom-report/magento-invoiced-sales-report#comments</comments>
		<pubDate>Fri, 04 Sep 2009 19:17:29 +0000</pubDate>
		<dc:creator>Andy Etemadi</dc:creator>
				<category><![CDATA[custom report]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sales invoice]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[magento custom report]]></category>

		<guid isPermaLink="false">http://www.eyemaginetech.com/our-thoughts/?p=57</guid>
		<description><![CDATA[Have you ever needed a report of the actual sales that your Magento store has completed? <a href="http://www.eyemaginetech.com/blog/custom-report/magento-invoiced-sales-report">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Have you ever needed a report of the actual sales that your Magento store has completed?</p>
<p>Would you like to see all of your closed/completed sales in a single Magento report that includes: Order ID, Order Date, Shipping Date, Merchandise Amount, Tax Amount, Shipping Amount, Tracking Number, Refunded Amount, Net Amount?<span id="more-57"></span></p>
<p>We have created a custom Magento report that includes all of the information above for each report within a time frame that you can specify.</p>
<p><a class="pink-btn" title="Magento Invoiced Sales Report for Magento" href="/store/invoiced-sales-reports.html">Buy Now</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.eyemaginetech.com/blog/custom-report/magento-invoiced-sales-report/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How To Add News Articles and Press Releases to Magento</title>
		<link>http://www.eyemaginetech.com/blog/cms/how-to-add-news-articles-and-press-releases-to-magento</link>
		<comments>http://www.eyemaginetech.com/blog/cms/how-to-add-news-articles-and-press-releases-to-magento#comments</comments>
		<pubDate>Mon, 20 Jul 2009 22:28:35 +0000</pubDate>
		<dc:creator>Andy Etemadi</dc:creator>
				<category><![CDATA[cms]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[news articles]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[press release]]></category>

		<guid isPermaLink="false">http://www.eyemaginetech.com/our-thoughts/?p=19</guid>
		<description><![CDATA[Free Magento extension for News Articles and Press Releases. <a href="http://www.eyemaginetech.com/blog/cms/how-to-add-news-articles-and-press-releases-to-magento">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of our clients asked for a standard Press Release section for their Magento site. With the majority of their website built on the Magento platform, it made more sense to build an extension to handle the press releases, rather than add a whole separate CMS. The rationale was that having a single CMS to log into will increase productivity and eliminate confusion. Since Magento has a decent CMS and user role/permission interface, it just made sense to enhance the CMS functionality.<span id="more-19"></span></p>
<h3>Extending Magento</h3>
<p>We worked through some details and nailed down the functionality, enabling complete control of press releases within the Magento framework. With this functionality fully integrated, the administrator finally had complete control of all the functions they wanted within their site, all accessed with one login in one place.</p>
<h3>User Story</h3>
<p>The administrator that desires to add a new Press Release via Magento will login and click on a new menu item under the CMS menu. After clicking on a &#8220;Add new item&#8221; the input screen will allow the administrator to select a type (is it a News Article or a Press Release?) and fill in the following fields: title, author, summary/excerpt, actual content, author biography, date to start displaying the item (the date to start displaying the item as a current item), expiration date (the date to change this item to an archived item), and status (enabled or disabled?).</p>
<p>The public site will display a slick menu that will allow the user to choose between News Articles and Press Releases.  Within the News Articles and Press Releases, the user has the option of selecting current articles or archived/expired articles.</p>
<h3>DOWNLOAD</h3>
<p>Now that we&#8217;ve gone through the trouble, we have contributed it to the community on Magento Connect.  At the time of writing, the extension is pending approval, but you can download and install it now by clicking <a title="Magento News Article Press Release Extension" href="/our-thoughts/wp-content/uploads/2009/07/News-0.1.tgz">here</a>.</p>
<p>Please note that this is in development and may have bugs. If you experience any difficulty, please <a href="/contact-us/">contact us</a> or leave a comment below. If you would like to learn more about our work with Magento, please visit our <a href="/magento/">Magento page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eyemaginetech.com/blog/cms/how-to-add-news-articles-and-press-releases-to-magento/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

