<?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; private</title>
	<atom:link href="https://nemops.com/tag/private/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>Private Orders Shop in PrestaShop and thirty bees part 2: hide shopping options for visitors</title>
		<link>https://nemops.com/private-orders-in-prestashop-thirty-bees-2-hide-shopping-options-for-visitors/</link>
		<comments>https://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="https://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="https://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="https://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="https://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://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>Private Orders Shop in PrestaShop and thirty bees part 1: manual customer verification</title>
		<link>https://nemops.com/private-orders-shop-in-prestashop-and-thirty-bees-part-1-manual-customer-verification/</link>
		<comments>https://nemops.com/private-orders-shop-in-prestashop-and-thirty-bees-part-1-manual-customer-verification/#comments</comments>
		<pubDate>Wed, 30 May 2018 12:39:37 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[customers]]></category>
		<category><![CDATA[orders]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[private]]></category>
		<category><![CDATA[thirtybees]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=3133</guid>
		<description><![CDATA[<p>In this 2-part tutorial series, we will see how to create a private orders shop in PrestaShop and thirty bees. In this first part we will see how to add a manual approval for new customers while in the second on we will learn how to prevent orders from people who are not registered and [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://nemops.com/private-orders-shop-in-prestashop-and-thirty-bees-part-1-manual-customer-verification/">Private Orders Shop in PrestaShop and thirty bees part 1: manual customer verification</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this 2-part tutorial series, we will see how to create a private orders shop in PrestaShop and thirty bees.<br />
In this first part we will see how to add a manual approval for new customers while in the second on  we will learn how to prevent orders from people who are not registered and approved by us.<br />
<span id="more-3133"></span></p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/CkNh1VEdpbw" 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>I will use PrestaShop 1.6 for the demo but the modification works in thirty bees as well. Bear in mind it DOES NOT work in PrestaShop 1.7.</p>
<p>Open up controllers/front/AuthController.php</p>
<p>Look for the following code, around line 455. If it’s not in those whereabouts, just make sure you change every instance</p>
<pre class="brush: php; title: ; notranslate">
$customer-&gt;active = 1;
</pre>
<p>set to 0, so that the user cannot perform any action right away.</p>
<p>Now we also want to give the user some feedback, so let&#8217;s redirect him to a custom page. Scroll down a few lines, and where you see all these redirects:</p>
<pre class="brush: php; title: ; notranslate">
if (($back = Tools::getValue('back')) &amp;&amp; $back == Tools::secureReferrer($back)) {
                            Tools::redirect(html_entity_decode($back));
                        }
</pre>
<p>And add a new one before</p>
<pre class="brush: php; title: ; notranslate">
  Tools::redirect($this-&gt;context-&gt;link-&gt;getPageLink('welcome'));
</pre>
<p>Of course this page does not exist yet but we will create it in a moment.</p>
<p>Before that though, we have to take care of a little issue. Since the user has been created but set to inactive, the system treats it as banned by default. Even if we are to redirect to a page, we would instantly be kicked out of the session and redirected to the login. We want to create an exception so that the welcome page can be displayed. </p>
<p>Let&#8217;s go ahead and open up the customer class, so classes/customer.php<br />
Look for the following method:</p>
<pre class="brush: php; title: ; notranslate">
public static function isBanned($id_customer)
</pre>
<p>And at the very beginning, add:</p>
<pre class="brush: php; title: ; notranslate">
        if(Context::getContext()-&gt;controller-&gt;php_self == 'welcome')
            return false;
</pre>
<p>That’s settled! Now for our welcome page, I will create a new controller and a template file in the theme folder</p>
<p>Let’s head to controllers/front, and create a new PHP file first, named WelcomeController.php:</p>
<pre class="brush: php; title: ; notranslate">
class WelcomeControllerCore extends FrontController
{
    public $php_self = 'welcome';


    public function initContent()
    {
        parent::initContent();
        $this-&gt;setTemplate(_PS_THEME_DIR_.'welcome.tpl');
    }
}
</pre>
<p>Then in the theme folder, create a new file named welcome.tpl, adding the following code inside</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
{capture name=&quot;path&quot;} {l s='Welcome'}{/capture}
&lt;h1&gt;{l s='Welcome to'} {$shop_name}! &lt;/h1&gt;
&lt;hr&gt;
&lt;p&gt;
	{l s='Your account is currently under review, you will receive an email as soon as it is validated'}
&lt;/p&gt;
</pre>
<p>So let&#8217;s go ahead and try it out now&#8230; but before let&#8217;s clear cache by erasing cache/class_index.php, since we added a new controller and the system wouldn’t read it otherwise.</p>
<p>The next step is to send out and email when a status is changed to active for the customer, in the back office.<br />
Open controllers/admin/admincustomerscontroller.php</p>
<p>We will add a new method, which is inherited from the admincontroller class:</p>
<pre class="brush: php; title: ; notranslate">

    public function processStatus()
    {
        if($object = parent::processStatus()) {
            if(get_class($object) == 'Customer' &amp;&amp; $object-&gt;active) // the customer has been activated, send out an email
            {
                Mail::Send($object-&gt;id_lang, 'account_activated', $this-&gt;l('Your account has been activated'),
                    ['name' =&gt; $object-&gt;firstname .' '. $object-&gt;lastname],
                $object-&gt;email,
                $object-&gt;firstname .' '. $object-&gt;lastname,
                Configuration::get('PS_SHOP_EMAIL'),
                Configuration::get('PS_SHOP_NAME'));
            }
        }

       return $object;
    }

</pre>
<p>Of course, there is no such email template so we have to create it. I suggest copying an existing one, like the order confirmation, and adding new text, just to be quicker. The code is different for every template, just bear in mind to add the {name} variable inside it, so that the customer name is displayed!</p>
<p>This is it for part 1, make sure you test the email as well since sometimes they do fail for odd reasons, if you don&#8217;t see it coming, triple check the template names and make sure they are located in the proper path for each language you use.</p>
<p>In part two we will see how to prevent orders in case a customer is not registered, which is fundamental not to break the system if you have a one page checkout, as right now it would display an error.</p>
<p>The post <a rel="nofollow" href="https://nemops.com/private-orders-shop-in-prestashop-and-thirty-bees-part-1-manual-customer-verification/">Private Orders Shop in PrestaShop and thirty bees part 1: manual customer verification</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://nemops.com/private-orders-shop-in-prestashop-and-thirty-bees-part-1-manual-customer-verification/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add private access to CMS pages in PrestaShop</title>
		<link>https://nemops.com/prestashop-private-access-cms/</link>
		<comments>https://nemops.com/prestashop-private-access-cms/#comments</comments>
		<pubDate>Wed, 28 Sep 2016 10:24:51 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[private]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2870</guid>
		<description><![CDATA[<p>In this tutorial we will see how to make cms pages private in PrestaShop, and only allow access to registered customers Watch the Screencast</p>
<p>The post <a rel="nofollow" href="https://nemops.com/prestashop-private-access-cms/">Add private access to CMS pages in PrestaShop</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this tutorial we will see how to make cms pages private in PrestaShop, and only allow access to registered customers<br />
<span id="more-2870"></span></p>
<h2>Watch the Screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/7eMotQyowpc" 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="https://nemops.com/prestashop-private-access-cms/">Add private access to CMS pages in PrestaShop</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://nemops.com/prestashop-private-access-cms/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
