I created a module that looks like this:
http://screencast.com/t/TG7brmUi
And the code looks like this:
he code is as follows:
Luisvalencia_Affiliate.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Luisvalencia_Affiliate>
<active>true</active>
<codePool>community</codePool>
</Luisvalencia_Affiliate>
</modules>
</config>
config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Luisvalencia_Affiliate>
<version>0.0.1</version>
</Luisvalencia_Affiliate>
</modules>
<frontend>
<events>
<controller_action_predispatch>
<observers>
<luisvalencia_affiliate>
<class>luisvalencia_affiliate/observer</class>
<method>captureReferral</method>
<type>singleton</type>
</luisvalencia_affiliate>
</observers>
</controller_action_predispatch>
</events>
</frontend>
</config>
and Observer.php
<?php
class Luisvalencia_Affiliate_Model_Observer
{
const COOKIE_KEY_SOURCE = 'luisvalencia_affiliate_source';
public function captureReferral(Varien_Event_Observer $observer)
{
//bla bla bla, get cookie value from admin?
}
protected function _getCookieLifetime()
{
$days = 1;
// convert to seconds
return (int)86400 * $days;
}
}
As you can see the cookie lifetime is hardcoded.
I would like to add an admin section on the magento backend to be able to edit the cookie lifetime for example.
can you please guide me?