Programaticaly import products no csv
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!
Programaticaly import products no csv
Hello, I;m new to aimeos.
Is there a class that will help mass add products? i got product list from json api.
In documentation i found that i should probably use theese:
https://aimeos.org/docs/2022.x/models/managing-items/
but I can't get what to send as $context inside laravel
I use laravel 9.38 (latest), php 8.1, aimeos 2022.x (latest) on VPS/linux debian 11 on apache 2.4
I try to implement aimeos product import inside laravel nova action.
Can someone show a laravel code example for creating one empty item?
below some code example for easier anwser:
Is there a class that will help mass add products? i got product list from json api.
In documentation i found that i should probably use theese:
https://aimeos.org/docs/2022.x/models/managing-items/
Code: Select all
$manager = \Aimeos\MShop::create( $context, 'product' );
$item = $manager->create(/* pass some data from my json api here */);
I use laravel 9.38 (latest), php 8.1, aimeos 2022.x (latest) on VPS/linux debian 11 on apache 2.4
I try to implement aimeos product import inside laravel nova action.
Can someone show a laravel code example for creating one empty item?
below some code example for easier anwser:
Code: Select all
<?php
namespace App\Nova\Actions\Aimeos;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Collection;
use Laravel\Nova\Actions\Action;
use Laravel\Nova\Fields\ActionFields;
use Laravel\Nova\Http\Requests\NovaRequest;
class ImportProduct extends Action
{
use InteractsWithQueue, Queueable;
/**
* Perform the action on the given models.
*
* @param \Laravel\Nova\Fields\ActionFields $fields
* @param \Illuminate\Support\Collection $models
* @return mixed
*/
public function handle(ActionFields $fields, Collection $models)
{
$manager = \Aimeos\MShop::create( $context, 'product' ); //Call to product manager; But what to send as $context?
$item = $manager->create(); // create empty item
/* this code returns a error: Unidentified variable $context */
}
}
Re: Programaticaly import products no csv
any support in this case will be appreciated
Re: Programaticaly import products no csv
Use this to get the Aimeos context and create a new item:
Documentation: https://aimeos.org/docs/latest/laravel/ ... os-objects
Code: Select all
$context = app('aimeos.context')->get();
$manager = \Aimeos\MShop::create( $context, 'product' );
$item = $manager->create()->setCode( 'test' );
$manager->save( $item );
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