src/ShopBundle/objects/db/TShopOrder.class.php
protected function &SaveArticle(TShopBasketArticle $oBasketItem)
    {
        $oVat = $oBasketItem->GetVat();
        $oOrderItem = TdbShopOrderItem::GetNewInstance();
        /** @var $oOrderItem TdbShopOrderItem */
        $oManufacturer = TdbShopManufacturer::GetNewInstance();
        $oManufacturer->Load($oBasketItem->fieldShopManufacturerId);
        $aData = array(
            'shop_order_id' => $this->id,
            'basket_item_key' => $oBasketItem->sBasketItemKey,
            'shop_article_id' => $oBasketItem->id,
            'name' => $oBasketItem->fieldName,
            'name_variant_info' => $oBasketItem->fieldNameVariantInfo,
            'articlenumber' => $oBasketItem->fieldArticlenumber,
            'description_short' => $oBasketItem->fieldDescriptionShort,
            'description' => $oBasketItem->fieldDescription,
            'shop_manufacturer_id' => $oBasketItem->fieldShopManufacturerId,
            'shop_manufacturer_name' => $oManufacturer->GetName(),
            'price' => $oBasketItem->fieldPrice,
            'price_reference' => $oBasketItem->fieldPriceReference,
            'vat_percent' => $oVat->fieldVatPercent,
            'size_weight' => $oBasketItem->fieldSizeWeight,
            'size_width' => $oBasketItem->fieldSizeWidth,
            'size_height' => $oBasketItem->fieldSizeHeight,
            'size_length' => $oBasketItem->fieldSizeLength,
            'stock' => $oBasketItem->getAvailableStock(),
            'virtual_article' => $oBasketItem->sqlData['virtual_article'],
            'exclude_from_vouchers' => $oBasketItem->sqlData['exclude_from_vouchers'],
            'subtitle' => $oBasketItem->fieldSubtitle,
            'is_new' => $oBasketItem->sqlData['is_new'],
            'usp' => $oBasketItem->fieldUsp,
            'is_bundle' => $oBasketItem->sqlData['is_bundle'],
            'order_amount' => $oBasketItem->dAmount,
            'order_price' => $oBasketItem->dPrice,
            'order_price_total' => $oBasketItem->dPriceTotal,
            'order_price_after_discounts' => $oBasketItem->dPriceTotalAfterDiscount,
            'order_total_weight' => $oBasketItem->dTotalWeight,
            'order_total_volume' => $oBasketItem->dTotalVolume,
            'download' => $oBasketItem->fieldDownload,
            'price_discounted' => $oBasketItem->dPriceAfterDiscount,
            'exclude_from_discounts' => $oBasketItem->sqlData['exclude_from_discounts'],
            'quantity_in_units' => $oBasketItem->fieldQuantityInUnits,
            'shop_unit_of_measurement_id' => $oBasketItem->fieldShopUnitOfMeasurementId,
            'custom_data' => $oBasketItem->getCustomData(),
        );
        $this->PrepareArticleDataForSave($oBasketItem, $aData);
        $oOrderItem->LoadFromRow($aData);
        $oOrderItem->AllowEditByAll(true);
        $iInsertedOrderArticleId = $oOrderItem->Save();

        //Linking the downloads from BasketItem to OrderItem
        $oDownloadFilesList = $oBasketItem->GetDownloads('download');
        while ($oDownloadFile = $oDownloadFilesList->Next()) {
            $sQuery = "INSERT INTO `shop_order_item_download_cms_document_mlt`
                           SET `source_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iInsertedOrderArticleId)."',
                               `target_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oDownloadFile->id)."'";
            MySqlLegacySupport::getInstance()->query($sQuery);
        }

        if ($oBasketItem->fieldIsBundle) {
            // also save bundle articles
            $oBundleArticles = $oBasketItem->GetFieldShopBundleArticleList();
            while ($oBundleArticle = $oBundleArticles->Next()) {
                $this->SaveBundleArticle($oBasketItem, $oOrderItem, $oBundleArticle);
            }
        }

        return $oOrderItem;
    }
