GithubHelp home page GithubHelp logo

aimeos / ai-controller-jobs Goto Github PK

View Code? Open in Web Editor NEW
28.0 28.0 17.0 4.67 MB

Aimeos e-commerce job controllers

Home Page: https://aimeos.org

License: GNU Lesser General Public License v3.0

PHP 100.00%

ai-controller-jobs's Introduction

Aimeos logo

Total Downloads Latest Stable Version License Open issues

⭐ Star us on GitHub — it motivates us a lot! 😀

Aimeos GitHub stats

Aimeos - THE Laravel ecommerce platform

Aimeos is THE ultra-fast, cloud-native and API-first e-commerce platform! You can install it within 5 minutes and can adapt, extend, overwrite and customize anything to your needs.

Aimeos Laravel demo

Features

Aimeos is a full-featured e-commerce package:

  • JSON REST API based on jsonapi.org
  • GraphQL API for administration
  • Perfect fit for AWS, Google, Azure and Kubernetes based clouds
  • Multi vendor, multi channel and multi warehouse
  • From one to 1,000,000,000+ items
  • Extremly fast down to 20ms
  • For multi-tentant e-commerce SaaS solutions with unlimited vendors
  • Bundles, vouchers, virtual, configurable, custom and event products
  • Subscriptions with recurring payments
  • 100+ payment gateways
  • Full RTL support (frontend and backend)
  • Block/tier pricing out of the box
  • Extension for customer/group based prices
  • Discount and voucher support
  • Flexible basket rule system
  • Full-featured admin backend
  • Beautiful admin dashboard
  • Configurable product data sets
  • Completly modular structure
  • Extremely configurable and extensible
  • Extension for market places with millions of vendors
  • Fully SEO optimized including rich snippets
  • Translated to 30+ languages
  • AI-based text translation
  • Optimized for smart phones and tablets
  • Secure and reviewed implementation
  • High quality source code

... and more Aimeos features

Supported languages:

           

Check out the demos:

Headless distribution

To build a single page application (SPA) respectively a progressive web application (PWA), the Aimeos headless distribution is the right choice with API-only and JWT authentication pre-configured:

Aimeos headless distribution

Integrate into existing applications

You already have an existing Laravel application and want to add a shop to your web site? Install the Aimeos composer package for Laravel and add e-commerce to your existing application in minutes:

Aimeos Laravel package

Standalone application

Requirements

The Aimeos shop distribution requires:

  • Linux/Unix, WAMP/XAMP or MacOS environment
  • PHP >= 8.2
  • MySQL >= 5.7.8, MariaDB >= 10.2.2, PostgreSQL 9.6+, SQL Server 2019+
  • Web server (Apache, Nginx or integrated PHP web server for testing)

If required PHP extensions are missing, composer will tell you about the missing dependencies.

If you want to upgrade between major versions, please have a look into the upgrade guide!

Installation

To install the Aimeos shop application, you need composer 2.2+. On the CLI, execute this command for a complete installation including a working setup:

wget https://getcomposer.org/download/latest-stable/composer.phar -O composer
php composer create-project aimeos/aimeos myshop

You will be asked for the parameters of your database and mail server as well as an e-mail and password used for creating the administration account.

In a local environment, you can use the integrated PHP web server to test your new Aimeos installation. Simply execute the following command to start the web server:

cd myshop
php artisan serve

Note: In an hosting environment, the document root of your virtual host must point to the /.../myshop/public/ directory and you have to change the APP_URL setting in your .env file to your domain without port, e.g.:

APP_URL=http://myhostingdomain.com

Frontend

After the installation, you can test the Aimeos shop frontend by calling the URL of your VHost in your browser. If you use the integrated PHP web server, you should browse this URL: http://127.0.0.1:8000

Aimeos frontend

Backend

The Aimeos administration interface will be available at /admin in your VHost. When using the integrated PHP web server, call this URL: http://127.0.0.1:8000/admin

Aimeos admin backend

Customize

Laravel and the Aimeos e-commerce package are extremely flexible and highly customizable. A lot of documentation for the Laravel framework and the Aimeos e-commerce framework exists. If you have questions about Aimeos, don't hesitate to ask in our Aimeos forum.

