<?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; Tips n Tricks</title>
	<atom:link href="http://nemops.com/category/tutorials/tips/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>Creating Multilanguage attachments in PrestaShop 1.7</title>
		<link>http://nemops.com/prestashop-1-7-multilanguage-attachments/</link>
		<comments>http://nemops.com/prestashop-1-7-multilanguage-attachments/#comments</comments>
		<pubDate>Wed, 05 Dec 2018 13:24:30 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[attachments]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[prestashop 1.7]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=3173</guid>
		<description><![CDATA[<p>Attachments are a great way to provide your customers with rich pre-sale information about your products. But what if your site is multilingual? Let’s see how to make Attachments multilanguage in PrestaShop 1.7. Watch the screencast Text Version Step 1 – Adding the attachments Adding attachments with the proper name is fundamental for this technique. [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-1-7-multilanguage-attachments/">Creating Multilanguage attachments in PrestaShop 1.7</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Attachments are a great way to provide your customers with rich pre-sale information about your products. But what if your site is multilingual? Let’s see how to make Attachments multilanguage in PrestaShop 1.7.</p>
<p><span id="more-3173"></span></p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/zoo6WkY7ouc" 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>
<h3>Step 1 – Adding the attachments</h3>
<p>Adding attachments with the proper name is fundamental for this technique. We will append the language ISOs to the names, so that they can later be targeted in the template.</p>
<p>Login to the back office, then navigate to Catalog &gt; Products, and choose one to start with. At the bottom of the <strong>Options </strong>tab, add two test attachments. The file names don’t matter, but the <strong>title </strong>you choose does. Add one attachment for each language it’s translated to, making sure you append the ISO code for that language after the name, like this: <strong>_en</strong>, <strong>_it</strong>, <strong>_fr</strong>.</p>
<p><strong>Note: </strong>If you don’t know what the language code is, hop to International &gt; Localization, and click on Languages. The ISO code is listed in the table:</p>
<p><a href="http://nemops.com/wp-content/uploads/2018/12/prestashop-17-language-iso.jpg"><img class="aligncenter size-full wp-image-3174" src="http://nemops.com/wp-content/uploads/2018/12/prestashop-17-language-iso.jpg" alt="PrestaShop 1.7 Language ISO" width="665" height="361" /></a></p>
<p>&nbsp;</p>
<p>If you need an attachment to display for all of the languages, make sure you <strong>do not</strong> add any language ISO to it.</p>
<div class="separator"></div>
<h3>Step 2 – Editing the template</h3>
<p>&nbsp;</p>
<p>For this tutorial I am using the “classic” template, that ships with PrestaShop 1.7. If you are using a custom theme, be aware that some of the code might be different, or even located in a different file.</p>
<p>Open up <strong>themes/classic/templates/catalog/product.tpl</strong>.</p>
<p>Locate the following code:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{if $product.attachments}
                    &lt;div class=&quot;tab-pane fade in&quot; id=&quot;attachments&quot; role=&quot;tabpanel&quot;&gt;
                       &lt;section class=&quot;product-attachments&quot;&gt;
                         &lt;h3 class=&quot;h5 text-uppercase&quot;&gt;{l s='Download' d='Shop.Theme.Actions'}&lt;/h3&gt;
</pre>
<p>Right afterwards, but before the foreach loop, add the following</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{$lang_checker = &quot;_&quot;|cat: {$language.iso_code}}
{$lang_checker_array = ['en', 'it']}

</pre>
<p><strong>Make sure you use your own ISO codes instead of ‘en’ and ‘it’. Add all of the languages your store supports</strong></p>
<p>Next, wrap the attachment block in the following IF statement</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
                         {if $attachment.name|strstr:{$lang_checker}}
                           &lt;div class=&quot;attachment&quot;&gt;
                             &lt;h4&gt;&lt;a href=&quot;{url entity='attachment' params=['id_attachment' =&gt; $attachment.id_attachment]}&quot;&gt;{$attachment.name|replace:{$lang_checker}:''}&lt;/a&gt;&lt;/h4&gt;
                             &lt;p&gt;{$attachment.description}&lt;/p
                             &lt;a href=&quot;{url entity='attachment' params=['id_attachment' =&gt; $attachment.id_attachment]}&quot;&gt;
                               {l s='Download' d='Shop.Theme.Actions'} ({$attachment.file_size_formatted})
                             &lt;/a&gt;
                           &lt;/div&gt;
{/if}

</pre>
<p>If you don’t need some attachments to display for all languages, you can go ahead and test it, as the basic part if basically done. If you do, you will need to add a little extra condition, and we will use that lang_checker_array for it.</p>
<div class="separator"></div>
<h3>Step 2.1 – Fallback for generic attachments</h3>
<p>Right before the end of the IF statement that checks for our ISO code, add the following:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">

{else}
  {$denier = false}
  {foreach from=$lang_checker_array item=checkr_lang}
                              {if $attachment.name|strstr:{$checkr_lang}}
                              {$denier = true}
                              {/if}
  {/foreach}

</pre>
<p><strong>Explanation: </strong>We are setting a variable (denier) that will prevent displaying the attachment if it contains <strong>any</strong> language ISO. Because of this logic, make sure you use a string that’s unique enough in case your attachment names contain product codes or alike, otherwise they won’t ever display.</p>
<p>Right afterwards, but still inside our main IF, add this last chunk of code</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
                               
{if !$denier}
&lt;div class=&quot;attachment&quot;&gt;
&lt;h4&gt;&lt;a href=&quot;{url entity='attachment' params=['id_attachment' =&gt; $attachment.id_attachment]}&quot;&gt;{$attachment.name|replace:{$lang_checker}:''}&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;{$attachment.description}&lt;/p
&lt;a href=&quot;{url entity='attachment' params=['id_attachment' =&gt; $attachment.id_attachment]}&quot;&gt;
{l s='Download' d='Shop.Theme.Actions'} ({$attachment.file_size_formatted})
&lt;/a&gt;
&lt;/div&gt;
{/if}

</pre>
<p>Which is basically a copy of the standard attachment code. If the attachment does not contain any iso code, it means we can display it normally.</p>
<p>We are done!</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-1-7-multilanguage-attachments/">Creating Multilanguage attachments in PrestaShop 1.7</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-1-7-multilanguage-attachments/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Removing out of stock products from the cart in PrestaShop 1.7</title>
		<link>http://nemops.com/remove-out-of-stock-products-from-the-cart-prestashop-17/</link>
		<comments>http://nemops.com/remove-out-of-stock-products-from-the-cart-prestashop-17/#comments</comments>
		<pubDate>Thu, 04 Oct 2018 00:08:07 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[out of stock]]></category>
		<category><![CDATA[prestashop 1.7]]></category>
		<category><![CDATA[products]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=3151</guid>
		<description><![CDATA[<p>PrestaShop 1.7 does not remove out of stock products from shopping carts, creating major troubles when keeping low stock. Let&#8217;s see how to improve our customer&#8217;s experience with a simple modification! Watch the screencast Text Version If you have lots of users it might happen sometimes that a product goes out of stock while it&#8217;s [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/remove-out-of-stock-products-from-the-cart-prestashop-17/">Removing out of stock products from the cart in PrestaShop 1.7</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>PrestaShop 1.7 does not remove out of stock products from shopping carts, creating major troubles when keeping low stock. Let&#8217;s see how to improve our customer&#8217;s experience with a simple modification!</p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/OouTaCaMZBU" 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>If you have lots of users it might happen sometimes that a product goes out of stock while it&#8217;s in someone&#8217;s cart. For example two users add the last unit, one proceeds to the checkout and the other doesn&#8217;t. What happens is when the second customer places the order, the product will not be available anymore, and it will cause confusion if not irritation to that person, especially if you cannot restock that specific item.</p>
<h3>The Cart Presenter in PrestaShop 1.7</h3>
<p>The first file we need to edit is the <strong>cartPresenter</strong>, which is responsible of displaying cart information across the store.</p>
<p>Open up <em>src/Adapter/Cart/cartpresenter.php</em> and add the following around line 51, in the class properties:</p>
<pre class="brush: php; title: ; notranslate">
private static $removedProducts = [];
</pre>
<p>Then locate the <strong>present </strong>method, and right after the following statement:</p>
<pre class="brush: php; title: ; notranslate">
        if ($shouldSeparateGifts) {
            $rawProducts = $cart-&gt;getProductsWithSeparatedGifts();
        } else {
            $rawProducts = $cart-&gt;getProducts(true);
        }
</pre>
<p>Add this:</p>
<pre class="brush: php; title: ; notranslate">


        // start nemo

        if(!self::$removedProducts)
            foreach ($rawProducts as $pk =&gt; $product)
            {
            // we want to remove the product in case it's not available
                if($product['quantity_available'] &lt;= 0 &amp;&amp; !Product::isAvailableWhenOutOfStock($product['out_of_stock']))
                {
                    Context::getContext()-&gt;cart-&gt;deleteProduct($product['id_product'],$product['id_product_attribute'], $product['id_customization'], $product['id_address_delivery']);
                    self::$removedProducts[] = $product['name'];
                    unset($rawProducts[$pk]);
                    continue;
                }
            }
           
        Context::getContext()-&gt;smarty-&gt;assign(['removed_products' =&gt; self::$removedProducts]);
        \Media::addJsDef(['removed_products' =&gt; self::$removedProducts]);


</pre>
<p>And that&#8217;s all for php! Before continuing let&#8217;s make sure the product actually gets removed, so let&#8217;s test it and see if they really get removed!</p>
<h3>The shopping cart template in PrestaShop 1.7</h3>
<p>Let&#8217;s open up <em>themes/classic/modules/ps_shoppingcart/ps_shoppingcart.tpl </em></p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{if isset($removed_products) &amp;&amp; $removed_products}
  &lt;div id=&quot;removed-modal&quot; class=&quot;modal&quot;&gt;
    &lt;div class=&quot;modal-dialog&quot;&gt;
      &lt;div class=&quot;modal-content&quot;&gt;
        &lt;div class=&quot;modal-body&quot;&gt;
          &lt;p&gt;{l s='These products are out of stock' d='Shop.Theme.Checkout'}&lt;/p&gt;
            &lt;ul&gt;
              {foreach from=$removed_products item='r_product'}
                &lt;li&gt;- {$r_product}&lt;/li&gt;
              {/foreach}
            &lt;/ul&gt;
            &lt;p&gt;{l s='And have therefore been removed from your cart' d='Shop.Theme.Checkout'}&lt;/p&gt;
        &lt;/div&gt;

      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
{/if}
</pre>
<p>And the very last thing is actually triggering the modal when we need, so let&#8217;s add some javascript to <em>themes/classic/assets/js/custom.js</em></p>
<pre class="brush: jscript; title: ; notranslate">
if(removed_products.length &gt; 0) {
	$('#removed-modal').modal('show');
}

</pre>
<p>And that&#8217;s it! Now this modal doesn&#8217;t look so fancy, but no worries since in one of the next videos we will go over creating and styling custom popups in prestashop 1.7, so stay tuned!</p>
<p>The post <a rel="nofollow" href="http://nemops.com/remove-out-of-stock-products-from-the-cart-prestashop-17/">Removing out of stock products from the cart in PrestaShop 1.7</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/remove-out-of-stock-products-from-the-cart-prestashop-17/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Blocking spam emails in PrestaShop</title>
		<link>http://nemops.com/blocking-spam-emails-in-prestashop/</link>
		<comments>http://nemops.com/blocking-spam-emails-in-prestashop/#comments</comments>
		<pubDate>Wed, 22 Aug 2018 02:11:43 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=3145</guid>
		<description><![CDATA[<p>As you know PrestaShop has been dreaded by a lot of spam issues recently. In this video we will see how to quickly block spam emails coming from the PrestaShop contact form Watch the screencast Let&#8217;s get started! Create a new php file in the override/controllers/front folder, and name it: ContactController.php and add the following [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/blocking-spam-emails-in-prestashop/">Blocking spam emails in PrestaShop</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>As you know PrestaShop has been dreaded by a lot of spam issues recently. In this video we will see how to quickly block spam emails coming from the PrestaShop contact form<br />
<span id="more-3145"></span></p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/D3_gvr0Raww" 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>
<p>Let&#8217;s get started! Create a new php file in the <em>override/controllers/front</em> folder, and name it: <strong>ContactController.php</strong> and add the following inside php tags:</p>
<pre class="brush: php; title: ; notranslate">

class ContactController extends ContactControllerCore
{
}

</pre>
<p>We need to latch into the postProcess method, so let&#8217;s extend it:</p>
<pre class="brush: php; title: ; notranslate">
public function postProcess()
{
    if(Tools::isSubmit('submitMessage'))
    {
    }
}
</pre>
<p>We want to save the submitted message to a variable first, and then the email:</p>
<pre class="brush: php; title: ; notranslate">
    	$message = Tools::getValue('message');
        $from = trim(Tools::getValue('from'))
</pre>
<p>Now to keep things tidy we will create two new arrays, one will contain the list of strings to ban from emails, the other the ones to ban from the content:</p>
<pre class="brush: php; title: ; notranslate">

            $banned_in_email = ['.ru', 'qq.com', '.vn'];
            $banned_content = ['email marketing'];
</pre>
<p><strong>Please Note:</strong> make sure you use strings that are related to the spam you are actually getting. I am getting spam from .ru, qq.com and .vn domains, so that&#8217;s what I am blocking. I also get a lot of emails containing &#8220;email marketing&#8221; in the text, and am unlikely to get anything real with that type of content.<br />
Make sure you do not ban real customers!</p>
<p>We want to loop through both and spawn an error if anything is contained in the submitted variables:</p>
<pre class="brush: php; title: ; notranslate">
            foreach ($banned_in_email as $string) {
                if(strstr($from, $string))
                    $this-&gt;errors[] = Tools::displayError('This email address is not allowed');
            }
            foreach ($banned_content as $string) {
                if(strstr($message, $string))
                    $this-&gt;errors[] = Tools::displayError('Invalid content');
            }
</pre>
<p>And that&#8217;s basically it, we just need to call the parent at the very end of the method:</p>
<p>parent::postProcess();</p>
<p>And we are done! Here is the complete override:</p>
<pre class="brush: php; title: ; notranslate">
class ContactController extends ContactControllerCore
{
    public function postProcess()
    {
        if(Tools::isSubmit('submitMessage')) {

            $message = Tools::getValue('message');
            $from = Tools::getValue('from');

            $banned_in_email = ['.ru', 'qq.com', '.vn'];
            $banned_content = ['email marketing'];

            foreach ($banned_in_email as $string) {
                if(strstr($from, $string))
                    $this-&gt;errors[] = Tools::displayError('This email address is not allowed');
            }

            foreach ($banned_content as $string) {
                if(strstr($message, $string))
                    $this-&gt;errors[] = Tools::displayError('Invalid Content');
            }
        }
        parent::postProcess();
    }
}
</pre>
<p>Before you test, make sure you erase cache/class_index.php, so that the new override is loaded in the system.</p>
<p>The post <a rel="nofollow" href="http://nemops.com/blocking-spam-emails-in-prestashop/">Blocking spam emails in PrestaShop</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/blocking-spam-emails-in-prestashop/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Private Orders Shop in PrestaShop and thirty bees part 2: hide shopping options for visitors</title>
		<link>http://nemops.com/private-orders-in-prestashop-thirty-bees-2-hide-shopping-options-for-visitors/</link>
		<comments>http://nemops.com/private-orders-in-prestashop-thirty-bees-2-hide-shopping-options-for-visitors/#comments</comments>
		<pubDate>Mon, 18 Jun 2018 10:54:39 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[private]]></category>
		<category><![CDATA[shop]]></category>
		<category><![CDATA[thirtybees]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=3138</guid>
		<description><![CDATA[<p>In this second tutorial we will see how to prevent orders from non-registered customers, which is also necessary in case you applied the previous tutorial and are currently using a one page checkout. Watch the screencast Text Version METHOD 1 – Selectively enabling catalog mode If we don’t need to display prices to our visitors, [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/private-orders-in-prestashop-thirty-bees-2-hide-shopping-options-for-visitors/">Private Orders Shop in PrestaShop and thirty bees part 2: hide shopping options for visitors</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this second tutorial we will see how to prevent orders from non-registered customers, which is also necessary in case you applied the previous tutorial and are currently using a one page checkout.<br />
<span id="more-3138"></span></p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/TQQuckN9HdQ" 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>
<h3>METHOD 1 – Selectively enabling catalog mode</h3>
<p>If we don’t need to display prices to our visitors, the simplest and quickest way to proceed is by selectively enable catalog mode. Open classes/controller/FrontController.php, and locate the following string, inside the init method:</p>
<pre class="brush: php; title: ; notranslate">
'PS_CATALOG_MODE' =&gt; (bool)Configuration::get('PS_CATALOG_MODE') || (Group::isFeatureActive() &amp;amp;&amp;amp; !(bool)Group::getCurrent()-&gt;show_prices),
</pre>
<p>Replace it with the following:</p>
<pre class="brush: php; title: ; notranslate">
'PS_CATALOG_MODE' =&gt; $catalog_mode || (Group::isFeatureActive() &amp;amp;&amp;amp; !(bool)Group::getCurrent()-&gt;show_prices),
</pre>
<p>We need to create that $catalog_mode variable of course, so let’s add this before the whole assign block:</p>
<pre class="brush: php; title: ; notranslate">
$catalog_mode = (bool)Configuration::get('PS_CATALOG_MODE');
if(!$this-&gt;context-&gt;customer-&gt;id)
    $catalog_mode = true;
</pre>
<p>As you can see, we simply check if the customer id is set (that is, if the user is logged in) and if so, we set catalog mode to true, effectively disabling all cart functionalities. This however left us with a useless cart block, and without prices. Let’s see how to handle it differently then!</p>
<div class="separator"></div>
<h3>METHOD 2 – Selectively disable products</h3>
<p>I will create an override for this one, so in override/classes, let’s create a new file named Product.php.</p>
<p>Let&#8217;s open it up, and copy over the construct method from the core product class. Get rid of everything inside it, and simply add the following:</p>
<pre class="brush: php; title: ; notranslate">
Class Product extends ProductCore
{
    public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null)
    {
        parent::__construct($id_product, $id_lang, $id_shop);

        if(!Context::getContext()-&gt;customer-&gt;id)
            $this-&gt;available_for_order = false;
    }
}
</pre>
<p>This will take care of the product page. Now for the product list, the property is set elsewhere, and specifically in the getProductProperties method (without s). Copy the whole method from the original class again, but this time leave the content, and just append the following code at the end, right before self::$producPropertiesCache[$cache_key] = $row;</p>
<pre class="brush: php; title: ; notranslate">
if(!$context-&gt;customer-&gt;id)
    $row['available_for_order'] = false;
</pre>
<p>And that’s all we need! Since we created a new override, remember it’s necessary to erase cache/class_index.php in order for the changes to take place.</p>
<p>The post <a rel="nofollow" href="http://nemops.com/private-orders-in-prestashop-thirty-bees-2-hide-shopping-options-for-visitors/">Private Orders Shop in PrestaShop and thirty bees part 2: hide shopping options for visitors</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/private-orders-in-prestashop-thirty-bees-2-hide-shopping-options-for-visitors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a &#8220;Go back to the category&#8221; button in PrestaShop and thirty bees</title>
		<link>http://nemops.com/how-to-create-a-go-back-to-the-category-button-in-prestashop-and-thirty-bees/</link>
		<comments>http://nemops.com/how-to-create-a-go-back-to-the-category-button-in-prestashop-and-thirty-bees/#comments</comments>
		<pubDate>Mon, 09 Apr 2018 10:56:55 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[prestashop 1.6]]></category>
		<category><![CDATA[thirtybees]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=3125</guid>
		<description><![CDATA[<p>In this video we will make a handy button to let our customers navigate back to the previously visited category from the product page, in PrestaShop 1.6 and thirty bees Watch the screencast Text Version To start with, open up global.js, located in your theme folder /js. At the very end, add the following: Then, [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/how-to-create-a-go-back-to-the-category-button-in-prestashop-and-thirty-bees/">How to create a &#8220;Go back to the category&#8221; button in PrestaShop and thirty bees</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this video we will make a handy button to let our customers navigate back to the previously visited category from the product page, in PrestaShop 1.6 and thirty bees<br />
<span id="more-3125"></span></p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/nOR7f_76LHE" 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>To start with, open up <strong>global.js</strong>, located in your theme folder <em>/js</em>. At the very end, add the following:</p>
<pre class="brush: jscript; title: ; notranslate">

$(document).ready(function() {
	if($('body').hasClass('category'))
	{
		$('.product_img_link').click(function(e) {
			$.totalStorage('last_visited_category', window.location.href);
		});
	}
});
</pre>
<p>Then, in <strong>product.tpl</strong>, again in the theme folder, find a proper spot for the button, then add the following inside a &lt;script&gt; tag:</p>
<pre class="brush: jscript; title: ; notranslate">
	$(document).ready(function() {
		if(previous_category = $.totalStorage('last_visited_category'))
		{
			$('#goback').attr('href', previous_category);
			$.totalStorage('last_visited_category', '');
		} else $('#goback').hide();
	});
</pre>
<p>Right after id, add our button:</p>
<pre class="brush: xml; title: ; notranslate">

&lt;a href=&quot;javascript:void(0)&quot; class=&quot;btn btn-default&quot; id=&quot;goback&quot;&gt;
	&lt;i class=&quot;icon-chevron-left left&quot;&gt;&lt;/i&gt; {l s='Go Back to the last category'}
&lt;/a&gt;
</pre>
<p>Here is the final code for product.tpl</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script&gt;

	$(document).ready(function() {
		if(previous_category = $.totalStorage('last_visited_category'))
		{
			$('#goback').attr('href', previous_category);
			$.totalStorage('last_visited_category', '');
		} else $('#goback').hide();
	});
&lt;/script&gt;

&lt;a href=&quot;javascript:void(0)&quot; class=&quot;btn btn-default&quot; id=&quot;goback&quot;&gt;
	&lt;i class=&quot;icon-chevron-left left&quot;&gt;{l s='Go Back to the last category'}&lt;/i&gt;
&lt;/a&gt;

</pre>
<p><strong>Notice:</strong> If you want to keep a record of the visited category across pages, you can remove <strong>$.totalStorage(&#8216;last_visited_category&#8217;, &#8221;);</strong> from the code in product.tpl.</p>
<p>The post <a rel="nofollow" href="http://nemops.com/how-to-create-a-go-back-to-the-category-button-in-prestashop-and-thirty-bees/">How to create a &#8220;Go back to the category&#8221; button in PrestaShop and thirty bees</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/how-to-create-a-go-back-to-the-category-button-in-prestashop-and-thirty-bees/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setting up a staging site for PrestaShop and Thirtybees</title>
		<link>http://nemops.com/staging-site-prestashop-thirtybees/</link>
		<comments>http://nemops.com/staging-site-prestashop-thirtybees/#comments</comments>
		<pubDate>Wed, 10 Jan 2018 08:18:49 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[staging]]></category>
		<category><![CDATA[thirtybees]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=3116</guid>
		<description><![CDATA[<p>It’s always better not to directly modify your live site, especially when core changes are involved. In this video, we will see how to create a development site for PrestaShop 1.6 and ThirtyBees Watch the screencast</p>
<p>The post <a rel="nofollow" href="http://nemops.com/staging-site-prestashop-thirtybees/">Setting up a staging site for PrestaShop and Thirtybees</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>It’s always better not to directly modify your live site, especially when core changes are involved. In this video, we will see how to create a development site for PrestaShop 1.6 and ThirtyBees<br />
<span id="more-3116"></span></p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/ATV5K9UpJHs" 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>
<p>The post <a rel="nofollow" href="http://nemops.com/staging-site-prestashop-thirtybees/">Setting up a staging site for PrestaShop and Thirtybees</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/staging-site-prestashop-thirtybees/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Duplicating Carriers along with Products in PrestaShop and ThirtyBees</title>
		<link>http://nemops.com/prestashop-thirtybees-duplicate-product-carriers/</link>
		<comments>http://nemops.com/prestashop-thirtybees-duplicate-product-carriers/#comments</comments>
		<pubDate>Mon, 13 Nov 2017 12:54:03 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[carriers]]></category>
		<category><![CDATA[duplicate]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[thirtybees]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=3090</guid>
		<description><![CDATA[<p>In this tutorial we will use a little code snippet to have carriers copy over on product duplication in PrestaShop and Thirtybees. Watch the screencast Duplicating product carriers in PrestaShop and ThirtyBees &#8211; text version Create a new override in override/controllers/admin, and name it AdminProductsController.php: We need to copy the original ProcessDuplicate method, and paste [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-thirtybees-duplicate-product-carriers/">Duplicating Carriers along with Products in PrestaShop and ThirtyBees</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this tutorial we will use a little code snippet to have carriers copy over on product duplication in PrestaShop and Thirtybees.</p>
<p><span id="more-3090"></span></p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/SZfVTkEDjb4" 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>Duplicating product carriers in PrestaShop and ThirtyBees &#8211; text version</h2>
<p>Create a new override in <em>override/controllers/admin</em>, and name it <strong>AdminProductsController.php</strong>:</p>
<pre class="brush: php; title: ; notranslate">
class AdminProductsController extends AdminProductsControllerCore
{
}
</pre>
<p>We need to copy the original <strong>ProcessDuplicate</strong> method, and paste it into our override. You will see it&#8217;s calling a bunch of methods that start with &#8220;duplicate&#8221;. Add the following right after Product::duplicateSuppliers($id_product_old, $product->id):</p>
<pre class="brush: php; title: ; notranslate">
            &amp;&amp; Product::duplicateCarriers($id_product_old, $product-&gt;id)
</pre>
<p>Next, we have to add the method we are calling to the Product class. We will use another override, so let&#8217;s create <strong>Product.php</strong> in <em>override/classes</em></p>
<p>Open it up, and paste the following, or if you have a product override already in place, just copy over the <strong>DuplicateCarriers</strong> method:</p>
<pre class="brush: php; title: ; notranslate">
    public static function duplicateCarriers($id_product_old, $id_product_new)
    {
        $result = Db::getInstance()-&gt;executeS('
		SELECT *
		FROM `'._DB_PREFIX_.'product_carrier`
		WHERE `id_product` = '.(int)$id_product_old);

        foreach ($result as $row) {
            unset($row['id_product_carrier']);
            $row['id_product'] = $id_product_new;
            if (!Db::getInstance()-&gt;insert('product_carrier', $row)) {
                return false;
            }
        }

        return true;
    }	
</pre>
<p>Save, then reach the <em>cache/</em> folder and erase <strong>class_index.php</strong>, so that the new overrides can get loaded in the system.</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-thirtybees-duplicate-product-carriers/">Duplicating Carriers along with Products in PrestaShop and ThirtyBees</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-thirtybees-duplicate-product-carriers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a “Clear cart” button in PrestaShop 1.7</title>
		<link>http://nemops.com/prestashop-1-7-clear-cart-button/</link>
		<comments>http://nemops.com/prestashop-1-7-clear-cart-button/#comments</comments>
		<pubDate>Mon, 06 Nov 2017 13:09:06 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[cart]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[prestashop 1.7]]></category>
		<category><![CDATA[products]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=3093</guid>
		<description><![CDATA[<p>Let&#8217; see how to create a button to empty the PrestaShop 1.7 shopping cart in one click! Version used: Prestashop 1.7.2.4 In this tutorial we will see how to apply my previous guide on Creating a “Clear cart” button in PrestaShop to PrestaShop 1.7, as it doesn&#8217;t work out of the box because of the [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-1-7-clear-cart-button/">Creating a “Clear cart” button in PrestaShop 1.7</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Let&#8217; see how to create a button to empty the PrestaShop 1.7 shopping cart in one click!<br />
<span id="more-3093"></span></p>
<ul>
<li>Version used: <strong>Prestashop 1.7.2.4</strong></li>
</ul>
<p>In this tutorial we will see how to apply my previous guide on <a href="http://nemops.com/clear-cart-button-prestashop">Creating a “Clear cart” button in PrestaShop</a> to PrestaShop 1.7, as it doesn&#8217;t work out of the box because of the new template.</p>
<p>The basic code still works, and the process is more or less the same, though the files needing modifications are totally different. For this tutorial, I will be using the classic (or standard) template, so wherever you read &#8220;themename&#8221;, just put <strong>classic</strong>. As a side not, please notice some files might be different if you use a custom PrestaShop theme.</p>
<h2>Adding the button to the cart page in PrestaShop 1.7</h2>
<p>The PrestaShop 1.7 template structure is quite different from 1.6, so we need to account for that. The main view for the cart is now located at <em>themes/*themename*/templates/checkout/</em>, and it&#8217;s called <strong>cart.tpl</strong>. Open it up, and locat the following block:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
      {block name='cart_overview'}
        {include file='checkout/_partials/cart-detailed.tpl' cart=$cart}
      {/block}
</pre>
<p>This represents the products list block, and we want to add the button right after it:</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
    &lt;a class=&quot;btn btn-primary&quot; style=&quot;float:right&quot; id=&quot;removeAll&quot; href=&quot;javascript:void(0)&quot;&gt;
      Empty Cart
    &lt;/a&gt;
</pre>
<p>At this point, unlike 1.6 where we could add our code directly to the template, with PrestaShop 1.7 we have to use a new file, named <strong>custom.js</strong>.</p>
<div class="separator"></div>
<h2>Adding new javascript to a PrestaShop 1.7 template</h2>
<p>Open up <strong>custom.js</strong>, located in <em>themes/*themename*/assets/js</em>.<br />
It&#8217;s empty by default, so if not (as in the case of custom templates), just add the code at the end.</p>
<p>This file is loaded on all pages, and since we only want to run it on the cart one, we have to wrap our snippet with a condition:</p>
<pre class="brush: jscript; title: ; notranslate">
if(prestashop.page.page_name == 'cart')
{}
</pre>
<p>The <strong>prestashop</strong> javascript variable is a new global available in all pages of the shop, which contains a number of useful data that can be used in scripts. In this case, we use the current page name.</p>
<p>Here is all the rest of the code we need:</p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function() {

	    $('#removeAll').click(function(e) {
	        e.preventDefault()
	        $.ajax({
	            type: 'POST',
	            headers: { &quot;cache-control&quot;: &quot;no-cache&quot; },
	            url: prestashop.urls.base_url + &quot;cart&quot;,
	            async: true,
	            cache: false,
	            data: 'deleteAll=1&amp;token=' + prestashop.token + '&amp;ajax=true',
	            success: function(data){	
	                window.location.reload();
	            }
	        })
	    });
	});	
</pre>
<p><strong>Explanation:</strong> we are using the prestashop variable again, this time to fetch the base url. The cart controller, which we will be editing shortly, can be accessed at /cart by default, so we pass this url to the ajax call.<br />
For the querystring, we pass in <strong>deleteAll</strong>, to make sure we can refer to this action in the next step, a <strong>token</strong> required by PrestaShop 1.7, and <strong>ajax=true</strong>, so that the cart know the action has to be run in ajax mode.<br />
If the call is successful, we refresh the page to show that the cart is now empty.</p>
<div class="separator"></div>
<h2>Editing the CartController</h2>
<p>PrestaShop 1.7 discourages the use of overrides, but we will use one in any case <img src="http://nemops.com/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /><br />
Create a new file in <em>override/controllers/front</em>, and name it <strong>cartController.php</strong>. Reach back the original cart controller in the main <em>controllers/front</em>, and copy the whole <strong>updateCart</strong> method, pasting it into our new file:</p>
<pre class="brush: php; title: ; notranslate">
    protected function updateCart()
    {
        // Update the cart ONLY if $this-&gt;cookies are available, in order to avoid ghost carts created by bots
        if ($this-&gt;context-&gt;cookie-&gt;exists() &amp;&amp; !$this-&gt;errors &amp;&amp; !($this-&gt;context-&gt;customer-&gt;isLogged() &amp;&amp; !$this-&gt;isTokenValid())) {
            if (Tools::getIsset('add') || Tools::getIsset('update')) {
                $this-&gt;processChangeProductInCart();
            } elseif (Tools::getIsset('delete')) {
                $this-&gt;processDeleteProductInCart();
            } elseif (CartRule::isFeatureActive()) {
                if (Tools::getIsset('addDiscount')) {
                    if (!($code = trim(Tools::getValue('discount_name')))) {
                        $this-&gt;errors[] = $this-&gt;trans('You must enter a voucher code.', array(), 'Shop.Notifications.Error');
                    } elseif (!Validate::isCleanHtml($code)) {
                        $this-&gt;errors[] = $this-&gt;trans('The voucher code is invalid.', array(), 'Shop.Notifications.Error');
                    } else {
                        if (($cartRule = new CartRule(CartRule::getIdByCode($code))) &amp;&amp; Validate::isLoadedObject($cartRule)) {
                            if ($error = $cartRule-&gt;checkValidity($this-&gt;context, false, true)) {
                                $this-&gt;errors[] = $error;
                            } else {
                                $this-&gt;context-&gt;cart-&gt;addCartRule($cartRule-&gt;id);
                            }
                        } else {
                            $this-&gt;errors[] = $this-&gt;trans('This voucher does not exist.', array(), 'Shop.Notifications.Error');
                        }
                    }
                } elseif (($id_cart_rule = (int)Tools::getValue('deleteDiscount')) &amp;&amp; Validate::isUnsignedId($id_cart_rule)) {
                    $this-&gt;context-&gt;cart-&gt;removeCartRule($id_cart_rule);
                    CartRule::autoAddToCart($this-&gt;context);
                }
            }
        } elseif (!$this-&gt;isTokenValid() &amp;&amp; Tools::getValue('action') !== 'show' &amp;&amp; !Tools::getValue('ajax')) {
            Tools::redirect('index.php');
        }
    }
</pre>
<p>All we have to do now is add our condition, as part of all those ELSEIFs:</p>
<pre class="brush: php; title: ; notranslate">
            elseif (Tools::getIsset('deleteAll')) {
                $this-&gt;context-&gt;cart-&gt;delete();
                $this-&gt;context-&gt;cookie-&gt;id_cart = 0;
                die(1);
            }
</pre>
<p>Here is the final code:</p>
<pre class="brush: php; title: ; notranslate">
    protected function updateCart()
    {
        // Update the cart ONLY if $this-&gt;cookies are available, in order to avoid ghost carts created by bots
        if ($this-&gt;context-&gt;cookie-&gt;exists() &amp;&amp; !$this-&gt;errors &amp;&amp; !($this-&gt;context-&gt;customer-&gt;isLogged() &amp;&amp; !$this-&gt;isTokenValid())) {
            if (Tools::getIsset('add') || Tools::getIsset('update')) {
                $this-&gt;processChangeProductInCart();
            } elseif (Tools::getIsset('delete')) {
                $this-&gt;processDeleteProductInCart();

            } elseif (Tools::getIsset('deleteAll')) { /* Nemo */
                $this-&gt;context-&gt;cart-&gt;delete();
                $this-&gt;context-&gt;cookie-&gt;id_cart = 0;
                die(1);
            } elseif (CartRule::isFeatureActive()) {
                if (Tools::getIsset('addDiscount')) {
                    if (!($code = trim(Tools::getValue('discount_name')))) {
                        $this-&gt;errors[] = $this-&gt;trans('You must enter a voucher code.', array(), 'Shop.Notifications.Error');
                    } elseif (!Validate::isCleanHtml($code)) {
                        $this-&gt;errors[] = $this-&gt;trans('The voucher code is invalid.', array(), 'Shop.Notifications.Error');
                    } else {
                        if (($cartRule = new CartRule(CartRule::getIdByCode($code))) &amp;&amp; Validate::isLoadedObject($cartRule)) {
                            if ($error = $cartRule-&gt;checkValidity($this-&gt;context, false, true)) {
                                $this-&gt;errors[] = $error;
                            } else {
                                $this-&gt;context-&gt;cart-&gt;addCartRule($cartRule-&gt;id);
                            }
                        } else {
                            $this-&gt;errors[] = $this-&gt;trans('This voucher does not exist.', array(), 'Shop.Notifications.Error');
                        }
                    }
                } elseif (($id_cart_rule = (int)Tools::getValue('deleteDiscount')) &amp;&amp; Validate::isUnsignedId($id_cart_rule)) {
                    $this-&gt;context-&gt;cart-&gt;removeCartRule($id_cart_rule);
                    CartRule::autoAddToCart($this-&gt;context);
                }
            }
        } elseif (!$this-&gt;isTokenValid() &amp;&amp; Tools::getValue('action') !== 'show' &amp;&amp; !Tools::getValue('ajax')) {
            Tools::redirect('index.php');
        }
    }
</pre>
<p>We are done! Reach the back office, Advanced Parameters, Performance, and hit the clear cache button on the top right, so that the override takes place.</p>
<p>Should it not work, check that <strong>Disable all overrides</strong> is set to no, right below on the same page. If it still doesn&#8217;t, try editing the core CartController.php.</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-1-7-clear-cart-button/">Creating a “Clear cart” button in PrestaShop 1.7</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-1-7-clear-cart-button/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Mark orders with returned products in the order list of ThirtyBees and PrestaShop</title>
		<link>http://nemops.com/thirtybees-prestashop-mark-returned-orders/</link>
		<comments>http://nemops.com/thirtybees-prestashop-mark-returned-orders/#comments</comments>
		<pubDate>Mon, 02 Oct 2017 10:34:33 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[orders]]></category>
		<category><![CDATA[prestashop 1.6]]></category>
		<category><![CDATA[products]]></category>
		<category><![CDATA[return]]></category>
		<category><![CDATA[thirtybees]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=3085</guid>
		<description><![CDATA[<p>In this video for ThirtyBees and Prestashop 1.6, we will see how to add a checkmark for orders that contain returned products, so that they are easy to spot in the back office order list Watch the screencast Text Version All of the modifications need to be applied to AdminOrdersController.php, located in controllers/admin Add to [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/thirtybees-prestashop-mark-returned-orders/">Mark orders with returned products in the order list of ThirtyBees and PrestaShop</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this video for ThirtyBees and Prestashop 1.6, we will see how to add a checkmark for orders that contain returned products, so that they are easy to spot in the back office order list<br />
<span id="more-3085"></span></p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/fpuJEs8oo84" 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>All of the modifications need to be applied to <strong>AdminOrdersController.php</strong>, located in <em>controllers/admin</em><br />
Add to $this->_select (do not forget the comma!):</p>
<pre class="brush: php; title: ; notranslate">
od.product_quantity_return as has_returned,
</pre>
<p>Add to $this->_join:</p>
<pre class="brush: php; title: ; notranslate">
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order` = a.`id_order`)
</pre>
<p>Right after the join variable is set, add:</p>
<pre class="brush: php; title: ; notranslate">
$this-&gt;_group = 'GROUP BY a.id_order';
</pre>
<p>This way we avoid duplicates in the order list.</p>
<p>In the next step we will add the actual column, scroll down to around line 130, and add the following to the $this->fields_list variable:</p>
<pre class="brush: php; title: ; notranslate">
                'has_returned'            =&gt; [
                    'title'      =&gt; $this-&gt;l('Return'),
                    'align'      =&gt; 'text-center',
                    'type'       =&gt; 'bool',
                    'callback'       =&gt; 'getIsReturned',
                ],
</pre>
<p>Lastly, out of the construct method (it can be anywhere, right after it or at the end of the file) we will add the callback function:</p>
<pre class="brush: php; title: ; notranslate">
    public function getIsReturned($a, $order)
    {
        $has_returned = Db::getInstance()-&gt;getValue('SELECT product_quantity_return FROM '._DB_PREFIX_.'order_detail WHERE id_order =' .(int)$order['id_order'] .' AND product_quantity_return &gt; 0');

        $class = $has_returned ? 'icon-check' : 'icon-remove';
        return '&lt;i class=&quot;'.$class.'&quot;&gt;&lt;/i&gt;';

    }
</pre>
<p>The post <a rel="nofollow" href="http://nemops.com/thirtybees-prestashop-mark-returned-orders/">Mark orders with returned products in the order list of ThirtyBees and PrestaShop</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/thirtybees-prestashop-mark-returned-orders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Edit the product creation date in ThirtyBees and PrestaShop</title>
		<link>http://nemops.com/eidt-product-creation-date-thirtybees-prestashop/</link>
		<comments>http://nemops.com/eidt-product-creation-date-thirtybees-prestashop/#comments</comments>
		<pubDate>Mon, 14 Aug 2017 10:45:47 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[new product]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[thirtybees]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=3054</guid>
		<description><![CDATA[<p>In this quick tip we will see how to add a new field to the product&#8217;s back office in ThirtyBees and Prestashop 1.6, so that we can edit its creation date Watch the screencast Code Snippet</p>
<p>The post <a rel="nofollow" href="http://nemops.com/eidt-product-creation-date-thirtybees-prestashop/">Edit the product creation date in ThirtyBees and PrestaShop</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this quick tip we will see how to add a new field to the product&#8217;s back office in ThirtyBees and Prestashop 1.6, so that we can edit its creation date<br />
<span id="more-3054"></span></p>
<p><!--more--></p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/8HM4ZH5Q8cY" 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>Code Snippet</h2>
<pre class="brush: php; title: ; notranslate">
	{if $product-&gt;date_add}
		&lt;div class=&quot;form-group&quot;&gt;
			&lt;label class=&quot;control-label col-lg-3&quot;&gt;
				&lt;span class=&quot;label-tooltip&quot; data-toggle=&quot;tooltip&quot; title=&quot;{l s='Change date for product new from.'}&quot;&gt;
					{$bullet_common_field} {l s='New from'}
				&lt;/span&gt;
			&lt;/label&gt;
			&lt;div class=&quot;col-lg-3&quot;&gt;
				&lt;input type=&quot;text&quot; id=&quot;date_add&quot; class=&quot;datepicker&quot; name=&quot;date_add&quot; value=&quot;{$product-&gt;date_add|escape:html:'UTF-8'}&quot;&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	{/if}
</pre>
<p>The post <a rel="nofollow" href="http://nemops.com/eidt-product-creation-date-thirtybees-prestashop/">Edit the product creation date in ThirtyBees and PrestaShop</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/eidt-product-creation-date-thirtybees-prestashop/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
