本文整理汇总了PHP中ARSelectFilter::joinTable方法的典型用法代码示例。如果您正苦于以下问题:PHP ARSelectFilter::joinTable方法的具体用法?PHP ARSelectFilter::joinTable怎么用?PHP ARSelectFilter::joinTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ARSelectFilter
的用法示例。
在下文中一共展示了ARSelectFilter::joinTable方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defineJoin
public function defineJoin(ARSelectFilter $filter)
{
$filter->joinTable('ProductPrice', 'Product', 'productID AND (ProductPrice.currencyID = "' . $this->application->getDefaultCurrencyCode() . '")', 'ID');
}
示例2: getFilesByProductFilter
private static function getFilesByProductFilter(Product $product)
{
$filter = new ARSelectFilter();
$filter->joinTable('ProductFileGroup', 'ProductFile', 'ID', 'productFileGroupID');
$filter->setOrder(new ARFieldHandle("ProductFileGroup", "position"), ARSelectFilter::ORDER_ASC);
$filter->setCondition(new EqualsCond(new ARFieldHandle(__CLASS__, 'productID'), $product->getID()));
$filter->setOrder(new ARFieldHandle(__CLASS__, 'position'), ARSelectFilter::ORDER_ASC);
return $filter;
}
示例3: getSelectFilter
protected function getSelectFilter()
{
$id = $this->getRequestCategory();
$category = Category::getInstanceByID($id, Category::LOAD_DATA);
$filter = new ARSelectFilter($category->getProductCondition(true));
$filter->joinTable('ProductPrice', 'Product', 'productID AND (ProductPrice.currencyID = "' . $this->application->getDefaultCurrencyCode() . '")', 'ID');
$filter->mergeCondition(new EqualsCond(new ARFieldHandle('ProductPrice', 'type'), ProductPrice::TYPE_GENERAL_PRICE));
foreach ($this->getDisplayedColumns($category) as $column => $type) {
$parts = explode('.', $column);
if (array_shift($parts) == 'specField') {
$field = SpecField::getInstanceByID(array_shift($parts));
if (!$field->isMultiValue->get()) {
$field->defineJoin($filter);
} else {
$values = is_array($this->request->get('filters')) ? $this->request->get('filters') : json_decode($this->request->get('filters'), true);
$values = isset($values[$column]) ? $values[$column] : null;
if ($values) {
foreach (ActiveRecordModel::getRecordSet('SpecFieldValue', select(in(f('SpecFieldValue.ID'), explode(',', urldecode($values))))) as $field) {
$f = new SelectorFilter($field);
$f->defineJoin($filter);
$filter->mergeCondition($f->getCondition());
}
}
}
}
}
return $filter;
}
示例4: getSelectFilter
protected function getSelectFilter()
{
$id = $this->request->get("id");
$id = is_numeric($id) ? $id : substr($this->request->get("id"), 9);
$category = Category::getInstanceByID($id, Category::LOAD_DATA);
$filter = new ARSelectFilter($category->getProductCondition(true));
$filter->joinTable('ProductPrice', 'Product', 'productID AND (ProductPrice.currencyID = "' . $this->application->getDefaultCurrencyCode() . '")', 'ID');
return $filter;
}
示例5: getSelectFilter
protected function getSelectFilter()
{
$f = new ARSelectFilter();
// specField columns
if ($this->isEav()) {
$needsJoin = true;
$fields = EavFieldManager::getClassFieldSet($this->getClassName());
foreach ($fields as $field) {
if (!$field->isMultiValue->get()) {
if ($needsJoin) {
$f->joinTable('EavObject', $this->getClassName(), 'ID', 'eavObjectID');
$needsJoin = false;
}
$field->defineJoin($f);
}
}
}
return $f;
}
示例6: applySortOrder
/**
* Apply selected product sort order to ARSelectFilter instance
*/
private function applySortOrder(ARSelectFilter $selectFilter, $order)
{
$dir = array_pop(explode('_', $order)) == 'asc' ? 'ASC' : 'DESC';
if (substr($order, 0, 12) == 'product_name') {
$selectFilter->setOrder(Product::getLangOrderHandle(new ARFieldHandle('Product', 'name')), $dir);
} else {
if (substr($order, 0, 5) == 'price') {
$selectFilter->setOrder(new ARFieldHandle('ProductPrice', 'price'), $dir);
$selectFilter->joinTable('ProductPrice', 'Product', 'productID AND (ProductPrice.currencyID = "' . $this->application->getDefaultCurrencyCode() . '")', 'ID');
} else {
if (substr($order, 0, 3) == 'sku') {
$selectFilter->setOrder(new ARFieldHandle('ProductPrice', 'price'), $dir);
$selectFilter->joinTable('ProductPrice', 'Product', 'productID AND (ProductPrice.currencyID = "' . $this->application->getDefaultCurrencyCode() . '")', 'ID');
} else {
if ('newest_arrivals' == $order) {
$selectFilter->setOrder(new ARFieldHandle('Product', 'dateCreated'), 'DESC');
} else {
if (in_array($order, array('rating', 'sku'))) {
$selectFilter->setOrder(new ARFieldHandle('Product', $order), $dir);
} else {
if ('sales_rank' == $order) {
Product::updateSalesRank();
$selectFilter->setOrder(new ARFieldHandle('Product', 'salesRank'), 'DESC');
} else {
if (is_numeric($fieldID = array_shift(explode('-', $order))) && !SpecField::getInstanceByID($fieldID, true)->isMultiValue->get()) {
$field = SpecField::getInstanceByID($fieldID);
$field->defineJoin($selectFilter);
$f = $field->getJoinAlias() . ($field->isSelector() ? '_value' : '') . '.value';
$selectFilter->setOrder(new ARExpressionHandle($f . ' IS NOT NULL'), 'DESC');
$selectFilter->setOrder(new ARExpressionHandle($f . ' != ""'), 'DESC');
$f = new ARExpressionHandle($f);
if ($field->isSelector()) {
$f = MultiLingualObject::getLangOrderHandle($f);
}
$selectFilter->setOrder($f, array_pop(explode('_', $order)) == 'desc' ? 'DESC' : 'ASC');
} else {
$selectFilter->setOrder(new ARFieldHandle('Product', 'isFeatured'), 'DESC');
$selectFilter->setOrder(new ARFieldHandle('Product', 'salesRank'), 'DESC');
$selectFilter->setOrder(new ARFieldHandle('Product', 'position'), 'DESC');
}
}
}
}
}
}
}
}
示例7: getRelatedProductsSetFilter
private static function getRelatedProductsSetFilter(Product $product, $type)
{
$filter = new ARSelectFilter();
$filter->joinTable('ProductRelationshipGroup', 'ProductRelationship', 'ID', 'productRelationshipGroupID');
$filter->setOrder(new ARFieldHandle("ProductRelationshipGroup", "position"), 'ASC');
$filter->setOrder(new ARFieldHandle(__CLASS__, "position"), 'ASC');
$filter->setCondition(new EqualsCond(new ARFieldHandle(__CLASS__, "productID"), $product->getID()));
$filter->mergeCOndition(new EqualsCond(new ARFieldHandle(__CLASS__, "type"), $type));
return $filter;
}
示例8: defineJoin
/**
* Adds JOIN definition to ARSelectFilter to retrieve product attribute value for the particular SpecField
*
* @param ARSelectFilter $filter Filter instance
*/
public function defineJoin(ARSelectFilter $filter)
{
$table = $this->getJoinAlias();
$filter->joinTable($this->getValueTableName(), $this->getOwnerClass(), $this->getObjectIDColumnName() . ' AND ' . $table . '.' . $this->getFieldIDColumnName() . ' = ' . $this->getID(), 'ID', $table);
if ($this->isSelector() && !$this->isMultiValue->get()) {
$itemClass = $this->getSelectValueClass();
$valueClass = call_user_func(array($itemClass, 'getValueClass'));
$valueField = call_user_func(array($itemClass, 'getValueIDColumnName'));
$filter->joinTable($valueClass, $table, 'ID', $valueField, $table . '_value');
}
}
示例9: defineJoin
/**
* Adds JOIN definition to ARSelectFilter to retrieve product attribute value for the particular SpecField
*
* @param ARSelectFilter $filter Filter instance
*/
public function defineJoin(ARSelectFilter $filter)
{
$table = $this->getJoinAlias();
$filter->joinTable('SpecificationItem', 'Product', 'productID AND ' . $table . '.SpecFieldValueID = ' . $this->specFieldValue->getID(), 'ID', $table);
}