For more details about Aimeos Laravel integration, please have a look at its repository.

Multi-language

For shops which offers multiple languages, just add this line to your ./myshop/.env file:

SHOP_MULTILOCALE=true

Then, the language will be added to the routes automatically. You can set up the available languages in the "Locale > Locale" panel of the Aimeos admin backend.

Multi-routing

If you want to have all category, product and page URLs as top level URLs like /shoes, /my-sneaker and /about-us, then you can enable the Aimeos multi-routing feature in your ./myshop/.env file:

SHOP_MULTIROUTE=true

Caution: This will affect performance as it requires additional database queries for each request!

Multi-vendor

To enable multi-vendor features, add this settings to the ./myshop/.env file:

SHOP_MULTISHOP=true

If you want to allow vendors to register themselves as sellers, set this option in the ./myshop/.env file too:

SHOP_REGISTRATION=true

By default, newly registered sellers have administrator privileges in the backend for their own site. For a more limited access to the backend, you can change the permission level to "editor" in the ./myshop/.env file:

SHOP_PERMISSION=editor

You can change the permissions associated to "admin" or "editor" by adding your own version of the JQAdm resource configuration to the "admin" section of your ./config/shop.php file.

License

The Aimeos shop system is licensed under the terms of the MIT and LGPLv3 license and is available for free.

Links

ai-controller-jobs's People

Contributors

aimeos avatar alextravin avatar cnoelker avatar mbrather avatar merzilla avatar mterwei avatar nvindice avatar pdanzinger avatar scrutinizer-auto-fixer avatar vertexvaar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ai-controller-jobs's Issues

Sitemap Index with relative URLs and Google

Google, at least through its search console, does not accept relative URLs in the index sitemap as locations for the individual sitemaps.

The specification https://www.sitemaps.org/protocol.html#locdef does require a full URL with protocol for loc of an url entry. For sitemap index it is not exactly defined, but I would guess the same definition applies.

The index files generated through aimeos only include the basename of the file.

Invalid name "0" - Order Email Delivery Job

Hi Guys,

I'm not sure at this point if this is a bug or just a missing config

Environment

  1. Version: 2022.04.3
  2. Operating system: Ubuntu 20.04.4, PHP: 8.1.6

Describe the bug
Emails are not sent when running aimeos:job order/email/delivery on a standard aimeos/aimeos installation

