import features

  • Posts: 14
  • Thank you received: 0
12 years 1 month ago #66268

Hello!
Thank you for the great job you are doing.
Not sure if such rerature exists in hikashoop, but definitely i was unable to find it.
When importing goods from csv or text is it possible to somehow add quantity of a certain pruduct to the remains of that product in the shop instead of replacing the quantity?

Example:
1)I sell pencils, I've reveived 10 "superpencils" from a supplier and added them to hikashop.
2) some time has passed and over thet time I've sold 5 superpensils so the remains in hikashop database are 5 superpencils
3)I receive anothe 10 superpencils and decide to import them (along with many other items) through csv or text
so I set "product_quantity" to 10 and upload? and after that I have 10 superpencils in the shop. not 15! because 10 replaced 5

the thing is that to make it 15 I need to: a)export my product list, b)see how many superpencils I have remaining, c) in the csv intended for import i have to add remaining 5 to the newly received 10 (making it 15), d) upload csv file.
And there are hundreds of products ((

there could be a simple solution as for example setting "product_quantity" to 10 to rewrite quantity and "+10" or "add10" to add to existing remains.

Or maybe I just missed such solution.
Please help me out

Last edit: 12 years 1 month ago by rusil.

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

  • Posts: 13201
  • Thank you received: 2322
12 years 1 month ago #66348

Hi rusil,

Actually the easy way is to export your product list, change the quantity, and import the csv file.

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

  • Posts: 14
  • Thank you received: 0
12 years 1 month ago #66565

Actually the easy way (when talking about significant amount of items) is not a manual one. And this is just what you propose to do. The easy way is to transform initial product list into uploadable format csv, and just upload. The easy way would be to make hikashop able to add quantity of items that already exist, not overwrite it. How can thi be implemented?

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

  • Posts: 13201
  • Thank you received: 2322
12 years 1 month ago #66578

Hi rusil,

You can add this feature, edit the file: "yourSite/administrator/components/com_hikashop/views/import/tmpl/file.php" and add the code:

	<tr>
		<td class="key" >
			<?php echo JText::_('UPDATE_PRODUCT_QUANTITY'); ?>
		</td>
		<td>
			<?php echo JHTML::_('select.booleanlist', 'update_product_quantity','',JRequest::getInt('update_product_quantity','0'));?>
		</td>
	</tr>
just befor the tag "</table>".

And edit the file: "yourSite/administrator/components/com_hikashop/helpers/import.php", in the function "_insertOneTypeOfProducts()" add the code:
							if(JRequest::getInt('update_product_quantity','0') && $field=='product_quantity' && $product->product_quantity != -1){
								$product->product_quantity += $already[$product->product_id]->$field;
							}
just before the line:
$line[] = $this->db->Quote(@$product->$field);

By this way you can choose if you want to update the product quantity or replace it.

You can add the translation:
UPDATE_PRODUCT_QUANTITY="Update the product quantity instead of replacing it"
in HikaShop > Configuration > Languages

Last edit: 12 years 1 month ago by Xavier.

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

  • Posts: 14
  • Thank you received: 0
12 years 1 month ago #66686

not working! ((
sad, but with either yes or no option it just removes items from shop

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

  • Posts: 13201
  • Thank you received: 2322
12 years 1 month ago #66722

Hi,

It's working fine on my end.
Are you sure that you have correctly paste the code in the correct place ?

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

  • Posts: 14
  • Thank you received: 0
12 years 1 month ago #67342

thank you so much for your help
Actually the line $line[] = $this->db->Quote(@$product->$field);
is located in two places in yourSite/administrator/components/com_hikashop/helpers/import.php

and the code you suggest should be placed before second appearance of this line

Thanks and regards

Last edit: 12 years 1 month ago by rusil.

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

  • Posts: 14
  • Thank you received: 0
12 years 1 month ago #67359

Hmmmm...
Functions strange anyway ((
I created same option in import from text field
and from text field it updates the quantities just fine, though it doesn't create new products no matter what the options are.
But when I use csv import it is so strange that products from csv (which quantities i want to update) are updated but are also moved into newly created categoty (which has no name)
And again no way to add new products

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

  • Posts: 14
  • Thank you received: 0
12 years 1 month ago #67361

maybe i just really didn't explain well what i wanted..
that is:
When i receive products from supplier I create a csv file to import them to hikashop
some products are new some i already heve in hika
when i import i need new products to be created and existing products to be updated (quantity of supply added to remaining quantity in hika)
please help

Last edit: 12 years 1 month ago by rusil.

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

  • Posts: 14
  • Thank you received: 0
12 years 1 month ago #67427

checked and re-checked everything. kinda works for now. will see what happens next

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

  • Posts: 14
  • Thank you received: 0
12 years 1 month ago #67438

problems were caused by product_id used in csv (maybe due to some conflict), leaving this field blank and letting hika set id itself solved the problem

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

Time to create page: 0.088 seconds
Powered by Kunena Forum