Decorators How they work and problems

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Shopmister
Posts: 92
Joined: 15 Jan 2021, 11:02

Decorators How they work and problems

Post by Shopmister » 11 Apr 2021, 11:15

Hey,
Typo3 10.4.13; Aimeos newest version (11.4.21)
Webserver Apache
PHP Version 7.3.27-1~deb10u1
Database (Default) MySQL 5.5.5-10.3.27-MariaDB-0+deb10u1
Application Context Production
Operating System Linux 4.19.0-9-amd64
Last Scheduler run 11-04-21 at 13:02, Duration 0 min, (started automatically)Aimeos newest version


I think i dont understand the decorators right.
Can you tell me shortly with my examples they dont work, how the decorators have to work?
Two things i tryed. download.all 1/0 and weight.min 10. Both do nothing in frontend. i delted php - cache.
Option Value
download.all 1
weight.min 10

But frontend shows all delivery services like before.
BTW ow downloadproducts know they are downloadproducts? Only bcause they have an download ?

Now i have this frontenderror if i want to click to go to the checkout:
Argument 1 passed to Aimeos\MShop\Service\Item\Standard::getArrayValue() must be of the type array, string given, called in /home/users/username/www/Domainname/typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mshoplib/src/MShop/Common/Item/Config/Traits.php on line 85

Ps. i did give for sure the product an weight of 0, and its a downloadproduct. And setted for free shipping download.all 1 and for the dhl and so, "0"

Ps2. For sure i did read the different docus about before. But i dont understand, or something different wents wrong

Thanks. :)

stagedive_media
Posts: 2
Joined: 14 Apr 2021, 10:36

Re: Decorators How they work and problems

Post by stagedive_media » 14 Apr 2021, 10:43

I am getting the Same Error, but only if I try to add more than 12 items to the cart. I am not even kidding.

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Decorators How they work and problems

Post by aimeos » 14 Apr 2021, 10:51

Which version do you use (20.10.x?) and does anybody has a complete stack trace of the problem?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Shopmister
Posts: 92
Joined: 15 Jan 2021, 11:02

Re: Decorators How they work and problems

Post by Shopmister » 14 Apr 2021, 11:29

Ps. I have this error not always, only by some products from the aimeos demos, i think. But maybe i changed there something. Please answer too about the decoratorquestion, or i didnt forget anything? :)
Im not sure if it make sence to tell another problem here: That always every to the basket added product is adding two times. it s possible to delete one then buts not good. Maybe its the same Root cause. I have no idea .
Is the stack trace the errorthing the full. here is a half of it. I hope its anough :)

Ps. Maybe because the 200€vallue, that would be dont make sence in one way, because its from aimeos but in other way: His 12 Products maybe over 200 and my AImeos products are all without the vouchers(and the vouchers make no problem) are 200€ or higher if two at the basket.

(1/1) TypeError

Argument 1 passed to Aimeos\MShop\Service\Item\Standard::getArrayValue() must be of the type array, string given, called in /home/users/username/www/Domainname/typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mshoplib/src/MShop/Common/Item/Config/Traits.php on line 85
in /home/users/Username/www/Domianname/typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mshoplib/src/MShop/Common/Item/Config/Traits.php line 80