php artisan aimeos:job order/email/delivery
Invalid name "0"
#0 /var/www/aimeos/vendor/aimeos/aimeos-base/src/Criteria/Expression/Combine/SQL.php(71): Aimeos\Base\Criteria\Expression\Compare\Base->toSource()
aimeos/aimeos-laravel#1 /var/www/aimeos/vendor/aimeos/aimeos-base/src/Criteria/Expression/Combine/SQL.php(71): Aimeos\Base\Criteria\Expression\Combine\SQL->toSource()
aimeos/aimeos-laravel#2 /var/www/aimeos/vendor/aimeos/aimeos-base/src/Criteria/Expression/Combine/SQL.php(85): Aimeos\Base\Criteria\Expression\Combine\SQL->toSource()
aimeos/aimeos-laravel#3 /var/www/aimeos/vendor/aimeos/aimeos-base/src/Criteria/SQL.php(129): Aimeos\Base\Criteria\Expression\Combine\SQL->toSource()
aimeos/aimeos-laravel#4 /var/www/aimeos/vendor/aimeos/aimeos-core/src/MShop/Common/Manager/Base.php(777): Aimeos\Base\Criteria\SQL->getConditionSource()
aimeos/aimeos-laravel#5 /var/www/aimeos/vendor/aimeos/aimeos-core/src/MShop/Common/Manager/Base.php(839): Aimeos\MShop\Common\Manager\Base->getSQLReplacements()
aimeos/aimeos-laravel#6 /var/www/aimeos/vendor/aimeos/aimeos-core/src/MShop/Order/Manager/Standard.php(795): Aimeos\MShop\Common\Manager\Base->searchItemsBase()
aimeos/aimeos-laravel#7 /var/www/aimeos/vendor/aimeos/aimeos-core/src/MShop/Common/Manager/Decorator/Depth.php(59): Aimeos\MShop\Order\Manager\Standard->search()
aimeos/aimeos-laravel#8 /var/www/aimeos/vendor/aimeos/aimeos-core/src/MShop/Common/Manager/Decorator/Lazy.php(36): Aimeos\MShop\Common\Manager\Decorator\Depth->search()
aimeos/aimeos-laravel#9 /var/www/aimeos/vendor/aimeos/map/src/Map.php(4309): Aimeos\MShop\Common\Manager\Decorator\Lazy->Aimeos\MShop\Common\Manager\Decorator\{closure}()
aimeos/aimeos-laravel#10 /var/www/aimeos/vendor/aimeos/map/src/Map.php(4372): Aimeos\Map->array()
aimeos/aimeos-laravel#11 /var/www/aimeos/vendor/aimeos/map/src/Map.php(120): Aimeos\Map->list()
aimeos/aimeos-laravel#12 /var/www/aimeos/vendor/aimeos/ai-controller-jobs/src/Controller/Jobs/Order/Email/Delivery/Standard.php(202): Aimeos\Map->__call()
aimeos/aimeos-laravel#13 /var/www/aimeos/vendor/aimeos/ai-controller-jobs/src/Controller/Jobs/Order/Email/Delivery/Standard.php(127): Aimeos\Controller\Jobs\Order\Email\Delivery\Standard->notify()
aimeos/aimeos-laravel#14 /var/www/aimeos/vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Command/JobsCommand.php(54): Aimeos\Controller\Jobs\Order\Email\Delivery\Standard->run()
aimeos/aimeos-laravel#15 [internal function]: Aimeos\Shop\Command\JobsCommand->Aimeos\Shop\Command\{closure}()
aimeos/aimeos-laravel#16 /var/www/aimeos/vendor/aimeos/aimeos-base/src/Process/Pcntl.php(181): call_user_func_array()
aimeos/aimeos-laravel#17 /var/www/aimeos/vendor/aimeos/aimeos-base/src/Process/Pcntl.php(116): Aimeos\Base\Process\Pcntl->exec()
aimeos/aimeos-laravel#18 /var/www/aimeos/vendor/aimeos/aimeos-base/src/Process/Decorator/Check.php(61): Aimeos\Base\Process\Pcntl->start()
aimeos/aimeos-laravel#19 /var/www/aimeos/vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Command/JobsCommand.php(63): Aimeos\Base\Process\Decorator\Check->start()
aimeos/aimeos-laravel#20 [internal function]: Aimeos\Shop\Command\JobsCommand->Aimeos\Shop\Command\{closure}()
aimeos/aimeos-laravel#21 /var/www/aimeos/vendor/aimeos/aimeos-base/src/Process/Pcntl.php(181): call_user_func_array()
aimeos/aimeos-laravel#22 /var/www/aimeos/vendor/aimeos/aimeos-base/src/Process/Pcntl.php(116): Aimeos\Base\Process\Pcntl->exec()
aimeos/aimeos-laravel#23 /var/www/aimeos/vendor/aimeos/aimeos-base/src/Process/Decorator/Check.php(61): Aimeos\Base\Process\Pcntl->start()
aimeos/aimeos-laravel#24 /var/www/aimeos/vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Command/AbstractCommand.php(67): Aimeos\Base\Process\Decorator\Check->start()
aimeos/aimeos-laravel#25 /var/www/aimeos/vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Command/JobsCommand.php(69): Aimeos\Shop\Command\AbstractCommand->exec()
aimeos/aimeos-laravel#26 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Aimeos\Shop\Command\JobsCommand->handle()
aimeos/aimeos-laravel#27 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
aimeos/aimeos-laravel#28 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
aimeos/aimeos-laravel#29 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
aimeos/aimeos-laravel#30 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\Container\BoundMethod::call()
aimeos/aimeos-laravel#31 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call()
aimeos/aimeos-laravel#32 /var/www/aimeos/vendor/symfony/console/Command/Command.php(291): Illuminate\Console\Command->execute()
aimeos/aimeos-laravel#33 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()
aimeos/aimeos-laravel#34 /var/www/aimeos/vendor/symfony/console/Application.php(989): Illuminate\Console\Command->run()
aimeos/aimeos-laravel#35 /var/www/aimeos/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()
aimeos/aimeos-laravel#36 /var/www/aimeos/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
aimeos/aimeos-laravel#37 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Console/Application.php(102): Symfony\Component\Console\Application->run()
aimeos/aimeos-laravel#38 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()
aimeos/aimeos-laravel#39 /var/www/aimeos/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
aimeos/aimeos-laravel#40 {main}Process (PID "18964") failed with status "256"

