1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27:
28: class Mage_SalesRule_Model_Rule_Condition_Product_Combine extends Mage_Rule_Model_Condition_Combine
29: {
30: public function __construct()
31: {
32: parent::__construct();
33: $this->setType('salesrule/rule_condition_product_combine');
34: }
35:
36: public function getNewChildSelectOptions()
37: {
38: $productCondition = Mage::getModel('salesrule/rule_condition_product');
39: $productAttributes = $productCondition->loadAttributeOptions()->getAttributeOption();
40: $pAttributes = array();
41: $iAttributes = array();
42: foreach ($productAttributes as $code=>$label) {
43: if (strpos($code, 'quote_item_')===0) {
44: $iAttributes[] = array('value'=>'salesrule/rule_condition_product|'.$code, 'label'=>$label);
45: } else {
46: $pAttributes[] = array('value'=>'salesrule/rule_condition_product|'.$code, 'label'=>$label);
47: }
48: }
49:
50: $conditions = parent::getNewChildSelectOptions();
51: $conditions = array_merge_recursive($conditions, array(
52: array('value'=>'salesrule/rule_condition_product_combine', 'label'=>Mage::helper('catalog')->__('Conditions Combination')),
53: array('label'=>Mage::helper('catalog')->__('Cart Item Attribute'), 'value'=>$iAttributes),
54: array('label'=>Mage::helper('catalog')->__('Product Attribute'), 'value'=>$pAttributes),
55: ));
56: return $conditions;
57: }
58:
59: public function collectValidatedAttributes($productCollection)
60: {
61: foreach ($this->getConditions() as $condition) {
62: $condition->collectValidatedAttributes($productCollection);
63: }
64: return $this;
65: }
66: }
67: