Class Mage_SalesRule_Model_Rule

Description

Magento

NOTICE OF LICENSE

This source file is subject to the Open Software License (OSL 3.0) that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://opensource.org/licenses/osl-3.0.php If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.

DISCLAIMER

Do not edit or add to this file if you wish to upgrade Magento to newer versions in the future. If you wish to customize Magento for your needs please refer to http://www.magentocommerce.com for more information.

Located in /SalesRule/Model/Rule.php (line 28)

Varien_Object
   |
   --Mage_Core_Model_Abstract
      |
      --Mage_Rule_Model_Rule
         |
         --Mage_SalesRule_Model_Rule
Class Constant Summary
Variable Summary
Method Summary
Mage_SalesRule_Model_Coupon|null acquireCoupon ([bool $saveNewlyCreated = true], [int $saveAttemptCount = 10])
array getCoupons ()
array getCouponTypes ()
string getStoreLabel ([store $store = null])
array getStoreLabels ()
array toArray ([ $arrAttributes = array()])
void toString ([ $format = ''])
void _construct ()
array _getUsedAttributes (string $serializedString)
Variables
static Mage_SalesRule_Model_Coupon_CodegeneratorInterface $_couponCodeGenerator (line 51)
  • access: protected
array $_coupons (line 83)

Rule's subordinate coupons

  • var: of Mage_SalesRule_Model_Coupon
  • access: protected
array $_couponTypes (line 90)

Coupon types cache for lazy getter

  • access: protected
string $_eventObject = 'rule' (line 67)

Parameter name in event

In observe method you can use $observer->getEvent()->getRule() in this case

  • access: protected

Redefinition of:
Mage_Core_Model_Abstract::$_eventObject
Parameter name in event
string $_eventPrefix = 'salesrule_rule' (line 58)

Prefix of model events names

  • access: protected

Redefinition of:
Mage_Core_Model_Abstract::$_eventPrefix
Prefix of model events names
mixed $_labels = array() (line 69)
  • access: protected
Mage_SalesRule_Model_Coupon $_primaryCoupon (line 76)

Rule's primary coupon

  • access: protected

Inherited Variables

Inherited from Mage_Rule_Model_Rule

Mage_Rule_Model_Rule::$_actions
Mage_Rule_Model_Rule::$_conditions
Mage_Rule_Model_Rule::$_form
Mage_Rule_Model_Rule::$_isDeleteable
Mage_Rule_Model_Rule::$_isReadonly

Inherited from Mage_Core_Model_Abstract

Mage_Core_Model_Abstract::$_cacheTag
Mage_Core_Model_Abstract::$_dataSaveAllowed
Mage_Core_Model_Abstract::$_isObjectNew
Mage_Core_Model_Abstract::$_resource
Mage_Core_Model_Abstract::$_resourceCollectionName
Mage_Core_Model_Abstract::$_resourceName
Methods
static method getCouponCodeGenerator (line 104)

Set code generator instance for auto generated coupons

  • access: public
static Mage_SalesRule_Model_Coupon_CodegeneratorInterface getCouponCodeGenerator ()
static method setCouponCodeGenerator (line 117)

Set code generator instance for auto generated coupons

  • access: public
static void setCouponCodeGenerator (Mage_SalesRule_Model_Coupon_CodegeneratorInterface $codeGenerator)
acquireCoupon (line 334)

Acquire coupon instance

  • access: public
Mage_SalesRule_Model_Coupon|null acquireCoupon ([bool $saveNewlyCreated = true], [int $saveAttemptCount = 10])
  • bool $saveNewlyCreated: Whether or not to save newly created coupon
  • int $saveAttemptCount: Number of attempts to save newly created coupon
getActionsInstance (line 154)
  • access: public
void getActionsInstance ()

Redefinition of:
Mage_Rule_Model_Rule::getActionsInstance()
getConditionsInstance (line 149)
  • access: public
void getConditionsInstance ()

Redefinition of:
Mage_Rule_Model_Rule::getConditionsInstance()
getCoupons (line 294)

Retrieve subordinate coupons

  • return: of Mage_SalesRule_Model_Coupon
  • access: public
array getCoupons ()
getCouponTypes (line 310)

Retrieve coupon types

  • access: public
array getCouponTypes ()
getPrimaryCoupon (line 127)

Retrieve rule's primary coupon

  • access: public
Mage_SalesRule_Model_Coupon getPrimaryCoupon ()
getResourceCollection (line 214)
  • access: public
void getResourceCollection ()

Redefinition of:
Mage_Core_Model_Abstract::getResourceCollection()
Get collection instance
getStoreLabel (line 258)

Get Rule label for specific store

  • return: | false
  • access: public
string getStoreLabel ([store $store = null])
  • store $store
getStoreLabels (line 280)

Get all existing rule labels

  • access: public
array getStoreLabels ()
loadPost (line 178)

Initialize rule model data from array

  • access: public
Mage_SalesRule_Model_Rule loadPost ( $rule)
  • array $rule

Redefinition of:
Mage_Rule_Model_Rule::loadPost()
toArray (line 205)

Returns rule as an array for admin interface

Output example: array( 'name'=>'Example rule', 'conditions'=>{condition_combine::toArray} 'actions'=>{action_collection::toArray} )

  • access: public
