本文整理汇总了PHP中Varien_Db_Select::crossUpdateFromSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Db_Select::crossUpdateFromSelect方法的具体用法?PHP Varien_Db_Select::crossUpdateFromSelect怎么用?PHP Varien_Db_Select::crossUpdateFromSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Db_Select
的用法示例。
在下文中一共展示了Varien_Db_Select::crossUpdateFromSelect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applyPriceRuleToIndexTable
/**
* Apply price rule price to price index table
*
* @param Varien_Db_Select $select
* @param array|string $indexTable
* @param string $entityId
* @param string $customerGroupId
* @param string $websiteId
* @param array $updateFields the array of fields for compare with rule price and update
* @param string $websiteDate
* @return Mage_CatalogRule_Model_Resource_Rule_Product_Price
*/
public function applyPriceRuleToIndexTable(Varien_Db_Select $select, $indexTable, $entityId, $customerGroupId, $websiteId, $updateFields, $websiteDate)
{
if (empty($updateFields)) {
return $this;
}
if (is_array($indexTable)) {
foreach ($indexTable as $k => $v) {
if (is_string($k)) {
$indexAlias = $k;
} else {
$indexAlias = $v;
}
break;
}
} else {
$indexAlias = $indexTable;
}
$select->join(array('rp' => $this->getMainTable()), "rp.rule_date = {$websiteDate}", array())->where("rp.product_id = {$entityId} AND rp.website_id = {$websiteId} AND rp.customer_group_id = {$customerGroupId}");
foreach ($updateFields as $priceField) {
$priceCond = $this->_getWriteAdapter()->quoteIdentifier(array($indexAlias, $priceField));
$priceExpr = $this->_getWriteAdapter()->getCheckSql("rp.rule_price < {$priceCond}", 'rp.rule_price', $priceCond);
$select->columns(array($priceField => $priceExpr));
}
$query = $select->crossUpdateFromSelect($indexTable);
$this->_getWriteAdapter()->query($query);
return $this;
}