<?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; csv</title>
	<atom:link href="http://nemops.com/tag/csv/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>Adding new fields to the PrestaShop CSV Importer</title>
		<link>http://nemops.com/new-fields-prestashop-csv-importer/</link>
		<comments>http://nemops.com/new-fields-prestashop-csv-importer/#comments</comments>
		<pubDate>Mon, 04 Apr 2016 09:40:19 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[back office]]></category>
		<category><![CDATA[csv]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[spreadsheet]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2750</guid>
		<description><![CDATA[<p>The CSV import PrestaShop natively comes with becomes useless if we have added custom fields to our objects. Let&#8217;s see how to overcome the limit, and enable extra fields in the CSV Importer as well. Adding an extra field to PrestaShop objects Before doing anything with CSVs or the importer, we need a field to [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/new-fields-prestashop-csv-importer/">Adding new fields to the PrestaShop CSV Importer</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>The CSV import PrestaShop natively comes with becomes useless if we have added custom fields to our objects. Let&#8217;s see how to overcome the limit, and enable extra fields in the CSV Importer as well.</p>
<p><span id="more-2750"></span></p>
<h2>Adding an extra field to PrestaShop objects</h2>
<p>Before doing anything with CSVs or the importer, we need a field to fill with your data. If you don&#8217;t know how to add one, here is a tutorial on <a href="http://nemops.com/extending-prestashop-objects/#.Vv5Nkfn5jmg" title="How to extend PrestaShop Objects">How to extend PrestaShop Objects</a>, and add new fields to them.<br />
In this example, we will use that extrafield one added in the tutorial.<br />
As a side note, it&#8217;s not strictly necessary to add the extra field to the product object, as we will see, but it&#8217;s essential to have a database column we can use.</p>
<div class="separator"></div>
<h2>Two approaches</h2>
<p>Given that the Product class override is not strictly necessary, we can proceed in two ways, depending on our needs: the first, is to complete the previous tutorial, and add the field to the Product Object; the second is to stop after adding the database column, and override an extra method of the AdminImportController, to manually update the new field. We will cover both to see how they work.</p>
<div class="separator"></div>
<h2>The AdminImportController override</h2>
<p>Let&#8217;s start playing with the real file. First of all, create a new file in <em>override/controllers/admin</em>, and name it <strong>AdminImportController.php</strong></p>
<p>Open it up, and add some standard override code within PHP tags</p>
<pre class="brush: php; title: ; notranslate">
class AdminImportController extends AdminImportControllerCore
{

}
</pre>
<p>Next, we want to tell the Importer we have an extra field for products. To do this, we have to override the whole construct method, since it&#8217;s the one defining available fields for all entities. It&#8217;s too long to copy it here, to make sure you grab yours from the original Controller, and drop it into the override.</p>
<pre class="brush: php; title: ; notranslate">
class AdminImportController extends AdminImportControllerCore
{
        $this-&gt;bootstrap = true;
        $this-&gt;entities = array(
            $this-&gt;l('Categories'),
            $this-&gt;l('Products'),
            $this-&gt;l('Combinations'),
            $this-&gt;l('Customers'),
            $this-&gt;l('Addresses'),
            $this-&gt;l('Manufacturers'),
            $this-&gt;l('Suppliers'),
            $this-&gt;l('Alias'),
        );
        // more code here

        $this-&gt;separator = ($separator = Tools::substr(strval(trim(Tools::getValue('separator'))), 0, 1)) ? $separator :  ';';
        $this-&gt;multiple_value_separator = ($separator = Tools::substr(strval(trim(Tools::getValue('multiple_value_separator'))), 0, 1)) ? $separator :  ',';
        AdminController::__construct();
}
</pre>
<p><strong>Make absolutely sure you change the very last call to AdminController::__construct(); to avoid losing any modification to the product properties.</strong></p>
<p>Now that the override is in place, we must let it know about our field. Locate the following snippet:</p>
<pre class="brush: php; title: ; notranslate">
            case $this-&gt;entities[$this-&gt;l('Products')]:
                self::$validators['image'] = array(
                    'AdminImportController',
                    'split'
                );
</pre>
<p>You will notice it&#8217;s followed by an array defining available fields:</p>
<pre class="brush: php; title: ; notranslate">
               $this-&gt;available_fields = array(
                    'no' =&gt; array('label' =&gt; $this-&gt;l('Ignore this column')),
                    'id' =&gt; array('label' =&gt; $this-&gt;l('ID')),
                    'active' =&gt; array('label' =&gt; $this-&gt;l('Active (0/1)')),
                    'name' =&gt; array('label' =&gt; $this-&gt;l('Name')),
                    'category' =&gt; array('label' =&gt; $this-&gt;l('Categories (x,y,z...)')),
                    'price_tex' =&gt; array('label' =&gt; $this-&gt;l('Price tax excluded')),
                    'price_tin' =&gt; array('label' =&gt; $this-&gt;l('Price tax included')),
                    'id_tax_rules_group' =&gt; array('label' =&gt; $this-&gt;l('Tax rules ID')),
                    'wholesale_price' =&gt; array('label' =&gt; $this-&gt;l('Wholesale price')),
                    'on_sale' =&gt; array('label' =&gt; $this-&gt;l('On sale (0/1)')),
                    'reduction_price' =&gt; array('label' =&gt; $this-&gt;l('Discount amount')),
                    'reduction_percent' =&gt; array('label' =&gt; $this-&gt;l('Discount percent')),
                    'reduction_from' =&gt; array('label' =&gt; $this-&gt;l('Discount from (yyyy-mm-dd)')),
                    'reduction_to' =&gt; array('label' =&gt; $this-&gt;l('Discount to (yyyy-mm-dd)')),
                    'reference' =&gt; array('label' =&gt; $this-&gt;l('Reference #')),
                    'supplier_reference' =&gt; array('label' =&gt; $this-&gt;l('Supplier reference #')),
                    'supplier' =&gt; array('label' =&gt; $this-&gt;l('Supplier')),
                    'manufacturer' =&gt; array('label' =&gt; $this-&gt;l('Manufacturer')),
                    'ean13' =&gt; array('label' =&gt; $this-&gt;l('EAN13')),
                    'upc' =&gt; array('label' =&gt; $this-&gt;l('UPC')),
                    'ecotax' =&gt; array('label' =&gt; $this-&gt;l('Ecotax')),
                    'width' =&gt; array('label' =&gt; $this-&gt;l('Width')),
                    'height' =&gt; array('label' =&gt; $this-&gt;l('Height')),
                    'depth' =&gt; array('label' =&gt; $this-&gt;l('Depth')),
                    'weight' =&gt; array('label' =&gt; $this-&gt;l('Weight')),
                    'quantity' =&gt; array('label' =&gt; $this-&gt;l('Quantity')),
                    'minimal_quantity' =&gt; array('label' =&gt; $this-&gt;l('Minimal quantity')),
                    'visibility' =&gt; array('label' =&gt; $this-&gt;l('Visibility')),
                    'additional_shipping_cost' =&gt; array('label' =&gt; $this-&gt;l('Additional shipping cost')),
                    'unity' =&gt; array('label' =&gt; $this-&gt;l('Unit for the unit price')),
                    'unit_price' =&gt; array('label' =&gt; $this-&gt;l('Unit price')),
                    'description_short' =&gt; array('label' =&gt; $this-&gt;l('Short description')),
                    'description' =&gt; array('label' =&gt; $this-&gt;l('Description')),
                    'tags' =&gt; array('label' =&gt; $this-&gt;l('Tags (x,y,z...)')),
                    'meta_title' =&gt; array('label' =&gt; $this-&gt;l('Meta title')),
                    'meta_keywords' =&gt; array('label' =&gt; $this-&gt;l('Meta keywords')),
                    'meta_description' =&gt; array('label' =&gt; $this-&gt;l('Meta description')),
                    'link_rewrite' =&gt; array('label' =&gt; $this-&gt;l('URL rewritten')),
                    'available_now' =&gt; array('label' =&gt; $this-&gt;l('Text when in stock')),
                    'available_later' =&gt; array('label' =&gt; $this-&gt;l('Text when backorder allowed')),
                    'available_for_order' =&gt; array('label' =&gt; $this-&gt;l('Available for order (0 = No, 1 = Yes)')),
                    'available_date' =&gt; array('label' =&gt; $this-&gt;l('Product availability date')),
                    'date_add' =&gt; array('label' =&gt; $this-&gt;l('Product creation date')),
                    'show_price' =&gt; array('label' =&gt; $this-&gt;l('Show price (0 = No, 1 = Yes)')),
                    'image' =&gt; array('label' =&gt; $this-&gt;l('Image URLs (x,y,z...)')),
                    'delete_existing_images' =&gt; array(
                        'label' =&gt; $this-&gt;l('Delete existing images (0 = No, 1 = Yes)')
                    ),
                    'features' =&gt; array('label' =&gt; $this-&gt;l('Feature (Name:Value:Position:Customized)')),
                    'online_only' =&gt; array('label' =&gt; $this-&gt;l('Available online only (0 = No, 1 = Yes)')),
                    'condition' =&gt; array('label' =&gt; $this-&gt;l('Condition')),
                    'customizable' =&gt; array('label' =&gt; $this-&gt;l('Customizable (0 = No, 1 = Yes)')),
                    'uploadable_files' =&gt; array('label' =&gt; $this-&gt;l('Uploadable files (0 = No, 1 = Yes)')),
                    'text_fields' =&gt; array('label' =&gt; $this-&gt;l('Text fields (0 = No, 1 = Yes)')),
                    'out_of_stock' =&gt; array('label' =&gt; $this-&gt;l('Action when out of stock')),
                    'shop' =&gt; array(
                        'label' =&gt; $this-&gt;l('ID / Name of shop'),
                        'help' =&gt; $this-&gt;l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.'),
                    ),
                    'advanced_stock_management' =&gt; array(
                        'label' =&gt; $this-&gt;l('Advanced Stock Management'),
                        'help' =&gt; $this-&gt;l('Enable Advanced Stock Management on product (0 = No, 1 = Yes).')
                    ),
                    'depends_on_stock' =&gt; array(
                        'label' =&gt; $this-&gt;l('Depends on stock'),
                        'help' =&gt; $this-&gt;l('0 = Use quantity set in product, 1 = Use quantity from warehouse.')
                    ),
                    'warehouse' =&gt; array(
                        'label' =&gt; $this-&gt;l('Warehouse'),
                        'help' =&gt; $this-&gt;l('ID of the warehouse to set as storage.')
                    )
                );
</pre>
<p>This represents all of the fields, or columns, that you can map to every column of your csv file. At this point, it&#8217;s enough to append our element to the array:</p>
<pre class="brush: php; title: ; notranslate">
                    'depends_on_stock' =&gt; array(
                        'label' =&gt; $this-&gt;l('Depends on stock'),
                        'help' =&gt; $this-&gt;l('0 = Use quantity set in product, 1 = Use quantity from warehouse.')
                    ),
                    'warehouse' =&gt; array(
                        'label' =&gt; $this-&gt;l('Warehouse'),
                        'help' =&gt; $this-&gt;l('ID of the warehouse to set as storage.')
                    ),
                    'extrafield' =&gt; array(
                        'label' =&gt; $this-&gt;l('Extrafield'),
                        'help' =&gt; $this-&gt;l('Something')
                    )
                );
</pre>
<p>Save, then reach the <em>cache</em> folder and delete <strong>class_index.php</strong>, so that the override file is loaded.</p>
<p><strong>If you added the Product class override, you can skip to Testing The Import</strong></p>
<p>Otherwise, there is a little snippet you need to add. Unfortunately, in order to do it we have to <strong>override the whole ProductImport()</strong> method. Therefore, copy and paste yours into the override file we created; then, reach the very end of it, where it reads:</p>
<pre class="brush: php; title: ; notranslate">
        $this-&gt;closeCsvFile($handle);
        Module::processDeferedFuncCall();
        Module::processDeferedClearCache();
        Tag::updateTagCount();
</pre>
<p>Right before, add the following statement</p>
<pre class="brush: php; title: ; notranslate">
Db::getInstance()-&gt;update('product', array('extrafield' =&gt; $info['extrafield']), 'id_product = ' . (int)$product-&gt;id);
</pre>
<p>This will manually update the field, in case it was not part of the product object.</p>
<div class="separator"></div>
<h2>Testing The Import</h2>
<p><strong>Before proceeding: Make sure you do not have a product with the same ID of the sample one, or it will be overridden.</strong></p>
<p>We are ready for a test run. Download the product csv sample from <strong>Advanced Parameters > CSV Import</strong></p>
<p><a href="http://nemops.com/wp-content/uploads/2016/04/download_sample.png"><img src="http://nemops.com/wp-content/uploads/2016/04/download_sample-680x332.png" alt="PrestaShop Sample CSV File Download" width="680" height="332" class="aligncenter size-large wp-image-2752" /></a></p>
<p>Open up the file in any text editor, get rid of all lines apart from the heading and first product. Then, add a new heading after &#8220;Warehouse&#8221;, and a value for it on the next line:</p>
<p><a href="http://nemops.com/wp-content/uploads/2016/04/extrafield_product.png"><img src="http://nemops.com/wp-content/uploads/2016/04/extrafield_product.png" alt="Adding an extra field value to the csv for PrestaShop" width="349" height="104" class="aligncenter size-full wp-image-2754" /></a></p>
<p><a href="http://nemops.com/wp-content/uploads/2016/04/extrafield_heading.png"><img src="http://nemops.com/wp-content/uploads/2016/04/extrafield_heading.png" alt="Adding an extra field to the csv for PrestaShop" width="381" height="140" class="aligncenter size-full wp-image-2753" /></a></p>
<p>Save the file. Now load it up in the importer. Make sure you select Products as entity, and leave all other settings as default. Hit Next.</p>
<p><a href="http://nemops.com/wp-content/uploads/2016/04/importer_settings.png"><img src="http://nemops.com/wp-content/uploads/2016/04/importer_settings-680x752.png" alt="PrestaShop CSV Import Settings" width="680" height="752" class="aligncenter size-large wp-image-2755" /></a></p>
<p>On the next screen, hit the next arrow until you reach the end of the file. You should see the new column popping up:</p>
<p><a href="http://nemops.com/wp-content/uploads/2016/04/importer_columns.png"><img src="http://nemops.com/wp-content/uploads/2016/04/importer_columns-680x172.png" alt="PrestaShop CSV Import Settings for Columns" width="680" height="172" class="aligncenter size-large wp-image-2756" /></a></p>
<p>Now proceed and simply hit import to complete the process. You will probably get an error because of the broken image url, but the new field should be added to the database:</p>
<p><a href="http://nemops.com/wp-content/uploads/2016/04/database_updated.png"><img src="http://nemops.com/wp-content/uploads/2016/04/database_updated.png" alt="PrestaShop Database Updated PrestaShop Database via CSV via CSV" width="537" height="219" class="aligncenter size-full wp-image-2757" /></a></p>
<p>We are done! Now you can display the extra field the way you like, whether it is with a module or following the previously linked tutorial.</p>
<h3>Additional Resources on CSV Import in PrestaShop</h3>
<ul>
<li><a href="http://nemops.com/extending-prestashop-objects/#.Vv5Nkfn5jmg" title="How to extend PrestaShop Objects">How to extend PrestaShop Objects</a></li>
<li><a href="http://nemops.com/prestashop-import-csv-data-in-1-6/#.VwIzWvn5jmg" title="Prestashop: Import CSV data in 1.6">Prestashop: Import CSV data in 1.6</a></li>
</ul>
<p>The post <a rel="nofollow" href="http://nemops.com/new-fields-prestashop-csv-importer/">Adding new fields to the PrestaShop CSV Importer</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/new-fields-prestashop-csv-importer/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Prestashop: Import CSV data in 1.6</title>
		<link>http://nemops.com/prestashop-import-csv-data-in-1-6/</link>
		<comments>http://nemops.com/prestashop-import-csv-data-in-1-6/#comments</comments>
		<pubDate>Mon, 23 Mar 2015 10:28:37 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[catalog]]></category>
		<category><![CDATA[csv]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[prestashop]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=2352</guid>
		<description><![CDATA[<p>In this extended Prestashop Tutorial we will see how to import CSV data in 1.6, namely products and combinations, into our shop&#8217;s catalog Watch the screencast Additional Resources CSV Files information on Wikipedia CSV Import Parameters at the official Prestashop Documentation</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-import-csv-data-in-1-6/">Prestashop: Import CSV data in 1.6</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In this extended Prestashop Tutorial we will see how to import CSV data in 1.6, namely products and combinations, into our shop&#8217;s catalog<br />
<span id="more-2352"></span></p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/uNh-iMpPOGE#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>
<h3>Additional Resources</h3>
<ul>
<li><a target="_blank" title="CSV Files information on Wikipedia" href="http://en.wikipedia.org/wiki/Comma-separated_values">CSV Files information on Wikipedia</a></li>
<li><a target="_blank" title="CSV Import Parameters at the official Prestashop Documentation" href="http://doc.prestashop.com/display/PS16/CSV+Import+Parameters">CSV Import Parameters at the official Prestashop Documentation</a></li>
</ul>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-import-csv-data-in-1-6/">Prestashop: Import CSV data in 1.6</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-import-csv-data-in-1-6/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Importing data into your store: Prestashop Import CSV Tool</title>
		<link>http://nemops.com/prestashop-import-csv/</link>
		<comments>http://nemops.com/prestashop-import-csv/#comments</comments>
		<pubDate>Sat, 01 Sep 2012 09:35:17 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[csv]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[prestashop]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=328</guid>
		<description><![CDATA[<p>Importing data into a web store is essential to keep catalogs up to date. Prestashop offers the possibility to import a vast amount of field types. Let&#8217;s take a look at the Prestashop Import CSV tool. Running Time: 15 mins Prestashop Version Used: 1.4.8.2 Watch The Screencast Additional Resources Wikipedia: CSV &#8211; Comma separated Values</p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-import-csv/">Importing data into your store: Prestashop Import CSV Tool</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Importing data into a web store is essential to keep catalogs up to date. Prestashop offers the possibility to import a vast amount of field types. Let&#8217;s take a look at the Prestashop Import CSV tool.<span id="more-328"></span></p>
<p><strong>Running Time: </strong>15 mins</p>
<p><strong>Prestashop Version Used:</strong> 1.4.8.2</p>
<h2>Watch The Screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/1Yk5pa1i_aM" 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>
<h3></h3>
<h3>Additional Resources</h3>
<p><a title="CSV: Comma Separated Values" href="http://en.wikipedia.org/wiki/Comma-separated_values">Wikipedia: CSV &#8211; Comma separated Values</a></p>
<p>The post <a rel="nofollow" href="http://nemops.com/prestashop-import-csv/">Importing data into your store: Prestashop Import CSV Tool</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/prestashop-import-csv/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
