[SOLVED] Howto write multicurrency at csv file (for Aimeos import) + add second import job for only prices csv

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
ЕвгенияСемихова(ИПСемиховаЕ.А.)
Posts: 70
Joined: 11 Jan 2025, 09:45

[SOLVED] Howto write multicurrency at csv file (for Aimeos import) + add second import job for only prices csv

Post by ЕвгенияСемихова(ИПСемиховаЕ.А.) » 01 Mar 2025, 12:41

I have read instructions and this forum's topics, but can't create correct line for product import (by csv file).
I take for example file from instruction, there was this part:

Image

At instruction:

Code: Select all

'price' => [
        9 => 'price.currencyid', // three letter ISO currency code
        10 => 'price.quantity', // the quantity the price (for block pricing)
        11 => 'price.value', // price with decimals separated by a dot
        12 => 'price.taxrate', // tax rate with decimals separated by a dot
How I can write line with 3 currency?
Or I need write this code to shop.php for 3 times for each USD, RUB and CNY currency?
Last edited by ЕвгенияСемихова(ИПСемиховаЕ.А.) on 06 Mar 2025, 22:24, edited 1 time in total.
Debian 12, PHP 8.3, Server 1 = Aimeos 2024.10.13, Server 2 = ES 8.17.1
life is full of many new and interesting things

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Howto write multicurrency at csv file (for Aimeos import)

Post by aimeos » 03 Mar 2025, 10:27

To import several prices for on product, add more columns for the price details:

Code: Select all

'price' => [
        9 => 'price.currencyid', // three letter ISO currency code
        10 => 'price.quantity', // the quantity the price (for block pricing)
        11 => 'price.value', // price with decimals separated by a dot
        12 => 'price.taxrate', // tax rate with decimals separated by a dot
        13 => 'price.currencyid', // three letter ISO currency code
        14 => 'price.quantity', // the quantity the price (for block pricing)
        15 => 'price.value', // price with decimals separated by a dot
        16 => 'price.taxrate', // tax rate with decimals separated by a dot
],
This also works for texts, categories, attributes, etc.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
ЕвгенияСемихова(ИПСемиховаЕ.А.)
Posts: 70
Joined: 11 Jan 2025, 09:45

Re: Howto write multicurrency at csv file (for Aimeos import)

Post by ЕвгенияСемихова(ИПСемиховаЕ.А.) » 03 Mar 2025, 10:49

To import several prices for on product, add more columns for the price details:
That's what I thought. Thanks for the reply. One more question, please:
1) I want to upload a new products with a full set of data (short and long description, metadata, all prices, all characteristics - everything that can be conveniently generated in Excel with a large list). 2) The secondary uploads should be very fast - only the product ID and its price (in each currency) - such an update should be very fast for a huge amount of goods.
Here the question arises: what is the best way to distribute these types of downloads? At first, I thought of using the natural separation between CSV and XML standards. But then my workers (managers) have difficulties processing two different files, one of which is not very friendly (I'm talking about raw xml).
Can you tell me a simple and, more interesting - the best way to separate the download of the full and shortened csv list? For example, by creating independent directories on the server?
Last edited by ЕвгенияСемихова(ИПСемиховаЕ.А.) on 03 Mar 2025, 11:04, edited 1 time in total.
Debian 12, PHP 8.3, Server 1 = Aimeos 2024.10.13, Server 2 = ES 8.17.1
life is full of many new and interesting things

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Howto write multicurrency at csv file (for Aimeos import)

Post by aimeos » 03 Mar 2025, 11:04

Partial imports doesn't work for ES because it's a document-oriented system (contrary to relational databases) and the complete document with all product details needs to be stored.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
ЕвгенияСемихова(ИПСемиховаЕ.А.)
Posts: 70
Joined: 11 Jan 2025, 09:45

Re: Howto write multicurrency at csv file (for Aimeos import)

Post by ЕвгенияСемихова(ИПСемиховаЕ.А.) » 03 Mar 2025, 11:19

aimeos wrote: 03 Mar 2025, 11:04 Partial imports doesn't work for ES because it's a document-oriented system (contrary to relational databases) and the complete document with all product details needs to be stored.
do I understand correctly that even using ElasticSearch as the base for the product, I can still determine in the "shop.php" file only the 3 columns needed to read and thus update only the prices?

Image

Do I understand correctly?

So, can I add to shop.php this:

Code: Select all

'item' => [
        0 => 'product.code',
        1 => 'product.type',
	2 => 'product.label',
    ],
'price' => [
       		3 => 'price.currencyid', // for CNY
        4 => 'price.quantity', // the quantity the price (for block pricing)
        5 => 'price.value', // price with decimals separated by a dot
        6 => 'price.taxrate', // tax rate with decimals separated by a dot
        	7 => 'price.currencyid', // for USD
        8 => 'price.quantity', // the quantity the price (for block pricing)
        9 => 'price.value', // price with decimals separated by a dot
        10 => 'price.taxrate', // tax rate with decimals separated by a dot
		11 => 'price.currencyid', // for RUB
        12 => 'price.quantity', // the quantity the price (for block pricing)
        13 => 'price.value', // price with decimals separated by a dot
        14 => 'price.taxrate', // tax rate with decimals separated by a dot

],
and will it work for only price's update? (but if will be new item - it will add to site - managers will add text and media by manual). So, no any rewritings textes and media files?
Debian 12, PHP 8.3, Server 1 = Aimeos 2024.10.13, Server 2 = ES 8.17.1
life is full of many new and interesting things

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Howto write multicurrency at csv file (for Aimeos import)

Post by aimeos » 05 Mar 2025, 08:58

ЕвгенияСемихова(ИПСемиховаЕ.А.) wrote: 03 Mar 2025, 11:19 do I understand correctly that even using ElasticSearch as the base for the product, I can still determine in the "shop.php" file only the 3 columns needed to read and thus update only the prices?

and will it work for only price's update? (but if will be new item - it will add to site - managers will add text and media by manual). So, no any rewritings textes and media files?
For the CSV import yes, because the CSV import fetches the document from ES first, updates it and stores it again.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
ЕвгенияСемихова(ИПСемиховаЕ.А.)
Posts: 70
Joined: 11 Jan 2025, 09:45

Re: Howto write multicurrency at csv file (for Aimeos import)

Post by ЕвгенияСемихова(ИПСемиховаЕ.А.) » 05 Mar 2025, 11:28

For the CSV import yes, because the CSV import fetches the document from ES first, updates it and stores it again.
your answers are food for the mind, thank you - they are extremely useful to us. Let me still ask you for advice on the most optimal and efficient algorithm for implementing my current task.:
We have: excel-generated files for each store on our website. The files themselves have 2 pages:
1 - the most informative in terms of description, properties and language (more than 55 columns) - this is a very heavy file designed for the initial download of goods from sellers;
2 - an automatically generated list containing "code, product name, price and quantity in stock" - this is the file for updating prices and stock's pcs, and it can be imported very quickly.

That's all that came to my mind.:
a) do a large download in CSV, and redo the price and balance updates in XML (I've a problem with XML generation from Excel)
b) make two versions of the file shop.php and at the time of the need to import the full catalog of new products, set the main one. After finishing, return the file version. shop.php , where only prices and balances are loaded.
I don't have enough knowledge for more than that yet.