* @param array $parts Configuration path parts to look for inside the array
* @param mixed $default Default value if no configuration is found
* @return mixed Found value or null if no value is available
*/
protected function getArrayValue( array $config, array $parts, $default )
{
if( ( $current = array_shift( $parts ) ) !== null && isset( $config[$current] ) )
{
if( count( $parts ) > 0 ) {

at Aimeos\MShop\Service\Item\Standard->getArrayValue('', array('EUR'), null)
in /home/users/Username/www/Domainname/typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mshoplib/src/MShop/Common/Item/Config/Traits.php line 85

{
if( ( $current = array_shift( $parts ) ) !== null && isset( $config[$current] ) )
{
if( count( $parts ) > 0 ) {
return $this->getArrayValue( $config[$current], $parts, $default );
}

return $config[$current];
}

at Aimeos\MShop\Service\Item\Standard->getArrayValue(array('reduction.basket-value-max' => '', 'reduction.basket-value-min' => array('EUR' => '200.00'), 'reduction.percent' => 100, 'reduction.product-costs' => 0), array('EUR'), null)
in /home/users/Username/www/Domainname/typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mshoplib/src/MShop/Common/Item/Config/Traits.php line 48

* @return mixed Configuration value or array of values
*/
public function getConfigValue( string $key, $default = null )
{
return $this->getArrayValue( $this->getConfig(), explode( '/', trim( $key, '/' ) ), $default );
}


/**

at Aimeos\MShop\Service\Item\Standard->getConfigValue('reduction.basket-value-max/EUR')
in /home/users/username/www/Domainname/typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mshoplib/src/MShop/Service/Provider/Decorator/Reduction.php line 122

if( ( $val = $item->getConfigValue( 'reduction.basket-value-min/' . $currency ) ) !== null && $val > $total ) {
return $price;
}

if( ( $val = $item->getConfigValue( 'reduction.basket-value-max/' . $currency ) ) !== null && $val < $total ) {
return $price;
}

if( $item->getConfigValue( 'reduction.product-costs' ) )

at Aimeos\MShop\Service\Provider\Decorator\Reduction->calcPrice(object(Aimeos\MShop\Order\Item\Base\Standard))
in /home/users/username/www/Domainame/typo3conf/ext/aimeos/Resources/Private/Extensions/ai-client-html/client/html/src/Client/Html/Checkout/Standard/Delivery/Standard.php line 346

}
}

$services[$id] = $provider->getServiceItem()->set( 'attributes', $attr )
->set( 'price', $provider->calcPrice( $basket ) );
}
}

$view->deliveryServices = $services;

at Aimeos\Client\Html\Checkout\Standard\Delivery\Standard->addData(object(Aimeos\MW\View\Standard), array(), null)
in /home/users/username/www/Domainname/typo3conf/ext/aimeos/Resources/Private/Extensions/ai-client-html/client/html/src/Client/Html/Base.php line 67

*/
public function addData( \Aimeos\MW\View\Iface $view, array &$tags = [], string &$expire = null ) : \Aimeos\MW\View\Iface
{
foreach( $this->getSubClients() as $name => $subclient ) {
$view = $subclient->addData( $view, $tags, $expire );
}

return $view;
}

at Aimeos\Client\Html\Base->addData(object(Aimeos\MW\View\Standard), array(), null)
in /home/users/username/www/Domainname/typo3conf/ext/aimeos/Resources/Private/Extensions/ai-client-html/client/html/src/Client/Html/Checkout/Standard/Standard.php line 492


$view = $this->addNavigationUrls( $view, $steps, $view->standardStepActive );
$view->standardSteps = $steps;

return parent::addData( $view, $tags, $expire );
}


/**

at Aimeos\Client\Html\Checkout\Standard\Standard->addData(object(Aimeos\MW\View\Standard))
in /home/users/username/www/Domainname/typo3conf/ext/aimeos/Resources/Private/Extensions/ai-client-html/client/html/src/Client/Html/Checkout/Standard/Standard.php line 203


try
{
if( !isset( $this->view ) ) {
$view = $this->view = $this->getObject()->addData( $view );
}

$html = '';
foreach( $this->getSubClients() as $subclient ) {

at Aimeos\Client\Html\Checkout\Standard\Standard->getHeader()
in /home/users/username/www/Domainname/typo3conf/ext/aimeos/Classes/Controller/AbstractController.php line 164

{
$client->setView( $this->getContext()->getView() );
$client->process();

$this->response->addAdditionalHeaderData( (string) $client->getHeader() );

return $client->getBody();
}

at Aimeos\Aimeos\Controller\AbstractController->getClientOutput(object(Aimeos\Client\Html\Checkout\Standard\Standard))
in /home/users/username/www/Domainname/typo3conf/ext/aimeos/Classes/Controller/CheckoutController.php line 30

*/
public function indexAction()
{
$client = \Aimeos\Client\Html::create( $this->getContext(), 'checkout/standard' );
return $this->getClientOutput( $client );
}


/**

at Aimeos\Aimeos\Controller\CheckoutController->indexAction()
in /home/users/Username/www/typo3_sources/typo3_src-10.4.13/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php line 498

}
$validationResult = $this->arguments->validate();
if (!$validationResult->hasErrors()) {
$this->eventDispatcher->dispatch(new BeforeActionCallEvent(static::class, $this->actionMethodName, $preparedArguments));
$actionResult = $this->{$this->actionMethodName}(...$preparedArguments);
} else {
$actionResult = $this->{$this->errorMethodName}();
}

at TYPO3\CMS\Extbase\Mvc\Controller\ActionController->callActionMethod()
in /home/users/Username/www/typo3_sources/typo3_src-10.4.13/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php line 426

$this->view = $this->resolveView();
if ($this->view !== null) {
$this->initializeView($this->view);
}
$this->callActionMethod();
$this->renderAssetsForRequest($request);
}

/**

at TYPO3\CMS\Extbase\Mvc\Controller\ActionController->processRequest(object(TYPO3\CMS\Extbase\Mvc\Web\Request), object(TYPO3\CMS\Extbase\Mvc\Web\Response))
in /home/users/Username/www/typo3_sources/typo3_src-10.4.13/typo3/sysext/extbase/Classes/Mvc/Dispatcher.php line 89

throw new InfiniteLoopException('Could not ultimately dispatch the request after ' . $dispatchLoopCount . ' iterations. Most probably, a @' . IgnoreValidation::class . ' annotation is missing on re-displaying a form with validation errors.', 1217839467);
}
$controller = $this->resolveController($request);
try {
$controller->processRequest($request, $response);
} catch (StopActionException $ignoredException) {
}
}

at TYPO3\CMS\Extbase\Mvc\Dispatcher->dispatch(object(TYPO3\CMS\Extbase\Mvc\Web\Request), object(TYPO3\CMS\Extbase\Mvc\Web\Response))
in /home/users/Username/www/typo3_sources/typo3_src-10.4.13/typo3/sysext/extbase/Classes/Mvc/Web/FrontendRequestHandler.php line 66

}

/** @var \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response */
$response = $this->objectManager->get(Response::class);
$this->dispatcher->dispatch($request, $response);
return $response;
}

/**

at TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler->handleRequest()
in /home/users/Username/www/typo3_sources/typo3_src-10.4.13/typo3/sysext/extbase/Classes/Core/Bootstrap.php line 183

protected function handleRequest(): string
{
$requestHandler = $this->requestHandlerResolver->resolveRequestHandler();

$response = $requestHandler->handleRequest();
// If response is NULL after handling the request we need to stop
// This happens for instance, when a USER object was converted to a USER_INT
// @see TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler::handleRequest()
if ($response === null) {

at TYPO3\CMS\Extbase\Core\Bootstrap->handleRequest()
in /home/users/Username/www/typo3_sources/typo3_src-10.4.13/typo3/sysext/extbase/Classes/Core/Bootstrap.php line 173

*/
public function run(string $content, array $configuration): string
{
$this->initialize($configuration);
return $this->handleRequest();
}

/**
* @return string

at TYPO3\CMS\Extbase\Core\Bootstrap->run('', array('userFunc' => 'TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run', 'extensionName' => 'Aimeos', 'pluginName' => 'checkout-standard'))
at call_user_func_array(array(object(TYPO3\CMS\Extbase\Core\Bootstrap), 'run'), array('', array('userFunc' => 'TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run', 'extensionName' => 'Aimeos', 'pluginName' => 'checkout-standard')))
in /home/users/Username/www/typo3_sources/typo3_src-10.4.13/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 5644

if (is_object($classObj) && method_exists($classObj, $parts[1]) && is_callable($callable)) {
$classObj->cObj = $this;
$content = call_user_func_array($callable, [
$content,
$conf
]);
} else {
$this->getTimeTracker()->setTSlogMessage('Method "' . $parts[1] . '" did not exist in class "' . $parts[0] . '"', 3);
}

at TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->callUserFunction('TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run', array('userFunc' => 'TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run', 'extensionName' => 'Aimeos', 'pluginName' => 'checkout-standard'), '')
in /home/users/Username/www/typo3_sources/typo3_src-10.4.13/typo3/sysext/frontend/Classes/ContentObject/UserContentObject.php line 43

if ($this->cObj->getUserObjectType() === false) {
// Come here only if we are not called from $TSFE->processNonCacheableContentPartsAndSubstituteContentMarkers()!
$this->cObj->setUserObjectType(ContentObjectRenderer::OBJECTTYPE_USER);
}
$tempContent = $this->cObj->callUserFunction($conf['userFunc'], $conf, '');
if ($this->cObj->doConvertToUserIntObject) {
$this->cObj->doConvertToUserIntObject = false;
$content = $this->cObj->cObjGetSingle('USER_INT', $conf);
} else {

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Decorators How they work and problems

Post by aimeos » 14 Apr 2021, 12:08

We can't reproduce the issue in our test environment but it has something to do with an invalid value entered in the admin backend. Can you post a screenshot of your service configuration that causes the problem?

Nevertheless, we've made a change in the Aimeos core that checks for invalid values and ignores them for now. If you use composer, you can run "composer up" to get the new aimeos-core release (20.10.22).
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Shopmister
Posts: 92
Joined: 15 Jan 2021, 11:02

Re: Decorators How they work and problems

Post by Shopmister » 14 Apr 2021, 12:54

No i dont use composer. Symlink ^^
The only change i did made with this DHL Service i think , is i added download.all

aimeos_service_values.png
aimeos_service_values.png (8.13 KiB) Viewed 4677 times

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Decorators How they work and problems

Post by aimeos » 14 Apr 2021, 12:59

Can you add an empty object value for "reduction.basket-value-max" -> "{}" (without apostrophes)?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Shopmister
Posts: 92
Joined: 15 Jan 2021, 11:02

Re: Decorators How they work and problems

Post by Shopmister » 14 Apr 2021, 13:06

Can you add an empty object value for "reduction.basket-value-max" -> "{}" (without apostrophes)?
If i add
{}

the result after saving is: []

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Decorators How they work and problems

Post by aimeos » 14 Apr 2021, 13:07

Doesn't matter. Does the error in the frontend still occur?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Shopmister
Posts: 92
Joined: 15 Jan 2021, 11:02

Re: Decorators How they work and problems

Post by Shopmister » 14 Apr 2021, 13:24

Doesn't matter. Does the error in the frontend still occur?
It seems the solution for this problem. I will see, but i testet 3 times in and not in and its always the same: if "[]" in the maxvaluefield all good and the field is empty the error :).


Okay,
and how in generel the service decorators work. BEcause download.all is false maybe and weight.min/max isnt working too. And i needed a very logn time to understand with the many dokus about the same, that i can use in the fields and not have to use the service decorators customer/lala/ ... = ...
And i dont understand the reduction and its dont working too i think, without the error but its do nothing :)

Post Reply