Example #1
0
 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;
 }
 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;
 }
Example #3
0
 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;
 }
Example #4
0
 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;
 }
Example #5
0
 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;
 }
Example #6
0
 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;
 }
Example #7
0
 /**
  * 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);
 }
Example #8
0
 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;
 }
Example #9
0
 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;
 }
 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;
 }
Example #11
0
 public function getNewChildSelectOptions()
 {
     $productCondition = Mage::getModel('catalogrule/rule_condition_product');
     //$productCondition = Mage::getModel('rewardpoints/catalogpointrule_condition_product');
     $productAttributes = $productCondition->loadAttributeOptions()->getAttributeOption();
     $attributes = array();
     foreach ($productAttributes as $code => $label) {
         $attributes[] = array('value' => 'catalogrule/rule_condition_product|' . $code, 'label' => $label);
     }
     $conditions = parent::getNewChildSelectOptions();
     $conditions = array_merge_recursive($conditions, array(array('value' => 'rewardpoints/catalogpointrule_condition_combine', 'label' => Mage::helper('catalogrule')->__('Conditions Combination')), array('label' => Mage::helper('rewardpoints')->__('Product Attribute'), 'value' => $attributes)));
     return $conditions;
 }
Example #12
0
 /**
  * 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;
 }
Example #13
0
 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;
 }
 /**
  * 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;
 }
Example #15
0
 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;
 }
 public function getNewChildSelectOptions()
 {
     $productCondition = Mage::getModel('hipay/rule_condition_product');
     $productAttributes = $productCondition->loadAttributeOptions()->getAttributeOption();
     $pAttributes = array();
     $iAttributes = array();
     foreach ($productAttributes as $code => $label) {
         if (strpos($code, 'order_item_') === 0) {
             $iAttributes[] = array('value' => 'hipay/rule_condition_product|' . $code . '|' . $this->getPaymentMethodCode(), 'label' => $label);
         } else {
             $pAttributes[] = array('value' => 'hipay/rule_condition_product|' . $code . '|' . $this->getPaymentMethodCode(), 'label' => $label);
         }
     }
     $conditions = parent::getNewChildSelectOptions();
     $conditions = array_merge_recursive($conditions, array(array('value' => 'hipay/rule_condition_product_combine||' . $this->getPaymentMethodCode(), 'label' => Mage::helper('catalog')->__('Conditions Combination')), array('label' => Mage::helper('hipay')->__('Order Attribute'), 'value' => $iAttributes), array('label' => Mage::helper('catalog')->__('Product Attribute'), 'value' => $pAttributes)));
     return $conditions;
 }
Example #17
0
 /**
  * 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;
 }
 public function getNewChildSelectOptions()
 {
     $addressCondition = Mage::getModel('hhennes_autogroups/rule_condition_address');
     $addressAttributes = $addressCondition->loadAttributeOptions()->getAttributeOption();
     $attributes = array();
     foreach ($addressAttributes as $code => $label) {
         $attributes[] = array('value' => 'hhennes_autogroups/rule_condition_address|' . $code, 'label' => $label);
     }
     $customerCondition = Mage::getModel('hhennes_autogroups/rule_condition_customer');
     $customerAttributes = $customerCondition->loadAttributeOptions()->getAttributeOption();
     $CustomersAttributes = array();
     foreach ($customerAttributes as $code => $label) {
         $CustomersAttributes[] = array('value' => 'hhennes_autogroups/rule_condition_customer|' . $code, 'label' => $label);
     }
     $conditions = parent::getNewChildSelectOptions();
     $conditions = array_merge_recursive($conditions, array(array('label' => Mage::helper('hhennes_autogroups')->__('Address Attributes'), 'value' => $attributes), array('label' => Mage::helper('hhennes_autogroups')->__('Customer Attributes'), 'value' => $CustomersAttributes)));
     return $conditions;
 }
Example #19
0
 public function getNewChildSelectOptions()
 {
     $productCondition = Mage::getModel('salesrule/rule_condition_product');
     $productAttributes = $productCondition->loadAttributeOptions()->getAttributeOption();
     $pAttributes = array();
     $pAttributes[] = array('value' => 'productlabels/rule_condition_product|is_new', 'label' => 'Is New');
     $pAttributes[] = array('value' => 'productlabels/rule_condition_product|is_special', 'label' => 'Is Special Price');
     $pAttributes[] = array('value' => 'productlabels/rule_condition_product|qty', 'label' => 'Qty');
     $pAttributes[] = array('value' => 'productlabels/rule_condition_product|out_of_stock', 'label' => 'Is Out Of Stock');
     $pAttributes[] = array('value' => 'productlabels/rule_condition_product|best_seller', 'label' => 'Amount Best Seller');
     $iAttributes = array();
     foreach ($productAttributes as $code => $label) {
         if (strpos($code, 'quote_item_') === 0) {
             $iAttributes[] = array('value' => 'salesrule/rule_condition_product|' . $code, 'label' => $label);
         } else {
             $pAttributes[] = array('value' => 'salesrule/rule_condition_product|' . $code, 'label' => $label);
         }
     }
     $conditions = parent::getNewChildSelectOptions();
     $conditions = array_merge_recursive($conditions, array(array('value' => 'salesrule/rule_condition_product_combine', 'label' => Mage::helper('catalog')->__('Conditions Combination')), array('label' => Mage::helper('catalog')->__('Product Attribute'), 'value' => $pAttributes)));
     return $conditions;
 }
Example #20
0
 public function getNewChildSelectOptions()
 {
     $productCondition = Mage::getModel('seo/template_rule_condition_validate');
     $productAttributes = $productCondition->loadAttributeOptions()->getAttributeOption();
     $attributes = array();
     foreach ($productAttributes as $code => $label) {
         $group = 'attributes';
         foreach ($this->_groups as $key => $values) {
             if (in_array($code, $values)) {
                 $group = $key;
             }
         }
         $attributes[$group][] = array('value' => 'seo/template_rule_condition_validate|' . $code, 'label' => $label);
     }
     $conditions = parent::getNewChildSelectOptions();
     $conditions = array_merge_recursive($conditions, array(array('value' => 'seo/template_rule_condition_combine', 'label' => Mage::helper('seo')->__('Conditions Combination')), array('label' => Mage::helper('seo')->__('Categories and Layered navigation'), 'value' => $attributes['category'])));
     $model = Mage::registry('current_template_model');
     if ($model && $model->getRuleType() && $model->getRuleType() == Mirasvit_Seo_Model_Config::PRODUCTS_RULE) {
         $conditions = array_merge_recursive($conditions, array(array('label' => Mage::helper('seo')->__('Products'), 'value' => $attributes['base']), array('label' => Mage::helper('seo')->__('Products Attributes'), 'value' => $attributes['attributes'])));
     }
     return $conditions;
 }
 public function getNewChildSelectOptions()
 {
     $addressCondition = Mage::getModel('hipay/rule_condition_address');
     $addressAttributes = $addressCondition->loadAttributeOptions()->getAttributeOption();
     $attributes = array();
     foreach ($addressAttributes as $code => $label) {
         $attributes[] = array('value' => 'hipay/rule_condition_address|' . $code . '|' . $this->getPaymentMethodCode(), 'label' => $label);
     }
     $customerCondition = Mage::getModel('hipay/rule_condition_customer');
     $customerAttributes = $customerCondition->loadAttributeOptions()->getAttributeOption();
     $cAttributes = array();
     foreach ($customerAttributes as $code => $label) {
         $cAttributes[] = array('value' => 'hipay/rule_condition_customer|' . $code . '|' . $this->getPaymentMethodCode(), 'label' => $label);
     }
     $conditions = parent::getNewChildSelectOptions();
     $conditions = array_merge_recursive($conditions, array(array('value' => 'hipay/rule_condition_product_found||' . $this->getPaymentMethodCode(), 'label' => Mage::helper('salesrule')->__('Product attribute combination')), array('value' => 'hipay/rule_condition_product_subselect||' . $this->getPaymentMethodCode(), 'label' => Mage::helper('salesrule')->__('Products subselection')), array('value' => 'hipay/rule_condition_combine||' . $this->getPaymentMethodCode(), 'label' => Mage::helper('salesrule')->__('Conditions combination')), array('label' => Mage::helper('hipay')->__('Order Attribute'), 'value' => $attributes), array('label' => Mage::helper('hipay')->__('Customer Attribute'), 'value' => $cAttributes)));
     $additional = new Varien_Object();
     Mage::dispatchEvent('hipay_rule_condition_combine', array('additional' => $additional));
     if ($additionalConditions = $additional->getConditions()) {
         $conditions = array_merge_recursive($conditions, $additionalConditions);
     }
     return $conditions;
 }
Example #22
0
 /**
  * Remove catalog attribute condition by attribute code from rule conditions
  *
  * @param Mage_Rule_Model_Condition_Combine $combine
  * @param string $attributeCode
  */
 protected function _removeAttributeFromConditions($combine, $attributeCode)
 {
     $conditions = $combine->getConditions();
     foreach ($conditions as $conditionId => $condition) {
         if ($condition instanceof Mage_Rule_Model_Condition_Combine) {
             $this->_removeAttributeFromConditions($condition, $attributeCode);
         }
         if ($condition instanceof Mage_SalesRule_Model_Rule_Condition_Product) {
             if ($condition->getAttribute() == $attributeCode) {
                 unset($conditions[$conditionId]);
             }
         }
     }
     $combine->setConditions($conditions);
 }
