Skip to content

Commit

Permalink
Replace basket services even if re-added by Autofill plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
aimeos committed Sep 26, 2023
1 parent 3b64cd8 commit 9265586
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Client/JsonApi/Basket/Service/Standard.php
Expand Up @@ -249,11 +249,11 @@ public function patch( ServerRequestInterface $request, ResponseInterface $respo

$cntl = \Aimeos\Controller\Frontend::create( $this->context(), 'service' );

if( $relId = $view->param( 'relatedid' ) ) {
$this->controller->deleteService( $relId );
if( $type = $view->param( 'relatedid' ) ) {
$this->controller->deleteService( $type );
}

foreach( $payload->data as $entry )
foreach( $payload->data as $pos => $entry )
{
if( !isset( $entry->id ) ) {
throw new \Aimeos\Client\JsonApi\Exception( 'Service type (ID) is missing', 400 );
Expand All @@ -270,7 +270,7 @@ public function patch( ServerRequestInterface $request, ResponseInterface $respo
$item = $cntl->uses( ['media', 'price', 'text'] )->get( $entry->attributes->{'service.id'} );
unset( $entry->attributes->{'service.id'} );

$this->controller->addService( $item, (array) $entry->attributes );
$this->controller->addService( $item, (array) $entry->attributes, $pos );
}


Expand Down

0 comments on commit 9265586

Please sign in to comment.