コード例 #1
0
ファイル: ProductCollection.php プロジェクト: Aziz-JH/core
 /**
  * Initialize a new collection and duplicate everything from the source
  * @param   IsotopeProductCollection
  */
 public static function createFromCollection(IsotopeProductCollection $objSource)
 {
     global $objPage;
     $objCollection = new static();
     $objConfig = $objSource->getRelated('config_id');
     if (null === $objConfig) {
         $objConfig = Isotope::getConfig();
     }
     $objCollection->uniqid = uniqid(Haste::getInstance()->call('replaceInsertTags', array((string) $objConfig->orderPrefix, false)), true);
     $objCollection->source_collection_id = (int) $objSource->id;
     $objCollection->config_id = (int) $objConfig->id;
     $objCollection->store_id = (int) $objSource->store_id;
     $objCollection->member = (int) $objSource->member;
     $objCollection->language = (string) $GLOBALS['TL_LANGUAGE'];
     $objCollection->currency = (string) $objConfig->currency;
     $objCollection->pageId = (int) $objPage->id;
     $objCollection->setShippingMethod($objSource->getShippingMethod());
     $objCollection->setPaymentMethod($objSource->getPaymentMethod());
     $objCollection->setShippingAddress($objSource->getShippingAddress());
     $objCollection->setBillingAddress($objSource->getBillingAddress());
     $arrItemIds = $objCollection->copyItemsFrom($objSource);
     $arrSurchargeIds = $objCollection->copySurchargesFrom($objSource, $arrItemIds);
     $objCollection->updateDatabase();
     // HOOK: order status has been updated
     if (isset($GLOBALS['ISO_HOOKS']['createFromProductCollection']) && is_array($GLOBALS['ISO_HOOKS']['createFromProductCollection'])) {
         foreach ($GLOBALS['ISO_HOOKS']['createFromProductCollection'] as $callback) {
             $objCallback = \System::importStatic($callback[0]);
             $objCallback->{$callback}[1]($objCollection, $objSource, $arrItemIds, $arrSurchargeIds);
         }
     }
     return $objCollection;
 }
コード例 #2
0
ファイル: ProductCollection.php プロジェクト: rpquadrat/core
 /**
  * Initialize a new collection and duplicate everything from the source
  *
  * @param IsotopeProductCollection $objSource
  *
  * @return static
  */
 public static function createFromCollection(IsotopeProductCollection $objSource)
 {
     $objCollection = new static();
     $objConfig = $objSource->getRelated('config_id');
     if (null === $objConfig) {
         $objConfig = Isotope::getConfig();
     }
     $objCollection->source_collection_id = (int) $objSource->id;
     $objCollection->config_id = (int) $objConfig->id;
     $objCollection->store_id = (int) $objSource->store_id;
     $objCollection->member = (int) $objSource->member;
     $objCollection->setShippingMethod($objSource->getShippingMethod());
     $objCollection->setPaymentMethod($objSource->getPaymentMethod());
     $objCollection->setShippingAddress($objSource->getShippingAddress());
     $objCollection->setBillingAddress($objSource->getBillingAddress());
     $arrItemIds = $objCollection->copyItemsFrom($objSource);
     $objCollection->updateDatabase();
     // HOOK: order status has been updated
     if (isset($GLOBALS['ISO_HOOKS']['createFromProductCollection']) && is_array($GLOBALS['ISO_HOOKS']['createFromProductCollection'])) {
         foreach ($GLOBALS['ISO_HOOKS']['createFromProductCollection'] as $callback) {
             $objCallback = \System::importStatic($callback[0]);
             $objCallback->{$callback}[1]($objCollection, $objSource, $arrItemIds);
         }
     }
     return $objCollection;
 }