To Reproduce
Create an order in a standard aimeos/aimeos installation and then run php artisan aimeos:job order/email/delivery

Expected behavior
Order delivery emails sent

Additional context
.ENV content
SHOP_MULTILOCALE=true SHOP_MULTISHOP=false SHOP_REGISTRATION=false SHOP_PERMISSION=

Content of $types array when this is failing
Aimeos\Base\Criteria\Expression\Compare\Base::toSource

$types = [
  "locale.language.id" => 4
  "locale.language.label" => 4
  "locale.language.code" => 4
  "locale.language.status" => 2
  "locale.language.ctime" => 4
  "locale.language.mtime" => 4
  "locale.language.editor" => 4
  1 => 2
]

mshop_order table content

id siteid baseid relatedid channel datepayment datedelivery statuspayment statusdelivery cdate cmonth cweek cwday chour mtime ctime editor
9 1. 9 2022-05-24 11:14:32 5 1 2022-05-24 2022-05 2022-21 2 11 2022-05-24 11:15:00 2022-05-24 11:14:32 aimeos:jobs

mshop_order_status table content

id siteid parentid type value mtime ctime editor
29 1. 9 stock-update 1 2022-05-24 11:14:32 2022-05-24 11:14:32 LS
30 1. 9 coupon-update 1 2022-05-24 11:14:32 2022-05-24 11:14:32 LS
31 1. 9 status-payment 5 2022-05-24 11:14:32 2022-05-24 11:14:32 LS
32 1. 9 status-delivery 1 2022-05-24 11:15:00 2022-05-24 11:15:00 aimeos:jobs

Typo in config key in sitemap export

In Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard the configuration for the domains is queried with the key domains, but in the switch statement to resolve this to controller/jobs/product/export/sitemap/domains the case domain is checked.


Mimetype previews not added in CSV import

When uploading a non-image media file via the admin interface, the media file gets a preview URL according to the mime type.

However, when importing products via CSV import, this does not work. The process function calls the update function which creates previews via the Media contoller's scale function:

} elseif( $fs->has( $url ) && ( $refItem->getPreviews() === [] || $refItem->getUrl() !== $url ) ) {
$refItem = \Aimeos\Controller\Common\Media\Factory::create( $context )->scale( $refItem->setUrl( $url ) );
}

The scale function can only handle Images.

Solution 1 (ugly): checking the media type in the Media here:
https://github.com/aimeos/aimeos-core/blob/f3fa1ec4b293ef2052f07fcdb082f0b6d947366d/controller/common/src/Controller/Common/Media/Standard.php#L199-L201
...and set the $item preview to a mime type thumb

Solution 2: checking the media type in the CSV import processor (good) and either scale or add a mime type thumb - this would require to make this function public:
https://github.com/aimeos/aimeos-core/blob/f3fa1ec4b293ef2052f07fcdb082f0b6d947366d/controller/common/src/Controller/Common/Media/Standard.php#L532

What do you think?

Order update emails sending multiple times per update

I am currently testing with the ai-sites paid extension where I have multiple vendors but customers checkout on the main parent site.
I have noticed each order update causes multiple emails to be sent. In my testing, the new order email is sent twice to the vendor email address, and each order status update (payment received, order in progress etc) causes 4 identical emails to be sent to the customer for each update.

CSV product import image previews