Question: how can I do my task most efficiently, beautifully, and lightly? It can be the creation of a second cron.job "import/csv/onlyprice" ?
I'm sure you've come across something similar and have come up with a very clever solution (also fast and powerfull).

P.S.:
1) our national ERP systems can't handle more than a few hundred thousand products;
2) I have seen an implemented cell binding algorithm on other systems directly when uploading a file (I understand that this is an additional functional matching system).
3) For importing to xml (in my case), we lack a functional system for exporting data from excel to xml while maintaining the necessary structure and schema of the document. Internet searches and answers in the AI of working systems were not provided. In the future, we will create our own lightweight ERP system with direct access to the database of our website.
Debian 12, PHP 8.3, Server 1 = Aimeos 2024.10.13, Server 2 = ES 8.17.1
life is full of many new and interesting things

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Howto write multicurrency at csv file (for Aimeos import)

Post by aimeos » 06 Mar 2025, 09:46

The best approach for two different CSV imports would be to create a second job controller, e.g. "product/import/price". Extend from the existing \Aimeos\Controller\Jobs\Product\Import\Csv\Standard class and overwrite at least the location() and mapping() methods to use another configuration key. Then, you can import two different kinds of CSV files with different column mappings stored in different directories.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
ЕвгенияСемихова(ИПСемиховаЕ.А.)
Posts: 70
Joined: 11 Jan 2025, 09:45

