当前位置: 首页>>代码示例>>PHP>>正文


PHP eZProductCollectionItem::definition方法代码示例

本文整理汇总了PHP中eZProductCollectionItem::definition方法的典型用法代码示例。如果您正苦于以下问题:PHP eZProductCollectionItem::definition方法的具体用法?PHP eZProductCollectionItem::definition怎么用?PHP eZProductCollectionItem::definition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZProductCollectionItem的用法示例。


在下文中一共展示了eZProductCollectionItem::definition方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: items

 function items($asObject = true, $alternativeProductionID = false, $offset = false, $limit = false)
 {
     $productItems = eZPersistentObject::fetchObjectList(eZProductCollectionItem::definition(), null, array('productcollection_id' => $alternativeProductionID === false ? $this->ProductCollectionID : $alternativeProductionID), null, array('offset' => $offset, 'length' => $limit), $asObject);
     //        $discountPercent = $this->discountPercent();
     $addedProducts = array();
     foreach ($productItems as $productItem) {
         $discountPercent = 0.0;
         $isVATIncluded = true;
         $id = $productItem->attribute('id');
         $contentObject = $productItem->attribute('contentobject');
         //if the node is put into trash/delete, don't fetch it
         if ($contentObject !== null && $contentObject->attribute('main_node_id') !== null) {
             $vatValue = $productItem->attribute('vat_value');
             $count = $productItem->attribute('item_count');
             $discountPercent = $productItem->attribute('discount');
             $nodeID = $contentObject->attribute('main_node_id');
             $objectName = $contentObject->attribute('name');
             $isVATIncluded = $productItem->attribute('is_vat_inc');
             $price = $productItem->attribute('price');
             if ($isVATIncluded) {
                 $priceExVAT = $price / (100 + $vatValue) * 100;
                 $priceIncVAT = $price;
             } else {
                 $priceExVAT = $price;
                 $priceIncVAT = $price * (100 + $vatValue) / 100;
             }
             $totalPriceExVAT = $count * $priceExVAT * (100 - $discountPercent) / 100;
             $totalPriceIncVAT = $count * $priceIncVAT * (100 - $discountPercent) / 100;
             $addedProduct = array("id" => $id, "vat_value" => $vatValue, "item_count" => $count, "node_id" => $nodeID, "object_name" => $objectName, "price_ex_vat" => $priceExVAT, "price_inc_vat" => $priceIncVAT, "discount_percent" => $discountPercent, "total_price_ex_vat" => $totalPriceExVAT, "total_price_inc_vat" => $totalPriceIncVAT, 'item_object' => $productItem);
             $addedProducts[] = $addedProduct;
         }
     }
     return $addedProducts;
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:34,代码来源:ezwishlist.php

示例2: fetchList

 static function fetchList($conditions = null, $asObjects = true, $offset = false, $limit = false)
 {
     $limitation = null;
     if ($offset !== false or $limit !== false) {
         $limitation = array('offset' => $offset, 'length' => $limit);
     }
     return eZPersistentObject::fetchObjectList(eZProductCollectionItem::definition(), null, $conditions, null, $limitation, $asObjects);
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:8,代码来源:ezproductcollectionitem.php

示例3: items

 /**
  * Fetch basket items (ordered by object id by default)
  *
  * @param bool $asObject
  * @param array|null $sorts Array with sort data sent directly to {@link eZPersistentObject::fetchObjectList()}
  */
 function items($asObject = true, $sorts = array('contentobject_id' => 'desc'))
 {
     $productItems = eZPersistentObject::fetchObjectList(eZProductCollectionItem::definition(), null, array('productcollection_id' => $this->ProductCollectionID), $sorts, null, $asObject);
     $addedProducts = array();
     foreach ($productItems as $productItem) {
         $discountPercent = 0.0;
         $isVATIncluded = true;
         $id = $productItem->attribute('id');
         $contentObject = $productItem->attribute('contentobject');
         if ($contentObject !== null) {
             $vatValue = $productItem->attribute('vat_value');
             // If VAT is unknown yet then we use zero VAT percentage for price calculation.
             $realVatValue = $vatValue;
             if ($vatValue == -1) {
                 $vatValue = 0;
             }
             $count = $productItem->attribute('item_count');
             $discountPercent = $productItem->attribute('discount');
             $nodeID = $contentObject->attribute('main_node_id');
             $objectName = $contentObject->name(false, $contentObject->currentLanguage());
             $isVATIncluded = $productItem->attribute('is_vat_inc');
             $price = $productItem->attribute('price');
             if ($isVATIncluded) {
                 $priceExVAT = $price / (100 + $vatValue) * 100;
                 $priceIncVAT = $price;
                 $totalPriceExVAT = $count * $priceExVAT * (100 - $discountPercent) / 100;
                 $totalPriceIncVAT = $count * $priceIncVAT * (100 - $discountPercent) / 100;
             } else {
                 $priceExVAT = $price;
                 $priceIncVAT = $price * (100 + $vatValue) / 100;
                 $totalPriceExVAT = $count * $priceExVAT * (100 - $discountPercent) / 100;
                 $totalPriceIncVAT = $count * $priceIncVAT * (100 - $discountPercent) / 100;
             }
             $addedProduct = array("id" => $id, "vat_value" => $realVatValue, "item_count" => $count, "node_id" => $nodeID, "object_name" => $objectName, "price_ex_vat" => $priceExVAT, "price_inc_vat" => $priceIncVAT, "discount_percent" => $discountPercent, "total_price_ex_vat" => $totalPriceExVAT, "total_price_inc_vat" => $totalPriceIncVAT, 'item_object' => $productItem);
             $addedProducts[] = $addedProduct;
         }
     }
     return $addedProducts;
 }
开发者ID:rmiguel,项目名称:ezpublish,代码行数:45,代码来源:ezbasket.php

示例4: verify

 static function verify($id)
 {
     $invalidItemArray = array();
     $collection = eZProductCollection::fetch($id);
     if (!is_object($collection)) {
         return $invalidItemArray;
     }
     $currency = $collection->attribute('currency_code');
     $productItemList = eZPersistentObject::fetchObjectList(eZProductCollectionItem::definition(), null, array("productcollection_id" => $id), null, null, true);
     $isValid = true;
     foreach ($productItemList as $productItem) {
         if (!$productItem->verify($currency)) {
             $invalidItemArray[] = $productItem;
             $isValid = false;
         }
     }
     if (!$isValid) {
         return $invalidItemArray;
     }
     return $isValid;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:21,代码来源:ezproductcollection.php

示例5: productItems

 /**
  * Fetch product items that bellongs ot the order
  *
  * @param bool $asObject
  * @param array|null $sorts Array with sort data sent directly to {@link eZPersistentObject::fetchObjectList()}
  */
 function productItems($asObject = true, array $sorts = null)
 {
     $productItems = eZPersistentObject::fetchObjectList(eZProductCollectionItem::definition(), null, array('productcollection_id' => $this->ProductCollectionID), $sorts, null, $asObject);
     $addedProducts = array();
     foreach ($productItems as $productItem) {
         $contentObject = $productItem->attribute('contentobject');
         if ($this->IgnoreVAT == true) {
             $vatValue = 0;
         } else {
             $vatValue = $productItem->attribute('vat_value');
         }
         if ($contentObject) {
             $nodeID = $contentObject->attribute('main_node_id');
             $objectName = $contentObject->attribute('name');
         } else {
             $nodeID = false;
             $objectName = $productItem->attribute('name');
         }
         $price = $productItem->attribute('price');
         if ($productItem->attribute('is_vat_inc')) {
             $priceExVAT = $price / (100 + $vatValue) * 100;
             $priceIncVAT = $price;
         } else {
             $priceExVAT = $price;
             $priceIncVAT = $price * (100 + $vatValue) / 100;
         }
         $count = $productItem->attribute('item_count');
         $discountPercent = $productItem->attribute('discount');
         $realPricePercent = (100 - $discountPercent) / 100;
         $addedProducts[] = array("id" => $productItem->attribute('id'), "vat_value" => $vatValue, "item_count" => $count, "node_id" => $nodeID, "object_name" => $objectName, "price_ex_vat" => $priceExVAT, "price_inc_vat" => $priceIncVAT, "discount_percent" => $discountPercent, "total_price_ex_vat" => round($count * $priceExVAT * $realPricePercent, 2), "total_price_inc_vat" => round($count * $priceIncVAT * $realPricePercent, 2), 'item_object' => $productItem);
     }
     return $addedProducts;
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:39,代码来源:ezorder.php

示例6: purge

    /**
     * Deletes the current object, all versions and translations, and corresponding tree nodes from the database
     *
     * Transaction unsafe. If you call several transaction unsafe methods you must enclose
     * the calls within a db transaction; thus within db->begin and db->commit.
     */
    function purge()
    {
        $delID = $this->ID;
        // Who deletes which content should be logged.
        eZAudit::writeAudit( 'content-delete', array( 'Object ID' => $delID, 'Content Name' => $this->attribute( 'name' ),
                                                      'Comment' => 'Purged the current object: eZContentObject::purge()' ) );

        $db = eZDB::instance();

        $db->begin();

        $attrOffset = 0;
        $attrLimit = 20;
        while (
            $contentobjectAttributes = $this->allContentObjectAttributes(
                $delID, true, array( 'limit' => $attrLimit, 'offset' => $attrOffset )
            )
        )
        {
            foreach ( $contentobjectAttributes as $contentobjectAttribute )
            {
                $dataType = $contentobjectAttribute->dataType();
                if ( !$dataType )
                    continue;
                $dataType->deleteStoredObjectAttribute( $contentobjectAttribute );
            }
            $attrOffset += $attrLimit;
        }

        eZInformationCollection::removeContentObject( $delID );

        eZContentObjectTrashNode::purgeForObject( $delID );

        $db->query( "DELETE FROM ezcontentobject_tree
             WHERE contentobject_id='$delID'" );

        $db->query( "DELETE FROM ezcontentobject_attribute
             WHERE contentobject_id='$delID'" );

        $db->query( "DELETE FROM ezcontentobject_version
             WHERE contentobject_id='$delID'" );

        $db->query( "DELETE FROM ezcontentobject_name
             WHERE contentobject_id='$delID'" );

        $db->query( "DELETE FROM ezcobj_state_link WHERE contentobject_id=$delID" );

        $db->query( "DELETE FROM ezcontentobject
             WHERE id='$delID'" );

        $db->query( "DELETE FROM eznode_assignment
             WHERE contentobject_id = '$delID'" );

        $db->query( "DELETE FROM ezuser_role
             WHERE contentobject_id = '$delID'" );

        $db->query( "DELETE FROM ezuser_discountrule
             WHERE contentobject_id = '$delID'" );

        eZContentObject::fixReverseRelations( $delID, 'remove' );

        eZSearch::removeObjectById( $delID );

        // Check if deleted object is in basket/wishlist
        $sql = 'SELECT DISTINCT ezproductcollection_item.productcollection_id
                FROM   ezbasket, ezwishlist, ezproductcollection_item
                WHERE  ( ezproductcollection_item.productcollection_id=ezbasket.productcollection_id OR
                         ezproductcollection_item.productcollection_id=ezwishlist.productcollection_id ) AND
                       ezproductcollection_item.contentobject_id=' . $delID;
        $rows = $db->arrayQuery( $sql );
        if ( count( $rows ) > 0 )
        {
            $countElements = 50;
            $deletedArray = array();
            // Create array of productCollectionID will be removed from ezwishlist and ezproductcollection_item
            foreach ( $rows as $row )
            {
                $deletedArray[] = $row['productcollection_id'];
            }
            // Split $deletedArray into several arrays with $countElements values
            $splitted = array_chunk( $deletedArray, $countElements );
            // Remove eZProductCollectionItem and eZWishList
            foreach ( $splitted as $value )
            {
                eZPersistentObject::removeObject( eZProductCollectionItem::definition(), array( 'productcollection_id' => array( $value, '' ) ) );
                eZPersistentObject::removeObject( eZWishList::definition(), array( 'productcollection_id' => array( $value, '' ) ) );
            }
        }
        $db->query( 'UPDATE ezproductcollection_item
                     SET contentobject_id = 0
                     WHERE  contentobject_id = ' . $delID );

        // Cleanup relations in two steps to avoid locking table for to long
        $db->query( "DELETE FROM ezcontentobject_link
//.........这里部分代码省略.........
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:101,代码来源:ezcontentobject.php


注:本文中的eZProductCollectionItem::definition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。