<?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; duplicate</title>
	<atom:link href="https://nemops.com/tag/duplicate/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>Duplicating Carriers along with Products in PrestaShop and ThirtyBees</title>
		<link>https://nemops.com/prestashop-thirtybees-duplicate-product-carriers/</link>
		<comments>https://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="https://nemops.com/prestashop-thirtybees-duplicate-product-carriers/">Duplicating Carriers along with Products in PrestaShop and ThirtyBees</a> appeared first on <a rel="nofollow" href="https://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="https://nemops.com/prestashop-thirtybees-duplicate-product-carriers/">Duplicating Carriers along with Products in PrestaShop and ThirtyBees</a> appeared first on <a rel="nofollow" href="https://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://nemops.com/prestashop-thirtybees-duplicate-product-carriers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
