Import weight for variants

  • Posts: 179
  • Thank you received: 17
12 years 8 months ago #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_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

Last edit: 12 years 8 months ago by rikatos.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
12 years 8 months ago #43475

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.

  • Posts: 179
  • Thank you received: 17
12 years 8 months ago #44075

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.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
12 years 8 months ago #44335

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.

  • Posts: 179
  • Thank you received: 17
12 years 8 months ago #44344

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.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
12 years 8 months ago #44524

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

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');
			}
		}
and change the code :
$this->_insertOneTypeOfProducts($products,'main');
by:
$this->_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

Please Log in or Create an account to join the conversation.

  • Posts: 179
  • Thank you received: 17
12 years 8 months ago #44532

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.064 seconds
Powered by Kunena Forum