public function getOfferMinPrice($sPriceTypeCode = null)
    {
        $obProductList = clone $this;

        $sSorting = ProductListStore::SORT_PRICE_ASC;
        if (!empty($sPriceTypeCode)) {
            $sSorting .= '|'.$sPriceTypeCode;
        }

        $obProductList->sort($sSorting);

        //Get product with min price
        /** @var \Lovata\Shopaholic\Classes\Item\ProductItem $obProductItem */
        $obProductItem = $obProductList->first();

        if ($obProductItem->isEmpty()) {
            return OfferItem::make(null);
        }

        //Get offer with min price
        $obOfferCollection = $obProductItem->offer;
        if ($obOfferCollection->isEmpty()) {
            return OfferItem::make(null);
        }

        $sSorting = OfferListStore::SORT_PRICE_ASC;
        if (!empty($sPriceTypeCode)) {
            $sSorting .= '|'.$sPriceTypeCode;
        }

        /** @var OfferItem $obOfferItem */
        $obOfferItem = $obOfferCollection->sort($sSorting)->first();

        return $obOfferItem;
    }
public function getOfferMinPrice($sPriceTypeCode = null)
    {
        $obProductList = clone $this;

        $sSorting = ProductListStore::SORT_PRICE_ASC;
        if (!empty($sPriceTypeCode)) {
            $sSorting .= '|'.$sPriceTypeCode;
        }

        $obProductList->sort($sSorting);

        //Get product with min price
        /** @var \Lovata\Shopaholic\Classes\Item\ProductItem $obProductItem */
        $obProductItem = $obProductList->first();

        if ($obProductItem->isEmpty()) {
            return OfferItem::make(null);
        }

        //Get offer with min price
        $obOfferCollection = $obProductItem->offer;
        if ($obOfferCollection->isEmpty()) {
            return OfferItem::make(null);
        }

        $sSorting = OfferListStore::SORT_PRICE_ASC;
        if (!empty($sPriceTypeCode)) {
            $sSorting .= '|'.$sPriceTypeCode;
        }

        /** @var OfferItem $obOfferItem */
        $obOfferItem = $obOfferCollection->sort($sSorting)->first();

        return $obOfferItem;
    }
public function getOfferMinPrice ( $ sPriceTypeCode = null ) { $ obProductList = clone $ this ; $ sSorting = ProductListStore :: SORT_PRICE_ASC ; if ( ! empty ( $ sPriceTypeCode ) ) { $ sSorting .= '|' . $ sPriceTypeCode ; } $ obProductList -> sort ( $ sSorting ) ; //Get product with min price /** @var \Lovata\Shopaholic\Classes\Item\ProductItem $obProductItem */ $ obProductItem = $ obProductList -> first ( ) ; if ( $ obProductItem -> isEmpty ( ) ) { return OfferItem :: make ( null ) ; } //Get offer with min price $ obOfferCollection = $ obProductItem -> offer ; if ( $ obOfferCollection -> isEmpty ( ) ) { return OfferItem :: make ( null ) ; } $ sSorting = OfferListStore :: SORT_PRICE_ASC ; if ( ! empty ( $ sPriceTypeCode ) ) { $ sSorting .= '|' . $ sPriceTypeCode ; } /** @var OfferItem $obOfferItem */ $ obOfferItem = $ obOfferCollection -> sort ( $ sSorting ) -> first ( ) ; return $ obOfferItem ; }
Get offer with min price
@param string $sPriceTypeCode
@return OfferItem
Get offer with min price