Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#4634 by Bevi
25 Sep 2017, 21:33
Hi, how am I supposed to make a different mapping for each category? Is it even possible, or will I have to make a new shop for every kind of product?
#4639 by Bevi
26 Sep 2017, 14:39
I have the following categories in my shop:


each of them needs a different mapping in order to import their own csv, but, as far as I know, I could only make 1 type of mapping in the shop.php.
What should I do?
#4641 by aimeos
26 Sep 2017, 15:32
You can copy and extend from the existing factory (, e.g. to a sub-directory controller/jobs/src/Controller/Jobs/Product/Import/Csv/Clothes/Factory.php in your own Aimeos extension. In the createController() method of your new factory add this:

Code: Select allpublic static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null )
   $mapping = [
      // ...
   $context->getConfig()->set( 'controller/jobs/product/import/csv/mapping', $mapping );
   return parent::createController( $context, $aimeos, $name );

Then, you can execute the importer for each category with the required mapping:
Code: Select allartisan aimeos:jobs product/import/csv/clothes
#4642 by Bevi
26 Sep 2017, 21:39
I'm getting this error:

Code: Select all[Symfony\Component\Debug\Exception\FatalThrowableError] Call to undefined method Aimeos\Controller\Jobs\Common\Factory\Base::createController()

Are you sure it's:
Code: Select all  return parent::createController( $context, $aimeos, $name );
#4643 by aimeos
26 Sep 2017, 22:00
You may have forgotten to extend from the existing class like this:
Code: Select allclass Factory
   extends \Aimeos\Controller\Jobs\Product\Import\Csv\Factory
   implements \Aimeos\Controller\Jobs\Common\Factory\Iface
#4648 by Bevi
27 Sep 2017, 16:03
I can now execute
Code: Select allphp artisan aimeos:jobs "product/import/csv/pneumatici"

(please note "pneumatici" is my product name), but I'm still reading from the mapping array in shop.php

So i tried to put 'name' => 'Pneumatici', in the shop.php (not sure if it's the right thing to do) and now I'm getting this error:
Code: Select all[Aimeos\Controller\Jobs\Exception]
  Class "\Aimeos\Controller\Jobs\Product\Import\Csv\Pneumatici" not available

What should I do from here?
#4650 by aimeos
28 Sep 2017, 08:02
The full code for the file "controller/jobs/src/Controller/Jobs/Product/Import/Csv/Clothes/Standard.php" in you own Aimeos extension is:
Code: Select allnamespace Aimeos\Controller\Jobs\Product\Import\Csv\Clothes;

class Factory
   extends \Aimeos\Controller\Jobs\Product\Import\Csv\Factory
   implements \Aimeos\Controller\Jobs\Common\Factory\Iface
    public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null )
        $mapping = [
            // mapping for clothes
        $context->getConfig()->set( 'controller/jobs/product/import/csv/mapping', $mapping );
        return parent::createController( $context, $aimeos, $name );

Then you can execute:
Code: Select allphp artisan aimeos:jobs "product/import/csv/clothes"
#4965 by antonlinderer
14 Nov 2017, 09:02
Just a small correction... the mentioned code is for file "controller/jobs/src/Controller/Jobs/Product/Import/Csv/Clothes/Factory.php" and thel code for the file "controller/jobs/src/Controller/Jobs/Product/Import/Csv/Clothes/Standard.php" remains the same as in the file "controller/jobs/src/Controller/Jobs/Product/Import/Csv/Standard.php"