本文整理汇总了PHP中ARSelectFilter类的典型用法代码示例。如果您正苦于以下问题:PHP ARSelectFilter类的具体用法?PHP ARSelectFilter怎么用?PHP ARSelectFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ARSelectFilter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: products
public function products()
{
$this->setLayout('empty');
set_time_limit(0);
$response = new XMLResponse();
$filter = new ARSelectFilter();
$filter->setOrder(f('Product.dateCreated'), ARSelectFilter::ORDER_DESC);
$categoryId = $this->getRequest()->get('id');
if (preg_match('/^\\d+$/', $categoryId)) {
$this->shouldBeEnabledFeed('CATEGORY_PRODUCTS');
$category = Category::getInstanceById($categoryId, Category::LOAD_DATA);
$filter = new ProductFilter($category, $filter);
} else {
$this->shouldBeEnabledFeed('ALL_PRODUCTS');
$category = Category::getRootNode(true);
$filter = new ProductFilter($category, $filter);
$filter->includeSubCategories();
}
$feed = new ProductFeed($filter);
$feed->setFlush();
$feed->setLimit($this->config->get('NUMBER_OF_PRODUCTS_TO_INCLUDE'));
$response->set('feed', $feed);
$response->set('category', $category->toArray());
return $response;
}
开发者ID:saiber,项目名称:livecart,代码行数:25,代码来源:RssController.php
示例2: getSelectFilter
public function getSelectFilter($searchTerm)
{
$c = new ARExpressionHandle($this->getWeighedSearchCondition($this->getOption('BACKEND_QUICK_SEARCH') ? array('title' => 1) : array('title' => 4, 'text' => 2, 'moreText' => 1), $searchTerm));
$f = new ARSelectFilter(new MoreThanCond($c, 0));
$f->setOrder($c, 'DESC');
return $f;
}
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:SearchableNewsPost.php
示例3: 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
示例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: getSelectFilter
public function getSelectFilter($searchTerm)
{
$c = new ARExpressionHandle($this->getWeighedSearchCondition(array('name' => 1), $searchTerm));
$f = new ARSelectFilter(new MoreThanCond($c, 0));
$f->setOrder($c, 'DESC');
return $f;
}
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:SearchableManufacturer.php
示例6: index
/**
* Main settings page
*/
public function index()
{
$f = new ARSelectFilter();
$f->setOrder(new ARFieldHandle('StaticPage', 'position'));
$f->setOrder(new ARFieldHandle('StaticPage', 'parentID'));
$s = ActiveRecordModel::getRecordSetArray('StaticPage', $f);
$pages = array();
foreach ($s as $page) {
$pointers[$page['ID']] = array('title' => $page['title_lang'], 'id' => $page['ID'], 'parentID' => $page['parentID']);
}
foreach ($pointers as $page) {
if ($page['parentID'] && !empty($pointers[$page['parentID']])) {
$root =& $pointers[$page['parentID']];
} else {
$root =& $pages;
}
$root['children'][] =& $pointers[$page['id']];
}
$response = new ActionResponse();
$response->set('pages', json_encode($pages));
$form = $this->getForm();
$page = StaticPage::getNewInstance();
$page->getSpecification()->setFormResponse($response, $form);
$response->set('form', $form);
$response->set('page', $page->toArray());
return $response;
}
开发者ID:saiber,项目名称:livecart,代码行数:30,代码来源:StaticPageController.php
示例7: index
public function index()
{
$this->addIndexBreadCrumb();
$f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('NewsPost', 'isEnabled'), true));
$f->setOrder(new ARFieldHandle('NewsPost', 'position'), 'DESC');
return new ActionResponse('news', ActiveRecordModel::getRecordSetArray('NewsPost', $f));
}
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:NewsController.php
示例8: 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
示例9: filter
public function filter($emptyListIsException = false)
{
$request = $this->application->getRequest();
$parser = $this->getParser();
$apiFieldNames = $parser->getApiFieldNames();
$parser->loadDataInRequest($request);
$f = new ARSelectFilter();
$orderID = $request->get('orderID');
if (intval($orderID) > 0) {
$f->mergeCondition(new EqualsCond(new ARFieldHandle('Shipment', 'orderID'), $orderID));
} else {
throw new Exception("Order ID is required");
}
$shipment = ActiveRecordModel::getRecordSetArray('Shipment', $f);
$response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
if ($emptyListIsException && count($shipment) == 0) {
throw new Exception('Shipment not found');
}
while ($ser = array_shift($shipment)) {
$xmlShipment = $response->addChild('shipment');
foreach ($ser as $k => $v) {
if (in_array($k, $apiFieldNames)) {
$xmlShipment->addChild($k, $v);
}
}
}
return new SimpleXMLResponse($response);
}
开发者ID:saiber,项目名称:www,代码行数:28,代码来源:ShipmentApi.php
示例10: 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($countryID)) {
$f->mergeCondition(new EqualsCond(new ARFieldHandle('DeliveryZoneCountry', 'ID'), $ID));
}
$countryZones = ActiveRecordModel::getRecordSetArray('DeliveryZoneCountry', $f);
$response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
if ($emptyListIsException && count($countryZones) == 0) {
throw new Exception('DeliveryZoneCountry not found');
}
while ($country_zone = array_shift($countryZones)) {
$xmlCountryZone = $response->addChild('delivery_zone_country');
foreach ($country_zone as $k => $v) {
if (in_array($k, $apiFieldNames)) {
$xmlCountryZone->addChild($k, $v);
}
}
}
return new SimpleXMLResponse($response);
}
开发者ID:saiber,项目名称:www,代码行数:26,代码来源:DeliveryZoneCountryApi.php
示例11: 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
示例12: 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
示例13: index
public function index()
{
$f = new ARSelectFilter();
$f->setOrder(new ARFieldHandle('NewsPost', 'position'), 'DESC');
$response = new ActionResponse('newsList', ActiveRecordModel::getRecordSetArray('NewsPost', $f));
$response->set('form', $this->buildForm());
return $response;
}
开发者ID:saiber,项目名称:livecart,代码行数:8,代码来源:SiteNewsController.php
示例14: 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
示例15: 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
示例16: isValid
public function isValid($value)
{
ClassLoader::import('application.model.user.User');
$filter = new ARSelectFilter();
$cond = new EqualsCond(new ARFieldHandle('User', 'email'), $value);
$filter->setCondition($cond);
return ActiveRecordModel::getRecordCount('User', $filter) == 0;
}
开发者ID:saiber,项目名称:livecart,代码行数:8,代码来源:IsUniqueEmailCheck.php
示例17: 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
示例18: 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
示例19: 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
示例20: 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
注:本文中的ARSelectFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论