catalog Id in product/export job

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!
xaxalex
Posts: 2
Joined: 23 Apr 2023, 12:58

catalog Id in product/export job

Post by xaxalex » 23 Apr 2023, 13:01

Good afternoon.
Pls tell me how to get also its categories when exporting a product?
aimeos shop 2022.10, php 8.1. ubuntu 22.04

xaxalex
Posts: 2
Joined: 23 Apr 2023, 12:58

Re: catalog Id in product/export job

Post by xaxalex » 24 Apr 2023, 15:50

I see that the data is taken from 4 domains. To the shop catalog.php I also registered the domain 'like this:

Code: Select all

'product' => [
   'export' => [
      'location' => 'my_path',
      'type' => 'csv',
      'domains' => [
         'catalog',
      ],
      'partials' => [
         'directory' => '"my_path"/packages/champion-theme/templates/controller/jobs/product/export/items-partial-catalog-standard.php ' ,
      ],
   ]
]
I also created a file items-partial-catalog-standard.php and also prescribed the full path to it in the configuration.

in the mshop_product_list table, where, as far as I understand, the product data comes from, there is the necessary line: catalog|default|17

however, after completing the task, I still do not receive this data.

Dear Aimeos team!
I ask for your help.
Last edited by xaxalex on 24 Apr 2023, 15:52, edited 1 time in total.

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

Re: catalog Id in product/export job

Post by aimeos » 26 Apr 2023, 06:20

Your configuration is probably at the wrong location. You have to add it either to your ./config/shop.php and use this structure:

Code: Select all

'controller' => [
  'jobs' =>
    'product' => [
      'export' => [
        'location' => 'my_path',
        'type' => 'csv',
        'domains' => [
          'catalog', 'attribute', 'media', 'price', 'product', 'text'
        ],
        'partials' => [
          'directory' => 'my_path/packages/champion-theme/templates/controller/jobs/product/export/items-partial-catalog-standard.php ' ,
        ],
      ]
    ]
  ]
]
Or in your own project-specifc Aimeos extension you've created in ./config/controller.php as:

Code: Select all

  'jobs' =>
    'product' => [
      'export' => [
        'location' => 'my_path',
        'type' => 'csv',
        'domains' => [
          'catalog' => 'catalog'
        ],
        'partials' => [
          'directory' => 'my_path/packages/champion-theme/templates/controller/jobs/product/export/items-partial-catalog-standard.php ' ,
        ],
      ]
    ]
  ]
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

xaxalex
Posts: 2
Joined: 23 Apr 2023, 12:58

Re: catalog Id in product/export job

Post by xaxalex » 26 Apr 2023, 10:14

Good afternoon.
My configuration was in ./config/shop.php
I added the example you sent as well in controller.php in its extension.
Anyway, the catalog domain is missing.

it's my controller.php:

Code: Select all

<?php

return [
    'common' => [
    ],
    'frontend' => [
    ],
    'jobs' => [
        'product' => [
            'export' => [
                'location' => 'my_path'/export.zip',
                'domains' => [
                    'catalog', 'attribute', 'media', 'price', 'product', 'text',
                ],
                'partials' => [
                    'catalog' => ''my_path'/packages/champion-theme/templates/controller/jobs/product/export/items-partial-catalog-standard.php',
                ],
            ],
            'import' => [
                'csv' => [
                    'location' => ''my_path'/import-product',
                ],
            ],
        ],
        'catalog' => [
            'import' => [
                'csv' => [
                    'location' => ''my_path'/import-category',
                ],
            ],
        ],
    ],
];

partials of product/export/items-body-standard.php

Code: Select all

	<lists>
		<?php foreach ($item->getDomains() as $domain): ?>
            <?=print('@@@@' . $domain . '!!!!')?>
			<?=$this->partial(
    'product/export/items-partial-' . str_replace('/', '', $domain) . '-standard',
    ['listItems' => $item->getListItems($domain)]
)?>

		<?php endforeach?>

	</lists>
partials of product/export/items-partial-catalog-standard.php

Code: Select all

<catalog>
	<?php foreach ($this->listItems as $listItem): ?>
        <?=print_r('!!! CATALOG !!!')?>

		<?php if ($refItem = $listItem->getRefItem()): ?>
            <?=print_r('!!! DOMAIN !!!')?>

		<?php endif?>
	<?php endforeach?>
</catalog>

I can't figure out what's the problem

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

Re: catalog Id in product/export job

Post by aimeos » 29 Apr 2023, 07:35

Seems to be OK. Keep in mind that configuration in ./config/shop.php overwrites configuration if your own extensions.
First I would check if the list of domains really contains "catalog" here:
https://github.com/aimeos/ai-controller ... d.php#L471
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply