00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 class Mage_SalesRule_Model_Rule_Condition_Product_Combine extends Mage_Rule_Model_Condition_Combine
00029 {
00030 public function __construct()
00031 {
00032 parent::__construct();
00033 $this->setType('salesrule/rule_condition_product_combine');
00034 }
00035
00036 public function getNewChildSelectOptions()
00037 {
00038 $productCondition = Mage::getModel('salesrule/rule_condition_product');
00039 $productAttributes = $productCondition->loadAttributeOptions()->getAttributeOption();
00040 $pAttributes = array();
00041 $iAttributes = array();
00042 foreach ($productAttributes as $code=>$label) {
00043 if (strpos($code, 'quote_item_')===0) {
00044 $iAttributes[] = array('value'=>'salesrule/rule_condition_product|'.$code, 'label'=>$label);
00045 } else {
00046 $pAttributes[] = array('value'=>'salesrule/rule_condition_product|'.$code, 'label'=>$label);
00047 }
00048 }
00049
00050 $conditions = parent::getNewChildSelectOptions();
00051 $conditions = array_merge_recursive($conditions, array(
00052 array('value'=>'salesrule/rule_condition_product_combine', 'label'=>Mage::helper('catalog')->__('Conditions Combination')),
00053 array('label'=>Mage::helper('catalog')->__('Cart Item Attribute'), 'value'=>$iAttributes),
00054 array('label'=>Mage::helper('catalog')->__('Product Attribute'), 'value'=>$pAttributes),
00055 ));
00056 return $conditions;
00057 }
00058
00059 public function collectValidatedAttributes($productCollection)
00060 {
00061 foreach ($this->getConditions() as $condition) {
00062 $condition->collectValidatedAttributes($productCollection);
00063 }
00064 return $this;
00065 }
00066 }