aimeos / ai-client-html

Aimeos e-commerce HTML client components
https://aimeos.org
GNU Lesser General Public License v3.0
142 stars 58 forks source link

Unable to find product "1w" #181

Closed liviusirbulescu closed 2 years ago

liviusirbulescu commented 2 years ago

Hi Guys,

Getting this in the logs when uploading a PDF

Environment Version: 2022.04 Operating system: Ubuntu 20.04.4, PHP: 8.1.6

Describe the bug Downloads section image

Unable to find product "1w"
#0 /home/forge/aimeos/vendor/aimeos/ai-client-html/src/Client/Html/Catalog/Detail/Standard.php(268): Aimeos\Controller\Frontend\Product\Standard->resolve()
#1 /home/forge/aimeos/vendor/aimeos/ai-client-html/src/Client/Html/Common/Decorator/Base.php(67): Aimeos\Client\Html\Catalog\Detail\Standard->data()
#2 /home/forge/aimeos/vendor/aimeos/ai-client-html/src/Client/Html/Common/Decorator/Context.php(48): Aimeos\Client\Html\Common\Decorator\Base->data()
#3 /home/forge/aimeos/vendor/aimeos/ai-client-html/src/Client/Html/Catalog/Detail/Standard.php(152): Aimeos\Client\Html\Common\Decorator\Context->data()
#4 /home/forge/aimeos/vendor/aimeos/ai-client-html/src/Client/Html/Common/Decorator/Exceptions.php(73): Aimeos\Client\Html\Catalog\Detail\Standard->header()
#5 /home/forge/aimeos/vendor/aimeos/ai-client-html/src/Client/Html/Common/Decorator/Base.php(92): Aimeos\Client\Html\Common\Decorator\Exceptions->header()
#6 /home/forge/aimeos/vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Controller/CatalogController.php(59): Aimeos\Client\Html\Common\Decorator\Base->header()
#7 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): Aimeos\Shop\Controller\CatalogController->detailAction()
#8 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction()
#9 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Routing/Route.php(261): Illuminate\Routing\ControllerDispatcher->dispatch()
#10 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Routing/Route.php(204): Illuminate\Routing\Route->runController()
#11 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Routing/Router.php(725): Illuminate\Routing\Route->run()
#12 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Routing\Router->Illuminate\Routing\closure()
#13 /home/forge/aimeos/app/Http/Middleware/EnsureEmailIsVerified.php(36): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#14 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\Http\Middleware\EnsureEmailIsVerified->handle()
#15 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#16 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Routing\Middleware\SubstituteBindings->handle()
#17 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#18 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Auth\Middleware\Authenticate->handle()
#19 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#20 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle()
#21 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#22 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\View\Middleware\ShareErrorsFromSession->handle()
#23 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#24 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest()
#25 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Session\Middleware\StartSession->handle()
#26 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#27 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()
#28 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#29 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Cookie\Middleware\EncryptCookies->handle()
#30 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#31 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Routing/Router.php(726): Illuminate\Pipeline\Pipeline->then()
#32 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Routing/Router.php(703): Illuminate\Routing\Router->runRouteWithinStack()
#33 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Routing/Router.php(667): Illuminate\Routing\Router->runRoute()
#34 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Routing/Router.php(656): Illuminate\Routing\Router->dispatchToRoute()
#35 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(167): Illuminate\Routing\Router->dispatch()
#36 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\closure()
#37 /home/forge/aimeos/app/Http/Middleware/SetLocale.php(26): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#38 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\Http\Middleware\SetLocale->handle()
#39 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#40 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#41 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()
#42 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#43 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#44 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\TrimStrings->handle()
#45 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#46 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()
#47 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#48 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()
#49 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#50 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Http\Middleware\HandleCors->handle()
#51 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#52 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Http\Middleware\TrustProxies->handle()
#53 /home/forge/aimeos/app/Http/Middleware/TrustHosts.php(24): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#54 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\Http\Middleware\TrustHosts->handle()
#55 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\closure()
#56 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(142): Illuminate\Pipeline\Pipeline->then()
#57 /home/forge/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#58 /home/forge/aimeos/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle()
#59 main
aimeos commented 2 years ago

Works pretty well in our test setup. How does the URL of the link looks like?

