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


PHP ARSelectFilter::mergeCondition方法代码示例

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


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

示例1: getOrderFiles

 public static function getOrderFiles(ARSelectFilter $f)
 {
     $f->mergeCondition(new EqualsCond(new ARFieldHandle('CustomerOrder', 'isCancelled'), 0));
     $f->mergeCondition(new EqualsCond(new ARFieldHandle('CustomerOrder', 'isFinalized'), true));
     $f->mergeCondition(new EqualsCond(new ARFieldHandle('CustomerOrder', 'isPaid'), true));
     //$f->mergeCondition(new EqualsCond(new ARFieldHandle('Product', 'type'), Product::TYPE_DOWNLOADABLE));
     $f->setOrder(new ARFieldHandle('CustomerOrder', 'ID'), 'DESC');
     $downloadable = ActiveRecordModel::getRecordSet('OrderedItem', $f, array('Product', 'CustomerOrder'));
     $fileArray = array();
     foreach ($downloadable as &$item) {
         $files = $item->getProduct()->getFiles();
         $itemFiles = array();
         foreach ($files as $file) {
             if ($item->isDownloadable($file)) {
                 $itemFiles[] = $file->toArray();
             }
         }
         if (!$itemFiles) {
             continue;
         }
         $array = $item->toArray();
         $array['Product']['Files'] = ProductFileGroup::mergeGroupsWithFields($item->getProduct()->getFileGroups()->toArray(), $itemFiles);
         foreach ($array['Product']['Files'] as $key => $file) {
             if (!isset($file['ID'])) {
                 unset($array['Product']['Files'][$key]);
             }
         }
         $fileArray[] = $array;
     }
     return $fileArray;
 }
开发者ID:saiber,项目名称:livecart,代码行数:31,代码来源:ProductFile.php

示例2: filter

 public function filter($emptyListIsException = false)
 {
     $request = $this->application->getRequest();
     $parser = $this->getParser();
     $apiFieldNames = $parser->getApiFieldNames();
     $parser->loadDataInRequest($request);
     $f = new ARSelectFilter();
     $ID = $request->get('ID');
     $shippingServiceID = $request->get('shippingServiceID');
     if (intval($ID) > 0) {
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('ShippingRate', 'ID'), $ID));
     }
     if (intval($shippingServiceID) > 0) {
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('ShippingRate', 'shippingServiceID'), $shippingServiceID));
     }
     $shipping_rate = ActiveRecordModel::getRecordSetArray('ShippingRate', $f);
     $response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
     if ($emptyListIsException && count($shipping_rate) == 0) {
         throw new Exception('ShippingService not found');
     }
     while ($rate = array_shift($shipping_rate)) {
         $xmlRate = $response->addChild('shipping_rate');
         foreach ($rate as $k => $v) {
             if (in_array($k, $apiFieldNames)) {
                 $xmlRate->addChild($k, $v);
             }
         }
     }
     return new SimpleXMLResponse($response);
 }
开发者ID:saiber,项目名称:www,代码行数:30,代码来源:ShippingRateApi.php

示例3: getInstance

 /**
  * Get related product active record by ID
  *
  * @param mixed $recordID
  * @param bool $loadRecordData
  * @param bool $loadReferencedRecords
  *
  * @return ProductRelationshipGroup
  */
 public static function getInstance(Product $product, Product $relatedProduct, $type, $loadRecordData = false, $loadReferencedRecords = false)
 {
     $f = new ARSelectFilter(new EqualsCond(new ARFieldHandle(__CLASS__, 'productID'), $product->getID()));
     $f->mergeCondition(new EqualsCond(new ARFieldHandle(__CLASS__, 'relatedProductID'), $relatedProduct->getID()));
     $f->mergeCondition(new EqualsCond(new ARFieldHandle(__CLASS__, 'type'), $type));
     $set = parent::getRecordSet(__CLASS__, $f, $loadReferencedRecords);
     return $set->size() ? $set->get(0) : null;
 }
开发者ID:saiber,项目名称:www,代码行数:17,代码来源:ProductRelationship.php

示例4: filter

 public function filter($emptyListIsException = false)
 {
     $request = $this->application->getRequest();
     $parser = $this->getParser();
     $apiFieldNames = $parser->getApiFieldNames();
     $parser->loadDataInRequest($request);
     $f = new ARSelectFilter();
     $id = $request->get('ID');
     if (!empty($id)) {
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('ProductVariation', 'ID'), $id));
     } else {
         throw new Exception('Product variation ID is required');
     }
     $product_variations = ActiveRecordModel::getRecordSetArray('ProductVariation', $f);
     $response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
     if ($emptyListIsException && count($product_variations) == 0) {
         throw new Exception('Product variation not found');
     }
     while ($variation = array_shift($product_variations)) {
         $xml = $response->addChild('product_variation');
         foreach ($variation as $k => $v) {
             if (in_array($k, $apiFieldNames)) {
                 $xml->addChild($k, $v);
             }
         }
     }
     return new SimpleXMLResponse($response);
 }
开发者ID:saiber,项目名称:www,代码行数:28,代码来源:ProductVariationApi.php

示例5: index

 public function index()
 {
     // get filter to select manufacturers of active products only
     $rootCat = Category::getRootNode();
     $f = new ARSelectFilter();
     $productFilter = new ProductFilter($rootCat, $f);
     $ids = $counts = array();
     foreach (ActiveRecordModel::getDataBySQL('SELECT DISTINCT(manufacturerID), COUNT(*) AS cnt FROM Product ' . $f->createString() . ' GROUP BY manufacturerID') as $row) {
         $ids[] = $row['manufacturerID'];
         $counts[$row['manufacturerID']] = $row['cnt'];
     }
     $f = new ARSelectFilter(new InCond(new ARFieldHandle('Manufacturer', 'ID'), $ids));
     $f->mergeCondition(new NotEqualsCond(new ARFieldHandle('Manufacturer', 'name'), ''));
     $f->setOrder(new ARFieldHandle('Manufacturer', 'name'));
     $manufacturers = ActiveRecordModel::getRecordSetArray('Manufacturer', $f);
     foreach ($manufacturers as &$manufacturer) {
         $manufacturer['url'] = $this->getManufacturerFilterUrl($manufacturer);
     }
     $this->addBreadCrumb($this->translate('_manufacturers'), '');
     $response = new ActionResponse();
     $response->setReference('manufacturers', $manufacturers);
     $response->set('counts', $counts);
     $response->set('rootCat', $rootCat->toArray());
     return $response;
 }
开发者ID:saiber,项目名称:www,代码行数:25,代码来源:ManufacturersController.php

示例6: filter

 public function filter($emptyListIsException = false)
 {
     $request = $this->application->getRequest();
     $parser = $this->getParser();
     $apiFieldNames = $parser->getApiFieldNames();
     $parser->loadDataInRequest($request);
     $f = new ARSelectFilter();
     $id = $request->get('ID');
     $parentNodeID = $request->get('parentNodeID');
     if (intval($id) > 0) {
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('Category', 'ID'), $id));
     }
     if (intval($parentNodeID) > 0) {
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('Category', 'parentNodeID'), $parentNodeID));
     }
     $f->setOrder(MultiLingualObject::getLangOrderHandle(new ARFieldHandle('Category', 'name')));
     $categories = ActiveRecordModel::getRecordSetArray('Category', $f);
     $response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
     if ($emptyListIsException && count($categories) == 0) {
         throw new Exception('Category not found');
     }
     while ($category = array_shift($categories)) {
         $xmlCategory = $response->addChild('category');
         foreach ($category as $k => $v) {
             if (in_array($k, $apiFieldNames)) {
                 $xmlCategory->addChild($k, htmlentities($v));
             }
         }
     }
     return new SimpleXMLResponse($response);
 }
开发者ID:saiber,项目名称:www,代码行数:31,代码来源:CategoryApi.php

示例7: filter

 public function filter($emptyListIsException = false)
 {
     $request = $this->application->getRequest();
     $parser = $this->getParser();
     $apiFieldNames = $parser->getApiFieldNames();
     $parser->loadDataInRequest($request);
     $f = new ARSelectFilter();
     $id = $request->get('ID');
     if (intval($id) > 0) {
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('NewsPost', 'ID'), $id));
     }
     $f->setOrder(new ARExpressionHandle('NewsPost.ID'), 'DESC');
     $newspost = ActiveRecordModel::getRecordSetArray('NewsPost', $f);
     $response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
     if ($emptyListIsException && count($newspost) == 0) {
         throw new Exception('News post not found');
     }
     while ($category = array_shift($newspost)) {
         $xmlNewsPost = $response->addChild('newspost');
         foreach ($category as $k => $v) {
             if (in_array($k, $apiFieldNames)) {
                 $xmlNewsPost->addChild($k, htmlentities($v));
             }
         }
     }
     return new SimpleXMLResponse($response);
 }
