<?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; order</title>
	<atom:link href="https://nemops.com/tag/order/feed/" rel="self" type="application/rss+xml" />
	<link>https://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>Display a &#8220;Bought product&#8221; label in PrestaShop</title>
		<link>https://nemops.com/prestashop-bought-product-label/</link>
		<comments>https://nemops.com/prestashop-bought-product-label/#comments</comments>
		<pubDate>Mon, 05 Sep 2016 08:30:53 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[order]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[product]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2847</guid>
		<description><![CDATA[<p>In today&#8217;s tutorial we will learn how to add a &#8220;bought product&#8221; notification on the PrestaShop product page, much like Amazon does. Creating a ProductController override in PrestaShop The cleanest and standard compliant method for assigning the proper variables in PrestaShop, is to use a controller. We need to add content to the product page, [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://nemops.com/prestashop-bought-product-label/">Display a &#8220;Bought product&#8221; label in PrestaShop</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In today&#8217;s tutorial we will learn how to add a &#8220;bought product&#8221; notification on the PrestaShop product page, much like Amazon does.</p>
<p><span id="more-2847"></span></p>
<h2>Creating a ProductController override in PrestaShop</h2>
<p>The cleanest and standard compliant method for assigning the proper variables in PrestaShop, is to use a controller. We need to add content to the product page, so the one we are interested in is the ProductController. Additionally, in order to make sure our modification is upgrade-safe, we need to use an override instead of modifying the original.</p>
<p>Let&#8217;s get started!</p>
<p>Create a new file inside <em>override/controllers/front/</em> and name it <strong>ProductController.php</strong></p>
<p>Open it up, and within php tags add the following:</p>
<pre class="brush: php; title: ; notranslate">

Class ProductController extends ProductControllerCore
{

}
</pre>
<p>We want to extend the initContent() method, so let&#8217;s do it:</p>
<pre class="brush: php; title: ; notranslate">

Class ProductController extends ProductControllerCore
{
	public function initContent()
    {
        parent::initContent();
    }
}
</pre>
<p>We are calling the parent&#8217;s initContent as well, to make sure all the needed variables are loaded. At this point, <strong>before</strong> the parent is called, let&#8217;s first check if the current user is a registered customer, as we will never be able to tell what a guest has bought:</p>
<pre class="brush: php; title: ; notranslate">

Class ProductController extends ProductControllerCore
{
	public function initContent()
    {

    	if($this-&gt;context-&gt;customer-&gt;id) // only if logged in
        {
			$bought_products = $this-&gt;context-&gt;customer-&gt;getBoughtProducts(); // only valid orders
        }
        parent::initContent();
    }
}
</pre>
<p>If it is, we get all the products he bought. Please notice only valid(paid) orders are considered. If you wish to include them all, you must remove the condition &#8220;valid = 1&#8243; in the getBoughtProducts method, Customer class.</p>
<p>Now let&#8217;s cycle through them. If the current product&#8217;s id is matched, we assign a date variable to the template:</p>
<pre class="brush: php; title: ; notranslate">
    if($this-&gt;context-&gt;customer-&gt;id) // only if logged in
    {
        $bought_products = $this-&gt;context-&gt;customer-&gt;getBoughtProducts(); // only valid orders
        if($bought_products)
        {
            foreach ($bought_products as $prod) {

                if($prod['product_id'] = $this-&gt;product-&gt;id)
                {
                    $this-&gt;context-&gt;smarty-&gt;assign(array(
                        'bought_on'=&gt; $prod['date_add']
                    ));
                }
            }
        }
    }
</pre>
<p>We are done with php, the next step will be showing our custom text in the product.tpl file. Before proceeding, make sure to erase your class_index.php file, located in the <em>cache/</em> folder.</p>
<div class="separator"></div>
<h2>Adding a bought product text to the product page</h2>
<p>Open up <strong>product.tpl</strong>, located in the theme folder. Please notice your code will be different if you use a custom template, as I am using default-bootstrap for this demonstration. I decided to add the info box at the top of the page, above the product image.<br />
If you want to pick the same spot, locate the div with class pb-left-column, and add the following right before it:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
		{if isset($bought_on)}
			&lt;div class=&quot;col-xs-12&quot;&gt;
				&lt;div class=&quot;bought_on alert alert-info&quot;&gt;
					{l s='You purchased this product on'} {dateFormat date=$bought_on}
				&lt;/div&gt;	
			&lt;/div&gt;
		{/if}
</pre>
<p>Save and refresh, we are done! You should see something like this:</p>
<p><a href="http://nemops.com/wp-content/uploads/2016/09/bought_product_notification.png"><img src="http://nemops.com/wp-content/uploads/2016/09/bought_product_notification-680x418.png" alt="Product bought label in PrestaShop" width="680" height="418" class="aligncenter size-large wp-image-2848" /></a></p>
<p>The post <a rel="nofollow" href="https://nemops.com/prestashop-bought-product-label/">Display a &#8220;Bought product&#8221; label in PrestaShop</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://nemops.com/prestashop-bought-product-label/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Displaying the order resume at the Order Confirmation in Prestashop</title>
		<link>https://nemops.com/prestashop-order-confirmation-resume/</link>
		<comments>https://nemops.com/prestashop-order-confirmation-resume/#comments</comments>
		<pubDate>Mon, 15 Jun 2015 09:23:20 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[order]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[products]]></category>
		<category><![CDATA[resume]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2445</guid>
		<description><![CDATA[<p>Customers love visual feedback, and most of them often like to see a resume of their order right after pay. Let&#8217;s see how to display the order resume on the order confirmation page in Prestashop. Creating a simple module The best way to add new elements to the order confirmation page, in Prestashop, is through [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://nemops.com/prestashop-order-confirmation-resume/">Displaying the order resume at the Order Confirmation in Prestashop</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Customers love visual feedback, and most of them often like to see a resume of their order right after pay. Let&#8217;s see how to display the order resume on the order confirmation page in Prestashop.</p>
<a class="download-files button style1" href="http://nemops.com/wp-content/uploads/2015/06/confirmation_resume.zip" title="Download Project Files">Download Project Files</a>
<p><span id="more-2445"></span></p>
<h2>Creating a simple module</h2>
<p>The best way to add new elements to the order confirmation page, in Prestashop, is through a very simple module that hooks to <strong>orderConfirmation</strong>. Even if you are not familiar with advanced coding, this very step should be pretty simple to follow.</p>
<p>First off, download the sample module archive you find at the beginning of the article. Open it and place the first <strong>psconfresume</strong> folder you see inside <em>modules/</em>.</p>
<p>Navigate to it, and open <strong>psconfresume.php</strong> in your favorite code editor, then paste in the following, inside php tags:</p>
<pre class="brush: php; title: ; notranslate">
if (!defined('_PS_VERSION_'))
	exit;

class psConfResume extends Module
{

	protected $_errors = array();


	public function __construct()
	{
		$this-&gt;name = 'psconfresume';
		$this-&gt;tab = 'front_office_features';
		$this-&gt;version = '1.0';
		$this-&gt;author = 'Nemo';
		$this-&gt;need_instance = 0;


		$this-&gt;bootstrap = true;


	 	parent::__construct();

		$this-&gt;displayName = $this-&gt;l('psconfresume');
		$this-&gt;description = $this-&gt;l('Adds a block.');
		$this-&gt;confirmUninstall = $this-&gt;l('Are you sure you want to delete this module?');
	}
	
	public function install()
	{
		if (!parent::install() OR
			!$this-&gt;registerHook('orderConfirmation')
			)
			return false;
		return true;
	}
	
	public function uninstall()
	{
		if (!parent::uninstall())
			return false;
		return true;
	}
}
</pre>
<p>These are just the barebones of a module. Just make sure you register the orderConfirmation hook if you do it from scratch.</p>
<h3>Assigning parameters to the hook</h3>
<p>Once done with the basic setup, we need to do something with the hook. Add the following as last method:</p>
<pre class="brush: php; title: ; notranslate">

	public function hookOrderConfirmation($params)
	{

		$order = $params['objOrder'];
		$products = $order-&gt;getProducts();

		$this-&gt;context-&gt;smarty-&gt;assign(array(
			'order'=&gt; $order,
			'order_products' =&gt; $products
		));
		
		return $this-&gt;display(__FILE__, 'confirmation.tpl');
	}
</pre>
<p>There is nothing too fancy going on here. First, we take advantage of the <strong>order</strong> object, which comes through the $params array, and use it to get more details on the ordered products. Then, we simply assign both variables to the template, returning it in the end. Make sure this .tpl file is located inside the module&#8217;s folder, <em>views/templates/hook</em>.</p>
<div class="separator"></div>
<h2>The order resume table</h2>
<p>At this point, we are just throwing in an empty template, so we need to fill it with data. Open up <strong>views/templates/hook/confirmation.tpl</strong> and paste the following (yeah it&#8217;s long):</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
&lt;table class=&quot;std&quot;&gt;
	&lt;thead&gt;
		&lt;tr&gt;
			&lt;th&gt;{l s='Product' mod='psconfresume'}&lt;/th&gt;
			&lt;th&gt;{l s='Price' mod='psconfresume'}&lt;/th&gt;
			&lt;th&gt;{l s='Qty' mod='psconfresume'}&lt;/th&gt;
		&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
		{foreach from=$order_products item=product}
			&lt;tr&gt;
				&lt;td&gt;{$product.product_name}&lt;/td&gt;
				&lt;td&gt;
					{if $use_taxes}
						{displayPrice price=$product.total_price_tax_incl}
					{else}
						{displayPrice price=$product.total_price_tax_excl}
					{/if}
				&lt;/td&gt;
				&lt;td&gt;{$product.product_quantity}&lt;/td&gt;
			&lt;/tr&gt;
		{/foreach}
	&lt;/tbody&gt;
	&lt;tfoot&gt;
		&lt;tr&gt;
			&lt;td style=&quot;text-align:right&quot;&gt;
				{l s='Products Total' mod='psconfresume'}
			&lt;/td&gt;
			&lt;td colspan=&quot;2&quot;&gt;
				{if $use_taxes}
					{displayPrice price=$order-&gt;total_products_wt}
				{else}
					{displayPrice price=$order-&gt;total_products}
				{/if}
				
			&lt;/td&gt;
		&lt;/tr&gt;	
		&lt;tr&gt;
			&lt;td style=&quot;text-align:right&quot;&gt;
				{l s='Shipping' mod='psconfresume'}
			&lt;/td&gt;
			&lt;td colspan=&quot;2&quot;&gt;
				{if $use_taxes}
					{displayPrice price=$order-&gt;total_shipping_tax_incl}
				{else}
					{displayPrice price=$order-&gt;total_shipping_tax_excl}
				{/if}
				
			&lt;/td&gt;
		&lt;/tr&gt;
		{if $order-&gt;total_discounts != '0.00'}
			&lt;tr&gt;
				&lt;td style=&quot;text-align:right&quot;&gt;
					{l s='Discounts' mod='psconfresume'}
				&lt;/td&gt;
				&lt;td colspan=&quot;2&quot;&gt;-
					{if $use_taxes}
						{displayPrice price=$order-&gt;total_discounts_tax_incl}
					{else}
						{displayPrice price=$order-&gt;total_discounts_tax_excl}
					{/if}
				&lt;/td&gt;
			&lt;/tr&gt;
		{/if}
		{if $use_taxes}
			&lt;tr&gt;
				&lt;td style=&quot;text-align:right&quot;&gt;
					{l s='Taxes Paid' mod='psconfresume'}
				&lt;/td&gt;
				&lt;td colspan=&quot;2&quot;&gt;
					{$taxamt = $order-&gt;total_paid_tax_incl - $order-&gt;total_paid_tax_excl}
					{displayPrice price=$taxamt}

				&lt;/td&gt;
			&lt;/tr&gt;
		{/if}
		&lt;tr&gt;
			&lt;td style=&quot;text-align:right&quot;&gt;
				{l s='TOTAL' mod='psconfresume'}
			&lt;/td&gt;
			&lt;td colspan=&quot;2&quot;&gt;
				{if $use_taxes}
					{displayPrice price=$order-&gt;total_paid_tax_incl}
				{else}
					{displayPrice price=$order-&gt;total_paid_tax_excl}
				{/if}
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tfoot&gt;
&lt;/table&gt;
</pre>
<p>I didn&#8217;t break it into steps because it&#8217;s quite simple: we create a table with Product name, price and quantity as headers. Then, in the body, we loop through products themselves and display what we need. Lastly, we take care of shipping, discounts, taxes and total in the tfoot element. Please notice I used the $use_taxes variable to detect whether or not we have to display the taxed amount. You might want to tweak these parts depending on your needs, such as adding gift wrap as well or using DIV tags instead of a table.</p>
<p>That is basically it, create and order and see if everything works:</p>
<p><a href="http://nemops.com/wp-content/uploads/2015/06/order_confirmation_resume.png"><img src="http://nemops.com/wp-content/uploads/2015/06/order_confirmation_resume-680x288.png" alt="Prestashop order confirmation resume" width="680" height="288" class="aligncenter size-large wp-image-2451" /></a></p>
<p>The post <a rel="nofollow" href="https://nemops.com/prestashop-order-confirmation-resume/">Displaying the order resume at the Order Confirmation in Prestashop</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://nemops.com/prestashop-order-confirmation-resume/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>How to show &#8220;spend X to get Free Shipping&#8221; in Prestashop</title>
		<link>https://nemops.com/prestashop-show-free-shipping/</link>
		<comments>https://nemops.com/prestashop-show-free-shipping/#comments</comments>
		<pubDate>Mon, 04 Aug 2014 10:07:28 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[cart]]></category>
		<category><![CDATA[free shipping]]></category>
		<category><![CDATA[order]]></category>
		<category><![CDATA[prestashop 1.6]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2107</guid>
		<description><![CDATA[<p>In this Prestashop tutorial, we will see how to boost our sales by letting customers know how much they still have to spend in order to be eligible for free shipping. Version used: Prestashop 1.6 Setting the Free Shipping amount To keep thing simple, in this tutorial we will only consider the &#8220;Free shipping starts [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://nemops.com/prestashop-show-free-shipping/">How to show &#8220;spend X to get Free Shipping&#8221; in Prestashop</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this Prestashop tutorial, we will see how to boost our sales by letting customers know how much they still have to spend in order to be eligible for free shipping.</p>
<p><span id="more-2107"></span></p>
<p>Version used: Prestashop 1.6</p>
<h2>Setting the Free Shipping amount</h2>
<p>To keep thing simple, in this tutorial we will only consider the &#8220;<strong>Free shipping starts at</strong>&#8221; value that we can configure in the back office, instead of dealing with all the 0-fee weight or price ranges that it&#8217;s possible to setup for each carrier.</p>
<p>Therefore, before starting, head to <strong>Shipping -> Preferences</strong> and set &#8220;<strong>Free shipping starts at</strong>&#8221; to any value you like. Please notice this represent the price in the default currency, and it&#8217;s not possible to set up one for each, at the time being.</p>
<div class="separator"></div>
<h2>Retrieving the Free shipping value &#8211; 2 approaches</h2>
<p>When dealing with an MVC pattern, the best approach is usually to keep logic and display code separated. Prestashop, however, allows us to retrieve the previously set configuration value in templates too, saving us the trouble to create an override and extend the default <strong>OrderController</strong>, in order to assign the value we need. </p>
<p>Therefore, given that <strong>the best way to go would be to create an override, grab the configuration value, and assign it to the template</strong>, for simplicity reasons I will get it directly in the template, so it&#8217;s ready to use.</p>
<div class="separator"></div>
<h2>Amending the template: shopping-cart.tpl</h2>
<p>Reach your theme folder and open up <strong>shopping-cart.tpl</strong>. We will be adding our small advertisement right below the cart summary. This is the perfect chance to apply some cross-selling principles; therefore, if you use the cross-selling module in the cart page, <strong>the best spot to maximize your cross-selling rate is right above it, before the shopping cart hook </strong>.</p>
<p>Locate:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
&lt;div id=&quot;HOOK_SHOPPING_CART&quot;&gt;{$HOOK_SHOPPING_CART}&lt;/div&gt;
</pre>
<p>And right before it, add the following</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{assign var='freeshipping_price' value=Configuration::get('PS_SHIPPING_FREE_PRICE')}
</pre>
<p><strong>Explanation</strong>: as I mentioned before, I am grabbing the free shipping value directly from the tpl file, and assigning it to a variable that can be used within our Prestashop template.</p>
<p>Then, we need to check if it is actually holding a value</p>
<pre class="brush: php; html-script: true; title: ; notranslate">

	{assign var='freeshipping_price' value=Configuration::get('PS_SHIPPING_FREE_PRICE')}
	{if $freeshipping_price}
		{assign var='freeshipping_price_converted' value={toolsConvertPrice price=$freeshipping_price}}	
	{/if}


</pre>
<p><strong>Explanation:</strong> if the value exists, we need to convert it to the current currency (which might be other than the default). Therefore, we use the very handy <strong>toolsConvertPrice</strong> method to make sure the value is correctly set to the actual customer currency.</p>
<p>What&#8217;s next? We need to compare the total cart value without shipping to the free shipping one, and display a message in case it&#8217;s positive:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
	
	{assign var='freeshipping_price' value=Configuration::get('PS_SHIPPING_FREE_PRICE')}

	{if $freeshipping_price}
		{assign var='freeshipping_price_converted' value={toolsConvertPrice price=$freeshipping_price}}


		{math equation='a-b' a=$total_price b=$total_shipping assign='total_without_shipping'}
		{math equation='a-b' a=$freeshipping_price_converted b=$total_without_shipping assign='remaining_to_spend'}

		{if $remaining_to_spend &gt; 0}
			&lt;p&gt;{l s='Your total (without shipping) is'} {convertPrice price=$total_without_shipping}&lt;/p&gt;
			&lt;p&gt;&lt;strong&gt;{l s='You will be eligible for free shipping if you spend another'} {convertPrice price=$remaining_to_spend}&lt;/strong&gt;&lt;/p&gt;
		{/if}
	

	{/if}

</pre>
<p><strong>Explanation:</strong> first, we subtract the total shipping price from the overall total, which is the value taken in consideration by Prestashop when deciding if a cart is eligible or not, and then we simply subtract it from our minimum free shipping threshold. If the result is positive, we tell our customers how much is left to get rid of the shipping charge!</p>
<p>The post <a rel="nofollow" href="https://nemops.com/prestashop-show-free-shipping/">How to show &#8220;spend X to get Free Shipping&#8221; in Prestashop</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://nemops.com/prestashop-show-free-shipping/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Flash Tip: Order Prestashop Features by name</title>
		<link>https://nemops.com/order-prestashop-features-name/</link>
		<comments>https://nemops.com/order-prestashop-features-name/#comments</comments>
		<pubDate>Tue, 03 Dec 2013 08:53:44 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[features]]></category>
		<category><![CDATA[order]]></category>
		<category><![CDATA[prestashop]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=1705</guid>
		<description><![CDATA[<p>In this flash tip, we will see how to order Prestashop Features by name automatically, without having to manually adjust their position every time! Ordering Prestashop Features by name In order to change the features&#8217; order we need to amend the method called getFrontFeaturesStatic, of the Product class. As it&#8217;s best practice, let&#8217;s use an [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://nemops.com/order-prestashop-features-name/">Flash Tip: Order Prestashop Features by name</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this flash tip, we will see how to order Prestashop Features by name automatically, without having to manually adjust their position every time!</p>
<p><span id="more-1705"></span></p>
<h2>Ordering Prestashop Features by name</h2>
<p>In order to change the features&#8217; order we need to amend the method called <strong>getFrontFeaturesStatic</strong>, of the Product class. As it&#8217;s best practice, let&#8217;s use an override!</p>
<p>Go to <em>override/classes</em> and create a file named <strong>Product.php</strong>. Inside, add the following:</p>
<pre class="brush: php; title: ; notranslate">
class Product extends ProductCore
{
}
</pre>
<p>Then, let&#8217;s have a look at the original getFrontFeaturesStatic, located in the code Product.php file, found in the <em>classes/</em> folder.</p>
<pre class="brush: php; title: ; notranslate">

	public static function getFrontFeaturesStatic($id_lang, $id_product)
	{
		if (!Feature::isFeatureActive())
			return array();
		if (!array_key_exists($id_product.'-'.$id_lang, self::$_frontFeaturesCache))
		{
			self::$_frontFeaturesCache[$id_product.'-'.$id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)-&gt;executeS('
				SELECT name, value, pf.id_feature
				FROM '._DB_PREFIX_.'feature_product pf
				LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
				LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
				LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
				'.Shop::addSqlAssociation('feature', 'f').'
				WHERE pf.id_product = '.(int)$id_product.'
				ORDER BY f.position ASC'
			);
		}
		return self::$_frontFeaturesCache[$id_product.'-'.$id_lang];
	}
</pre>
<p>Pay close attention to the ORDER BY clause. It currently says: f.position. We want to order by name, which is a column of the feature_lang table! Therefore, copy this whole method to the new override:</p>
<pre class="brush: php; title: ; notranslate">
class Product extends ProductCore
{

	public static function getFrontFeaturesStatic($id_lang, $id_product)
	{
		if (!Feature::isFeatureActive())
			return array();
		if (!array_key_exists($id_product.'-'.$id_lang, self::$_frontFeaturesCache))
		{
			self::$_frontFeaturesCache[$id_product.'-'.$id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)-&gt;executeS('
				SELECT name, value, pf.id_feature
				FROM '._DB_PREFIX_.'feature_product pf
				LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
				LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
				LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
				'.Shop::addSqlAssociation('feature', 'f').'
				WHERE pf.id_product = '.(int)$id_product.'
				ORDER BY f.position ASC'
			);
		}
		return self::$_frontFeaturesCache[$id_product.'-'.$id_lang];
	}

}
</pre>
<p>And change the ORDER BY clause as follows: </p>
<pre class="brush: php; title: ; notranslate">
ORDER BY fl.name ASC
</pre>
<p>Done! If you are using a version newer than 1.5.3, go to the <em>cache/</em> folder and delete the class_index.php file in order for the new changes to take place!</p>
<p>The final override:</p>
<pre class="brush: php; title: ; notranslate">
class Product extends ProductCore
{

	public static function getFrontFeaturesStatic($id_lang, $id_product)
	{
		if (!Feature::isFeatureActive())
			return array();
		if (!array_key_exists($id_product.'-'.$id_lang, self::$_frontFeaturesCache))
		{
			self::$_frontFeaturesCache[$id_product.'-'.$id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)-&gt;executeS('
				SELECT name, value, pf.id_feature
				FROM '._DB_PREFIX_.'feature_product pf
				LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
				LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
				LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
				'.Shop::addSqlAssociation('feature', 'f').'
				WHERE pf.id_product = '.(int)$id_product.'
				ORDER BY fl.name ASC'
			);
		}
		return self::$_frontFeaturesCache[$id_product.'-'.$id_lang];
	}

}
</pre>
<p>The post <a rel="nofollow" href="https://nemops.com/order-prestashop-features-name/">Flash Tip: Order Prestashop Features by name</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://nemops.com/order-prestashop-features-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
