/*!
\returns the type of basket. In other words: what type of products the basket contains.
357101
function type()
    {
        $type = false;

        // get first product
        $productCollectionItemList = eZProductCollectionItem::fetchList( array( 'productcollection_id' => $this->attribute( 'productcollection_id' ) ),
                                                                         true,
                                                                         0,
                                                                         1 );

        if ( is_array( $productCollectionItemList ) && count( $productCollectionItemList ) === 1 )
        {
            $product = $productCollectionItemList[0]->attribute( 'contentobject' );
            if ( is_object( $product ) )
            {
                $type = eZShopFunctions::productTypeByObject( $product );
            }
        }

        return $type;
    }
1138555
private function retrieveProductTypesMap()
    {
        $productTypeMap = [];
        LoadProductTypes::processProductTypesFixtures(
            function (\DOMElement $element) use (&$productTypeMap) {
                $productTypeMap[$element->getAttribute('key')] = $element->getAttribute('id');
            }
        );

        return $productTypeMap;
    }
641457
public function getBasketLink()
    {
        if ($this->getAmazonLoginIsActive() === true) {
            $sValue = $this->getViewConfigParam('basketlink');

            if ((string)$sValue === '') {
                $sValue = $this->_getContainer()->getConfig()->getShopSecureHomeUrl().'cl=basket';
                $this->setViewConfigParam('basketlink', $sValue);
            }

            return $sValue;
        }

        return parent::getBasketLink();
    }
1218797
public function getBasket()
    {
        if ($this->_oBasket === null) {
            $serializedBasket = $this->getVariable($this->_getBasketName());

            //init oxbasketitem class first
            //#1746
            oxNew(BasketItem::class);

            // init oxbasket through oxNew and not oxAutoload, Mantis-Bug #0004262
            $emptyBasket = oxNew(Basket::class);

            $basket =
                $this->isSerializedBasketValid($serializedBasket) &&
                ($unserializedBasket = unserialize($serializedBasket)) &&
                $this->isUnserializedBasketValid($unserializedBasket, $emptyBasket) ?
                    $unserializedBasket : $emptyBasket;

            $this->_validateBasket($basket);
            $this->setBasket($basket);
        }

        return $this->_oBasket;
    }
1206864
def get_basket_items(request):
    
    bid = basket_id(request)
    return BasketItem.objects.filter(basket_id=bid), bid
1254852
public function getType($item)
    {
        switch ($this->getProductType($item)) {
            case Bundle::TYPE_CODE:
                return $this->bundle->create()->setItem($item);
            case Grouped::TYPE_CODE:
                return $this->grouped->create()->setItem($item);
            case Configurable::TYPE_CODE:
                return $this->configurable->create()->setItem($item);
            default:
                return $this->generic->create()->setItem($item);
        }
    }
632931
private function getProductType($item)
    {
        $type = '';
        if ($item instanceof OrderItem) {
            $type = $item->getInternalOrderInfo()->getItemType();
        } elseif ($item instanceof Product) {
            $type = $item->getTypeId();
        } elseif ($item instanceof QuoteItem) {
            $type = $item->getProduct()->getTypeId();
        }

        if (empty($type)) {
            throw new \Exception('Did not recognize the passed object: ' . get_class($item));
        }

        return $type;
    }
240816
function itemList( $asObject = true )
    {
        return eZPersistentObject::fetchObjectList( eZProductCollectionItem::definition(),
                                                    null, array( "productcollection_id" => $this->ID ),
                                                    null,
                                                    null,
                                                    $asObject );
    }
1121023
public function getBasketItems()
    {
        $params = $this->getRequest()->getParams();

        if (! isset($params['quote_id']) ||
            ! isset($params['code']) ||
            ! $this->helper->isCodeValid($params['code'])
        ) {
            $this->helper->log('Abandoned cart not found or invalid code');

            return false;
        }
        $quoteId = (int) $params['quote_id'];
        $quoteModel = $this->quoteFactory->create()
            ->loadByIdWithoutStore($quoteId);

        //check for any quote for this email, don't want to render further
        if (!$quoteModel->getId()) {
            $this->helper->log('no quote found for ' . $quoteId);

            return false;
        }
        if (!$quoteModel->getIsActive()) {
            $this->helper->log('Cart is not active : ' . $quoteId);

            return false;
        }

        $this->quote = $quoteModel;

        //Start environment emulation of the specified store
        $storeId = $quoteModel->getStoreId();

        $appEmulation = $this->emulationFactory->create();
        $appEmulation->startEnvironmentEmulation($storeId);

        $quoteItems = $quoteModel->getAllItems();

        $itemsData = [];

        /** @var \Magento\Quote\Model\Quote\Item $quoteItem */

        $parentProductIds = [];

        //Collect all parent ids to identify later which products to show in EDC
        foreach ($quoteItems as $quoteItem) {
            if ($quoteItem->getParentItemId() == null) {
                $parentProductIds[] = $quoteItem->getProduct()->getId();
            }
        }
        foreach ($quoteItems as $quoteItem) {
            if ($quoteItem->getParentItemId() != null) {
                //If a product is a bundle we don't need to show all parts of it.
                if ($quoteItem->getParentItem()->getProductType() == 'bundle') {
                    continue;
                }
                $itemsData[] =  $this->getItemDataForChildProducts($quoteItem);
                //Signal that we added a child product, so its parent must be ignored later.
                if (in_array($quoteItem->getParentItem()->getProduct()->getId(), $parentProductIds)) {
                    $key = array_search($quoteItem->getParentItem()->getProduct()->getId(), $parentProductIds);
                    unset($parentProductIds[$key]);
                }
            }
        }

        foreach ($quoteItems as $quoteItem) {
            //If a child product added already, we must not add it's parent.
            if ($quoteItem->getParentItemId() == null && in_array($quoteItem->getProduct()->getId(), $parentProductIds)) {
                $itemsData[] = $this->getItemDataForParentProducts($quoteItem);
            }
        }

        return $itemsData;
    }