开发者ID:saiber,项目名称:www,代码行数:27,代码来源:NewsPostApi.php

示例8: add_to_cart

 public function add_to_cart()
 {
     $request = $this->application->getRequest();
     $productID = $request->get('productID');
     $customerOrderID = $request->get('customerOrderID');
     $count = $request->get('count');
     if (!isset($customerOrderID) && intval($customerOrderID == 0)) {
         throw new Exception('Order ID is required');
     }
     $order = CustomerOrder::getInstanceById($customerOrderID);
     $order->load(true);
     $order->loadAll();
     //throw new Exception('order : ' . $order->getTotal(true));
     $product = Product::getInstanceByID($productID, true, true);
     $product->load(true);
     //$variations = !$product->parent->get() ? $product->getVariationData($this->application) : array('1','2');
     //throw new Exception('variation ' . json_encode($variations) . ' parent : ' . $product->getID() . ' productID ' . $productID);
     if (!$product->isAvailable()) {
         throw new Exception('Product ' . $productID . ' is not Available ');
     } else {
         if ($count < $product->getMinimumQuantity()) {
             $count = $product->getMinimumQuantity();
         }
         ActiveRecordModel::beginTransaction();
         $item = $order->addProduct($product, $count);
         if ($item instanceof OrderedItem) {
             if ($order->isMultiAddress->get()) {
                 $item->save();
             }
         }
         if ($product->parent->get()) {
             $order->mergeItems();
         } else {
             $item->save();
         }
         //$order->mergeItems();
         $order->getTotal(true);
         $order->totalAmount->set($order->getTotal(true));
         $order->getTaxAmount();
         $order->save(true);
         ActiveRecordModel::commit();
     }
     $response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
     if ($item->getID() > 0) {
         $parser = $this->getParser();
         $apiFieldNames = $parser->getApiFieldNames();
         $selFilter = new ARSelectFilter();
         $selFilter->mergeCondition(new EqualsCond(new ARFieldHandle('OrderedItem', 'ID'), $item->getID()));
         $orderedItem = OrderedItem::getRecordSetArray('OrderedItem', $selFilter);
         while ($item = array_shift($orderedItem)) {
             $orderedItemXml = $response->addChild('ordered_item');
             foreach ($item as $k => $v) {
                 if (in_array($k, $apiFieldNames)) {
                     $orderedItemXml->addChild($k, htmlentities($v));
                 }
             }
         }
     }
     return new SimpleXMLResponse($response);
 }
开发者ID:saiber,项目名称:www,代码行数:60,代码来源:OrderedItemApi.php

示例9: getUserToolbarItems

 public static function getUserToolbarItems($types = null, $filter = null, $order = 'ASC')
 {
     if ($filter == null) {
         $filter = new ARSelectFilter();
     }
     $filter->mergeCondition(eq(f(__CLASS__ . '.ownerID'), SessionUser::getUser()->getID()));
     $filter->setOrder(f(__CLASS__ . '.position'), $order);
     $m = array(BackendToolbarItem::TYPE_MENU => '', BackendToolbarItem::TYPE_PRODUCT => '', BackendToolbarItem::TYPE_USER => '', BackendToolbarItem::TYPE_ORDER => '');
     if (is_array($types) == false) {
         $types = array($types);
     }
     $conditions = array();
     foreach ($types as $type) {
         switch ($type) {
             case BackendToolbarItem::TYPE_MENU:
                 $conditions[] = isnotnull(f(__CLASS__ . '.menuID'));
                 break;
             case BackendToolbarItem::TYPE_PRODUCT:
                 $conditions[] = new AndChainCondition(array(isnotnull(f(__CLASS__ . '.productID')), isnotnull(f('Product.ID'))));
                 // fake inner join
                 break;
             case BackendToolbarItem::TYPE_USER:
                 $conditions[] = new AndChainCondition(array(isnotnull(f(__CLASS__ . '.userID')), isnotnull(f('User.ID'))));
                 break;
             case BackendToolbarItem::TYPE_ORDER:
                 $conditions[] = new AndChainCondition(array(isnotnull(f(__CLASS__ . '.orderID')), isnotnull(f('CustomerOrder.ID'))));
                 break;
         }
     }
     if (count($conditions)) {
         $filter->mergeCondition(new OrChainCondition($conditions));
     }
     return self::getRecordSetArray(__CLASS__, $filter, true);
 }
开发者ID:saiber,项目名称:livecart,代码行数:34,代码来源:BackendToolbarItem.php

示例10: getProductGroupsFilter

 private static function getProductGroupsFilter(Product $product, $type)
 {
     $filter = new ARSelectFilter();
     $filter->setOrder(new ARFieldHandle("ProductRelationshipGroup", "position"), 'ASC');
     $filter->setCondition(new EqualsCond(new ARFieldHandle("ProductRelationshipGroup", "productID"), $product->getID()));
     $filter->mergeCondition(new EqualsCond(new ARFieldHandle("ProductRelationshipGroup", "type"), $type));
     return $filter;
 }
开发者ID:saiber,项目名称:www,代码行数:8,代码来源:ProductRelationshipGroup.php

示例11: getRecordCount

 public static function getRecordCount($locale = null)
 {
     $filter = new ARSelectFilter();
     if ($locale) {
         $filter->mergeCondition(eq(f(__CLASS__ . '.locale'), $locale));
     }
     return ActiveRecordModel::getRecordCount(__CLASS__, $filter);
 }
开发者ID:saiber,项目名称:livecart,代码行数:8,代码来源:SearchableItem.php

示例12: getSpecificationFieldSet

 public function getSpecificationFieldSet($loadReferencedRecords = false)
 {
     $f = new ARSelectFilter(new EqualsCond(new ARFieldHandle($this->getFieldClass(), 'classID'), EavField::getClassID($this->owner)));
     if ($this->owner->getStringIdentifier()) {
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('EavField', 'stringIdentifier'), $this->owner->getStringIdentifier()));
     }
     $f->setOrder(new ARFieldHandle($this->getFieldClass(), 'position'));
     return ActiveRecordModel::getRecordSet($this->getFieldClass(), $f, $loadReferencedRecords);
 }
开发者ID:saiber,项目名称:www,代码行数:9,代码来源:EavSpecificationManager.php

示例13: getGroupFilter

 /**
  * Creates a select filter for fields groups
  * @return ARSelectFilter
  */
 private function getGroupFilter()
 {
     $filter = new ARSelectFilter(new EqualsCond(new ARFieldHandle('EavFieldGroup', 'classID'), $this->classID));
     if ($this->stringIdentifier) {
         $filter->mergeCondition(new EqualsCond(new ARFieldHandle('EavFieldGroup', 'stringIdentifier'), $this->stringIdentifier));
     }
     $filter->setOrder(new ARFieldHandle('EavFieldGroup', 'position'));
     return $filter;
 }
开发者ID:saiber,项目名称:livecart,代码行数:13,代码来源:EavFieldManager.php

示例14: getRecordSetByOrder

 public static function getRecordSetByOrder(CustomerOrder $order, ARSelectFilter $filter = null, $loadReferencedRecords = false)
 {
     if (!$filter) {
         $filter = new ARSelectFilter();
     }
     $filter->mergeCondition(new EqualsCond(new ARFieldHandle(__CLASS__, 'orderID'), $order->getID()));
     $filter->setOrder(new ARFieldHandle(__CLASS__, 'time'), ARSelectFilter::ORDER_DESC);
     return self::getRecordSet($filter, $loadReferencedRecords);
 }
开发者ID:saiber,项目名称:www,代码行数:9,代码来源:OrderLog.php

示例15: getUseCount

 public function getUseCount()
 {
     $cond = $this->discountCondition->get();
     $f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('CustomerOrder', 'isFinalized'), true));
     if ($cond->couponLimitType->get() == DiscountCondition::COUPON_LIMIT_USER && $this->order->get()->user->get()) {
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('CustomerOrder', 'userID'), $this->order->get()->user->get()->getID()));
     }
     return $cond->getRelatedRecordCount(__CLASS__, $f, array('CustomerOrder'));
 }
开发者ID:saiber,项目名称:livecart,代码行数:9,代码来源:OrderCoupon.php


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