protected function &SaveArticle(TShopBasketArticle $oBasketItem)
    {
        $oVat = $oBasketItem->GetVat();
        $oOrderItem = TdbShopOrderItem::GetNewInstance();
        /** @var $oOrderItem TdbShopOrderItem */
        $oManufacturer = TdbShopManufacturer::GetNewInstance();
        $oManufacturer->Load($oBasketItem->fieldShopManufacturerId);
        $aData = array(
            'shop_order_id' => $this->id,
            'basket_item_key' => $oBasketItem->sBasketItemKey,
            'shop_article_id' => $oBasketItem->id,
            'name' => $oBasketItem->fieldName,
            'name_variant_info' => $oBasketItem->fieldNameVariantInfo,
            'articlenumber' => $oBasketItem->fieldArticlenumber,
            'description_short' => $oBasketItem->fieldDescriptionShort,
            'description' => $oBasketItem->fieldDescription,
            'shop_manufacturer_id' => $oBasketItem->fieldShopManufacturerId,
            'shop_manufacturer_name' => $oManufacturer->GetName(),
            'price' => $oBasketItem->fieldPrice,
            'price_reference' => $oBasketItem->fieldPriceReference,
            'vat_percent' => $oVat->fieldVatPercent,
            'size_weight' => $oBasketItem->fieldSizeWeight,
            'size_width' => $oBasketItem->fieldSizeWidth,
            'size_height' => $oBasketItem->fieldSizeHeight,
            'size_length' => $oBasketItem->fieldSizeLength,
            'stock' => $oBasketItem->getAvailableStock(),
            'virtual_article' => $oBasketItem->sqlData['virtual_article'],
            'exclude_from_vouchers' => $oBasketItem->sqlData['exclude_from_vouchers'],
            'subtitle' => $oBasketItem->fieldSubtitle,
            'is_new' => $oBasketItem->sqlData['is_new'],
            'usp' => $oBasketItem->fieldUsp,
            'is_bundle' => $oBasketItem->sqlData['is_bundle'],
            'order_amount' => $oBasketItem->dAmount,
            'order_price' => $oBasketItem->dPrice,
            'order_price_total' => $oBasketItem->dPriceTotal,
            'order_price_after_discounts' => $oBasketItem->dPriceTotalAfterDiscount,
            'order_total_weight' => $oBasketItem->dTotalWeight,
            'order_total_volume' => $oBasketItem->dTotalVolume,
            'download' => $oBasketItem->fieldDownload,
            'price_discounted' => $oBasketItem->dPriceAfterDiscount,
            'exclude_from_discounts' => $oBasketItem->sqlData['exclude_from_discounts'],
            'quantity_in_units' => $oBasketItem->fieldQuantityInUnits,
            'shop_unit_of_measurement_id' => $oBasketItem->fieldShopUnitOfMeasurementId,
            'custom_data' => $oBasketItem->getCustomData(),
        );
        $this->PrepareArticleDataForSave($oBasketItem, $aData);
        $oOrderItem->LoadFromRow($aData);
        $oOrderItem->AllowEditByAll(true);
        $iInsertedOrderArticleId = $oOrderItem->Save();

        //Linking the downloads from BasketItem to OrderItem
        $oDownloadFilesList = $oBasketItem->GetDownloads('download');
        while ($oDownloadFile = $oDownloadFilesList->Next()) {
            $sQuery = "INSERT INTO `shop_order_item_download_cms_document_mlt`
                           SET `source_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iInsertedOrderArticleId)."',
                               `target_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oDownloadFile->id)."'";
            MySqlLegacySupport::getInstance()->query($sQuery);
        }

        if ($oBasketItem->fieldIsBundle) {
            // also save bundle articles
            $oBundleArticles = $oBasketItem->GetFieldShopBundleArticleList();
            while ($oBundleArticle = $oBundleArticles->Next()) {
                $this->SaveBundleArticle($oBasketItem, $oOrderItem, $oBundleArticle);
            }
        }

        return $oOrderItem;
    }
