<?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>NemoPS &#187; reference</title>
	<atom:link href="http://nemops.com/tag/reference/feed/" rel="self" type="application/rss+xml" />
	<link>http://nemops.com</link>
	<description>Prestashop Tutorials, Modules and More!</description>
	<lastBuildDate>Wed, 05 Dec 2018 13:25:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.35</generator>
	<item>
		<title>Quick Tip: Replace Order References with IDs in Prestashop</title>
		<link>http://nemops.com/prestashop-replace-order-references-with-ids/</link>
		<comments>http://nemops.com/prestashop-replace-order-references-with-ids/#comments</comments>
		<pubDate>Tue, 30 Jun 2015 09:26:31 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[orders]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[reference]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2460</guid>
		<description><![CDATA[<p>If you find it annoying to have Order References with random characters, here is how to take Order IDs back in Prestashop, for customers as well. Watch the Screencast Text Version There is just one quick step to take, in order to replace the new odd reference number, and that is amending the generateReference method [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-replace-order-references-with-ids/">Quick Tip: Replace Order References with IDs in Prestashop</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>If you find it annoying to have Order References with random characters, here is how to take Order IDs back in Prestashop, for customers as well.</p>
<p><span id="more-2460"></span></p>
<h2>Watch the Screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/YKZ2AK-_XQA" frameborder="0" allowfullscreen></iframe><p><a href="https://www.youtube.com/user/NemoPostScriptum/videos" rel="nofollow" title="Subscribe Post Scriptum's Youtube Channel">Subscribe Post Scriptum's Youtube Channel</a></p>	</div>
<h2>Text Version</h2>
<p>There is just one quick step to take, in order to replace the new odd reference number, and that is amending the <strong>generateReference</strong> method of the Order class.</p>
<p>Let&#8217;s create an override for it! Create a new file inside <em>override/classes/order</em> and name it <strong>Order.php</strong>.<br />
Add the usual override code inside:</p>
<pre class="brush: php; title: ; notranslate">
Class Order extends OrderCore
{

}
</pre>
<p>Then, inside it, let&#8217;s paste the generateReference method:</p>
<pre class="brush: php; title: ; notranslate">
	public static function generateReference()
	{
		return strtoupper(Tools::passwdGen(9, 'NO_NUMERIC'));
	}
</pre>
<p>We want to grab the very last order ID, then increase it by one, increase it by one and pad it so all the new references have the same length in terms of characters</p>
<pre class="brush: php; title: ; notranslate">
	public static function generateReference()
	{
		$last_id = Db::getInstance()-&gt;getValue('
			SELECT MAX(id_order)
			FROM '._DB_PREFIX_.'orders');
		return str_pad((int)$last_id + 1, 9, '000000000', STR_PAD_LEFT);

	}
</pre>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-replace-order-references-with-ids/">Quick Tip: Replace Order References with IDs in Prestashop</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-replace-order-references-with-ids/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
	</channel>
</rss>
