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

#   Import weight for variants

##

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

Less More

- Posts: 179
- Thank you received: 17
-
-
- [](http://oceansafety.com)
-

14 years 7 months ago -  14 years 7 months ago [\#43292](#43292) by [rikatos](/forum/user/1634-rikatos "View rikatos's Profile")  *[Import weight for variants](/forum/2-general-talk-about-hikashop/43292-import-weight-for-variants#43292 "Hi There  I have tried to import the weight for all my products.  Naturally some products are variants. I exported the products and noticed the two fields I was interested in. These are product&#95;code and product&#95;weight nice and simple :) These seem to be for normal and variant products.  So I create a csv with these as header and import. The normal products are great all imported, but the variants no such luck. Myabe I am missing something. It told me 78 were new , 30 were invalid and 445 already existed, I am guessing the invalid ones are the variants ?  As the export had the correct product codes in the product&#95;code header I was hoping this would be simple so Im sure I missed something :) looking forward to the solution !  Regards  RIchard")* was created by *[rikatos](/forum/user/1634-rikatos "View rikatos's Profile")*

Hi There

I have tried to import the weight for all my products.

Naturally some products are variants. I exported the products and noticed the two fields I was interested in. These are product_code and product_weight nice and simple ![:)](/media/kunena/emoticons/3.png ":)") These seem to be for normal and variant products.

So I create a csv with these as header and import. The normal products are great all imported, but the variants no such luck. Myabe I am missing something. It told me 78 were new , 30 were invalid and 445 already existed, I am guessing the invalid ones are the variants ?

As the export had the correct product codes in the product_code header I was hoping this would be simple so Im sure I missed something ![:)](/media/kunena/emoticons/3.png ":)") looking forward to the solution !

Regards

RIchard