liviusirbulescu commented 2 years ago

URL of the uploaded PDF is ok, it's the icon src for the mime type that's causing the issue, see below snippet.

image

aimeos commented 2 years ago

What's the non-modified HTML source code (before the JS code updates src and srcset)?

liviusirbulescu commented 2 years ago

/var/www/aimeos/vendor/aimeos/ai-client-html/templates/client/html/catalog/detail/body.php

<div class="tab-pane fade" id="nav-characteristics" role="tabpanel" aria-labelledby="nav-characteristics-tab">
 <?php if( !( $mediaItems = $this->detailProductItem->getRefItems( 'media', 'download' ) )->isEmpty() ) : ?>
 <ul class="block downloads">
    <?php foreach( $mediaItems as $id => $mediaItem ) : ?>
        <li class="item">
        <a href="<?= $this->content( $mediaItem->getUrl(), $mediaItem->getFileSystem() ) ?>"
            title="<?= $enc->attr( $mediaItem->getProperties( 'title' )->first( $mediaItem->getLabel() ) ) ?>">
            <img class="media-image"
                alt="<?= $enc->attr( $mediaItem->getProperties( 'title' )->first( $mediaItem->getLabel() ) ) ?>"
                src="<?= $enc->attr( $this->content( $mediaItem->getPreview(), $mediaItem->getFileSystem() ) ) ?>"
                srcset="<?= $enc->attr( $this->imageset( $mediaItem->getPreviews(), $mediaItem->getFileSystem() ) ) ?>"
            >
            <span class="media-name"><?= $enc->html( $mediaItem->getProperties( 'title' )->first( $mediaItem->getLabel() ) ) ?></span>
        </a>
    </li>
    <?php endforeach ?>
    </ul>
<?php endif ?>
</div>
aimeos commented 2 years ago

We need the generated source code as sent to the browser, not the PHP template

liviusirbulescu commented 2 years ago

Sorry for the confusion, please see content of $mediaItems

^ Aimeos\Map {#1747 ▼
  #list: array:1 [▼
    159 => Aimeos\MShop\Media\Item\Standard {#1906 ▼
      -available: true
      -modified: false
      -prefix: "media."
      #bdata: array:16 [▼
        "cgroups" => 0
        "media.id" => 159
        "media.siteid" => "1."
        "media.languageid" => null
        "media.type" => "download"
        "media.url" => "1.d/files/a/b/ab7c43c8_Order-12.pdf"
        "media.label" => "Order-12.pdf"
        "media.status" => 1
        "media.mimetype" => "application/pdf"
        "media.domain" => "product"
        "media.previews" => array:1 [▼
          1 => ""
        ]
        "media.filesystem" => "fs-media"
        "media.mtime" => "2022-05-31 17:31:14"
        "media.ctime" => "2022-05-31 17:31:14"
        "media.editor" => "liviu"
        ".languageid" => "en"
      ]
      -langid: "en"
      -listItems: []
      -listRefItems: []
      -listRmItems: []
      -listPrepared: true
      -listRmMap: []
      -listMap: []
      -listMax: 0
      -propItems: []
      -propRmItems: []
      -propMax: 0
    }
  ]
  #sep: "/"
}

This works fine for images, however for pdf's, $mediaItem->getPreview() returns an empty string. I might be wrong but shouldn't this return a mimeicon ?

aimeos commented 2 years ago

Yes and it's a mime icon in our test setups. How does you ./config/shop.php looks like?

liviusirbulescu commented 2 years ago

Thanks for your reply, please see below

<?php

$routes = [];
$prefix = config('app.shop_multilocale') ? '{locale}/' : '';