array toArray ([ $arrAttributes = array()])
  • array $arrAttributes
toString (line 159)
  • access: public
void toString ([ $format = ''])
  • $format
_afterLoad (line 142)

Processing object after load data

  • access: protected
Mage_Core_Model_Abstract _afterLoad ()

Redefinition of:
Mage_Rule_Model_Rule::_afterLoad()
_afterSave (line 224)

Save rule labels after rule save and process product attributes used in actions and conditions

  • access: protected

Redefinition of:
Mage_Core_Model_Abstract::_afterSave()
Processing object after save data
_construct (line 92)
  • access: protected
void _construct ()

Redefinition of:
Mage_Rule_Model_Rule::_construct()
Init resoirce
_getUsedAttributes (line 382)

Return all product attributes used on serialized action or condition

  • access: protected
array _getUsedAttributes (string $serializedString)
  • string $serializedString

Inherited Methods

Inherited From Mage_Rule_Model_Rule

Mage_Rule_Model_Rule::afterLoad()
Mage_Rule_Model_Rule::asArray()
Mage_Rule_Model_Rule::asHtml()
Mage_Rule_Model_Rule::asString()
Mage_Rule_Model_Rule::getActions()
Mage_Rule_Model_Rule::getActionsInstance()
Mage_Rule_Model_Rule::getConditions()
Mage_Rule_Model_Rule::getConditionsInstance()
Mage_Rule_Model_Rule::getForm()
Mage_Rule_Model_Rule::isDeleteable()
Mage_Rule_Model_Rule::isReadonly()
Mage_Rule_Model_Rule::loadPost()
Mage_Rule_Model_Rule::setActions()
Mage_Rule_Model_Rule::setConditions()
Mage_Rule_Model_Rule::setIsDeleteable()
Mage_Rule_Model_Rule::setIsReadonly()
Mage_Rule_Model_Rule::validate()
Mage_Rule_Model_Rule::validateData()
Mage_Rule_Model_Rule::_afterLoad()
Mage_Rule_Model_Rule::_beforeSave()
Mage_Rule_Model_Rule::_construct()
Mage_Rule_Model_Rule::_convertFlatToRecursive()
Mage_Rule_Model_Rule::_prepareWebsiteIds()
Mage_Rule_Model_Rule::_resetActions()
Mage_Rule_Model_Rule::_resetConditions()

Inherited From Mage_Core_Model_Abstract

Mage_Core_Model_Abstract::afterCommitCallback()
Mage_Core_Model_Abstract::afterLoad()
Mage_Core_Model_Abstract::cleanModelCache()
Mage_Core_Model_Abstract::clearInstance()
Mage_Core_Model_Abstract::delete()
Mage_Core_Model_Abstract::getCacheIdTags()
Mage_Core_Model_Abstract::getCacheTags()
Mage_Core_Model_Abstract::getCollection()
Mage_Core_Model_Abstract::getEntityId()
Mage_Core_Model_Abstract::getId()
Mage_Core_Model_Abstract::getIdFieldName()
Mage_Core_Model_Abstract::getResource()
Mage_Core_Model_Abstract::getResourceCollection()
Mage_Core_Model_Abstract::getResourceName()
Mage_Core_Model_Abstract::isObjectNew()
Mage_Core_Model_Abstract::load()
Mage_Core_Model_Abstract::save()
Mage_Core_Model_Abstract::setId()
Mage_Core_Model_Abstract::_afterDelete()
Mage_Core_Model_Abstract::_afterDeleteCommit()
Mage_Core_Model_Abstract::_afterLoad()
Mage_Core_Model_Abstract::_afterSave()
Mage_Core_Model_Abstract::_afterSaveCommit()
Mage_Core_Model_Abstract::_beforeDelete()
Mage_Core_Model_Abstract::_beforeLoad()
Mage_Core_Model_Abstract::_beforeSave()
Mage_Core_Model_Abstract::_clearData()
Mage_Core_Model_Abstract::_clearReferences()
Mage_Core_Model_Abstract::_getEventData()
Mage_Core_Model_Abstract::_getResource()
Mage_Core_Model_Abstract::_hasModelChanged()
Mage_Core_Model_Abstract::_init()
Mage_Core_Model_Abstract::_protectFromNonAdmin()
Mage_Core_Model_Abstract::_setResourceModel()
Class Constants
BUY_X_GET_Y_ACTION = 'buy_x_get_y' (line 45)
BY_FIXED_ACTION = 'by_fixed' (line 43)
BY_PERCENT_ACTION = 'by_percent' (line 41)
CART_FIXED_ACTION = 'cart_fixed' (line 44)
COUPON_TYPE_AUTO = 3 (line 35)
COUPON_TYPE_NO_COUPON = 1 (line 33)
COUPON_TYPE_SPECIFIC = 2 (line 34)
FREE_SHIPPING_ADDRESS = 2 (line 31)
FREE_SHIPPING_ITEM = 1 (line 30)
TO_FIXED_ACTION = 'to_fixed' (line 42)
TO_PERCENT_ACTION = 'to_percent' (line 40)

Rule type actions

Documentation generated on Fri, 11 Feb 2011 17:11:42 +0200 by phpDocumentor 1.4.3