Last edit: 14 years 7 months ago by [rikatos](/forum/user/1634-rikatos "View rikatos's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzQzMjkyLWltcG9ydC13ZWlnaHQtZm9yLXZhcmlhbnRzP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

14 years 7 months ago [\#43475](#43475) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Import weight for variants](/forum/2-general-talk-about-hikashop/43292-import-weight-for-variants#43475 "Hi There  I have tried to import the weight for all my products.  Naturally some products are variants. I exported the products and noticed the two fields I was interested in. These are product&#95;code and product&#95;weight nice and simple :) These seem to be for normal and variant products.  So I create a csv with these as header and import. The normal products are great all imported, but the variants no such luck. Myabe I am missing something. It told me 78 were new , 30 were invalid and 445 already existed, I am guessing the invalid ones are the variants ?  As the export had the correct product codes in the product&#95;code header I was hoping this would be simple so Im sure I missed something :) looking forward to the solution !  Regards  RIchard")*

You should keep the product_type column too in your CSV.

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzQzMjkyLWltcG9ydC13ZWlnaHQtZm9yLXZhcmlhbnRzP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 179
- Thank you received: 17
-
-
- [](http://oceansafety.com)
-

14 years 7 months ago [\#44075](#44075) by [rikatos](/forum/user/1634-rikatos "View rikatos's Profile")  Replied by *[rikatos](/forum/user/1634-rikatos "View rikatos's Profile")* on topic *[Re: Import weight for variants](/forum/2-general-talk-about-hikashop/43292-import-weight-for-variants#44075 "Hi There  I have tried to import the weight for all my products.  Naturally some products are variants. I exported the products and noticed the two fields I was interested in. These are product&#95;code and product&#95;weight nice and simple :) These seem to be for normal and variant products.  So I create a csv with these as header and import. The normal products are great all imported, but the variants no such luck. Myabe I am missing something. It told me 78 were new , 30 were invalid and 445 already existed, I am guessing the invalid ones are the variants ?  As the export had the correct product codes in the product&#95;code header I was hoping this would be simple so Im sure I missed something :) looking forward to the solution !  Regards  RIchard")*

that did the trick, its a shame that has to be done though as it makes updates from csvs exported from our main file very difficult, is there no way that extra field can not have to be used ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzQzMjkyLWltcG9ydC13ZWlnaHQtZm9yLXZhcmlhbnRzP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

14 years 7 months ago [\#44335](#44335) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Import weight for variants](/forum/2-general-talk-about-hikashop/43292-import-weight-for-variants#44335 "Hi There  I have tried to import the weight for all my products.  Naturally some products are variants. I exported the products and noticed the two fields I was interested in. These are product&#95;code and product&#95;weight nice and simple :) These seem to be for normal and variant products.  So I create a csv with these as header and import. The normal products are great all imported, but the variants no such luck. Myabe I am missing something. It told me 78 were new , 30 were invalid and 445 already existed, I am guessing the invalid ones are the variants ?  As the export had the correct product codes in the product&#95;code header I was hoping this would be simple so Im sure I missed something :) looking forward to the solution !  Regards  RIchard")*

No, but I don't see why it's difficult for you to have that column ? Could you explain why ? We might be able to give you an easy solution for that instead.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzQzMjkyLWltcG9ydC13ZWlnaHQtZm9yLXZhcmlhbnRzP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 179
- Thank you received: 17
-
-
- [](http://oceansafety.com)
-

14 years 7 months ago [\#44344](#44344) by [rikatos](/forum/user/1634-rikatos "View rikatos's Profile")  Replied by *[rikatos](/forum/user/1634-rikatos "View rikatos's Profile")* on topic *[Re: Import weight for variants](/forum/2-general-talk-about-hikashop/43292-import-weight-for-variants#44344 "Hi There  I have tried to import the weight for all my products.  Naturally some products are variants. I exported the products and noticed the two fields I was interested in. These are product&#95;code and product&#95;weight nice and simple :) These seem to be for normal and variant products.  So I create a csv with these as header and import. The normal products are great all imported, but the variants no such luck. Myabe I am missing something. It told me 78 were new , 30 were invalid and 445 already existed, I am guessing the invalid ones are the variants ?  As the export had the correct product codes in the product&#95;code header I was hoping this would be simple so Im sure I missed something :) looking forward to the solution !  Regards  RIchard")*

Its not necessarily difficult from a hikashop perspective. But from our products database it is.

To give you an idea. We have a huge products invoicing, purchasing stock control etc etc database which I can export the product codes and other information (such as weight, prices etc) from. This database doesnt of course know how hikashop arranges its products, main or variant is not a variable it has in it or wants to have ![:)](/media/kunena/emoticons/3.png ":)")

So when we do a price update, or add new products, I now have to manually go through the csv and add if the product is a main product or variant, something I can only tell by exporting the csv from hikashop and stepping one by one through each one to see how hikashop exported it. Thats a big ouch !

If we didnt need to put the product type, just needed the code then it would be extremely easy for us to quickly update prices etc. this way there is a bottleneck (ie me) in the process.

Hope that makes sense.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzQzMjkyLWltcG9ydC13ZWlnaHQtZm9yLXZhcmlhbnRzP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

14 years 7 months ago [\#44524](#44524) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Import weight for variants](/forum/2-general-talk-about-hikashop/43292-import-weight-for-variants#44524 "Hi There  I have tried to import the weight for all my products.  Naturally some products are variants. I exported the products and noticed the two fields I was interested in. These are product&#95;code and product&#95;weight nice and simple :) These seem to be for normal and variant products.  So I create a csv with these as header and import. The normal products are great all imported, but the variants no such luck. Myabe I am missing something. It told me 78 were new , 30 were invalid and 445 already existed, I am guessing the invalid ones are the variants ?  As the export had the correct product codes in the product&#95;code header I was hoping this would be simple so Im sure I missed something :) looking forward to the solution !  Regards  RIchard")*

One solution I can see would be to merge automatically the CSV from HikaShop and the CSV from your database. There are tools for that you can find online:
[ www.google.com/search?ix=seb&amp;sourceid=ch...e=UTF-8&amp;q=csv+merger](https://www.google.com/search?ix=seb&sourceid=chrome&ie=UTF-8&q=csv+merger)

Another solution would be for you to try to remove the code Code:

if(empty($product-&gt;product_type)){ if(empty($product-&gt;product_parent_id)){ $product-&gt;product_type='main'; }else{ if(!empty($product-&gt;product_parent_id) &amp;&amp; !empty($product-&gt;product_code) &amp;&amp; $product-&gt;product_parent_id == $product-&gt;product_code){ $app =&amp; JFactory::getApplication(); $app-&gt;enqueueMessage('The product '.$product-&gt;product_code.' has the same value in the product_parent_id and product_code fields which is not possible ( a main product cannot be a variant at the same time ). This product has been considered as a main product by HikaShop and has been imported as such.'); $product-&gt;product_type='main'; $product-&gt;product_parent_id=0; }else{ $product-&gt;product_type='variant'; } } }else{ if(!in_array($product-&gt;product_type,array('main','variant'))){ $product-&gt;product_type = 'main'; } } if($product-&gt;product_type=='main'){ if(!empty($product-&gt;product_parent_id)){ $app =&amp; JFactory::getApplication(); $app-&gt;enqueueMessage('The product '.@$product-&gt;product_code.' should have an empty value instead of the value '.$product-&gt;product_parent_id.' in the field product_parent_id as it is a main product (not a variant) and thus doesn\'t have any parent.','error'); } }

and change the code : Code:

$this-&gt;_insertOneTypeOfProducts($products,'main');

by: Code:

$this-&gt;_insertOneTypeOfProducts($products,'');

in the file administrator/components/com_hikashop/helpers/import.php
That should avoid the problem.

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzQzMjkyLWltcG9ydC13ZWlnaHQtZm9yLXZhcmlhbnRzP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 179
- Thank you received: 17
-
-
- [](http://oceansafety.com)
-

14 years 7 months ago [\#44532](#44532) by [rikatos](/forum/user/1634-rikatos "View rikatos's Profile")  Replied by *[rikatos](/forum/user/1634-rikatos "View rikatos's Profile")* on topic *[Re: Import weight for variants](/forum/2-general-talk-about-hikashop/43292-import-weight-for-variants#44532 "Hi There  I have tried to import the weight for all my products.  Naturally some products are variants. I exported the products and noticed the two fields I was interested in. These are product&#95;code and product&#95;weight nice and simple :) These seem to be for normal and variant products.  So I create a csv with these as header and import. The normal products are great all imported, but the variants no such luck. Myabe I am missing something. It told me 78 were new , 30 were invalid and 445 already existed, I am guessing the invalid ones are the variants ?  As the export had the correct product codes in the product&#95;code header I was hoping this would be simple so Im sure I missed something :) looking forward to the solution !  Regards  RIchard")*

As usual a star, thanks for the advise, I will try each way and see what fits just about to order business edition as upgrading site to J2.5 so looking forward to the little extras it offers (and a good excuse to play!)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzQzMjkyLWltcG9ydC13ZWlnaHQtZm9yLXZhcmlhbnRzP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) 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.098 seconds

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