<?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; threads</title>
	<atom:link href="http://nemops.com/tag/threads/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>Change department for customer threads in PrestaShop 1.6</title>
		<link>http://nemops.com/prestashop-customer-threads-change-department/</link>
		<comments>http://nemops.com/prestashop-customer-threads-change-department/#comments</comments>
		<pubDate>Tue, 20 Jun 2017 17:46:55 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[back office]]></category>
		<category><![CDATA[customer service]]></category>
		<category><![CDATA[department]]></category>
		<category><![CDATA[messages]]></category>
		<category><![CDATA[threads]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=3036</guid>
		<description><![CDATA[<p>In this quick tip, we will see how to easily modify the PrestaShop back office template, so to be able to change the customer messages&#8217; department whenever we want. Watch the screencast Text Version This tutorial can be applied to ThirtyBees as well! Part of the functionality we need is in PrestaShop already, all we [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-customer-threads-change-department/">Change department for customer threads in PrestaShop 1.6</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 easily modify the PrestaShop back office template, so to be able to change the customer messages&#8217; department whenever we want.</p>
<p><span id="more-3036"></span></p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/Ol_RHo1mwcg#038;feature=youtu.be" 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>This tutorial can be applied to <strong><a href="http://thirtybees.com" title="ThirtyBees e-commerce software" target="_blank">ThirtyBees</a></strong> as well!</p>
<p>Part of the functionality we need is in PrestaShop already, all we have to do is add some place where we can submit the change of department type.<br />
Open up <strong>AdminCustomerThreadsController.php</strong> located in <em>controllers/admin</em> or use an override instead (recommended). We are interested in the renderView method, specifically where it assigns <strong>$this->tpl_vars</strong>, around line 700 in PrestaShop 1.6.1.7.</p>
<pre class="brush: php; title: ; notranslate">
        $this-&gt;tpl_view_vars = array(
            'id_customer_thread' =&gt; $id_customer_thread,
            'thread' =&gt; $thread,
            'actions' =&gt; $actions,
            'employees' =&gt; $employees,
            'current_employee' =&gt; $this-&gt;context-&gt;employee,
            'messages' =&gt; $messages,
            'first_message' =&gt; $first_message,
            'contact' =&gt; $contact,
            'contacts' =&gt; $contacts, // &lt;-- This is what we added!
            'next_thread' =&gt; $next_thread,
            'orders' =&gt; isset($orders) ? $orders : false,
            'customer' =&gt; isset($customer) ? $customer : false,
            'products' =&gt; isset($products) ? $products : false,
            'total_ok' =&gt; isset($total_ok) ?  Tools::displayPrice($total_ok, $this-&gt;context-&gt;currency) : false,
            'orders_ok' =&gt; isset($orders_ok) ? $orders_ok : false,
            'count_ok' =&gt; isset($orders_ok) ? count($orders_ok) : false,
            'PS_CUSTOMER_SERVICE_SIGNATURE' =&gt; str_replace('\r\n', &quot;\n&quot;, Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', (int)$thread-&gt;id_lang)),
            'timeline_items' =&gt; $timeline_items,
        );
</pre>
<p><strong>Please note:</strong> if you use an override, copy the whole method, add the variable as described above, and make sure you change return <strong>parent::renderView()</strong> to return <strong>AdminController::renderView()</strong> at the very end! Failing to do so will make it impossible for our new variable to be used in the template, as the parent class would simply override the tpl_vars.</p>
<p>Now that we have the variable containing all contacts, let&#8217;s add a form to submit it, in the view.tpl template of that controller. The file we want is located in the theme folder  <em>themes\default\template\controllers\customer_threads\helpers\view</em>. Once more, it&#8217;s <strong>named view.tpl</strong>.<br />
You can find any spot you like for the new button, I added it at the very beginning, before the div with class &#8220;well&#8221;</p>
<pre class="brush: php; html-script: true; title: ; notranslate">
	&lt;div class=&quot;well&quot;&gt;
		&lt;form action=&quot;{$link-&gt;getAdminLink('AdminCustomerThreads')|escape:'html':'UTF-8'}&amp;amp;viewcustomer_thread&amp;amp;id_customer_thread={$id_customer_thread|intval}&quot; method=&quot;post&quot; class=&quot;form-horizontal&quot;&gt;
			&lt;div class=&quot;row&quot;&gt;
				&lt;div class=&quot;col-sm-3&quot;&gt;
					&lt;select name=&quot;id_contact&quot;&gt;
						{foreach from=$contacts item=dept}
							&lt;option value=&quot;{$dept.id_contact}&quot; {if $dept.name == $contact}selected=&quot;selected&quot;{/if}&gt;
								{$dept.name}
							&lt;/option&gt;
						{/foreach}
					&lt;/select&gt;
				&lt;/div&gt;
				&lt;div class=&quot;col-sm-3&quot;&gt;
					&lt;button class=&quot;btn btn-default&quot; type=&quot;submit&quot;&gt;
						{l s='Change Department'}
					&lt;/button&gt;
				&lt;/div&gt;
			&lt;/div&gt;
		&lt;/form&gt;
	&lt;/div&gt;
</pre>
<p>Save and refresh, we should be done! We didn&#8217;t have to add any post processing code, simply because it&#8217;s already present, at the very beginning of the <strong>postProcess</strong> method of the AdminCustomerThreadsController.</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-customer-threads-change-department/">Change department for customer threads in PrestaShop 1.6</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-customer-threads-change-department/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
