Mapping different products
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Mapping different products
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?
Re: Mapping different products
Can you explain that in more detail please?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Mapping different products
I have the following categories in my shop:
1.Wheels
2.Modeling
3.Clothes
4Electronics
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?
1.Wheels
2.Modeling
3.Clothes
4Electronics
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?
Re: Mapping different products
You can copy and extend from the existing factory (https://github.com/aimeos/ai-controller ... actory.php), 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:
Then, you can execute the importer for each category with the required mapping:
Code: Select all
public 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 );
}
Code: Select all
artisan aimeos:jobs product/import/csv/clothes
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Mapping different products
I'm getting this error:
Are you sure it's:
?
Code: Select all
[Symfony\Component\Debug\Exception\FatalThrowableError] Call to undefined method Aimeos\Controller\Jobs\Common\Factory\Base::createController()
Code: Select all
return parent::createController( $context, $aimeos, $name );
Re: Mapping different products
You may have forgotten to extend from the existing class like this:
Code: Select all
class Factory
extends \Aimeos\Controller\Jobs\Product\Import\Csv\Factory
implements \Aimeos\Controller\Jobs\Common\Factory\Iface
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Mapping different products
I can now execute
(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:
What should I do from here?
Code: Select all
php artisan aimeos:jobs "product/import/csv/pneumatici"
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
Re: Mapping different products
The full code for the file "controller/jobs/src/Controller/Jobs/Product/Import/Csv/Clothes/Standard.php" in you own Aimeos extension is:
Then you can execute:
Code: Select all
namespace 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 );
}
}
Code: Select all
php artisan aimeos:jobs "product/import/csv/clothes"
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 42
- Joined: 14 Sep 2017, 09:59
Re: Mapping different products
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"