本文整理汇总了PHP中Mage_Rule_Model_Condition_Combine类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Rule_Model_Condition_Combine类的具体用法?PHP Mage_Rule_Model_Condition_Combine怎么用?PHP Mage_Rule_Model_Condition_Combine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Rule_Model_Condition_Combine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
public function validate(Varien_Object $object)
{
// for optimization if we no conditions
if (!$this->getConditions()) {
return true;
}
$origProduct = null;
if ($object->getHasChildren() && $object->getProductType() == 'configurable') {
//remember original product
$origProduct = $object->getProduct();
$origSku = $object->getSku();
foreach ($object->getChildren() as $child) {
// only one itereation.
$categoryIds = array_merge($child->getProduct()->getCategoryIds(), $origProduct->getCategoryIds());
$categoryIds = array_unique($categoryIds);
$object->setProduct($child->getProduct());
$object->setSku($child->getSku());
$object->getProduct()->setCategoryIds($categoryIds);
}
}
$result = @Mage_Rule_Model_Condition_Combine::validate($object);
if ($origProduct) {
// restore original product
$object->setProduct($origProduct);
$object->setSku($origSku);
}
return $result;
}
示例2: getConditions
/**
* Retrieve rule combine conditions model
*
* @return Mage_Rule_Model_Condition_Combine
*/
public function getConditions()
{
if (empty($this->_conditions)) {
$this->_resetConditions();
}
// Load rule conditions if it is applicable
if ($this->hasConditionsSerialized()) {
$conditions = $this->getConditionsSerialized();
if (!empty($conditions)) {
$conditions = unserialize($conditions);
if (is_array($conditions) && !empty($conditions)) {
$this->_conditions->loadArray($conditions);
}
}
$this->unsConditionsSerialized();
}
return $this->_conditions;
}
示例3: getNewChildSelectOptions
public function getNewChildSelectOptions()
{
if ($this->getRule()->getType()) {
$type = $this->getRule()->getType();
} else {
$type = Mage::app()->getRequest()->getParam('rule_type');
}
if ($type == Mirasvit_FeedExport_Model_Rule::TYPE_ATTRIBUTE) {
$itemAttributes = $this->_getProductAttributes();
$condition = 'product' . $this->getRulePrefix();
} else {
$itemAttributes = $this->_getPerformanceAttributes();
$condition = 'performance';
}
$attributes = array();
foreach ($itemAttributes as $code => $label) {
$group = Mage::helper('feedexport/html')->getAttributeGroup(str_replace(Mirasvit_FeedExport_Model_Rule_Condition_Combine_Parent::ATTR_CODE_PREFIX, '', $code));
$attributes[$group][] = array('value' => 'feedexport/rule_condition_' . $condition . '|' . $code, 'label' => $label);
}
$conditions = parent::getNewChildSelectOptions();
$conditions = array_merge_recursive($conditions, array(array('value' => 'feedexport/rule_condition_combine', 'label' => Mage::helper('feedexport')->__('Conditions Combination')), array('value' => 'feedexport/rule_condition_combine_parent', 'label' => Mage::helper('feedexport')->__('Parent Product Attributes'))));
foreach ($attributes as $group => $arrAttributes) {
$conditions = array_merge_recursive($conditions, array(array('label' => $group, 'value' => $arrAttributes)));
}
return $conditions;
}
示例4: getNewChildSelectOptions
public function getNewChildSelectOptions()
{
$attributes = array();
$customAttributes = Mage::getSingleton('xtento_orderexport/export_condition_custom')->getCustomAttributes();
foreach ($customAttributes as $code => $label) {
if (preg_match('/xt\\_billing\\_/', $code)) {
$attributes[] = array('value' => 'xtento_orderexport/export_condition_address_billing|' . str_replace('xt_billing_', '', $code), 'label' => $label);
} else {
if (preg_match('/xt\\_shipping\\_/', $code)) {
$attributes[] = array('value' => 'xtento_orderexport/export_condition_address_shipping|' . str_replace('xt_shipping_', '', $code), 'label' => $label);
} else {
$attributes[] = array('value' => 'xtento_orderexport/export_condition_object|' . $code, 'label' => $label);
}
}
}
$otherAttributes = array();
$customOtherAttributes = Mage::getSingleton('xtento_orderexport/export_condition_custom')->getCustomNotMappedAttributes();
foreach ($customOtherAttributes as $code => $label) {
$otherAttributes[] = array('value' => 'xtento_orderexport/export_condition_object|' . $code, 'label' => $label);
}
$conditions = parent::getNewChildSelectOptions();
$conditions = array_merge_recursive($conditions, array(array('value' => 'xtento_orderexport/export_condition_product_found', 'label' => Mage::helper('salesrule')->__('Product / Item attribute combination')), array('value' => 'xtento_orderexport/export_condition_product_subselect', 'label' => Mage::helper('salesrule')->__('Products subselection')), array('value' => 'xtento_orderexport/export_condition_combine', 'label' => Mage::helper('salesrule')->__('Conditions combination')), array('label' => Mage::helper('xtento_orderexport')->__('%s Attributes', ucfirst(Mage::registry('order_export_profile')->getEntity())), 'value' => $attributes), array('label' => Mage::helper('xtento_orderexport')->__('Misc. %s Attributes', ucfirst(Mage::registry('order_export_profile')->getEntity())), 'value' => $otherAttributes)));
$additional = new Varien_Object();
Mage::dispatchEvent('xtento_orderexport_rule_condition_combine', array('additional' => $additional));
if ($additionalConditions = $additional->getConditions()) {
$conditions = array_merge_recursive($conditions, $additionalConditions);
}
return $conditions;
}
示例5: getNewChildSelectOptions
public function getNewChildSelectOptions()
{
$addressCondition = Mage::getModel('followupemail/followupemailrule_rule_condition_address');
$addressAttributes = $addressCondition->loadAttributeOptions()->getAttributeOption();
$cattributes = array();
$oattributes = array();
$cusattributes = array();
$pattributes = array();
foreach ($addressAttributes as $code => $label) {
if (strpos($code, 'cart_') === 0) {
$cattributes[] = array('value' => 'followupemail/followupemailrule_rule_condition_address|' . $code, 'label' => $label);
} else {
if (strpos($code, 'order_') === 0) {
$oattributes[] = array('value' => 'followupemail/followupemailrule_rule_condition_address|' . $code, 'label' => $label);
} else {
if (strpos($code, 'product_') === 0) {
$pattributes[] = array('value' => 'followupemail/followupemailrule_rule_condition_address|' . $code, 'label' => $label);
} else {
$cusattributes[] = array('value' => 'followupemail/followupemailrule_rule_condition_address|' . $code, 'label' => $label);
}
}
}
}
$conditions = parent::getNewChildSelectOptions();
$conditions = array_merge_recursive($conditions, array(array('label' => Mage::helper('followupemail')->__('Cart Attribute'), 'value' => $cattributes), array('label' => Mage::helper('followupemail')->__('Order Attribute'), 'value' => $oattributes), array('label' => Mage::helper('followupemail')->__('Has Product'), 'value' => $pattributes), array('label' => Mage::helper('followupemail')->__('Customer Attribute'), 'value' => $cusattributes)));
// $additional = new Varien_Object();
// //Mage::dispatchEvent('helpdesk_helpdeskrule_rule_condition_combine', array('additional' => $additional));
// Mage::dispatchEvent('salesrule_rule_condition_combine', array('additional' => $additional));
// if ($additionalConditions = $additional->getConditions()) {
// $conditions = array_merge_recursive($conditions, $additionalConditions);
// }
return $conditions;
}
示例6: getNewChildSelectOptions
public function getNewChildSelectOptions()
{
$conditions = parent::getNewChildSelectOptions();
$conditions = array_merge_recursive($conditions, array(array('value' => 'rewardpoints/rule_condition_combine', 'label' => Mage::helper('rewardpoints')->__('Conditions Combination'))));
$c_attributes = array(array('value' => 'rewardpoints/rule_condition_customeraddress_params|postcode', 'label' => Mage::helper('rewardpoints')->__('User post code')), array('value' => 'rewardpoints/rule_condition_customeraddress_params|region_id', 'label' => Mage::helper('rewardpoints')->__('User region')), array('value' => 'rewardpoints/rule_condition_customeraddress_params|country_id', 'label' => Mage::helper('rewardpoints')->__('User country')));
/*$customer = Mage::getModel('customer/customer');
$c2_attributes = array();
foreach ($customer->getAttributes() as $attribute){
//echo $attribute->getAttributeCode();
//echo $attribute->getFrontendLabel();
//backend_type
if ($attribute->getBackendModel() == "" && $attribute->getFrontendLabel() != ""){
$c2_attributes[] = array('value'=>'rewardpoints/rule_condition_customerattribute_params|'.$attribute->getAttributeCode(), 'label'=> $attribute->getFrontendLabel());
}
}*/
$conditions = array_merge_recursive($conditions, array(array('label' => Mage::helper('rewardpoints')->__('User location'), 'value' => $c_attributes)));
/*$conditions = array_merge_recursive($conditions, array(
array('label'=>Mage::helper('rewardpoints')->__('User Attributes'), 'value'=>$c2_attributes),
));*/
$addressCondition = Mage::getModel('salesrule/rule_condition_address');
$addressAttributes = $addressCondition->loadAttributeOptions()->getAttributeOption();
$cart_attributes = array();
foreach ($addressAttributes as $code => $label) {
$cart_attributes[] = array('value' => 'salesrule/rule_condition_address|' . $code, 'label' => $label);
}
$conditions = array_merge_recursive($conditions, array(array('label' => Mage::helper('salesrule')->__('Cart Attributes'), 'value' => $cart_attributes)));
return $conditions;
}
示例7: getNewChildSelectOptions
public function getNewChildSelectOptions()
{
$cAttributes[] = array('value' => 'Aitoc_Aitloyalty_Model_Rule_Condition_Customer|amount_during_period', 'label' => 'Amount spent during period');
$cAttributes[] = array('value' => 'Aitoc_Aitloyalty_Model_Rule_Condition_Customer|membership_period', 'label' => 'Period of membership');
$cAttributes[] = array('value' => 'Aitoc_Aitloyalty_Model_Rule_Condition_Customer|amount_average', 'label' => 'Average order amount during period');
$conditions = parent::getNewChildSelectOptions();
$conditions = array_merge_recursive($conditions, array(array('value' => 'Aitoc_Aitloyalty_Model_Rule_Condition_Customer_Combine', 'label' => Mage::helper('catalog')->__('Conditions Combination')), array('label' => Mage::helper('catalog')->__('Customer Data'), 'value' => $cAttributes)));
return $conditions;
}
示例8: loadArray
/**
* Add operator when loading array
*
* @param array $arr
* @param string $key
* @return Enterprise_CustomerSegment_Model_Segment_Condition_Combine
*/
public function loadArray($arr, $key = 'conditions')
{
if (isset($arr['operator'])) {
$this->setOperator($arr['operator']);
}
if (isset($arr['attribute'])) {
$this->setAttribute($arr['attribute']);
}
return parent::loadArray($arr, $key);
}
示例9: getNewChildSelectOptions
public function getNewChildSelectOptions()
{
$bannerConditions = Mage::getModel('prolabels/rule_condition_product')->loadAttributeOptions()->getAttributeOption();
$attributes = array();
foreach ($bannerConditions as $code => $label) {
$attributes[] = array('value' => 'prolabels/rule_condition_product|' . $code, 'label' => $label);
}
$conditions = parent::getNewChildSelectOptions();
$conditions = array_merge_recursive($conditions, array(array('value' => 'prolabels/rule_condition_combine', 'label' => Mage::helper('catalogrule')->__('Conditions Combination')), array('value' => $attributes, 'label' => Mage::helper('catalogrule')->__('Product'))));
return $conditions;
}
示例10: getNewChildSelectOptions
public function getNewChildSelectOptions()
{
$productCondition = Mage::getModel('Mage_CatalogRule_Model_Rule_Condition_Product');
$productAttributes = $productCondition->loadAttributeOptions()->getAttributeOption();
$attributes = array();
foreach ($productAttributes as $code => $label) {
$attributes[] = array('value' => 'Mage_CatalogRule_Model_Rule_Condition_Product|' . $code, 'label' => $label);
}
$conditions = parent::getNewChildSelectOptions();
$conditions = array_merge_recursive($conditions, array(array('value' => 'Mage_CatalogRule_Model_Rule_Condition_Combine', 'label' => Mage::helper('Mage_CatalogRule_Helper_Data')->__('Conditions Combination')), array('label' => Mage::helper('Mage_CatalogRule_Helper_Data')->__('Product Attribute'), 'value' => $attributes)));
return $conditions;
}
示例11: getNewChildSelectOptions
public function getNewChildSelectOptions()
{
$addressCondition = AO::getModel('salesrule/rule_condition_address');
$addressAttributes = $addressCondition->loadAttributeOptions()->getAttributeOption();
$attributes = array();
foreach ($addressAttributes as $code => $label) {
$attributes[] = array('value' => 'salesrule/rule_condition_address|' . $code, 'label' => $label);
}
$conditions = parent::getNewChildSelectOptions();
$conditions = array_merge_recursive($conditions, array(array('value' => 'salesrule/rule_condition_product_found', 'label' => AO::helper('salesrule')->__('Product attribute combination')), array('value' => 'salesrule/rule_condition_product_subselect', 'label' => AO::helper('salesrule')->__('Products subselection')), array('value' => 'salesrule/rule_condition_combine', 'label' => AO::helper('salesrule')->__('Conditions combination')), array('label' => AO::helper('salesrule')->__('Cart Attribute'), 'value' => $attributes)));
return $conditions;
}
示例12: getNewChildSelectOptions
/**
* get child select options
* @return type
*/
public function getNewChildSelectOptions()
{
$orderAttributes = Mage::getModel('rewardpointsreferfriends/rule_condition_order')->loadAttributeOptions()->getAttributeOption();
$attributes = array();
foreach ($orderAttributes as $attribute => $label) {
$attributes[] = array('value' => 'rewardpointsreferfriends/rule_condition_order|' . $attribute, 'label' => $label);
}
$conditions = parent::getNewChildSelectOptions();
$conditions = array_merge_recursive($conditions, array(array('value' => 'salesrule/rule_condition_product_found', 'label' => Mage::helper('rewardpointsreferfriends')->__('Product attribute combination')), array('value' => 'salesrule/rule_condition_product_subselect', 'label' => Mage::helper('rewardpointsreferfriends')->__('Products subselection')), array('value' => 'rewardpointsreferfriends/rule_condition_combine', 'label' => Mage::helper('rewardpointsreferfriends')->__('Conditions combination')), array('value' => $attributes, 'label' => Mage::helper('rewardpointsreferfriends')->__('Cart Order Attribute'))));
$additional = new Varien_Object();
Mage::dispatchEvent('rewardpointsreferfriends_rule_condition_combine', array('additional' => $additional));
if ($additionalConditions = $additional->getConditions()) {
$conditions = array_merge_recursive($conditions, $additionalConditions);
}
return $conditions;
}
示例13: getNewChildSelectOptions
public function getNewChildSelectOptions()
{
$addressCondition = Mage::getModel('salesrule/rule_condition_address');
$addressAttributes = $addressCondition->loadAttributeOptions()->getAttributeOption();
$attributes = array();
foreach ($addressAttributes as $code => $label) {
$attributes[] = array('value' => 'salesrule/rule_condition_address|' . $code, 'label' => $label);
}
$conditions = parent::getNewChildSelectOptions();
$conditions = array_merge_recursive($conditions, array(array('value' => 'amacart/rule_condition_carts', 'label' => Mage::helper('amacart')->__('Number of recovered cards this month')), array('value' => 'salesrule/rule_condition_product_subselect', 'label' => Mage::helper('salesrule')->__('Products subselection')), array('value' => $this->getType(), 'label' => Mage::helper('salesrule')->__('Conditions combination')), array('label' => Mage::helper('salesrule')->__('Cart Attribute'), 'value' => $attributes)));
$additional = new Varien_Object();
Mage::dispatchEvent('salesrule_rule_condition_combine', array('additional' => $additional));
if ($additionalConditions = $additional->getConditions()) {
$conditions = array_merge_recursive($conditions, $additionalConditions);
}
return $conditions;
}
示例14: getNewChildSelectOptions
/**
* Retrieve the product options for the select field.
*
* @see Mage_Rule_Model_Condition_Abstract::getNewChildSelectOptions()
* @return array Conditions as array
*/
public function getNewChildSelectOptions()
{
$productCondition = Mage::getModel('dynamiccategory/rule_condition_product');
$productAttributes = $productCondition->loadAttributeOptions()->getAttributeOption();
$pAttributes = array();
$iAttributes = array();
foreach ($productAttributes as $code => $label) {
if (strpos($code, 'quote_item_') === 0) {
$iAttributes[] = array('value' => 'dynamiccategory/rule_condition_product|' . $code, 'label' => $label);
} else {
$pAttributes[] = array('value' => 'dynamiccategory/rule_condition_product|' . $code, 'label' => $label);
}
}
$conditions = parent::getNewChildSelectOptions();
$conditions = array_merge_recursive($conditions, array(array('value' => 'dynamiccategory/rule_condition_product_combine', 'label' => Mage::helper('dynamiccategory')->__('Conditions Combination')), array('label' => Mage::helper('dynamiccategory')->__('Product Attribute'), 'value' => $pAttributes)));
return $conditions;
}
示例15: getNewChildSelectOptions
public function getNewChildSelectOptions()
{
$addressCondition = Mage::getModel('Mage_SalesRule_Model_Rule_Condition_Address');
$addressAttributes = $addressCondition->loadAttributeOptions()->getAttributeOption();
$attributes = array();
foreach ($addressAttributes as $code => $label) {
$attributes[] = array('value' => 'Mage_SalesRule_Model_Rule_Condition_Address|' . $code, 'label' => $label);
}
$conditions = parent::getNewChildSelectOptions();
$conditions = array_merge_recursive($conditions, array(array('value' => 'Mage_SalesRule_Model_Rule_Condition_Product_Found', 'label' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Product attribute combination')), array('value' => 'Mage_SalesRule_Model_Rule_Condition_Product_Subselect', 'label' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Products subselection')), array('value' => 'Mage_SalesRule_Model_Rule_Condition_Combine', 'label' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Conditions combination')), array('label' => Mage::helper('Mage_SalesRule_Helper_Data')->__('Cart Attribute'), 'value' => $attributes)));
$additional = new Varien_Object();
Mage::dispatchEvent('salesrule_rule_condition_combine', array('additional' => $additional));
if ($additionalConditions = $additional->getConditions()) {
$conditions = array_merge_recursive($conditions, $additionalConditions);
}
return $conditions;
}