Re: Howto write multicurrency at csv file (for Aimeos import)

Post by ЕвгенияСемихова(ИПСемиховаЕ.А.) » 06 Mar 2025, 14:31

-------------------------------------------------------------------------------------------------
!!! Please, go to next message (after this) - for right instructions !!!
-------------------------------------------------------------------------------------------------

I have understand what wrong at this:

---THIS NOT WORKING ---
If I understanding right, I need to do:

1) Open "standart.php" file from "Jobs\Product\Import\Csv\" catalog and copy with rename methods "location" and "mapping":

Image

2) Create new catalog "price" at "storage/import":

Image

3) Open file "shop.php" and add second controller:

Image

right?

And after this, I can save a short csv file with only product.code and label + price to import catalog "price".
Q: can I use command for import this shor csv file only by new command:

Code: Select all

php artisan aimeos:jobs "product/import/price"
and this is all? All others job will do your Aimeos systems?

P.S.: I'm sorry for my newbie questions - this is all I have to do and study for the first time. It's very different from what I've been used to working with over the last 10 years, but it's very interesting.
Last edited by ЕвгенияСемихова(ИПСемиховаЕ.А.) on 06 Mar 2025, 22:05, edited 3 times in total.
Debian 12, PHP 8.3, Server 1 = Aimeos 2024.10.13, Server 2 = ES 8.17.1
life is full of many new and interesting things

User avatar
ЕвгенияСемихова(ИПСемиховаЕ.А.)
Posts: 70
Joined: 11 Jan 2025, 09:45

Re: Howto write multicurrency at csv file (for Aimeos import)

Post by ЕвгенияСемихова(ИПСемиховаЕ.А.) » 06 Mar 2025, 21:57

ATTENTION TO ALL: my some previous steps were wrong!

---THIS IS WORKING INSTRUCTION ---
After carefully reading the instructions 10 times, I finally get +1% more experience with this wonderful Aimeos system (total 2% :lol: )
First of all: do it with very high attentions!
1) Create catalog for "only prices" csv file:

Code: Select all

myshop/storage/import/price/

please, dont forget to create add catalog "default" for one seller Aimeos, and "storename" in multivendor.
Image

Image

2) Create new catalog "Price" at:

Code: Select all

src/Controller/Jobs/Product/Import
Image

3) Copy file with name "Standart.php" from
"src/Controller/Jobs/Product/Import/Csv"
to
"src/Controller/Jobs/Product/Import/Price".

4) Open it (from Price catalog) and change all "Csv" to "Price" (at 2024.10 version):
line 11: namespace Aimeos\Controller\Jobs\Product\Import\Price;
line 559: return (string) $this->context()->config()->get( 'controller/jobs/product/import/price/location', 'price' );
line 595: $map = (array) $this->context()->config()->get( 'controller/jobs/product/import/price/mapping', $this->getDefaultMapping() );
save it

5) Now open your "shop.php" configuration file and add new (by old mapping):

Image

Now you can load short CSV file with only prices and send command (or add to cron):

Code: Select all

php artisan aimeos:jobs "product/import/price"
I don't know if I did everything right, let the respected author of this wonderful creation correct me if something is wrong, but it worked for me!

The big bonus (for me): now I understand how this part of the system works. I was also surprised to find a separate "Stock" task - this is what I need to solve my question from a neighboring topic: How can I choose Domain's type of stock? - I think now I can solve it too.

Regarding the implementation and based on the instructions I read (once again): I think the author will agree that it would be more correct to make a separate folder "Prices" in the likeness of "Product" and "Stock"

Image
and write a specific handler. I think I can at free time (after starting site).

Once again, I would like to respectfully this wonderful system! It's easy to understand and it's very friendly, although it's very unusual (for me, certanly).
Debian 12, PHP 8.3, Server 1 = Aimeos 2024.10.13, Server 2 = ES 8.17.1
life is full of many new and interesting things

Post Reply