Page 1 of 1

export csv -> import some csv= nulled Advanced Stock Management

Posted: 09 Jan 2024, 04:37
by Mantrid
hello
fresh installed joomla 5.0.1
phoca cart 4.0.10
installed demo data
options:
Export Parameters YES
Export Advanced Stock Options YES
Export Attributes YES

product item :
attributes :
size :
1: image select ( L ) 2: image select ( XL )
stock option:
Stock Calculation: Advanced Stock Management
Advanced Stock Options: set In Stock :
In Stock image select ( L ) = 3
In Stock image select ( XL ) = 6

---------
next i Export data to CSV
and without any change IMPORT some csv


after import, all In Stock Variants data set to zero ( 0 )
looks like a bug

Re: export csv -> import some csv= nulled Advanced Stock Management

Posted: 10 Jan 2024, 01:26
by Jan
Hi, which stock variants do you mean, the stock values in attribute options or the stock value in mixed attributes (Stock Advanced Management)?

Jan

Re: export csv -> import some csv= nulled Advanced Stock Management

Posted: 10 Jan 2024, 10:06
by Mantrid
Stock Calculation: AdvancedStock Management
" Stock Options" -> "Advanced Stock Options" - After import all stock rewrited to "0"

Re: export csv -> import some csv= nulled Advanced Stock Management

Posted: 12 Jan 2024, 00:09
by Mantrid
I updated PhokaCart to v5.0.0Beta20, the result is the same.
after exporting and then importing the same data, the data is reset to zero.

I can provide access to the site's admin panel to demonstrate the bug.

Re: export csv -> import some csv= nulled Advanced Stock Management

Posted: 12 Jan 2024, 18:01
by Jan
Hi, sorry for misunderstanding, now I see, the advanced stock management table is not a part of products table, so it is not possible to export/import it, in such case the standard database export or import needs to be done :idea:

The table to export/import is: #__phocacart_product_stock

Jan

Re: export csv -> import some csv= nulled Advanced Stock Management

Posted: 13 Jan 2024, 09:38
by Mantrid
phocacart_product_stock has the following structure

Code: Select all

INSERT INTO `odfff_phocacart_product_stock` (`id`, `product_id`, `product_key`, `attributes`, `sku`, `ean`, `stock`, `image`, `image_small`, `image_medium`, `operator`, `amount`, `price`, `active_price`) VALUES
(44, 1, '1:YToxOntpOjE4MjthOjE6e2k6NDg7aTo0ODt9fQ==:', 'a:1:{i:182;a:1:{i:48;i:48;}}', '', '', 666, '', '', '', '', 0.0000, 0.0000, 0),
(45, 1, '1:YToxOntpOjE4MjthOjE6e2k6NDk7aTo0OTt9fQ==:', 'a:1:{i:182;a:1:{i:49;i:49;}}', '', '', 777, '', '', '', '', 0.0000, 0.0000, 0),
(47, 5, '5:YToxOntpOjE4MzthOjE6e2k6NTA7aTo1MDt9fQ==:', 'a:1:{i:183;a:1:{i:50;i:50;}}', '', '', 789, '', '', '', '', 0.0000, 0.0000, 0),
(48, 5, '5:YToxOntpOjE4MzthOjE6e2k6NTE7aTo1MTt9fQ==:', 'a:1:{i:183;a:1:{i:51;i:51;}}', '', '', 567, '', '', '', '', 0.0000, 0.0000, 0),
(49, 4, '4::', '4::', '', '', 777, '', '', '', '', 0.0000, 0.0000, 0),
(50, 4, '4:YToxOntpOjE4NDthOjE6e2k6NTI7aTo1Mjt9fQ==:', 'a:1:{i:184;a:1:{i:52;i:52;}}', '', '', 454, '', '', '', '', 0.0000, 0.0000, 0),
(51, 4, '4:YToxOntpOjE4NDthOjE6e2k6NTM7aTo1Mzt9fQ==:', 'a:1:{i:184;a:1:{i:53;i:53;}}', '', '', 456, '', '', '', '', 0.0000, 0.0000, 0);
The following fields are not obvious to me: product_key = "1:YToxOntpOjE4MjthOjE6e2k6NDg7aTo0ODt9fQ==: "
and attributes ="'a:1:{i:182;a:1:{i:48;i:48;}}"

how can I generate these fields? is there an example of using PHOCA CART API?

Re: export csv -> import some csv= nulled Advanced Stock Management

Posted: 15 Jan 2024, 23:46
by Jan
Hi, the token and the attributes are just created by Phoca Cart system when the attributes are added into system. The question is, when you export/import such values, why do you need to create own new values?

Jan

Re: export csv -> import some csv= nulled Advanced Stock Management

Posted: 16 Jan 2024, 03:14
by Mantrid
since export/import do not work with "Advanced Stock Options", I will have to write my own direct import of data from the supplier catalog into the database, and I will have to generate the attributes and product_key fields myself.
so I need to understand how easier it is to do this, ideally I need a call to the poca cart API to create / update a product

Re: export csv -> import some csv= nulled Advanced Stock Management

Posted: 18 Jan 2024, 00:38
by Jan
"I will have to generate the attributes and product_key fields myself."

I still don't understand, why you need to generate the attributes and product keys fields by yourself? When you export first then such keys are created yet, so you export the created keys and then you can import them.

BTW there is a function to create the keys in:
administrator/components/com_phocacart/libraries/phocacart/product/product.php
getProductKey

mostly called from attribute class:
administrator/components/com_phocacart/libraries/phocacart/attribute/attribute.php

Jan

Re: export csv -> import some csv= nulled Advanced Stock Management

Posted: 21 Jan 2024, 03:00
by Mantrid
No, I exported only to check the functionality of the Import function.
In reality, I need to import the supplier's catalog. Those I need to create new units of goods and further update the information of these units of goods.