Name: DerivedAttributes
Owner: FireGento e. V. - Hackathons
Description: Generate attribute values based on other attributes and rules
Created: 2015-05-09 08:58:52.0
Updated: 2018-02-20 14:28:03.0
Pushed: 2016-05-30 22:57:30.0
Homepage: null
Size: 200
Language: PHP
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Status: WIP
(Product Attribute, Customer Attributes)
Add required repositories to project composer.json
:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/magento-hackathon/DerivedAttributes.git"
},
{
"type": "vcs",
"url": "https://github.com/integer-net/IntegerNet_GridMassActionPager"
}
]
Install via composer: composer require magento-hackathon/derived-attributes
Custom conditions and generators must implement the interfaces listed below.
To add them, create an observer for the derivedattribute_new_rulemanager
event:
<events>
<derivedattribute_new_rulemanager>
<observers>
<your_module>
<type>singleton</type>
<class>Your_Module_Model_Observer</class>
<method>addDerivedAttributesPlugin</method>
</your_module>
</observers>
</derivedattribute_new_rulemanager>
</events>
In this observer:
class Your_Module_Model_Observer
{
public function addDerivedAttributesPlugin(Varien_Event_Observer $observer)
{
/** @var \Hackathon\DerivedAttributes\Service\Manager $ruleManager */
$ruleManager = $observer->getRuleManager();
$ruleManager->addConditionType('your_unique_condition_identifier', Mage::getModel('your_module/your_condition_class'));
$ruleManager->addGeneratorType('your_unique_generator_identifier', Mage::getModel('your_module/your_generator_class'));
}
}
GeneratorInterface configure(string $data)
string getData()
mixed generateAttributeValue(EntityInterface $entity)
string getTitle()
string getDescription()
ConditionInterface configure(string $data)
string getData()
boolean match(EntityInterface $entity)
string getTitle()
string getDescription()
There is NO magic for “derived of derivedAttributes”. Just rule priority.