Customer or customer group specific items
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 8
- Joined: 17 Aug 2018, 09:18
Customer or customer group specific items
Hi,
we use the "Customer or customer group specific items" extension, and we have a problem with them.
This extension has been tested for clean aimeos installations. We have not changed anything but only installed this extension.
At aimeos there are 20 products and 100 users.
Aimeos on arrival at eshop freezes and writes error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes)...
It is the following function getGroupIds() in:
ext/ai-customergroups/lib/custom/src/MShop/Common/Manager/Decorator/CustomerGroup.php
This function follows on:
vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Base/Context.php
Did anyone have a similar problem? Or maybe somebody can not help? Pricing rules work if instead of this function we insert the empty array.
Can not anyone know how to extend vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Base/Context.php?
Thx
we use the "Customer or customer group specific items" extension, and we have a problem with them.
This extension has been tested for clean aimeos installations. We have not changed anything but only installed this extension.
At aimeos there are 20 products and 100 users.
Aimeos on arrival at eshop freezes and writes error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes)...
It is the following function getGroupIds() in:
ext/ai-customergroups/lib/custom/src/MShop/Common/Manager/Decorator/CustomerGroup.php
Code: Select all
protected function checkItem( \Aimeos\MShop\Common\Item\ListRef\Iface $item, $date )
{
$context = $this->getContext();
$userId = $context->getUserId();
$groupIds = $context->getGroupIds();
$custIds = $cgroupdIds = [];
foreach( $item->getListItems( 'customer', 'default' ) as $listItem )
{
if( ( $listItem->getDateStart() === null || $listItem->getDateStart() < $date )
&& ( $listItem->getDateEnd() === null || $listItem->getDateEnd() > $date )
) {
$custIds[] = $listItem->getRefId();
}
}
foreach( $item->getListItems( 'customer/group', 'default' ) as $listItem )
{
if( ( $listItem->getDateStart() === null || $listItem->getDateStart() < $date )
&& ( $listItem->getDateEnd() === null || $listItem->getDateEnd() > $date )
) {
$cgroupdIds[] = $listItem->getRefId();
}
}
if( ( !empty( $custIds ) || !empty( $cgroupdIds ) )
&& ( empty( $custIds ) || !in_array( $userId, $custIds ) )
&& ( empty( $cgroupdIds ) || array_intersect( $groupIds, $cgroupdIds ) === [] )
) {
return false;
}
return true;
}
vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Base/Context.php
Code: Select all
protected function addGroups( \Aimeos\MShop\Context\Item\Iface $context )
{
if( ( $userid = Auth::id() ) !== null )
{
$context->setGroupIds( function() use ( $context, $userid )
{
$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups();
} );
}
return $context;
}
Can not anyone know how to extend vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Base/Context.php?
Thx
Re: Customer or customer group specific items
Which Laravel and Aimeos version are you using?
There was an improvment in aimeos-laravel 2018.07 that reduces the number of queries for checking authentication so please give the latest 2018.07 version a try.
If that doesn't help, please ask for support from the Aimeos company where you've bought the extension.
There was an improvment in aimeos-laravel 2018.07 that reduces the number of queries for checking authentication so please give the latest 2018.07 version a try.
If that doesn't help, please ask for support from the Aimeos company where you've bought the extension.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