1365455
public function getSelList()
    {
        if ($this->_aSelList == null && $this->oxuserbasketitems__oxsellist->value) {
            $this->_aSelList = unserialize($this->oxuserbasketitems__oxsellist->value);
        }

        return $this->_aSelList;
    }
412782
public function getItemType()
    {
        if (!preg_match('/array\<(.+)\>/i', $this->serializerType, $matches)) {
            return $this->serializerType;
        }

        $map = [
            'DateTime'  => 'date',
            'integer'   => 'int',
            'float'     => 'float',
            'double'    => 'float',
            'boolean'   => 'boolean',
            'extref'    => 'extref',
        ];
        return isset($map[$matches[1]]) ? $map[$matches[1]] : $matches[1];
    }
1120865
public function getBasketTotal()
    {
        $this->loadProducts();

        $total = 0;
        foreach($this->basketProducts as $bp) {
            $total += $bp['count'];
        }

        return $total;
    }
1036168
public function getBasketCost()
    {
        $this->loadProducts();

        $cost = 0;
        foreach($this->basketProducts as $bp) {
            $cost += $bp['count'] * $bp['price'];
        }

        return $cost;
    }
925843
public function getDiscountSumPayPalBasket()
    {
        // collect discounts
        $discount = 0.0;

        $totalDiscount = $this->getTotalDiscount();

        if ($totalDiscount) {
            $discount += $totalDiscount->getBruttoPrice();
        }

        //if payment costs are negative, adding them to discount
        if (($costs = $this->getPaymentCosts()) < 0) {
            $discount += ($costs * -1);
        }

        // vouchers..
        $vouchers = (array) $this->getVouchers();
        foreach ($vouchers as $voucher) {
            $discount += round($voucher->dVoucherdiscount, 2);
        }

        return $discount;
    }
753716
protected function getProductIdsFromBasket( \Aimeos\MShop\Order\Item\Base\Iface $basket )
	{
		$list = [];

		foreach( $basket->getProducts() as $orderProduct )
		{
			$list[ $orderProduct->getProductId() ] = true;

			foreach( $orderProduct->getProducts() as $subProduct ) {
				$list[ $subProduct->getProductId() ] = true;
			}
		}

		return array_keys( $list );
	}
147739
public function GetBasketQuantityForDiscount(TdbShopDiscount &$oDiscount)
    {
        // get the sum of all products (we exclude products with "fieldExcludeFromDiscounts")
        $iCurrentPosition = $this->getItemPointer();
        $this->GoToStart();
        $iAmount = 0;
        while ($oItem = &$this->Next()) {
            $bIncludeProduct = $oDiscount->AllowDiscountForArticle($oItem);
            if ($bIncludeProduct) {
                $iAmount = $iAmount + $oItem->dAmount;
            }
        }
        $this->setItemPointer($iCurrentPosition);

        return $iAmount;
    }
176332
protected function _basketDifference(\OxidEsales\Eshop\Application\Model\Basket $oBasket)
    {
        $aDiff = $this->_getReservedItems();
        // refreshing history
        foreach ($oBasket->getContents() as $oItem) {
            $sProdId = $oItem->getProductId();
            if (!isset($aDiff[$sProdId])) {
                $aDiff[$sProdId] = -$oItem->getAmount();
            } else {
                $aDiff[$sProdId] -= $oItem->getAmount();
            }
        }

        return $aDiff;
    }