src/ShopBundle/objects/db/TShopShippingTypeList.class.php
public static function &GetAvailableTypes($iGroupId)
    {
        $shippingTypeDataAccess = self::getShippingTypeDataAccess();
        $shopService = self::getShopService();

        $oUser = self::getExtranetUserProvider()->getActiveUser();
        $oShippingAddress = $oUser->GetShippingAddress();
        $sActiveShippingCountryId = '';
        if ($oShippingAddress) {
            $sActiveShippingCountryId = $oShippingAddress->fieldDataCountryId;
        }
        if (true === empty($sActiveShippingCountryId)) {
            // use default country
            $oShop = $shopService->getActiveShop();
            if ($oShop) {
                $sActiveShippingCountryId = $oShop->fieldDataCountryId;
            }
        }
        $rows = $shippingTypeDataAccess->getAvailableShippingTypes($iGroupId, $sActiveShippingCountryId, $shopService->getActiveBasket());

        $idList = array();
        $oBasket = TShopBasket::GetInstance();
        $oBasket->ResetAllShippingMarkers(); // once we are done, we want to clear the marker again
        foreach ($rows as $row) {
            $item = TdbShopShippingType::GetNewInstance($row);
            if ($item->IsAvailable()) {
                $idList[] = $item->id;
            }
        }

        $query = 'SELECT * FROM `shop_shipping_type` WHERE `id` IN (:idList) ORDER BY `position`';
        $oList = new TdbShopShippingTypeList();
        $oList->Load($query, array('idList' => $idList), array('idList' => Connection::PARAM_STR_ARRAY));
        $oList->bAllowItemCache = true;

        $oList->RemoveInvalidItems();

        return $oList;
    }
public static function &GetAvailableTypes($iGroupId)
    {
        $shippingTypeDataAccess = self::getShippingTypeDataAccess();
        $shopService = self::getShopService();

        $oUser = self::getExtranetUserProvider()->getActiveUser();
        $oShippingAddress = $oUser->GetShippingAddress();
        $sActiveShippingCountryId = '';
        if ($oShippingAddress) {
            $sActiveShippingCountryId = $oShippingAddress->fieldDataCountryId;
        }
        if (true === empty($sActiveShippingCountryId)) {
            // use default country
            $oShop = $shopService->getActiveShop();
            if ($oShop) {
                $sActiveShippingCountryId = $oShop->fieldDataCountryId;
            }
        }
        $rows = $shippingTypeDataAccess->getAvailableShippingTypes($iGroupId, $sActiveShippingCountryId, $shopService->getActiveBasket());

        $idList = array();
        $oBasket = TShopBasket::GetInstance();
        $oBasket->ResetAllShippingMarkers(); // once we are done, we want to clear the marker again
        foreach ($rows as $row) {
            $item = TdbShopShippingType::GetNewInstance($row);
            if ($item->IsAvailable()) {
                $idList[] = $item->id;
            }
        }

        $query = 'SELECT * FROM `shop_shipping_type` WHERE `id` IN (:idList) ORDER BY `position`';
        $oList = new TdbShopShippingTypeList();
        $oList->Load($query, array('idList' => $idList), array('idList' => Connection::PARAM_STR_ARRAY));
        $oList->bAllowItemCache = true;

        $oList->RemoveInvalidItems();

        return $oList;
    }
public static function & GetAvailableTypes ( $ iGroupId ) { $ shippingTypeDataAccess = self :: getShippingTypeDataAccess ( ) ; $ shopService = self :: getShopService ( ) ; $ oUser = self :: getExtranetUserProvider ( ) -> getActiveUser ( ) ; $ oShippingAddress = $ oUser -> GetShippingAddress ( ) ; $ sActiveShippingCountryId = '' ; if ( $ oShippingAddress ) { $ sActiveShippingCountryId = $ oShippingAddress -> fieldDataCountryId ; } if ( true === empty ( $ sActiveShippingCountryId ) ) { // use default country $ oShop = $ shopService -> getActiveShop ( ) ; if ( $ oShop ) { $ sActiveShippingCountryId = $ oShop -> fieldDataCountryId ; } } $ rows = $ shippingTypeDataAccess -> getAvailableShippingTypes ( $ iGroupId , $ sActiveShippingCountryId , $ shopService -> getActiveBasket ( ) ) ; $ idList = array ( ) ; $ oBasket = TShopBasket :: GetInstance ( ) ; $ oBasket -> ResetAllShippingMarkers ( ) ; // once we are done, we want to clear the marker again foreach ( $ rows as $ row ) { $ item = TdbShopShippingType :: GetNewInstance ( $ row ) ; if ( $ item -> IsAvailable ( ) ) { $ idList [ ] = $ item -> id ; } } $ query = 'SELECT * FROM `shop_shipping_type` WHERE `id` IN (:idList) ORDER BY `position`' ; $ oList = new TdbShopShippingTypeList ( ) ; $ oList -> Load ( $ query , array ( 'idList' => $ idList ) , array ( 'idList' => Connection :: PARAM_STR_ARRAY ) ) ; $ oList -> bAllowItemCache = true ; $ oList -> RemoveInvalidItems ( ) ; return $ oList ; }
return list of shipping types that match the given group, the current basket,
and the current user.

@param int $iGroupId

@return TdbShopShippingTypeList
return list of shipping types that match the given group the current basket and the current user .