src/ShopBundle/objects/db/TShopShippingGroup.class.php
public function GetShippingCostsForBasketArticleListAndCountry($oBasketArticleList, $sDataCountryId)
    {
        /** @var Request $request */
        $request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest();

        $oBasketArticleList->GoToStart();

        $oOldBasket = clone TShopBasket::GetInstance();
        $oOldUser = clone TdbDataExtranetUser::GetInstance();

        $oTmpBasket = new TShopBasket();
        $request->getSession()->set(TShopBasket::SESSION_KEY_NAME, $oTmpBasket);

        $oTmpUser = TdbDataExtranetUser::GetNewInstance();

        $oTmpShippingAddress = TdbDataExtranetUserAddress::GetNewInstance();
        $oTmpShippingAddress->fieldDataCountryId = $sDataCountryId;
        $oTmpShippingAddress->sqlData['data_country_id'] = $sDataCountryId;
        $oTmpShippingAddress->sqlData['lastname'] = 'Dummy';
        $oTmpShippingAddress->fieldLastname = 'Dummy';
        $oTmpShippingAddress->sqlData['city'] = 'Dummy';

        $oTmpUser->setFakedShippingAddressForUser($oTmpShippingAddress);

        $oTmpUser->fieldDataCountryId = $sDataCountryId;
        $oTmpUser->sqlData['data_country_id'] = $sDataCountryId;
        $oTmpUser->sqlData['lastname'] = 'Dummy';
        $oTmpUser->sqlData['city'] = 'Dummy';

        $request->getSession()->set(TdbDataExtranetUser::SESSION_KEY_NAME, $oTmpUser);

        while ($oBasketArticle = $oBasketArticleList->Next()) {
            $oTmpBasket->AddItem($oBasketArticle);
        }

        $oTmpBasket->SetActiveShippingGroup($this);

        $oTmpBasket->RecalculateBasket();
        $oTmpBasket->ResetAllShippingMarkers();

        $dShippingCosts = $oTmpBasket->dCostShipping;

        $request->getSession()->set(TShopBasket::SESSION_KEY_NAME, $oOldBasket);
        $request->getSession()->set(TdbDataExtranetUser::SESSION_KEY_NAME, $oOldUser);

        return $dShippingCosts;
    }
public function GetShippingCostsForBasketArticleListAndCountry($oBasketArticleList, $sDataCountryId)
    {
        /** @var Request $request */
        $request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest();

        $oBasketArticleList->GoToStart();

        $oOldBasket = clone TShopBasket::GetInstance();
        $oOldUser = clone TdbDataExtranetUser::GetInstance();

        $oTmpBasket = new TShopBasket();
        $request->getSession()->set(TShopBasket::SESSION_KEY_NAME, $oTmpBasket);

        $oTmpUser = TdbDataExtranetUser::GetNewInstance();

        $oTmpShippingAddress = TdbDataExtranetUserAddress::GetNewInstance();
        $oTmpShippingAddress->fieldDataCountryId = $sDataCountryId;
        $oTmpShippingAddress->sqlData['data_country_id'] = $sDataCountryId;
        $oTmpShippingAddress->sqlData['lastname'] = 'Dummy';
        $oTmpShippingAddress->fieldLastname = 'Dummy';
        $oTmpShippingAddress->sqlData['city'] = 'Dummy';

        $oTmpUser->setFakedShippingAddressForUser($oTmpShippingAddress);

        $oTmpUser->fieldDataCountryId = $sDataCountryId;
        $oTmpUser->sqlData['data_country_id'] = $sDataCountryId;
        $oTmpUser->sqlData['lastname'] = 'Dummy';
        $oTmpUser->sqlData['city'] = 'Dummy';

        $request->getSession()->set(TdbDataExtranetUser::SESSION_KEY_NAME, $oTmpUser);

        while ($oBasketArticle = $oBasketArticleList->Next()) {
            $oTmpBasket->AddItem($oBasketArticle);
        }

        $oTmpBasket->SetActiveShippingGroup($this);

        $oTmpBasket->RecalculateBasket();
        $oTmpBasket->ResetAllShippingMarkers();

        $dShippingCosts = $oTmpBasket->dCostShipping;

        $request->getSession()->set(TShopBasket::SESSION_KEY_NAME, $oOldBasket);
        $request->getSession()->set(TdbDataExtranetUser::SESSION_KEY_NAME, $oOldUser);

        return $dShippingCosts;
    }
public function GetShippingCostsForBasketArticleListAndCountry ( $ oBasketArticleList , $ sDataCountryId ) { /** @var Request $request */ $ request = \ ChameleonSystem \ CoreBundle \ ServiceLocator :: get ( 'request_stack' ) -> getCurrentRequest ( ) ; $ oBasketArticleList -> GoToStart ( ) ; $ oOldBasket = clone TShopBasket :: GetInstance ( ) ; $ oOldUser = clone TdbDataExtranetUser :: GetInstance ( ) ; $ oTmpBasket = new TShopBasket ( ) ; $ request -> getSession ( ) -> set ( TShopBasket :: SESSION_KEY_NAME , $ oTmpBasket ) ; $ oTmpUser = TdbDataExtranetUser :: GetNewInstance ( ) ; $ oTmpShippingAddress = TdbDataExtranetUserAddress :: GetNewInstance ( ) ; $ oTmpShippingAddress -> fieldDataCountryId = $ sDataCountryId ; $ oTmpShippingAddress -> sqlData [ 'data_country_id' ] = $ sDataCountryId ; $ oTmpShippingAddress -> sqlData [ 'lastname' ] = 'Dummy' ; $ oTmpShippingAddress -> fieldLastname = 'Dummy' ; $ oTmpShippingAddress -> sqlData [ 'city' ] = 'Dummy' ; $ oTmpUser -> setFakedShippingAddressForUser ( $ oTmpShippingAddress ) ; $ oTmpUser -> fieldDataCountryId = $ sDataCountryId ; $ oTmpUser -> sqlData [ 'data_country_id' ] = $ sDataCountryId ; $ oTmpUser -> sqlData [ 'lastname' ] = 'Dummy' ; $ oTmpUser -> sqlData [ 'city' ] = 'Dummy' ; $ request -> getSession ( ) -> set ( TdbDataExtranetUser :: SESSION_KEY_NAME , $ oTmpUser ) ; while ( $ oBasketArticle = $ oBasketArticleList -> Next ( ) ) { $ oTmpBasket -> AddItem ( $ oBasketArticle ) ; } $ oTmpBasket -> SetActiveShippingGroup ( $ this ) ; $ oTmpBasket -> RecalculateBasket ( ) ; $ oTmpBasket -> ResetAllShippingMarkers ( ) ; $ dShippingCosts = $ oTmpBasket -> dCostShipping ; $ request -> getSession ( ) -> set ( TShopBasket :: SESSION_KEY_NAME , $ oOldBasket ) ; $ request -> getSession ( ) -> set ( TdbDataExtranetUser :: SESSION_KEY_NAME , $ oOldUser ) ; return $ dShippingCosts ; }
Calculate the shipping costs for a basket article list to be expected for a certain shipping country id.

@param TShopBasketArticleList $oBasketArticleList
@param string                 $sDataCountryId

@return float
Calculate the shipping costs for a basket article list to be expected for a certain shipping country id .