Import weight for variants
14 years 6 months ago - 14 years 6 months ago #43292
by rikatos
Import weight for variants was created by rikatos
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
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
looking forward to the solution !
Regards
RIchard
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
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
Regards
RIchard
Last edit: 14 years 6 months ago by rikatos.
Please Log in or Create an account to join the conversation.
14 years 6 months ago #43475
by nicolas
Replied by nicolas on topic Re: Import weight for variants
You should keep the product_type column too in your CSV.
The following user(s) said Thank You: rikatos
Please Log in or Create an account to join the conversation.
14 years 6 months ago #44075
by rikatos
Replied by rikatos on topic Re: Import weight for variants
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 or Create an account to join the conversation.
14 years 6 months ago #44335
by nicolas
Replied by nicolas on topic Re: Import weight for variants
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 or Create an account to join the conversation.
14 years 6 months ago #44344
by rikatos
Replied by rikatos on topic Re: Import weight for variants
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
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.
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
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 or Create an account to join the conversation.
14 years 6 months ago #44524
by nicolas
Replied by nicolas on topic Re: Import weight for variants
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&sourceid=ch...e=UTF-8&q=csv+merger
Another solution would be for you to try to remove the code
and change the code :
by:
in the file administrator/components/com_hikashop/helpers/import.php
That should avoid the problem.
www.google.com/search?ix=seb&sourceid=ch...e=UTF-8&q=csv+merger
Another solution would be for you to try to remove the code
Code:
if(empty($product->product_type)){
if(empty($product->product_parent_id)){
$product->product_type='main';
}else{
if(!empty($product->product_parent_id) && !empty($product->product_code) && $product->product_parent_id == $product->product_code){
$app =& JFactory::getApplication();
$app->enqueueMessage('The product '.$product->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->product_type='main';
$product->product_parent_id=0;
}else{
$product->product_type='variant';
}
}
}else{
if(!in_array($product->product_type,array('main','variant'))){
$product->product_type = 'main';
}
}
if($product->product_type=='main'){
if(!empty($product->product_parent_id)){
$app =& JFactory::getApplication();
$app->enqueueMessage('The product '.@$product->product_code.' should have an empty value instead of the value '.$product->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');
}
}
Code:
$this->_insertOneTypeOfProducts($products,'main');
Code:
$this->_insertOneTypeOfProducts($products,'');
That should avoid the problem.
The following user(s) said Thank You: rikatos
Please Log in or Create an account to join the conversation.
14 years 6 months ago #44532
by rikatos
Replied by rikatos on topic Re: Import weight for variants
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 or Create an account to join the conversation.
Time to create page: 0.187 seconds