Example #23
0
 /**
  * Prepare list of contitions
  *
  * @return array
  */
 public function getNewChildSelectOptions()
 {
     $conditions = array(array('value' => $this->getType(), 'label' => Mage::helper('enterprise_targetrule')->__('Conditions Combination')), Mage::getModel('enterprise_targetrule/actions_condition_product_attributes')->getNewChildSelectOptions(), Mage::getModel('enterprise_targetrule/actions_condition_product_special')->getNewChildSelectOptions());
     $conditions = array_merge_recursive(parent::getNewChildSelectOptions(), $conditions);
     return $conditions;
 }
 public function getId()
 {
     return $this->getRule()->getType() . parent::getId();
 }
Example #25
0
 public function __construct($data = array())
 {
     $this->_initialData = $data;
     parent::__construct();
 }
 /**
  * Validate a condition with the checking of the child value
  * @param Varien_Object $object
  *
  * @return bool
  */
 public function validate(Varien_Object $object)
 {
     /** @var Mage_Catalog_Model_Product $product */
     $product = $object->getProduct();
     if (!$product instanceof Mage_Catalog_Model_Product) {
         $product = Mage::getModel('catalog/product')->load($object->getProductId());
     }
     $valid = parent::validate($object);
     if (!$valid && $product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
         $children = $object->getChildren();
         $valid = $children && $this->validate($children[0]);
     }
     return $valid;
 }
