/** * Saves the services of the order to the storage. * * @param MShop_Order_Item_Base_Interface $basket Basket containing service items */ protected function _storeServices(MShop_Order_Item_Base_Interface $basket) { $manager = $this->getSubManager('service'); $attrManager = $manager->getSubManager('attribute'); foreach ($basket->getServices() as $type => $item) { $item->setBaseId($basket->getId()); $item->setType($type); $manager->saveItem($item); foreach ($item->getAttributes() as $attribute) { $attribute->setServiceId($item->getId()); $attrManager->saveItem($attribute); } } }
protected function loadDownloadAttrList(MShop_Order_Item_Base_Interface $order, $context) { $downloads = array(); $downloadManager = MShop_Factory::createManager($context, 'download'); foreach ($order->getProducts() as $product) { $search = $downloadManager->createSearch(true); $expr = array($search->compare('==', 'download.prodid', $product->getId()), $search->compare('==', 'download.orderid', $order->getId()), $search->getConditions()); $search->setConditions($search->combine('&&', $expr)); $dlList = $downloadManager->searchItems($search); if (count($dlList) > 0) { $download = reset($dlList); $downloads[$product->getId()] = $download->getFileId(); } } return $downloads; }