// if (config('app.shop_multishop') || config('app.shop_registration')) {
//  $routes = ['routes' => [
//      'admin' => ['prefix' => 'admin', 'middleware' => ['web', 'auth', 'verified']],
//      'jqadm' => ['prefix' => 'admin/{site}/jqadm', 'middleware' => ['web', 'auth', 'verified']],
//      'jsonadm' => ['prefix' => 'admin/{site}/jsonadm', 'middleware' => ['web', 'auth', 'verified']],
//      'jsonapi' => ['prefix' => 'jsonapi/{site}', 'middleware' => ['web', 'api']],
//      'account' => ['prefix' => $prefix . 'profile/{site}', 'middleware' => ['web', 'auth', 'verified']],
//      'default' => ['prefix' => $prefix . 'shop/{site}', 'middleware' => ['web', 'auth', 'verified']],
//      'supplier' => ['prefix' => $prefix . 's/{site}', 'middleware' => ['web', 'auth', 'verified']],
//      'home' => ['prefix' => '{site}', 'middleware' => ['web', 'auth', 'verified']],
//      'page' => ['prefix' => '{site}', 'middleware' => ['web', 'auth', 'verified']],
//      'update' => ['prefix' => '{site}'],
//  ]];
// }

return $routes + [
    'apc_enabled' => false, // enable for maximum performance if APCu is available
    'apc_prefix' => 'aimeos:', // prefix for caching config and translation in APCu
    'num_formatter' => 'Locale', // locale based number formatter (alternative: "Standard")
    'pcntl_max' => 4, // maximum number of parallel command line processes when starting jobs
    'extdir' => '/var/www/marquis/packages',
    'version' => env('APP_VERSION', 1), // shop CSS/JS file version
    'legal' => true,

    'routes' => [
        // Docs: https://aimeos.org/docs/latest/laravel/extend/#custom-routes
        // Multi-sites: https://aimeos.org/docs/latest/laravel/customize/#multiple-shops
        'admin' => ['prefix' => 'admin', 'middleware' => ['web', 'auth', 'verified']],
        'jqadm' => ['prefix' => 'admin/{site}/jqadm', 'middleware' => ['web', 'auth', 'verified']],
        'jsonadm' => ['prefix' => 'admin/{site}/jsonadm', 'middleware' => ['web', 'auth', 'verified']],
        'jsonapi' => ['prefix' => 'jsonapi', 'middleware' => ['web', 'api', 'verified']],
        'account' => ['prefix' => $prefix . 'profile', 'middleware' => ['web', 'auth', 'verified']],
        'default' => ['prefix' => $prefix . 'shop', 'middleware' => ['web', 'auth', 'verified']],
        'supplier' => ['prefix' => $prefix . 's', 'middleware' => ['web', 'auth', 'verified']],
        'home' => ['prefix' => $prefix, 'middleware' => ['web', 'auth', 'verified']],
        'page' => ['prefix' => $prefix, 'middleware' => ['web', 'auth', 'verified']],
        'update' => [],
    ],

    'page' => [
        // Docs: https://aimeos.org/docs/latest/laravel/extend/#adapt-pages
        'account-index' => ['locale/select', 'basket/mini', 'catalog/tree', 'catalog/search', 'account/profile', 'account/review', 'account/subscription', 'account/history', 'account/favorite', 'account/watch', 'catalog/session'],
        'basket-index' => ['locale/select', 'catalog/tree', 'catalog/search', 'basket/standard', 'basket/bulk', 'basket/related'],
        'catalog-count' => ['catalog/count'],
        'catalog-detail' => ['locale/select', 'basket/mini', 'catalog/tree', 'catalog/search', 'catalog/stage', 'catalog/detail', 'catalog/session'],
        'catalog-home' => ['locale/select', 'basket/mini', 'catalog/tree', 'catalog/search', 'catalog/home', 'cms/page'],
        'catalog-list' => ['locale/select', 'basket/mini', 'catalog/filter', 'catalog/tree', 'catalog/search', 'catalog/price', 'catalog/supplier', 'catalog/attribute', 'catalog/session', 'catalog/stage', 'catalog/lists'],
        'catalog-session' => ['locale/select', 'basket/mini', 'catalog/tree', 'catalog/search', 'catalog/session'],
        'catalog-stock' => ['catalog/stock'],
        'catalog-suggest' => ['catalog/suggest'],
        'catalog-tree' => ['locale/select', 'basket/mini', 'catalog/filter', 'catalog/tree', 'catalog/search', 'catalog/price', 'catalog/supplier', 'catalog/attribute', 'catalog/session', 'catalog/stage', 'catalog/lists'],
        'checkout-confirm' => ['catalog/tree', 'catalog/search', 'checkout/confirm'],
        'checkout-index' => ['locale/select', 'catalog/tree', 'catalog/search', 'checkout/standard'],
        'checkout-update' => ['checkout/update'],
        'supplier-detail' => ['locale/select', 'basket/mini', 'catalog/tree', 'catalog/search', 'supplier/detail', 'catalog/lists'],
        'cms' => ['basket/mini', 'catalog/tree', 'cms/page'],
    ],

    'resource' => [
        'db' => [
            'adapter' => config('database.connections.' . config('database.default', 'mysql') . '.driver', 'mysql'),
            'host' => config('database.connections.' . config('database.default', 'mysql') . '.host', '127.0.0.1'),
            'port' => config('database.connections.' . config('database.default', 'mysql') . '.port', '3306'),
            'socket' => config('database.connections.' . config('database.default', 'mysql') . '.unix_socket', ''),
            'database' => config('database.connections.' . config('database.default', 'mysql') . '.database', 'forge'),
            'username' => config('database.connections.' . config('database.default', 'mysql') . '.username', 'forge'),
            'password' => config('database.connections.' . config('database.default', 'mysql') . '.password', ''),
            'stmt' => config('database.default', 'mysql') === 'mysql' ? ["SET SESSION sort_buffer_size=2097144; SET NAMES 'utf8mb4'; SET SESSION sql_mode='ANSI'"] : [],
            'limit' => 3, // maximum number of concurrent database connections
            'defaultTableOptions' => [
                'charset' => config('database.connections.' . config('database.default', 'mysql') . '.charset'),
                'collate' => config('database.connections.' . config('database.default', 'mysql') . '.collation'),
            ],
            'driverOptions' => config('database.connections.' . config('database.default', 'mysql') . '.options'),
        ],
        'fs' => [
            'adapter' => env('FILESYSTEM_DRIVER_FS'), // or FlyAwsS3
            'credentials' => [
                'key' => config('services.do.key'),
                'secret' => config('services.do.secret'),
            ],
            'endpoint' => config('services.do.endpoint'),
            'region' => config('services.do.region'),
            'version' => 'latest',
            'bucket' => config('services.do.bucket'),
            'prefix' => config('services.do.prefix'), // optional
            'baseurl' => config('services.do.baseurl') . DIRECTORY_SEPARATOR . config('services.do.prefix'),
        ],
        'fs-media' => [
            'adapter' => env('FILESYSTEM_DRIVER_FS'), // or FlyAwsS3
            'credentials' => [
                'key' => config('services.do.key'),
                'secret' => config('services.do.secret'),
            ],
            'endpoint' => config('services.do.endpoint'),
            'region' => config('services.do.region'),
            'version' => 'latest',
            'bucket' => config('services.do.bucket'),
            'prefix' => config('services.do.prefix'), // optional
            'baseurl' => config('services.do.baseurl') . DIRECTORY_SEPARATOR . config('services.do.prefix'),
        ],
        'fs-admin' => [
            'adapter' => env('FILESYSTEM_DRIVER_FS'), // or FlyAwsS3
            'credentials' => [
                'key' => config('services.do.key'),
                'secret' => config('services.do.secret'),
            ],
            'endpoint' => config('services.do.endpoint'),
            'region' => config('services.do.region'),
            'version' => 'latest',
            'bucket' => config('services.do.bucket'),
            'prefix' => config('services.do.prefix'), // optional
            'baseurl' => config('services.do.baseurl') . DIRECTORY_SEPARATOR . config('services.do.prefix'),
        ],
        'cache' => [
            'redis' => [
                'scheme' => 'tcp',
                'url' => env('REDIS_URL'),
                'host' => env('REDIS_HOST', '127.0.0.1'),
                'username' => env('REDIS_USERNAME'),
                'password' => env('REDIS_PASSWORD'),
                'port' => env('REDIS_PORT', '6379'),
                'database' => env('REDIS_DB', '0'),
            ]
        ],
        'email' => [
            'from-email' => config('mail.from.address'),
            'from-name' => config('mail.from.name'),
        ],
    ],

    'admin' => [
        'jqadm' => [
            'resource' => [
                'locale' => [
                    'currency' => [
                        'groups' => ['admin', 'super'],
                    ],
                    'language' => [
                        'groups' => ['admin', 'super'],
                    ],
                    'groups' => ['admin', 'super'],
                ],
            ],
            'customer' => [
                'fields' => ['customer.status', 'customer.code', 'customer.lastname', 'customer.postal', 'customer.city'],
                'decorators' => [
                    'global' => ['CustomerDecorator']
                ],
            ],
            'locale' => [
                'currency' => [
                    'decorators' => [
                        'global' => ['CurrencyDecorator']
                    ]
                ]
            ],
            'order' => [
                'decorators' => [
                    'global' => ['OrderDecorator']
                ],
            ],
            'product' => [
                'fields' => ['image', 'product.id', 'product.status', 'product.type', 'product.code', 'product.label', 'product.stock'],
            ]
        ],
    ],

    'client' => [
        'html' => [
            'basket' => [
                'cache' => [
                    // 'enable' => false, // Disable basket content caching for development
                ],
            ],
            'common' => [
                'cache' => [
                    // 'force' => true // enforce caching for logged in users
                ],
                'content' => [
                    'baseurl' => env('APP_URL')
                ],
                // 'template' => [
                //  'baseurl' => public_path('packages/aimeos/shop/themes/elegance')
                // ]
            ],
            'catalog' => [
                'lists' => [
                    'basket-add' => true, // shows add to basket in list views
                    // 'infinite-scroll' => true, // load more products in list view
                    // 'size' => 48, // number of products per page
                ],
                'selection' => [
                    'type' => [ // how variant attributes are displayed
                        'color' => 'radio',
                        'length' => 'radio',
                        'width' => 'radio',
                    ],
                ],
            ],
            'email' => [
                'from-email' => config('mail.from.address'),
                'from-name' => config('mail.from.name'),
                'bcc-email' => config('mail.bcc'),
            ],
            'payment' => [
                'bcc-email' => config('mail.bcc'),
                'reply-email' => config('mail.from.address'),
            ],
            'checkout' => [
                'update' => [
                    'decorators' => [
                        'global' => []
                    ]
                ],
                'standard' => [
                    'decorators' => [
                        'global' => []
                    ],
                ],
            ],
        ],
    ],

    'controller' => [
        // 'common' => [
        //  'media' => [
        //      'standard' => [
        //          'mimeicon' => [
        //              'directory' => public_path('/vendor/shop/mimeicons/application/') // string - Path or URL to the base directory
        //          ]
        //      ]
        //  ]
        // ],
        'frontend' => [
            'order' => [
                'decorators' => [
                    'global' => []
                ]
            ],
            'catalog' => [
                'levels-always' => 3 // number of category levels for mega menu
            ]
        ],
        'jobs' => [
            'admin' => [
                'log' => [
                    'limit-days' => 1, // default 30
                ]
            ],
            'to-email' => config('mail.from.address'),
            'from-email' => config('mail.from.name'), // Recipient e-mail address used when sending job e-mails, errors
        ],
    ],

    'i18n' => [],

    'madmin' => [
        'cache' => [
            'manager' => [
                'name' => 'None', // Disable caching for development
            ],
        ],
        'log' => [
            'manager' => [
                // 'loglevel' => 7, // Enable debug logging into madmin_log table
            ],
        ],
    ],

    'mshop' => [
        // 'locale' => [
        //  'site' => 'default', // used instead of "default"
        // ]
        'order' => [
            'manager' => [
                'decorators' => [
                    'global' => ['CheckoutDecorator'],
                ],
            ],
        ],
    ],

    'command' => [],

    'frontend' => [
        'mshop' => [
            'customer' => [
                'manager' => [
                    'decorators' => [
                        'excludes' => [
                            'CustomerGroup'
                        ],
                    ],
                ],
            ],
            'attribute' => [
                'manager' => [
                    'decorators' => [
                        'global' => [
                            'CustomerGroup' => 'CustomerGroup'
                        ],
                    ],
                ],
            ],
            'catalog' => [
                'manager' => [
                    'decorators' => [
                        'local' => [
                            'CatalogCustomerGroup' => 'CatalogCustomerGroup',
                        ],
                    ],
                ],
            ],
            'index' => [
                'manager' => [
                    'decorators' => [
                        'local' => [
                            'IndexCustomerGroup' => 'IndexCustomerGroup'
                        ],
                    ],
                ],
            ],
            'media' => [
                'manager' => [
                    'decorators' => [
                        'global' => [
                            'CustomerGroup' => 'CustomerGroup'
                        ],
                    ],
                ],
            ],
            'product' => [
                'manager' => [
                    'decorators' => [
                        // for relational databases
                        'global' => [
                            'CustomerGroup' => 'CustomerGroup'
                        ],
                        // for ElasticSearch
                        // 'local' => [
                        //  'CustomerGroupElastic' => 'CustomerGroupElastic'
                        // ],
                    ],
                ],
            ],
            'service' => [
                'manager' => [
                    'decorators' => [
                        'global' => [
                            'CustomerGroup' => 'CustomerGroup'
                        ],
                    ],
                ],
            ],
            'supplier' => [
                'manager' => [
                    'decorators' => [
                        'global' => [
                            'CustomerGroup' => 'CustomerGroup'
                        ],
                    ],
                ],
            ],
            'text' => [
                'manager' => [
                    'decorators' => [
                        'global' => [
                            'CustomerGroup' => 'CustomerGroup'
                        ],
                    ],
                ],
            ],
            'locale' => [
                'manager' => [
                    'site' => [
                        'decorators' => [
                            'excludes' => [
                                'CustomerGroup' => 'CustomerGroup'
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],

    'backend' => [],

];
aimeos commented 2 years ago

The configuration in ./config/shop.php overwrites the resource key completely and you have to add the missing filesystems like they are in the default config file: https://github.com/aimeos/aimeos-laravel/blob/master/src/default.php#L65-L100

liviusirbulescu commented 2 years ago

For some reason I thought keys are replaced, I can confirm that after adding the missing the missing filesystems mime icons are working, thank you.

Just noticed that using url() in a config will throw an error. https://github.com/aimeos/aimeos-laravel/blob/master/src/default.php#L69

Illuminate\Routing\UrlGenerator::__construct(): Argument #2 ($request) must be of type Illuminate\Http\Request, null given, called in /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 65

aimeos commented 2 years ago

Do you have a stack trace or can you share the full details?

liviusirbulescu commented 2 years ago

Sure, see below stack trace - To replicate, add url() in shop config and run composer dump-autoload - more on this here and here

[2022-06-01 10:17:15] production.ERROR: Illuminate\Routing\UrlGenerator::__construct(): Argument #2 ($request) must be of type Illuminate\Http\Request, null given, called in /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 65 {"exception":"[object] (TypeError(code: 0): Illuminate\\Routing\\UrlGenerator::__construct(): Argument #2 ($request) must be of type Illuminate\\Http\\Request, null given, called in /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 65 at /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:120)
[stacktrace]
#0 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(65): Illuminate\\Routing\\UrlGenerator->__construct()
#1 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Container/Container.php(871): Illuminate\\Routing\\RoutingServiceProvider->Illuminate\\Routing\\{closure}()
#2 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Container/Container.php(756): Illuminate\\Container\\Container->build()
#3 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(855): Illuminate\\Container\\Container->resolve()
#4 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Container/Container.php(692): Illuminate\\Foundation\\Application->resolve()
#5 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(840): Illuminate\\Container\\Container->make()
#6 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(119): Illuminate\\Foundation\\Application->make()
#7 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(905): app()
#8 /var/www/aimeos/config/shop.php(124): url()
#9 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(72): require('...')
#10 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(39): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->loadConfigurationFiles()
#11 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(239): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->bootstrap()
#12 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\\Foundation\\Application->bootstrapWith()
#13 /var/www/aimeos/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#14 Command line code(1): Illuminate\\Foundation\\Console\\Kernel->handle()
#15 {main}
"} 
aimeos commented 2 years ago

Running composer dump-autoload doesn't reveal the error in our test setups. Does it work if you use this instead:

'baseurl' => rtrim( env( 'ASSET_URL', PHP_SAPI == 'cli' ? env( 'APP_URL' ) : '', '/' ) . '/vendor/shop/mimeicons',
liviusirbulescu commented 2 years ago

I can confirm your suggestion works. rtrim(env('ASSET_URL', PHP_SAPI == 'cli' ? env('APP_URL') : '', '/') . '/vendor/shop/mimeicons')

Thanks again for all help

aimeos commented 2 years ago

Great! Thanks for your help :-)