Example #27
0
 public function getNewChildSelectOptions()
 {
     $conditions = Mage_Rule_Model_Condition_Combine::getNewChildSelectOptions();
     $conditions = array_merge_recursive($conditions, array(array('label' => Mage::helper('amlanding')->__('Conditions Combination'), 'value' => 'amlanding/filter_condition_combine'), array('label' => Mage::helper('amlanding')->__('Custom Fields'), 'value' => array(array('label' => Mage::helper('amlanding')->__('Qty'), 'value' => 'amlanding/filter_condition_qty'), array('label' => Mage::helper('amlanding')->__('Min Price'), 'value' => 'amlanding/filter_condition_price_min'), array('label' => Mage::helper('amlanding')->__('Max Price'), 'value' => 'amlanding/filter_condition_price_max'), array('label' => Mage::helper('amlanding')->__('Final Price'), 'value' => 'amlanding/filter_condition_price_final'))), array('label' => Mage::helper('catalog')->__('Product Attribute'), 'value' => $this->_getProductAttributes())));
     return $conditions;
 }
Example #28
0
 public function getNewChildSelectOptions()
 {
     $conditions = parent::getNewChildSelectOptions();
     $conditions = array_merge_recursive($conditions, array(array('value' => 'advancednewsletter/rule_condition_combine', 'label' => Mage::helper('advancednewsletter')->__('Conditions Combination')), array('value' => 'advancednewsletter/rule_condition_order_params|store', 'label' => Mage::helper('advancednewsletter')->__('Store')), array('value' => 'advancednewsletter/rule_condition_order_params|category', 'label' => Mage::helper('advancednewsletter')->__('Category')), array('value' => 'advancednewsletter/rule_condition_order_params|sku', 'label' => Mage::helper('advancednewsletter')->__('Contains any of these SKUs')), array('value' => 'advancednewsletter/rule_condition_order_params|order_status', 'label' => Mage::helper('advancednewsletter')->__('Order status'))));
     return $conditions;
 }
 /**
  * @return array
  */
 public function getNewChildSelectOptions()
 {
     $addressAttributes = array();
     $addressAttributesBilling = array();
     $addressAttributesShipping = array();
     $addressAttributesTmp = Mage::getModel('salesrule/rule_condition_address')->loadAttributeOptions()->getAttributeOption();
     // only base_subtotal, total_qty, weight
     if (isset($addressAttributesTmp['base_subtotal'])) {
         $addressAttributes['base_subtotal'] = $addressAttributesTmp['base_subtotal'];
     }
     if (isset($addressAttributesTmp['total_qty'])) {
         $addressAttributes['total_qty'] = $addressAttributesTmp['total_qty'];
     }
     if (isset($addressAttributesTmp['weight'])) {
         $addressAttributes['weight'] = $addressAttributesTmp['weight'];
     }
     $addressAttributesTmp = Mage::getModel('mageworx_multifees/fee_condition_address_billing')->loadAttributeOptions()->getAttributeOption();
     if (isset($addressAttributesTmp['postcode'])) {
         $addressAttributesBilling['postcode'] = $addressAttributesTmp['postcode'];
     }
     if (isset($addressAttributesTmp['region'])) {
         $addressAttributesBilling['region'] = $addressAttributesTmp['region'];
     }
     if (isset($addressAttributesTmp['country_id'])) {
         $addressAttributesBilling['country_id'] = $addressAttributesTmp['country_id'];
     }
     if (isset($addressAttributesTmp['region_id'])) {
         $addressAttributesBilling['region_id'] = $addressAttributesTmp['region_id'];
     }
     $addressAttributesTmp = Mage::getModel('mageworx_multifees/fee_condition_address_shipping')->loadAttributeOptions()->getAttributeOption();
     if (isset($addressAttributesTmp['postcode'])) {
         $addressAttributesShipping['postcode'] = $addressAttributesTmp['postcode'];
     }
     if (isset($addressAttributesTmp['region'])) {
         $addressAttributesShipping['region'] = $addressAttributesTmp['region'];
     }
     if (isset($addressAttributesTmp['country_id'])) {
         $addressAttributesShipping['country_id'] = $addressAttributesTmp['country_id'];
     }
     if (isset($addressAttributesTmp['region_id'])) {
         $addressAttributesShipping['region_id'] = $addressAttributesTmp['region_id'];
     }
     $attributes = array();
     foreach ($addressAttributes as $code => $label) {
         $attributes[] = array('value' => 'salesrule/rule_condition_address|' . $code, 'label' => $label);
     }
     foreach ($addressAttributesBilling as $code => $label) {
         $attributes[] = array('value' => 'mageworx_multifees/fee_condition_address_billing|' . $code, 'label' => $label);
     }
     foreach ($addressAttributesShipping as $code => $label) {
         $attributes[] = array('value' => 'mageworx_multifees/fee_condition_address_shipping|' . $code, 'label' => $label);
     }
     $conditions = parent::getNewChildSelectOptions();
     $conditions = array_merge_recursive($conditions, array(array('value' => 'mageworx_multifees/fee_condition_product_found', 'label' => Mage::helper('salesrule')->__('Product attribute combination')), array('value' => 'mageworx_multifees/fee_condition_combine', '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;
 }
 /**
  * Add custom conditions selectors
  *
  * @return array
  */
 public function getNewChildSelectOptions()
 {
     $conditions = parent::getNewChildSelectOptions();
     $conditions = array_merge_recursive($conditions, array(array('value' => 'easyshippingrules/rule_condition_combine', 'label' => Mage::helper('easyshippingrules')->__('Conditions combination')), array('value' => 'easyshippingrules/rule_condition_product_found', 'label' => Mage::helper('easyshippingrules')->__('Product attribute combination')), array('value' => 'easyshippingrules/rule_condition_rule', 'label' => Mage::helper('easyshippingrules')->__('Shipping Rule')), array('value' => 'easyshippingrules/rule_condition_programmaticmethod', 'label' => Mage::helper('easyshippingrules')->__('Programmatic Method')), array('label' => Mage::helper('easyshippingrules')->__('Cart Attribute'), 'value' => $this->_getAddressAttributesData()), array('label' => Mage::helper('easyshippingrules')->__('Customer attribute'), 'value' => $this->_getCustomerAttributesData())));
     return $conditions;
 }