-
- Posts: 8
- Joined: 17 Aug 2018, 09:18
Re: Customer or customer group specific items
We use the version 2018.07
My composer.json
My composer.json
Code: Select all
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"aimeos/ai-admin-jqadm": "^2018.07",
"aimeos/ai-admin-jsonadm": "^2018.07",
"aimeos/ai-client-html": "^2018.07",
"aimeos/ai-client-jsonapi": "^2018.07",
"aimeos/ai-controller-frontend": "^2018.07",
"aimeos/ai-controller-jobs": "^2018.07",
"aimeos/ai-gettext": "^2018.07",
"aimeos/ai-laravel": "^2018.07",
"aimeos/ai-swiftmailer": "^2018.07",
"aimeos/aimeos-core": "^2018.07",
"aimeos/aimeos-laravel": "^2018.07",
"aimeoscom/ai-customergroups": "^2018.04",
"barryvdh/laravel-debugbar": "^3.1",
"doctrine/dbal": "^2.5",
"fideloper/proxy": "~3.3",
"intervention/image": "^2.4",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"league/flysystem-aws-s3-v3": "^1.0"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phing/phing": "^2.16",
"phpunit/phpunit": "~6.0",
"symfony/thanks": "^1.0"
},
"autoload": {
"files": [
"app/Helpers.php"
],
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"files": [
"app/Helpers.php"
],
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
],
"post-update-cmd": [
"php artisan vendor:publish --tag=public --force",
"php artisan migrate"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"repositories": [{
"type": "composer",
"url": "https://packages.aimeos.org/aimeoscom"
}]
}
-
- Posts: 44
- Joined: 05 Feb 2018, 09:57
Re: Customer or customer group specific items
What do you mean contact Aimeos company? As far as I understand, it's an official extension - https://aimeos.com/extensions/.
Which company should we contact then?
Thanks
Which company should we contact then?
Thanks
Re: Customer or customer group specific items
Hi Michaelmichal.fehér wrote:What do you mean contact Aimeos company? As far as I understand, it's an official extension - https://aimeos.com/extensions/.
Which company should we contact then?
The Aimeos community can't support the proprietary extensions of the Aimeos company even if both share the same name. Sorry for the confusion.
Can you post the output of "composer show"?
Maybe there's also something wrong in the data but that's only a wild guess because locally we haven't noticed any problems. If you want to share sensitive information, you can contact me directly.
Cheers
Norbert
-
- Posts: 44
- Joined: 05 Feb 2018, 09:57
Re: Customer or customer group specific items
Thanks Norbert for the reply.
Yes I can understand the community cant support paid plugins, but I thought user with nickname "aimeos" and role "administrator" was Aimeos representative. If not, can you tell me what is the best way to contact Aimeos?
Thanks.
Yes I can understand the community cant support paid plugins, but I thought user with nickname "aimeos" and role "administrator" was Aimeos representative. If not, can you tell me what is the best way to contact Aimeos?
Thanks.
-
- Posts: 8
- Joined: 17 Aug 2018, 09:18
Re: Customer or customer group specific items
Thanks Norbert for the reply. I'm sending you output for composer show.
Code: Select all
aimeos/ai-admin-jqadm 2018.07.9 Aimeos ai-admin-jqadm exte...
aimeos/ai-admin-jsonadm 2018.07.3 Aimeos ai-admin-jsonadm ex...
aimeos/ai-client-html 2018.07.10 Aimeos ai-client-html exte...
aimeos/ai-client-jsonapi 2018.07.4 Aimeos JSON API extension
aimeos/ai-controller-frontend 2018.07.5 Aimeos ai-controller-front...
aimeos/ai-controller-jobs 2018.07.8 Aimeos ai-controller-jobs ...
aimeos/ai-gettext 2018.07.2 Aimeos Gettext extension
aimeos/ai-laravel 2018.07.3 Laravel adapter for Aimeos...
aimeos/ai-swiftmailer 2018.07.1 SwiftMailer adapter for Ai...
aimeos/aimeos-core 2018.07.17 Full-featured e-commerce c...
aimeos/aimeos-laravel 2018.07.3 Full-featured Laravel web ...
aimeoscom/ai-customergroups 2018.07.6 Aimeos ai-customergroups e...
aws/aws-sdk-php 3.67.0 AWS SDK for PHP - Use Amaz...
barryvdh/laravel-debugbar v3.1.5 PHP Debugbar integration f...
composer/installers v1.5.0 A multi-framework Composer...
dnoegel/php-xdg-base-dir 0.1 implementation of xdg base...
doctrine/cache v1.8.0 Caching library offering a...
doctrine/dbal v2.8.0 Database Abstraction Layer
doctrine/event-manager v1.0.0 Doctrine Event Manager com...
doctrine/inflector v1.3.0 Common String Manipulation...
doctrine/instantiator 1.1.0 A small, lightweight utili...
doctrine/lexer v1.0.1 Base library for a lexer t...
egulias/email-validator 2.1.5 A library for validating e...
erusev/parsedown 1.7.1 Parser for Markdown.
fideloper/proxy 3.3.4 Set trusted proxies for La...
filp/whoops 2.2.0 php error handling for coo...
fzaninotto/faker v1.8.0 Faker is a PHP library tha...
guzzlehttp/guzzle 6.3.3 Guzzle is a PHP HTTP clien...
guzzlehttp/promises v1.3.1 Guzzle promises library
guzzlehttp/psr7 1.4.2 PSR-7 message implementati...
hamcrest/hamcrest-php v2.0.0 This is the PHP port of Ha...
intervention/image 2.4.2 Image handling and manipul...
jakub-onderka/php-console-color 0.1
jakub-onderka/php-console-highlighter v0.3.2
laravel/framework v5.5.42 The Laravel Framework.
laravel/tinker v1.0.7 Powerful REPL for the Lara...
league/flysystem 1.0.46 Filesystem abstraction: Ma...
league/flysystem-aws-s3-v3 1.0.19 Flysystem adapter for the ...
maximebf/debugbar v1.15.0 Debug bar in the browser f...
mockery/mockery 1.1.0 Mockery is a simple yet fl...
monolog/monolog 1.23.0 Sends your logs to files, ...
mtdowling/cron-expression v1.2.1 CRON for PHP: Calculate th...
mtdowling/jmespath.php 2.4.0 Declaratively specify how ...
myclabs/deep-copy 1.8.1 Create deep copies (clones...
nesbot/carbon 1.33.0 A simple API extension for...
nikic/php-parser v4.0.3 A PHP parser written in PHP
paragonie/random_compat v9.99.99 PHP 5.x polyfill for rando...
phar-io/manifest 1.0.1 Component for reading phar...
phar-io/version 1.0.1 Library for handling versi...
phing/phing 2.16.1 PHing Is Not GNU make; it'...
phpdocumentor/reflection-common 1.0.1 Common reflection classes ...
phpdocumentor/reflection-docblock 4.3.0 With this component, a lib...
phpdocumentor/type-resolver 0.4.0
phpspec/prophecy 1.8.0 Highly opinionated mocking...
phpunit/php-code-coverage 5.3.2 Library that provides coll...
phpunit/php-file-iterator 1.4.5 FilterIterator implementat...
phpunit/php-text-template 1.2.1 Simple template engine.
phpunit/php-timer 1.0.9 Utility class for timing
phpunit/php-token-stream 2.0.2 Wrapper around PHP's token...
phpunit/phpunit 6.5.12 The PHP Unit Testing frame...
phpunit/phpunit-mock-objects 5.0.10 Mock Object library for PH...
psr/container 1.0.0 Common Container Interface...
psr/http-message 1.0.1 Common interface for HTTP ...
psr/log 1.0.2 Common interface for loggi...
psr/simple-cache 1.0.1 Common interfaces for simp...
psy/psysh v0.9.7 An interactive shell for m...
ramsey/uuid 3.8.0 Formerly rhumsaa/uuid. A P...
sebastian/code-unit-reverse-lookup 1.0.1 Looks up which function or...
sebastian/comparator 2.1.3 Provides the functionality...
sebastian/diff 2.0.1 Diff implementation
sebastian/environment 3.1.0 Provides functionality to ...
sebastian/exporter 3.1.0 Provides the functionality...
sebastian/global-state 2.0.0 Snapshotting of global state
sebastian/object-enumerator 3.0.3 Traverses array structures...
sebastian/object-reflector 1.1.1 Allows reflection of objec...
sebastian/recursion-context 3.0.0 Provides functionality to ...
sebastian/resource-operations 1.0.0 Provides a list of PHP bui...
sebastian/version 2.0.1 Library that helps with ma...
swiftmailer/swiftmailer v6.1.2 Swiftmailer, free feature-...
symfony/console v3.4.14 Symfony Console Component
symfony/css-selector v4.1.3 Symfony CssSelector Component
symfony/debug v3.4.14 Symfony Debug Component
symfony/event-dispatcher v4.1.3 Symfony EventDispatcher Co...
symfony/finder v3.4.14 Symfony Finder Component
symfony/http-foundation v3.4.14 Symfony HttpFoundation Com...
symfony/http-kernel v3.4.14 Symfony HttpKernel Component
symfony/polyfill-ctype v1.9.0 Symfony polyfill for ctype...
symfony/polyfill-mbstring v1.9.0 Symfony polyfill for the M...
symfony/polyfill-php70 v1.9.0 Symfony polyfill backporti...
symfony/process v3.4.14 Symfony Process Component
symfony/psr-http-message-bridge v1.0.2 PSR HTTP message bridge
symfony/routing v3.4.14 Symfony Routing Component
symfony/thanks v1.1.0 Give thanks (in the form o...
symfony/translation v4.1.3 Symfony Translation Component
symfony/var-dumper v3.4.14 Symfony mechanism for expl...
symfony/yaml v4.1.3 Symfony Yaml Component
theseer/tokenizer 1.1.0 A small library for conver...
tijsverkoyen/css-to-inline-styles 2.2.1 CssToInlineStyles is a cla...
vlucas/phpdotenv v2.5.1 Loads environment variable...
webmozart/assert 1.3.0 Assertions to validate met...
zendframework/zend-diactoros 1.8.5 PSR HTTP Message implement...
Re: Customer or customer group specific items
Your package setup seems to be OK. Can you add a debug statement to find out how often checkItem() is called?
Another thing to check: Is there a circular reference in your data, e.g. customer item refers to the same customer item via the list table or something like
1. customer -> 2. customer -> 1. customer
@Michal: Use the Aimeos.com contact form, there you can get in touch with us directly:
https://aimeos.com/aimeos-gmbh/contact/
Another thing to check: Is there a circular reference in your data, e.g. customer item refers to the same customer item via the list table or something like
1. customer -> 2. customer -> 1. customer
@Michal: Use the Aimeos.com contact form, there you can get in touch with us directly:
https://aimeos.com/aimeos-gmbh/contact/
-
- Posts: 44
- Joined: 05 Feb 2018, 09:57
Re: Customer or customer group specific items
Hi Norbert,
the only way how to make the extension work is to make this change:
in
.
The original getGroupIds method has infinite loop or something. This was tested on fresh install of laravel so it shouldnt be anything you mentioned before.
Another strange thing that we noticed. When I restrict user from seeing all products in category (166 products in total) but one, the pagination wont work as expected. I would still see 4 pages available when there shouldnt be none (as there is only 1 product to see).
I checked the code (CustomerGroup Decorator) and I noticed you first mage all the queries to determine totals (listProductTotal, listPageSize) and only after that you unset array of items with checkItem method (check the attached screenshot).
Can you please advise how should we fix this?
Thanks.
the only way how to make the extension work is to make this change:
Code: Select all
// $groupIds = $context->getGroupIds();
$groupIds = (DB::table('users_list')->select('refid')->where('typeid', 3)->where('parentid', $userId)->get()->pluck('refid')->toArray());
Code: Select all
ext/ai-customergroups/lib/custom/src/MShop/Common/Manager/Decorator/CustomerGroup.php
The original getGroupIds method has infinite loop or something. This was tested on fresh install of laravel so it shouldnt be anything you mentioned before.
Another strange thing that we noticed. When I restrict user from seeing all products in category (166 products in total) but one, the pagination wont work as expected. I would still see 4 pages available when there shouldnt be none (as there is only 1 product to see).
I checked the code (CustomerGroup Decorator) and I noticed you first mage all the queries to determine totals (listProductTotal, listPageSize) and only after that you unset array of items with checkItem method (check the attached screenshot).
Can you please advise how should we fix this?
Thanks.
nos3 wrote:Your package setup seems to be OK. Can you add a debug statement to find out how often checkItem() is called?
Another thing to check: Is there a circular reference in your data, e.g. customer item refers to the same customer item via the list table or something like
1. customer -> 2. customer -> 1. customer
@Michal: Use the Aimeos.com contact form, there you can get in touch with us directly:
https://aimeos.com/aimeos-gmbh/contact/
- Attachments
-
- Snip20180903_6.png (108.99 KiB) Viewed 13639 times
-
- Snip20180903_5.png (154.81 KiB) Viewed 13639 times
Re: Customer or customer group specific items
Regarding the infinitive loop, can you post a dump of your users, users_list and mshop_customer_group tables (structure and data) nevertheless? Because we are unable to reproduce the problem.