Skip to content

Commit

Permalink
Fixes migrating products between sites
Browse files Browse the repository at this point in the history
  • Loading branch information
aimeos committed Aug 18, 2018
1 parent f1622b5 commit b711123
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions controller/frontend/src/Controller/Frontend/Basket/Base.php
Expand Up @@ -254,20 +254,21 @@ protected function copyProducts( \Aimeos\MShop\Order\Item\Base\Iface $basket, ar

try
{
$attrIds = [];
$variantIds = $configIds = $customIds = [];

foreach( $product->getAttributes() as $attrItem ) {
$attrIds[$attrItem->getType()][] = $attrItem->getAttributeId();
foreach( $product->getAttributes() as $attrItem )
{
switch( $attrItem->getType() )
{
case 'variant': $variantIds[] = $attrItem->getAttributeId(); break;
case 'config': $configIds[$attrItem->getAttributeId()] = $attrItem->getQuantity(); break;
case 'custom': $customIds[$attrItem->getAttributeId()] = $attrItem->getValue(); break;
}
}

$this->addProduct(
$product->getProductId(),
$product->getQuantity(),
$product->getStockType(),
$this->getValue( $attrIds, 'variant', [] ),
$this->getValue( $attrIds, 'config', [] ),
$this->getValue( $attrIds, 'hidden', [] ),
$this->getValue( $attrIds, 'custom', [] )
$product->getProductId(), $product->getQuantity(), $product->getStockType(),
$variantIds, $configIds, [], $customIds
);

$basket->deleteProduct( $pos );
Expand Down

0 comments on commit b711123

Please sign in to comment.