[Skip to main content](#vessel-content)

#   Error on Import

##

- **[gteigland](/forum/user/4840-gteigland "View gteigland's Profile")**
- [![gteigland's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/4840-gteigland "View gteigland's Profile") Topic Author
- [ Offline](/forum/user/4840-gteigland)

Less More

- Posts: 41
- Thank you received: 0
-
-

11 years 9 months ago [\#191896](#191896) by [gteigland](/forum/user/4840-gteigland "View gteigland's Profile")  *[Error on Import](/forum/25-install-update/875189-error-on-import#191896 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.6.3 -- Browser(s) name and version -- : Chrome -- Error-message(debug-mod must be tuned on) -- : 1136 Column count doesn't match value count at row 1 SQL=INSERT IGNORE INTO jbar3&#95;hikashop&#95;product&#95;related (&#96;product&#95;related&#95;id&#96;,&#96;product&#95;related&#95;type&#96;,&#96;product&#95;id&#96;) VALUES ()  Not really sure why this error would happen. Here are the steps. (furnitureandthings.com - upgrade to joomla 3) 1. I exported my products from hikashop2.3.5 FOR JOOMLA 2.5.28 (from live site) 2. Created fresh JOOMLA 3.3.6 site on local machine. Loaded hikashop version 2.3.5 (so it matches) 3. Imported product list (from step 1)  And this error shows up. Pleae explain the issue. I would think it should be seamless.    awesomescreenshot.com/0a34gzhp2b  Thanks!")* was created by *[gteigland](/forum/user/4840-gteigland "View gteigland's Profile")*

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.6.3
-- Browser(s) name and version -- : Chrome
-- Error-message(debug-mod must be tuned on) -- : 1136 Column count doesn't match value count at row 1 SQL=INSERT IGNORE INTO jbar3_hikashop_product_related (&#96;product_related_id&#96;,&#96;product_related_type&#96;,&#96;product_id&#96;) VALUES ()

Not really sure why this error would happen. Here are the steps. (furnitureandthings.com - upgrade to joomla 3)
1. I exported my products from hikashop2.3.5 FOR JOOMLA 2.5.28 (from live site)
2. Created fresh JOOMLA 3.3.6 site on local machine. Loaded hikashop version 2.3.5 (so it matches)
3. Imported product list (from step 1)

And this error shows up. Pleae explain the issue. I would think it should be seamless.

[ awesomescreenshot.com/0a34gzhp2b](http://awesomescreenshot.com/0a34gzhp2b)

Thanks!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NTE4OS1lcnJvci1vbi1pbXBvcnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

11 years 9 months ago [\#192112](#192112) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Error on Import](/forum/25-install-update/875189-error-on-import#192112 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.6.3 -- Browser(s) name and version -- : Chrome -- Error-message(debug-mod must be tuned on) -- : 1136 Column count doesn't match value count at row 1 SQL=INSERT IGNORE INTO jbar3&#95;hikashop&#95;product&#95;related (&#96;product&#95;related&#95;id&#96;,&#96;product&#95;related&#95;type&#96;,&#96;product&#95;id&#96;) VALUES ()  Not really sure why this error would happen. Here are the steps. (furnitureandthings.com - upgrade to joomla 3) 1. I exported my products from hikashop2.3.5 FOR JOOMLA 2.5.28 (from live site) 2. Created fresh JOOMLA 3.3.6 site on local machine. Loaded hikashop version 2.3.5 (so it matches) 3. Imported product list (from step 1)  And this error shows up. Pleae explain the issue. I would think it should be seamless.    awesomescreenshot.com/0a34gzhp2b  Thanks!")*

Hi,

I check the code of the import but I find something which could explain your issue.
In the file "administrator/components/com_hikashop/helpers/import.php", you will find the function "_insertRelated".
In this function, please replace the two references of Code:

if( $totalValid%$this-&gt;perBatch == 0){

By Code:

if( $totalValid &amp;&amp; $totalValid%$this-&gt;perBatch == 0){

And it should fix your issue.
Near the end of the function, you can also replace Code:

if(!empty($values)){

By Code:

if(count($values) &gt; 0){

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NTE4OS1lcnJvci1vbi1pbXBvcnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[gteigland](/forum/user/4840-gteigland "View gteigland's Profile")**
- [![gteigland's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/4840-gteigland "View gteigland's Profile") Topic Author
- [ Offline](/forum/user/4840-gteigland)

Less More

- Posts: 41
- Thank you received: 0
-
-

11 years 8 months ago [\#192835](#192835) by [gteigland](/forum/user/4840-gteigland "View gteigland's Profile")  Replied by *[gteigland](/forum/user/4840-gteigland "View gteigland's Profile")* on topic *[Error on Import](/forum/25-install-update/875189-error-on-import#192835 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.6.3 -- Browser(s) name and version -- : Chrome -- Error-message(debug-mod must be tuned on) -- : 1136 Column count doesn't match value count at row 1 SQL=INSERT IGNORE INTO jbar3&#95;hikashop&#95;product&#95;related (&#96;product&#95;related&#95;id&#96;,&#96;product&#95;related&#95;type&#96;,&#96;product&#95;id&#96;) VALUES ()  Not really sure why this error would happen. Here are the steps. (furnitureandthings.com - upgrade to joomla 3) 1. I exported my products from hikashop2.3.5 FOR JOOMLA 2.5.28 (from live site) 2. Created fresh JOOMLA 3.3.6 site on local machine. Loaded hikashop version 2.3.5 (so it matches) 3. Imported product list (from step 1)  And this error shows up. Pleae explain the issue. I would think it should be seamless.    awesomescreenshot.com/0a34gzhp2b  Thanks!")*

Unfortunately that did not work. I still get this error:

1136 Column count doesn't match value count at row 1 SQL=INSERT IGNORE INTO jbar3_hikashop_product_related (&#96;product_related_id&#96;,&#96;product_related_type&#96;,&#96;product_id&#96;) VALUES ()

I reverted back to the original. Realy need this to work as these products have many related products and I would think we should be able to export and import seamlessly between hikashop.

Thanks!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NTE4OS1lcnJvci1vbi1pbXBvcnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

11 years 8 months ago [\#192901](#192901) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Error on Import](/forum/25-install-update/875189-error-on-import#192901 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.6.3 -- Browser(s) name and version -- : Chrome -- Error-message(debug-mod must be tuned on) -- : 1136 Column count doesn't match value count at row 1 SQL=INSERT IGNORE INTO jbar3&#95;hikashop&#95;product&#95;related (&#96;product&#95;related&#95;id&#96;,&#96;product&#95;related&#95;type&#96;,&#96;product&#95;id&#96;) VALUES ()  Not really sure why this error would happen. Here are the steps. (furnitureandthings.com - upgrade to joomla 3) 1. I exported my products from hikashop2.3.5 FOR JOOMLA 2.5.28 (from live site) 2. Created fresh JOOMLA 3.3.6 site on local machine. Loaded hikashop version 2.3.5 (so it matches) 3. Imported product list (from step 1)  And this error shows up. Pleae explain the issue. I would think it should be seamless.    awesomescreenshot.com/0a34gzhp2b  Thanks!")*

Hi,

Please replace the whole content of the function by: Code:

function _insertRelated(&amp;$products,$type='related'){ $values = array(); $totalValid=0; $insert = 'INSERT IGNORE INTO '.hikashop_table('product_related').' (&#96;product_related_id&#96;,&#96;product_related_type&#96;,&#96;product_id&#96;) VALUES ('; $ids=array(); foreach($products as $product){ if(!isset($product-&gt;$type) &amp;&amp; empty($product-&gt;hikashop_update)){ //copy files from template if any if(@$product-&gt;product_type!='variant' &amp;&amp; !empty($this-&gt;template-&gt;$type)){ foreach($this-&gt;template-&gt;$type as $id){ $value = array((int)$id,$this-&gt;db-&gt;Quote($type),$product-&gt;product_id); $values[] = implode(',',$value); $totalValid++; if( $totalValid &amp;&amp; $totalValid%$this-&gt;perBatch == 0){ $this-&gt;db-&gt;setQuery($insert.implode('),(',$values).')'); $this-&gt;db-&gt;query(); $totalValid=0; $values=array(); } } } }elseif(isset($product-&gt;$type)&amp;&amp;is_array($product-&gt;$type)){ $ids[] = (int)$product-&gt;product_id; foreach($product-&gt;$type as $k =&gt; $id){ if(!empty($id)){ $id = $this-&gt;_getRelated($id); $product-&gt;{$type}[$k] = $id; $value = array((int)$id,$this-&gt;db-&gt;Quote($type),$product-&gt;product_id); $values[] = implode(',',$value); $totalValid++; } if( $totalValid &amp;&amp; $totalValid%$this-&gt;perBatch == 0){ if(!empty($ids)){ $this-&gt;db-&gt;setQuery('DELETE FROM '.hikashop_table('product_related').' WHERE product_id IN ('.implode(',',$ids).') AND product_related_type='.$this-&gt;db-&gt;Quote($type)); $this-&gt;db-&gt;query(); $ids=array(); } if(!empty($id)){ $this-&gt;db-&gt;setQuery($insert.implode('),(',$values).')'); $this-&gt;db-&gt;query(); } $totalValid=0; $values=array(); } } } } if(!empty($ids)){ $this-&gt;db-&gt;setQuery('DELETE FROM '.hikashop_table('product_related').' WHERE product_id IN ('.implode(',',$ids).') AND product_related_type='.$this-&gt;db-&gt;Quote($type)); $this-&gt;db-&gt;query(); } if(count($values)){ $this-&gt;db-&gt;setQuery($insert.implode('),(',$values).')'); $this-&gt;db-&gt;query(); } }

The following user(s) said Thank You: [gteigland](/forum/user/4840-gteigland "View gteigland's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NTE4OS1lcnJvci1vbi1pbXBvcnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.048 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