protected function & SaveArticle ( TShopBasketArticle $ oBasketItem ) { $ oVat = $ oBasketItem -> GetVat ( ) ; $ oOrderItem = TdbShopOrderItem :: GetNewInstance ( ) ; /** @var $oOrderItem TdbShopOrderItem */ $ oManufacturer = TdbShopManufacturer :: GetNewInstance ( ) ; $ oManufacturer -> Load ( $ oBasketItem -> fieldShopManufacturerId ) ; $ aData = array ( 'shop_order_id' => $ this -> id , 'basket_item_key' => $ oBasketItem -> sBasketItemKey , 'shop_article_id' => $ oBasketItem -> id , 'name' => $ oBasketItem -> fieldName , 'name_variant_info' => $ oBasketItem -> fieldNameVariantInfo , 'articlenumber' => $ oBasketItem -> fieldArticlenumber , 'description_short' => $ oBasketItem -> fieldDescriptionShort , 'description' => $ oBasketItem -> fieldDescription , 'shop_manufacturer_id' => $ oBasketItem -> fieldShopManufacturerId , 'shop_manufacturer_name' => $ oManufacturer -> GetName ( ) , 'price' => $ oBasketItem -> fieldPrice , 'price_reference' => $ oBasketItem -> fieldPriceReference , 'vat_percent' => $ oVat -> fieldVatPercent , 'size_weight' => $ oBasketItem -> fieldSizeWeight , 'size_width' => $ oBasketItem -> fieldSizeWidth , 'size_height' => $ oBasketItem -> fieldSizeHeight , 'size_length' => $ oBasketItem -> fieldSizeLength , 'stock' => $ oBasketItem -> getAvailableStock ( ) , 'virtual_article' => $ oBasketItem -> sqlData [ 'virtual_article' ] , 'exclude_from_vouchers' => $ oBasketItem -> sqlData [ 'exclude_from_vouchers' ] , 'subtitle' => $ oBasketItem -> fieldSubtitle , 'is_new' => $ oBasketItem -> sqlData [ 'is_new' ] , 'usp' => $ oBasketItem -> fieldUsp , 'is_bundle' => $ oBasketItem -> sqlData [ 'is_bundle' ] , 'order_amount' => $ oBasketItem -> dAmount , 'order_price' => $ oBasketItem -> dPrice , 'order_price_total' => $ oBasketItem -> dPriceTotal , 'order_price_after_discounts' => $ oBasketItem -> dPriceTotalAfterDiscount , 'order_total_weight' => $ oBasketItem -> dTotalWeight , 'order_total_volume' => $ oBasketItem -> dTotalVolume , 'download' => $ oBasketItem -> fieldDownload , 'price_discounted' => $ oBasketItem -> dPriceAfterDiscount , 'exclude_from_discounts' => $ oBasketItem -> sqlData [ 'exclude_from_discounts' ] , 'quantity_in_units' => $ oBasketItem -> fieldQuantityInUnits , 'shop_unit_of_measurement_id' => $ oBasketItem -> fieldShopUnitOfMeasurementId , 'custom_data' => $ oBasketItem -> getCustomData ( ) , ) ; $ this -> PrepareArticleDataForSave ( $ oBasketItem , $ aData ) ; $ oOrderItem -> LoadFromRow ( $ aData ) ; $ oOrderItem -> AllowEditByAll ( true ) ; $ iInsertedOrderArticleId = $ oOrderItem -> Save ( ) ; //Linking the downloads from BasketItem to OrderItem $ oDownloadFilesList = $ oBasketItem -> GetDownloads ( 'download' ) ; while ( $ oDownloadFile = $ oDownloadFilesList -> Next ( ) ) { $ sQuery = "INSERT INTO `shop_order_item_download_cms_document_mlt`
                           SET `source_id` = '" . MySqlLegacySupport :: getInstance ( ) -> real_escape_string ( $ iInsertedOrderArticleId ) . "',
                               `target_id` = '" . MySqlLegacySupport :: getInstance ( ) -> real_escape_string ( $ oDownloadFile -> id ) . "'" ; MySqlLegacySupport :: getInstance ( ) -> query ( $ sQuery ) ; } if ( $ oBasketItem -> fieldIsBundle ) { // also save bundle articles $ oBundleArticles = $ oBasketItem -> GetFieldShopBundleArticleList ( ) ; while ( $ oBundleArticle = $ oBundleArticles -> Next ( ) ) { $ this -> SaveBundleArticle ( $ oBasketItem , $ oOrderItem , $ oBundleArticle ) ; } } return $ oOrderItem ; }
store one article with order.

@param TShopBasketArticle $oBasketItem

@return TdbShopOrderItem
store one article with order .