<?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>Geoffrey&#039;s Blog</title>
	<atom:link href="http://www.speedking.eu/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.speedking.eu</link>
	<description></description>
	<lastBuildDate>Sat, 11 Feb 2012 11:56:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to use the subtotal including taxes / vat in Magento when using promotion coupons</title>
		<link>http://www.speedking.eu/2012/01/how-to-subtotal-including-taxes-promotion-coupons/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-subtotal-including-taxes-promotion-coupons</link>
		<comments>http://www.speedking.eu/2012/01/how-to-subtotal-including-taxes-promotion-coupons/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 21:44:19 +0000</pubDate>
		<dc:creator>Geoffrey</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.speedking.eu/?p=343</guid>
		<description><![CDATA[I recently have had to work on the opensource e-commerce CMS &#8220;Magento&#8221; through work. It was my first time using the application and had no knowledge of the inner workings of it all, so it was a real delight when I was given the easy task of adding  promotion coupons / vouchers to the website. [...]]]></description>
			<content:encoded><![CDATA[<p>I recently have had to work on the opensource e-commerce CMS &#8220;Magento&#8221; through work. It was my first time using the application and had no knowledge of the inner workings of it all, so it was a real delight when I was given the easy task of adding  promotion coupons / vouchers to the website.</p>
<p>All I had to do was to create a coupon that would reduce the grand total by a given percentage when the total of the basket was bigger than £100. Easy right? Well so I thought until I came to find out that magento, in all it&#8217;s V 1.3.2.3 glory, applies the promotion rule (having to be higher than £100) to the subtotal excluding taxes / vat rather than the opposite way!</p>
<p>Because of that, although a user may have had a basket worth £110, the promotion script would only see the price without taxes, in other words around £85 and therefore would not apply the discount. Because all prices throughout the website are displayed including VAT, this would have definitely been really confusing for visitors.</p>
<p>After spending countless hours first looking in vain for a fix on google, then spending days going through the horribly scattered pile of horse shit that is magento&#8217;s code, I finally came up with a fix! And because I&#8217;m nice and don&#8217;t want to put someone through what I went through, I will share it here with the rest of the internet.</p>
<p>It is in itself very straight forward. Locate the &#8220;<strong>validation.php</strong>&#8221; file in &#8220;<strong>app/code/core/mage/SalesRule/Method</strong>&#8221; and open it. Look for the following code:</p>
<pre class="brush:php">$quote = $item-&gt;getQuote();
if ($item instanceof Mage_Sales_Model_Quote_Address_Item) {
$address = $item-&gt;getAddress();
} elseif ($quote-&gt;isVirtual()) {
$address = $quote-&gt;getBillingAddress();
} else {
$address = $quote-&gt;getShippingAddress();
}</pre>
<p>Right after the closing bracket, simply add this little line of code;</p>
<pre class="brush:php">$address-&gt;setBaseSubtotal(number_format($address-&gt;getSubtotal() + $address-&gt;getTaxAmount() - $address-&gt;getShippingTaxAmount(), 2));</pre>
<p>All this does is that it add the total tax amount (while not including shipping tax tax) to the base_subtotal variable within the $address object which is the variable used by the promotion code. This change will however not change to front end value of the subtotal on your website so your basket will still display the correct subtotal without tax !</p>
<p>Let me know if you are having any problems or if you have any comment about my fix.</p>
<p>Till next time &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.speedking.eu/2012/01/how-to-subtotal-including-taxes-promotion-coupons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A new begining</title>
		<link>http://www.speedking.eu/2011/08/a-new-begining/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-new-begining</link>
		<comments>http://www.speedking.eu/2011/08/a-new-begining/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 23:43:43 +0000</pubDate>
		<dc:creator>Geoffrey</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.speedking.eu/?p=195</guid>
		<description><![CDATA[I&#8217;ve started so many blogs in the pasts couple of years, it&#8217;s hard to keep track. &#8220;Why are you starting another one then?&#8221; Well I&#8217;m glad you asked. Simply put, I just started a new job in web development and at the same time just started to get serious with my Arduino project, so I [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started so many blogs in the pasts couple of years, it&#8217;s hard to keep track.</p>
<p>&#8220;Why are you starting another one then?&#8221; Well I&#8217;m glad you asked. Simply put, I just started a new job in web development and at the same time just started to get serious with my Arduino project, so I wanted a place where I could put down tips, tricks or just random stuff about what I am doing. This would first and foremost be for my sake, so I can easily go back to something I wrote if I need to (i forget stuff quiet easily) but I am hoping that it will also be helpful to anyone else that somehow gets to this page.</p>
<p>I have for the occasion created a new template for the blog (which is like 50% done, but hell it&#8217;ll have to do for now) which is somewhat completely different to what I usually tend to design. It is also a great opportunity for me to try out some CSS3 goodness and see how well I can manage to break Internet Explorer with it.</p>
<p>Any ways, it&#8217;s late, I&#8217;m tired and I&#8217;ve never been great at those &#8220;introduction&#8221; messages so I&#8217;ll just leave it at that.</p>
<p>Catch you on the flip side (I&#8217;m trying to bring it back :D)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.speedking.eu/2011/08/a-new-begining/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