Currently when importing products via the CSV job without specifying image previews, no previews are generated. Looking at

} elseif( $fs->has( $url ) && ( $refItem->getPreviews() === [] || $refItem->getUrl() !== $url ) ) {
it seems that thumbs should be generated - however, this never happens, because the $force parameter in the scale() function call is not true.

Is this desired behaviour or is the $force parameter missing here?

Linking "selection" products to the gallery

Hello Aimeos!

I imported "selection" type products.

For example, a product has 3 subproducts in 3 different colors. Each subproduct has an image (blue, red and green).

Can I connect the interface so that when I select the color blue from the drop-down list, the gallery jumps to the photo of the blue product?
If the system doesn't know this, what's the easiest way to do it?

Merge images for "selection" products

Hello Aimeos!
I imported "selection" type products.

For example:

  • Main selection product (blue.jpg because of the article list)

    • Subproduct1 (Blue, size1, blue.jpg)
    • Subproduct2 (Blue, size2, blue.jpg)
    • Subproduct3 (Blue, size3, blue.jpg)
    • Subproduct4 (Red, size1, red.jpg)
    • Subproduct5 (Red, size2, red.jpg)
    • Subproduct6 (Red, size3, red.jpg)
    • Subproduct7 (Green, size1, green.jpg)
    • Subproduct8 (Green, size2, green.jpg)
    • Subproduct9 (Green, size3, green.jpg)

In this case, when I open the main selection product, I will see 10 images (4x blue.jpg, 3x red.jpg and 3x green.jpg).

What is the best way to see each image only once (1x blue.jpg, 1x red.jpg and 1x green.jpg)?

Addendum to Slicing issue in sitemap export

Hi thank you for fixing the issue with the export file generation in the sitemaps.
The algorithm you changed to query the items and add them to the export files is used in other export controllers too. I did not test it but I would expect, if you set 'controller/jobs/product/export/max-items' to 5 in https://github.com/aimeos/ai-controller-jobs/blob/master/controller/jobs/tests/Controller/Jobs/Product/Export/StandardTest.php#L53, as is the case in https://github.com/aimeos/ai-controller-jobs/blob/master/controller/jobs/tests/Controller/Jobs/Product/Export/Sitemap/StandardTest.php#L52, the same empty file would be generated. I suspect all export jobs use the same algorithm and need to be updated.

CSV import cannot import attributes

CSV Import cannot import attribute columns

With this mapping, none of the products will be imported:

. . .
'price' => [
11 => 'price.currencyid',
12 => 'price.quantity',
13 => 'price.value',
14 => 'price.taxrate',
],
'attribute' => [
15 => 'attribute.code',
16 => 'attribute.type',
17 => 'attribute.code',
18 => 'attribute.type',
],
'property' => [
19 => 'product.property.value',
20 => 'product.property.type',
21 => 'product.property.value',
22 => 'product.property.type',
23 => 'product.property.value',
24 => 'product.property.type',
],
. . .

This error message appears in the log for all products:
Unable to import product: Invalid type "Size" (attribute)
Unable to import product: Invalid type "Type" (attribute)

With this mapping, all products are imported without error:

. . .
'price' => [
11 => 'price.currencyid',
12 => 'price.quantity',
13 => 'price.value',
14 => 'price.taxrate',
],
'property' => [
15 => 'product.property.value',
16 => 'product.property.type',
17 => 'product.property.value',
18 => 'product.property.type',
19 => 'product.property.value',
20 => 'product.property.type',
21 => 'product.property.value',
22 => 'product.property.type',
23 => 'product.property.value',
24 => 'product.property.type',

]
. . .

But in this case, columns 15-18 will be properties.

Where's my fault?

15-18 colums data example:

Column15: '48'
Column16: 'Size'
Column17: 'MTB'
Column18: 'Type'

Import command:

php artisan aimeos:jobs product/import/csv default

When I import products, the images are not imported

Hello Aimeos!

When I import products, the images are not imported.
I've tried everything but it doesn't want to work.

Mapping:
'media' => [
8 => 'media.url',
9 => 'media.type',
],

CSV:
mediaurl column example: 'images/image1.jpg'
mediatype column example: 'default'
csvtable

I attached a photo from the mshop_media table.
images

Please help

Trying to import "selection" type products, but it doesn't work

Hello Aimeos!
I'm trying to import "selection" type products, but it doesn't work for me at all.

Mapping:

'item' => array(
0 => 'product.code',
1 => 'product.label',
2 => 'product.type',
3 => 'product.status',
),
...
...
'product' => array(
15 => 'product.code',
),

CSV:
subproderror

For the "selection" product, the "subproductcode" column contains the following content:
YRBQ1I43CM
YRBQ1I48CM
YRBQ1I53CM

Can you help me?

Slicing issue in sitemaps

While testing I did find some oddities with the logic which creates multiple files based on 'max-items' and 'max-query' in \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard.php::export(). The test exports 8 items with 5 in the first sitemap file, 3 in the second, as expected, but also another third empty sitemap file.
When you change 'max-items' to 6, the first file still only contains 5 items.
My class is based on this so the behaviour is the same.

The last empty file is probably due to creating a content item if there are no results any more:
https://github.com/aimeos/ai-controller-jobs/pull/12/files#diff-6e026c9e50bd1a0a33f93cc4651ef1dfR362

If 'max-items' is 6, the first file should contain 6 items and the second 2 (maybe with an empty third file too). Maybe this was still the content of the old file or the configuration is still cached somewhere?

Regarding the urls per file and number of files. Adding to the already discussed problems controller/jobs/product/export/sitemap/max-items can never be smaller then controller/jobs/product/export/sitemap/max-query as only after all queried items are written at once through addItems() a check is executed an possibly a new file is created.

That's usually not a problem so we can keep it as is.

Duplicate entry for key 'unq_msproli_pid_dm_ty_rid_sid' INTO "mshop_product_list"

Hello.
I get an error when I try to run a command through the console. I'm not sure, but before the last update, this error did not occur. Maybe I'm wrong and something else caused this error.

"aimeos/aimeos-laravel": "~2022.07"
"php": "^8.0.10"
"laravel/framework": "^9.2"
Ubuntu 18.04.6 LTS
php artisan aimeos:jobs "product/bought"
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-product-default-6-1.' for key 'unq_msproli_pid_dm_ty_rid_sid': 
                                        INSERT INTO "mshop_product_list" ( 
                                                "parentid", "key", "type", "domain", "refid", "start", "end",
                                                "config", "pos", "status", "mtime", "editor", "siteid", "ctime"
                                        ) VALUES ( 
                                                ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
                                        )
                                ["1","product|default|6","default","product","6",null,null,"[]",0,1,"2022-10-24 14:25:29","aimeos:jobs","1.","2022-10-24 14:25:29"]
#0 /var/www/shop/shop/vendor/aimeos/aimeos-core/src/MShop/Common/Manager/Lists/Base.php(237): Aimeos\Base\DB\Statement\DBAL\Prepared->execute()
#1 /var/www/shop/shop/vendor/aimeos/aimeos-core/src/MShop/Common/Manager/Base.php(154): Aimeos\MShop\Common\Manager\Lists\Base->saveItem()
#2 /var/www/shop/shop/vendor/aimeos/aimeos-core/src/MShop/Common/Manager/Decorator/Base.php(224): Aimeos\MShop\Common\Manager\Base->save()
#3 /var/www/shop/shop/vendor/aimeos/aimeos-core/src/MShop/Common/Manager/Decorator/Base.php(224): Aimeos\MShop\Common\Manager\Decorator\Base->save()
#4 /var/www/shop/shop/vendor/aimeos/aimeos-core/src/MShop/Common/Manager/ListsRef/Traits.php(300): Aimeos\MShop\Common\Manager\Decorator\Base->save()
#5 /var/www/shop/shop/vendor/aimeos/aimeos-core/src/MShop/Product/Manager/Standard.php(880): Aimeos\MShop\Product\Manager\Standard->saveListItems()
#6 /var/www/shop/shop/vendor/aimeos/aimeos-core/src/MShop/Common/Manager/Base.php(149): Aimeos\MShop\Product\Manager\Standard->saveItem()
#7 /var/www/shop/shop/vendor/aimeos/aimeos-core/src/MShop/Common/Manager/Decorator/Base.php(224): Aimeos\MShop\Common\Manager\Base->save()
#8 /var/www/shop/shop/vendor/aimeos/aimeos-core/src/MShop/Common/Manager/Decorator/Base.php(224): Aimeos\MShop\Common\Manager\Decorator\Base->save()
#9 /var/www/shop/shop/vendor/aimeos/ai-controller-jobs/src/Controller/Jobs/Product/Bought/Standard.php(317): Aimeos\MShop\Common\Manager\Decorator\Base->save()
#10 /var/www/shop/shop/vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Command/JobsCommand.php(54): Aimeos\Controller\Jobs\Product\Bought\Standard->run()
#11 [internal function]: Aimeos\Shop\Command\JobsCommand->Aimeos\Shop\Command\{closure}()
#12 /var/www/shop/shop/vendor/aimeos/aimeos-base/src/Process/Pcntl.php(181): call_user_func_array()
#13 /var/www/shop/shop/vendor/aimeos/aimeos-base/src/Process/Pcntl.php(116): Aimeos\Base\Process\Pcntl->exec()
#14 /var/www/shop/shop/vendor/aimeos/aimeos-base/src/Process/Decorator/Check.php(61): Aimeos\Base\Process\Pcntl->start()
#15 /var/www/shop/shop/vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Command/JobsCommand.php(63): Aimeos\Base\Process\Decorator\Check->start()
#16 [internal function]: Aimeos\Shop\Command\JobsCommand->Aimeos\Shop\Command\{closure}()
#17 /var/www/shop/shop/vendor/aimeos/aimeos-base/src/Process/Pcntl.php(181): call_user_func_array()
#18 /var/www/shop/shop/vendor/aimeos/aimeos-base/src/Process/Pcntl.php(116): Aimeos\Base\Process\Pcntl->exec()
#19 /var/www/shop/shop/vendor/aimeos/aimeos-base/src/Process/Decorator/Check.php(61): Aimeos\Base\Process\Pcntl->start()
#20 /var/www/shop/shop/vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Command/AbstractCommand.php(67): Aimeos\Base\Process\Decorator\Check->start()
#21 /var/www/shop/shop/vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Command/JobsCommand.php(69): Aimeos\Shop\Command\AbstractCommand->exec()
#22 /var/www/shop/shop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Aimeos\Shop\Command\JobsCommand->handle()
#23 /var/www/shop/shop/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#24 /var/www/shop/shop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#25 /var/www/shop/shop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#26 /var/www/shop/shop/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\Container\BoundMethod::call()
#27 /var/www/shop/shop/vendor/laravel/framework/src/Illuminate/Console/Command.php(144): Illuminate\Container\Container->call()
#28 /var/www/shop/shop/vendor/symfony/console/Command/Command.php(291): Illuminate\Console\Command->execute()
#29 /var/www/shop/shop/vendor/laravel/framework/src/Illuminate/Console/Command.php(126): Symfony\Component\Console\Command\Command->run()
#30 /var/www/shop/shop/vendor/symfony/console/Application.php(1002): Illuminate\Console\Command->run()
#31 /var/www/shop/shop/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()
#32 /var/www/shop/shop/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#33 /var/www/shop/shop/vendor/laravel/framework/src/Illuminate/Console/Application.php(102): Symfony\Component\Console\Application->run()
#34 /var/www/shop/shop/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(155): Illuminate\Console\Application->run()
#35 /var/www/shop/shop/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#36 {main}Process (PID "31026") failed with status "256"

Stock csv import more stock type bug

Hello!

There is a bug in this file if you have several stocks and run import several times.

namespace Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock;
class Standard

Here is the problem:
if( ( $item = $items->pop() ) === null ) {

The pop() sometimes one, sometimes the other.

This is my improved code:

try
		{
			$stock = 0;
			$map = $this->getMappedChunk( $data, $this->getMapping() );

            **// delete this line
            //$items = $manager->search( $manager->filter()->add( ['stock.productid' => $product->getId()] ) );**

			foreach( $map as $pos => $list )
			{
				if( !array_key_exists( 'stock.stocklevel', $list ) ) {
					continue;
				}

				$list['stock.productid'] = $product->getId();
				$list['stock.type'] = $this->val( $list, 'stock.type', 'default' );

				$this->addType( 'stock/type', 'product', $list['stock.type'] );

                **// add this line, filter for stock.type too
                $items = $manager->search( $manager->filter()->add( [
                    'stock.productid' => $product->getId(),
                    'stock.type' => $list['stock.type']
                ] ) );**

                if( ( $item = $items->pop() ) === null ) {
					$item = $manager->create();
				}

				$manager->save( $item->fromArray( $list ), false );

Best regards

TGergo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.