Version Notes
User Coupons
Download this release
Release Info
Developer | e-Infochips |
Extension | Coupons4U |
Version | 1.0.0.1 |
Comparing to | |
See all releases |
Version 1.0.0.1
- app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u.php +38 -0
- app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Edit.php +53 -0
- app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Edit/Form.php +43 -0
- app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Edit/Tab/Form.php +37 -0
- app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Edit/Tab/Meta.php +51 -0
- app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Edit/Tab/Stores.php +48 -0
- app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Edit/Tab/Viewassigncoupons.php +56 -0
- app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Edit/Tabs.php +52 -0
- app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Grid.php +184 -0
- app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Hello.php +93 -0
- app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/View.php +53 -0
- app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/View/Form.php +0 -0
- app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/View/Tabs.php +64 -0
- app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Widget/Chooser.php +156 -0
- app/code/community/Einfochips/Coupons4U/Block/Einfochipscoupons4u/List.php +63 -0
- app/code/community/Einfochips/Coupons4U/Block/Einfochipscoupons4u/View.php +34 -0
- app/code/community/Einfochips/Coupons4U/Block/Einfochipscoupons4u/Widget/Link.php +26 -0
- app/code/community/Einfochips/Coupons4U/Block/Einfochipscoupons4u/Widget/View.php +46 -0
- app/code/community/Einfochips/Coupons4U/Controller/Adminhtml/Coupons4U.php +60 -0
- app/code/community/Einfochips/Coupons4U/Controller/Router.php +76 -0
- app/code/community/Einfochips/Coupons4U/Helper/Data.php +34 -0
- app/code/community/Einfochips/Coupons4U/Helper/Einfochipscoupons4u.php +34 -0
- app/code/community/Einfochips/Coupons4U/Model/Einfochipscoupons4u.php +99 -0
- app/code/community/Einfochips/Coupons4U/Model/Email/Template.php +657 -0
- app/code/community/Einfochips/Coupons4U/Model/Resource/Einfochipscoupons4u.php +221 -0
- app/code/community/Einfochips/Coupons4U/Model/Resource/Einfochipscoupons4u/Collection.php +116 -0
- app/code/community/Einfochips/Coupons4U/Model/Resource/Setup.php +26 -0
- app/code/community/Einfochips/Coupons4U/Model/email.php +26 -0
- app/code/community/Einfochips/Coupons4U/controllers/Adminhtml/Coupons4U/Einfochipscoupons4uController.php +511 -0
- app/code/community/Einfochips/Coupons4U/controllers/Einfochipscoupons4uController.php +63 -0
- app/code/community/Einfochips/Coupons4U/controllers/IndexController.php +20 -0
- app/code/community/Einfochips/Coupons4U/etc/adminhtml.xml +63 -0
- app/code/community/Einfochips/Coupons4U/etc/config.xml +145 -0
- app/code/community/Einfochips/Coupons4U/etc/system.xml +99 -0
- app/code/community/Einfochips/Coupons4U/etc/widget.xml +64 -0
- app/code/community/Einfochips/Coupons4U/sql/einfochips_coupons4u_setup/install-0.0.1.php +86 -0
- app/design/adminhtml/default/default/layout/einfochips_coupons4u.xml +62 -0
- app/etc/modules/Einfochips_Coupons4U.xml +29 -0
- package.xml +18 -0
app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U admin block
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u extends Mage_Adminhtml_Block_Widget_Grid_Container{
|
25 |
+
/**
|
26 |
+
* constructor
|
27 |
+
* @access public
|
28 |
+
* @return void
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
public function __construct(){
|
32 |
+
$this->_controller = 'adminhtml_einfochipscoupons4u';
|
33 |
+
$this->_blockGroup = 'coupons4u';
|
34 |
+
$this->_headerText = Mage::helper('coupons4u')->__('EinfochipsCoupons4U');
|
35 |
+
$this->_addButtonLabel = Mage::helper('coupons4u')->__('View Assign Coupons');
|
36 |
+
parent::__construct();
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Edit.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U admin edit block
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Edit extends Mage_Adminhtml_Block_Widget_Form_Container{
|
25 |
+
/**
|
26 |
+
* constuctor
|
27 |
+
* @access public
|
28 |
+
* @return void
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
public function __construct(){
|
32 |
+
parent::__construct();
|
33 |
+
$this->_blockGroup = 'coupons4u';
|
34 |
+
$this->_controller = 'adminhtml_einfochipscoupons4u';
|
35 |
+
$this->_removeButton('save');
|
36 |
+
$this->_removeButton('reset');
|
37 |
+
|
38 |
+
}
|
39 |
+
/**
|
40 |
+
* get the edit form header
|
41 |
+
* @access public
|
42 |
+
* @return string
|
43 |
+
* @author e-Infochips
|
44 |
+
*/
|
45 |
+
public function getHeaderText(){
|
46 |
+
if( Mage::registry('einfochipscoupons4u_data') && Mage::registry('einfochipscoupons4u_data')->getId() ) {
|
47 |
+
return Mage::helper('coupons4u')->__("Edit EinfochipsCoupons4U '%s'", $this->htmlEscape(Mage::registry('einfochipscoupons4u_data')->getCouponId()));
|
48 |
+
}
|
49 |
+
else {
|
50 |
+
return Mage::helper('coupons4u')->__('Assign Coupons');
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Edit/Form.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U edit form
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Edit_Form extends Mage_Adminhtml_Block_Widget_Form{
|
25 |
+
/**
|
26 |
+
* prepare form
|
27 |
+
* @access protected
|
28 |
+
* @return Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Edit_Form
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
protected function _prepareForm(){
|
32 |
+
$form = new Varien_Data_Form(array(
|
33 |
+
'id' => 'edit_form',
|
34 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
35 |
+
'method' => 'post',
|
36 |
+
'enctype' => 'multipart/form-data'
|
37 |
+
)
|
38 |
+
);
|
39 |
+
$form->setUseContainer(true);
|
40 |
+
$this->setForm($form);
|
41 |
+
return parent::_prepareForm();
|
42 |
+
}
|
43 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U edit form tab
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Edit_Tab_Form extends Mage_Adminhtml_Block_Template{
|
25 |
+
/**
|
26 |
+
* prepare the form
|
27 |
+
* @access protected
|
28 |
+
* @return Coupons4U_Einfochipscoupons4u_Block_Adminhtml_Einfochipscoupons4u_Edit_Tab_Form
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
parent::_construct();
|
35 |
+
$this->setTemplate('einfochipscoupons4u/edit/tab/viewassigncoupons.phtml');
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Edit/Tab/Meta.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* meta information tab
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Edit_Tab_Meta extends Mage_Adminhtml_Block_Widget_Form{
|
25 |
+
/**
|
26 |
+
* prepare the form
|
27 |
+
* @access protected
|
28 |
+
* @return Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Edit_Tab_Meta
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
protected function _prepareForm(){
|
32 |
+
$form = new Varien_Data_Form();
|
33 |
+
$form->setFieldNameSuffix('einfochipscoupons4u');
|
34 |
+
$this->setForm($form);
|
35 |
+
$fieldset = $form->addFieldset('einfochipscoupons4u_meta_form', array('legend'=>Mage::helper('coupons4u')->__('Meta information')));
|
36 |
+
$fieldset->addField('meta_title', 'text', array(
|
37 |
+
'label' => Mage::helper('coupons4u')->__('Meta-title'),
|
38 |
+
'name' => 'meta_title',
|
39 |
+
));
|
40 |
+
$fieldset->addField('meta_description', 'textarea', array(
|
41 |
+
'name' => 'meta_description',
|
42 |
+
'label' => Mage::helper('coupons4u')->__('Meta-description'),
|
43 |
+
));
|
44 |
+
$fieldset->addField('meta_keywords', 'textarea', array(
|
45 |
+
'name' => 'meta_keywords',
|
46 |
+
'label' => Mage::helper('coupons4u')->__('Meta-keywords'),
|
47 |
+
));
|
48 |
+
$form->addValues(Mage::registry('current_einfochipscoupons4u')->getData());
|
49 |
+
return parent::_prepareForm();
|
50 |
+
}
|
51 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Edit/Tab/Stores.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* store selection tab
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Edit_Tab_Stores extends Mage_Adminhtml_Block_Widget_Form{
|
25 |
+
/**
|
26 |
+
* prepare the form
|
27 |
+
* @access protected
|
28 |
+
* @return Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Edit_Tab_Stores
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
protected function _prepareForm(){
|
32 |
+
$form = new Varien_Data_Form();
|
33 |
+
$form->setFieldNameSuffix('einfochipscoupons4u');
|
34 |
+
$this->setForm($form);
|
35 |
+
$fieldset = $form->addFieldset('einfochipscoupons4u_stores_form', array('legend'=>Mage::helper('coupons4u')->__('Store views')));
|
36 |
+
$field = $fieldset->addField('store_id', 'multiselect', array(
|
37 |
+
'name' => 'stores[]',
|
38 |
+
'label' => Mage::helper('coupons4u')->__('Store Views'),
|
39 |
+
'title' => Mage::helper('coupons4u')->__('Store Views'),
|
40 |
+
'required' => true,
|
41 |
+
'values'=> Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
|
42 |
+
));
|
43 |
+
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
|
44 |
+
$field->setRenderer($renderer);
|
45 |
+
$form->addValues(Mage::registry('current_einfochipscoupons4u')->getData());
|
46 |
+
return parent::_prepareForm();
|
47 |
+
}
|
48 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Edit/Tab/Viewassigncoupons.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* meta information tab
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Edit_Tab_Viewassigncoupons extends Mage_Core_Block_Template{
|
25 |
+
/**
|
26 |
+
* prepare the form
|
27 |
+
* @access protected
|
28 |
+
* @return Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Edit_Tab_Viewassigncoupons
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
parent::_construct();
|
35 |
+
$collection = Mage::getModel('customer/customer')->getCollection();
|
36 |
+
$this->setCollection($collection);
|
37 |
+
|
38 |
+
}
|
39 |
+
protected function _prepareLayout()
|
40 |
+
{
|
41 |
+
parent::_prepareLayout();
|
42 |
+
|
43 |
+
$pager = $this->getLayout()->createBlock('page/html_pager', 'custom.pager');
|
44 |
+
//$pager->setAvailableLimit(array(2=>2,3=>3,5=>5,'all'=>'all'));
|
45 |
+
$pager->setCollection($this->getCollection());
|
46 |
+
$this->setChild('pager', $pager);
|
47 |
+
$this->getCollection()->load();
|
48 |
+
$this->setTemplate('einfochipscoupons4u/edit/tab/viewassigncoupons.phtml');
|
49 |
+
return $this;
|
50 |
+
}
|
51 |
+
|
52 |
+
public function getPagerHtml()
|
53 |
+
{
|
54 |
+
return $this->getChildHtml('pager');
|
55 |
+
}
|
56 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Edit/Tabs.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U admin edit tabs
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs{
|
25 |
+
/**
|
26 |
+
* constructor
|
27 |
+
* @access public
|
28 |
+
* @return void
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
public function __construct(){
|
32 |
+
parent::__construct();
|
33 |
+
$this->setId('einfochipscoupons4u_tabs');
|
34 |
+
$this->setDestElementId('edit_form');
|
35 |
+
|
36 |
+
$this->setTitle(Mage::helper('coupons4u')->__('EinfochipsCoupons4U'));
|
37 |
+
}
|
38 |
+
/**
|
39 |
+
* before render html
|
40 |
+
* @access protected
|
41 |
+
* @return Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Edit_Tabs
|
42 |
+
* @author e-Infochips
|
43 |
+
*/
|
44 |
+
protected function _beforeToHtml(){
|
45 |
+
$this->addTab('form_einfochipscoupons4u', array(
|
46 |
+
'label' => Mage::helper('coupons4u')->__('View Details'),
|
47 |
+
'title' => Mage::helper('coupons4u')->__('View Details'),
|
48 |
+
'content' => $this->getLayout()->createBlock('coupons4u/adminhtml_einfochipscoupons4u_edit_tab_viewassigncoupons')->toHtml(),
|
49 |
+
));
|
50 |
+
return parent::_beforeToHtml();
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Grid.php
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U admin grid block
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Grid extends Mage_Adminhtml_Block_Widget_Grid{
|
25 |
+
/**
|
26 |
+
* constructor
|
27 |
+
* @access public
|
28 |
+
* @return void
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
public function __construct(){
|
32 |
+
parent::__construct();
|
33 |
+
$this->setId('einfochipscoupons4uGrid');
|
34 |
+
$this->setDefaultSort('entity_id');
|
35 |
+
$this->setDefaultDir('ASC');
|
36 |
+
$this->setSaveParametersInSession(true);
|
37 |
+
$this->setUseAjax(true);
|
38 |
+
}
|
39 |
+
/**
|
40 |
+
* prepare collection
|
41 |
+
* @access protected
|
42 |
+
* @return Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Grid
|
43 |
+
* @author e-Infochips
|
44 |
+
*/
|
45 |
+
protected function _prepareCollection(){
|
46 |
+
/* Get the usage coupon limit */
|
47 |
+
$couponIds = array();
|
48 |
+
$couponAssign = array();
|
49 |
+
$usageLimit = array();
|
50 |
+
$coupons_array = array();
|
51 |
+
|
52 |
+
$resource = Mage::getSingleton('core/resource');
|
53 |
+
$readConnection = $resource->getConnection('core_read');
|
54 |
+
|
55 |
+
|
56 |
+
$query = "select e.coupon_id,b.usage_limit from salesrule_coupon e JOIN salesrule_coupon b
|
57 |
+
ON e.times_used <= b.usage_limit AND e.coupon_id = b.coupon_id";
|
58 |
+
|
59 |
+
$results = $readConnection->fetchall($query);
|
60 |
+
|
61 |
+
foreach($results as $k=>$v) {
|
62 |
+
$couponIds[] = $v['coupon_id'];
|
63 |
+
$usageLimit[] = $v['usage_limit'];
|
64 |
+
}
|
65 |
+
|
66 |
+
$coupons = implode(",",$couponIds);
|
67 |
+
if($coupons=="") {
|
68 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('Coupons Not Present. Please create shopping cart rule and generate couponcode');
|
69 |
+
}
|
70 |
+
else {
|
71 |
+
$query2="select coupon_id,count(coupon_id) as used
|
72 |
+
from coupons4u_einfochipscoupons4u Where coupon_id IN (".$coupons.") GROUP BY coupon_id";
|
73 |
+
|
74 |
+
$results2 = $readConnection->fetchall($query2);
|
75 |
+
|
76 |
+
foreach($results2 as $k=>$v) {
|
77 |
+
$keyVal = array_search($v['coupon_id'],$couponIds);
|
78 |
+
if($v['used']==$usageLimit[$keyVal]) {
|
79 |
+
$couponAssign[] = $couponIds[$keyVal];
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
$filter = $this->getParam($this->getVarNameFilter(), null);
|
84 |
+
|
85 |
+
$couponsCollection = Mage::getResourceModel('salesrule/coupon_collection')
|
86 |
+
->addGeneratedCouponsFilter()
|
87 |
+
->addFieldToFilter('coupon_id',array('in'=>array_diff($couponIds,$couponAssign)));
|
88 |
+
if (is_null($filter)) {
|
89 |
+
$filter = $this->_defaultFilter;
|
90 |
+
}
|
91 |
+
$this->setCollection($couponsCollection);
|
92 |
+
return parent::_prepareCollection();
|
93 |
+
}
|
94 |
+
/**
|
95 |
+
* prepare grid collection
|
96 |
+
* @access protected
|
97 |
+
* @return Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Grid
|
98 |
+
* @author e-Infochips
|
99 |
+
*/
|
100 |
+
protected function _prepareColumns(){
|
101 |
+
/* Drop Down for Rules */
|
102 |
+
$ruleCollection = Mage::getResourceModel('salesrule/rule_collection');
|
103 |
+
$ruleArray = array();
|
104 |
+
foreach($ruleCollection as $releData){
|
105 |
+
$ruleArray[$releData->getData('rule_id')] = $releData->getData('name');
|
106 |
+
}
|
107 |
+
|
108 |
+
$this->addColumn('code', array(
|
109 |
+
'header' => Mage::helper('salesrule')->__('Coupon Code'),
|
110 |
+
'index' => 'code'
|
111 |
+
));
|
112 |
+
|
113 |
+
$this->addColumn("rule_id", array(
|
114 |
+
'header' => Mage::helper('salesrule')->__('Rule'),
|
115 |
+
'type' => 'options',
|
116 |
+
'index' => 'rule_id',
|
117 |
+
'options'=> $ruleArray
|
118 |
+
));
|
119 |
+
return parent::_prepareColumns();
|
120 |
+
}
|
121 |
+
/**
|
122 |
+
* prepare mass action
|
123 |
+
* @access protected
|
124 |
+
* @return Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Grid
|
125 |
+
* @author e-Infochips
|
126 |
+
*/
|
127 |
+
protected function _prepareMassaction(){
|
128 |
+
$this->setMassactionIdField('coupon_id');
|
129 |
+
$this->getMassactionBlock()->setFormFieldName('ids');
|
130 |
+
$this->getMassactionBlock()->setUseAjax(false);
|
131 |
+
$this->getMassactionBlock()->setHideFormElement(true);
|
132 |
+
|
133 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
134 |
+
'label'=> Mage::helper('adminhtml')->__('Assign'),
|
135 |
+
'url' => $this->getUrl('*/*/assign', array('_current' => true)),
|
136 |
+
'complete' => 'refreshCouponCodesGrid'
|
137 |
+
));
|
138 |
+
return $this;
|
139 |
+
}
|
140 |
+
/**
|
141 |
+
* get the row url
|
142 |
+
* @access public
|
143 |
+
* @param Einfochips_Coupons4U_Model_Einfochipscoupons4u
|
144 |
+
* @return string
|
145 |
+
* @author e-Infochips
|
146 |
+
*/
|
147 |
+
public function getRowUrl($row){
|
148 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
149 |
+
}
|
150 |
+
/**
|
151 |
+
* get the grid url
|
152 |
+
* @access public
|
153 |
+
* @return string
|
154 |
+
* @author e-Infochips
|
155 |
+
*/
|
156 |
+
public function getGridUrl(){
|
157 |
+
return $this->getUrl('*/*/grid', array('_current'=>true));
|
158 |
+
}
|
159 |
+
/**
|
160 |
+
* after collection load
|
161 |
+
* @access protected
|
162 |
+
* @return Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Grid
|
163 |
+
* @author e-Infochips
|
164 |
+
*/
|
165 |
+
protected function _afterLoadCollection(){
|
166 |
+
$this->getCollection()->walk('afterLoad');
|
167 |
+
parent::_afterLoadCollection();
|
168 |
+
}
|
169 |
+
/**
|
170 |
+
* filter store column
|
171 |
+
* @access protected
|
172 |
+
* @param Einfochips_Coupons4U_Model_Resource_Einfochipscoupons4u_Collection $collection
|
173 |
+
* @param Mage_Adminhtml_Block_Widget_Grid_Column $column
|
174 |
+
* @return Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Grid
|
175 |
+
* @author e-Infochips
|
176 |
+
*/
|
177 |
+
protected function _filterStoreCondition($collection, $column){
|
178 |
+
if (!$value = $column->getFilter()->getValue()) {
|
179 |
+
return;
|
180 |
+
}
|
181 |
+
$collection->addStoreFilter($value);
|
182 |
+
return $this;
|
183 |
+
}
|
184 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Hello.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Hello extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('customerGrid');
|
8 |
+
$this->setUseAjax(false);
|
9 |
+
$this->setDefaultSort('entity_id');
|
10 |
+
$this->setSaveParametersInSession(true);
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function _prepareCollection()
|
14 |
+
{
|
15 |
+
$collection = Mage::getResourceModel('customer/customer_collection')
|
16 |
+
->addNameToSelect()
|
17 |
+
->addAttributeToSelect('email')
|
18 |
+
->addAttributeToSelect('created_at')
|
19 |
+
->addAttributeToSelect('group_id')
|
20 |
+
->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
|
21 |
+
->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
|
22 |
+
->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
|
23 |
+
->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
|
24 |
+
->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left');
|
25 |
+
|
26 |
+
$this->setCollection($collection);
|
27 |
+
|
28 |
+
return parent::_prepareCollection();
|
29 |
+
}
|
30 |
+
|
31 |
+
protected function _prepareColumns()
|
32 |
+
{
|
33 |
+
$this->addColumn('entity_id', array(
|
34 |
+
'header' => Mage::helper('customer')->__('ID'),
|
35 |
+
'width' => '50px',
|
36 |
+
'index' => 'entity_id',
|
37 |
+
'type' => 'number',
|
38 |
+
));
|
39 |
+
|
40 |
+
$this->addColumn('name', array(
|
41 |
+
'header' => Mage::helper('customer')->__('Name'),
|
42 |
+
'index' => 'name'
|
43 |
+
));
|
44 |
+
$this->addColumn('email', array(
|
45 |
+
'header' => Mage::helper('customer')->__('Email'),
|
46 |
+
'width' => '150',
|
47 |
+
'index' => 'email'
|
48 |
+
));
|
49 |
+
|
50 |
+
$groups = Mage::getResourceModel('customer/group_collection')
|
51 |
+
->addFieldToFilter('customer_group_id', array('gt'=> 0))
|
52 |
+
->load()
|
53 |
+
->toOptionHash();
|
54 |
+
|
55 |
+
|
56 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
57 |
+
$this->addColumn('website_id', array(
|
58 |
+
'header' => Mage::helper('customer')->__('Website'),
|
59 |
+
'align' => 'center',
|
60 |
+
'width' => '80px',
|
61 |
+
'type' => 'options',
|
62 |
+
'options' => Mage::getSingleton('adminhtml/system_store')->getWebsiteOptionHash(true),
|
63 |
+
'index' => 'website_id',
|
64 |
+
));
|
65 |
+
}
|
66 |
+
|
67 |
+
return parent::_prepareColumns();
|
68 |
+
}
|
69 |
+
|
70 |
+
protected function _prepareMassaction()
|
71 |
+
{
|
72 |
+
$this->setMassactionIdField('entity_id');
|
73 |
+
$this->getMassactionBlock()->setFormFieldName('customer');
|
74 |
+
|
75 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
76 |
+
'label' => Mage::helper('customer')->__('AssignCoupons'),
|
77 |
+
'url' => $this->getUrl('*/*/assignCoupons'),
|
78 |
+
'confirm' => Mage::helper('customer')->__('Are you sure?')
|
79 |
+
));
|
80 |
+
|
81 |
+
return $this;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function getGridUrl()
|
85 |
+
{
|
86 |
+
return $this->getUrl('*/*/grid', array('_current'=> true));
|
87 |
+
}
|
88 |
+
|
89 |
+
public function getRowUrl($row)
|
90 |
+
{
|
91 |
+
return $this->getUrl('*/*/edit', array('id'=>$row->getId()));
|
92 |
+
}
|
93 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/View.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U admin edit block
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_View extends Mage_Adminhtml_Block_Widget_Form_Container{
|
25 |
+
/**
|
26 |
+
* constuctor
|
27 |
+
* @access public
|
28 |
+
* @return void
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
public function __construct(){
|
32 |
+
parent::__construct();
|
33 |
+
$this->_blockGroup = 'coupons4u';
|
34 |
+
$this->_controller = 'adminhtml_einfochipscoupons4u';
|
35 |
+
$this->_removeButton('save');
|
36 |
+
$this->_removeButton('reset');
|
37 |
+
|
38 |
+
}
|
39 |
+
/**
|
40 |
+
* get the edit form header
|
41 |
+
* @access public
|
42 |
+
* @return string
|
43 |
+
* @author e-Infochips
|
44 |
+
*/
|
45 |
+
public function getHeaderText(){
|
46 |
+
if( Mage::registry('einfochipscoupons4u_data') && Mage::registry('einfochipscoupons4u_data')->getId() ) {
|
47 |
+
return Mage::helper('coupons4u')->__("Edit EinfochipsCoupons4U '%s'", $this->htmlEscape(Mage::registry('einfochipscoupons4u_data')->getCouponId()));
|
48 |
+
}
|
49 |
+
else {
|
50 |
+
return Mage::helper('coupons4u')->__('Assign Coupons');
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/View/Form.php
ADDED
File without changes
|
app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/View/Tabs.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U admin edit tabs
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_View_Tabs extends Mage_Adminhtml_Block_Widget_Tabs{
|
25 |
+
/**
|
26 |
+
* constructor
|
27 |
+
* @access public
|
28 |
+
* @return void
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
public function __construct(){
|
32 |
+
parent::__construct();
|
33 |
+
$this->setId('einfochipscoupons4u_tabs');
|
34 |
+
//$this->setDestElementId('edit_form');
|
35 |
+
|
36 |
+
$this->setTitle(Mage::helper('coupons4u')->__('EinfochipsCoupons4U'));
|
37 |
+
}
|
38 |
+
/**
|
39 |
+
* before render html
|
40 |
+
* @access protected
|
41 |
+
* @return Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Edit_Tabs
|
42 |
+
* @author e-Infochips
|
43 |
+
*/
|
44 |
+
protected function _beforeToHtml(){
|
45 |
+
$this->addTab('form_einfochipscoupons4u', array(
|
46 |
+
'label' => Mage::helper('coupons4u')->__('View Details'),
|
47 |
+
'title' => Mage::helper('coupons4u')->__('View Details'),
|
48 |
+
'content' => $this->getLayout()->createBlock('coupons4u/adminhtml_einfochipscoupons4u_view_tab_viewassigncoupons')->toHtml(),
|
49 |
+
));
|
50 |
+
/*$this->addTab('form_meta_einfochipscoupons4u', array(
|
51 |
+
'label' => Mage::helper('coupons4u')->__('Meta'),
|
52 |
+
'title' => Mage::helper('coupons4u')->__('Meta'),
|
53 |
+
'content' => $this->getLayout()->createBlock('coupons4u/adminhtml_einfochipscoupons4u_edit_tab_meta')->toHtml(),
|
54 |
+
));
|
55 |
+
if (!Mage::app()->isSingleStoreMode()){
|
56 |
+
$this->addTab('form_store_einfochipscoupons4u', array(
|
57 |
+
'label' => Mage::helper('coupons4u')->__('Store views'),
|
58 |
+
'title' => Mage::helper('coupons4u')->__('Store views'),
|
59 |
+
'content' => $this->getLayout()->createBlock('coupons4u/adminhtml_einfochipscoupons4u_edit_tab_stores')->toHtml(),
|
60 |
+
));
|
61 |
+
}*/
|
62 |
+
return parent::_beforeToHtml();
|
63 |
+
}
|
64 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Adminhtml/Einfochipscoupons4u/Widget/Chooser.php
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U admin widget chooser
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Widget_Chooser extends Mage_Adminhtml_Block_Widget_Grid{
|
25 |
+
/**
|
26 |
+
* Block construction, prepare grid params
|
27 |
+
* @access public
|
28 |
+
* @param array $arguments Object data
|
29 |
+
* @return void
|
30 |
+
* @author e-Infochips
|
31 |
+
*/
|
32 |
+
public function __construct($arguments=array()){
|
33 |
+
parent::__construct($arguments);
|
34 |
+
$this->setDefaultSort('entity_id');
|
35 |
+
$this->setDefaultDir('ASC');
|
36 |
+
$this->setUseAjax(true);
|
37 |
+
$this->setDefaultFilter(array('chooser_status' => '1'));
|
38 |
+
}
|
39 |
+
/**
|
40 |
+
* Prepare chooser element HTML
|
41 |
+
* @access public
|
42 |
+
* @param Varien_Data_Form_Element_Abstract $element Form Element
|
43 |
+
* @return Varien_Data_Form_Element_Abstract
|
44 |
+
* @author e-Infochips
|
45 |
+
*/
|
46 |
+
public function prepareElementHtml(Varien_Data_Form_Element_Abstract $element){
|
47 |
+
$uniqId = Mage::helper('core')->uniqHash($element->getId());
|
48 |
+
$sourceUrl = $this->getUrl('coupons4u/adminhtml_coupons4u_einfochipscoupons4u_widget/chooser', array('uniq_id' => $uniqId));
|
49 |
+
$chooser = $this->getLayout()->createBlock('widget/adminhtml_widget_chooser')
|
50 |
+
->setElement($element)
|
51 |
+
->setTranslationHelper($this->getTranslationHelper())
|
52 |
+
->setConfig($this->getConfig())
|
53 |
+
->setFieldsetId($this->getFieldsetId())
|
54 |
+
->setSourceUrl($sourceUrl)
|
55 |
+
->setUniqId($uniqId);
|
56 |
+
if ($element->getValue()) {
|
57 |
+
$einfochipscoupons4u = Mage::getModel('coupons4u/einfochipscoupons4u')->load($element->getValue());
|
58 |
+
if ($einfochipscoupons4u->getId()) {
|
59 |
+
$chooser->setLabel($einfochipscoupons4u->getCouponId());
|
60 |
+
}
|
61 |
+
}
|
62 |
+
$element->setData('after_element_html', $chooser->toHtml());
|
63 |
+
return $element;
|
64 |
+
}
|
65 |
+
/**
|
66 |
+
* Grid Row JS Callback
|
67 |
+
* @access public
|
68 |
+
* @return string
|
69 |
+
* @author e-Infochips
|
70 |
+
*/
|
71 |
+
public function getRowClickCallback(){
|
72 |
+
$chooserJsObject = $this->getId();
|
73 |
+
$js = '
|
74 |
+
function (grid, event) {
|
75 |
+
var trElement = Event.findElement(event, "tr");
|
76 |
+
var einfochipscoupons4uId = trElement.down("td").innerHTML.replace(/^\s+|\s+$/g,"");
|
77 |
+
var einfochipscoupons4uTitle = trElement.down("td").next().innerHTML;
|
78 |
+
'.$chooserJsObject.'.setElementValue(einfochipscoupons4uId);
|
79 |
+
'.$chooserJsObject.'.setElementLabel(einfochipscoupons4uTitle);
|
80 |
+
'.$chooserJsObject.'.close();
|
81 |
+
}
|
82 |
+
';
|
83 |
+
return $js;
|
84 |
+
}
|
85 |
+
/**
|
86 |
+
* Prepare a static blocks collection
|
87 |
+
* @access protected
|
88 |
+
* @return Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Widget_Chooser
|
89 |
+
* @author e-Infochips
|
90 |
+
*/
|
91 |
+
protected function _prepareCollection(){
|
92 |
+
$collection = Mage::getModel('coupons4u/einfochipscoupons4u')->getCollection();
|
93 |
+
$this->setCollection($collection);
|
94 |
+
return parent::_prepareCollection();
|
95 |
+
}
|
96 |
+
/**
|
97 |
+
* Prepare columns for the a grid
|
98 |
+
* @access protected
|
99 |
+
* @return Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Widget_Chooser
|
100 |
+
* @author e-Infochips
|
101 |
+
*/
|
102 |
+
protected function _prepareColumns(){
|
103 |
+
$this->addColumn('chooser_id', array(
|
104 |
+
'header' => Mage::helper('coupons4u')->__('Id'),
|
105 |
+
'align' => 'right',
|
106 |
+
'index' => 'entity_id',
|
107 |
+
'type' => 'number',
|
108 |
+
'width' => 50
|
109 |
+
));
|
110 |
+
|
111 |
+
$this->addColumn('chooser_coupon_id', array(
|
112 |
+
'header'=> Mage::helper('coupons4u')->__('CouponId'),
|
113 |
+
'align' => 'left',
|
114 |
+
'index' => 'coupon_id',
|
115 |
+
));
|
116 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
117 |
+
$this->addColumn('store_id', array(
|
118 |
+
'header'=> Mage::helper('coupons4u')->__('Store Views'),
|
119 |
+
'index' => 'store_id',
|
120 |
+
'type' => 'store',
|
121 |
+
'store_all' => true,
|
122 |
+
'store_view'=> true,
|
123 |
+
'sortable' => false,
|
124 |
+
));
|
125 |
+
}
|
126 |
+
$this->addColumn('chooser_status', array(
|
127 |
+
'header'=> Mage::helper('coupons4u')->__('Status'),
|
128 |
+
'index' => 'status',
|
129 |
+
'type' => 'options',
|
130 |
+
'options' => array(
|
131 |
+
0 => Mage::helper('coupons4u')->__('Disabled'),
|
132 |
+
1 => Mage::helper('coupons4u')->__('Enabled')
|
133 |
+
),
|
134 |
+
));
|
135 |
+
return parent::_prepareColumns();
|
136 |
+
}
|
137 |
+
/**
|
138 |
+
* get url for grid
|
139 |
+
* @access public
|
140 |
+
* @return string
|
141 |
+
* @author e-Infochips
|
142 |
+
*/
|
143 |
+
public function getGridUrl(){
|
144 |
+
return $this->getUrl('adminhtml/coupons4u_einfochipscoupons4u_widget/chooser', array('_current' => true));
|
145 |
+
}
|
146 |
+
/**
|
147 |
+
* after collection load
|
148 |
+
* @access protected
|
149 |
+
* @return Einfochips_Coupons4U_Block_Adminhtml_Einfochipscoupons4u_Widget_Chooser
|
150 |
+
* @author e-Infochips
|
151 |
+
*/
|
152 |
+
protected function _afterLoadCollection(){
|
153 |
+
$this->getCollection()->walk('afterLoad');
|
154 |
+
parent::_afterLoadCollection();
|
155 |
+
}
|
156 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Einfochipscoupons4u/List.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U list block
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Einfochipscoupons4u_List extends Mage_Core_Block_Template{
|
25 |
+
/**
|
26 |
+
* initialize
|
27 |
+
* @access public
|
28 |
+
* @return void
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
public function __construct(){
|
32 |
+
parent::__construct();
|
33 |
+
$einfochipscoupons4us = Mage::getResourceModel('coupons4u/einfochipscoupons4u_collection')
|
34 |
+
->addStoreFilter(Mage::app()->getStore())
|
35 |
+
->addFilter('status', 1)
|
36 |
+
;
|
37 |
+
$einfochipscoupons4us->setOrder('coupon_id', 'asc');
|
38 |
+
$this->setEinfochipscoupons4us($einfochipscoupons4us);
|
39 |
+
}
|
40 |
+
/**
|
41 |
+
* prepare the layout
|
42 |
+
* @access protected
|
43 |
+
* @return Einfochips_Coupons4U_Block_Einfochipscoupons4u_List
|
44 |
+
* @author e-Infochips
|
45 |
+
*/
|
46 |
+
protected function _prepareLayout(){
|
47 |
+
parent::_prepareLayout();
|
48 |
+
$pager = $this->getLayout()->createBlock('page/html_pager', 'coupons4u.einfochipscoupons4u.html.pager')
|
49 |
+
->setCollection($this->getEinfochipscoupons4us());
|
50 |
+
$this->setChild('pager', $pager);
|
51 |
+
$this->getEinfochipscoupons4us()->load();
|
52 |
+
return $this;
|
53 |
+
}
|
54 |
+
/**
|
55 |
+
* get the pager html
|
56 |
+
* @access public
|
57 |
+
* @return string
|
58 |
+
* @author e-Infochips
|
59 |
+
*/
|
60 |
+
public function getPagerHtml(){
|
61 |
+
return $this->getChildHtml('pager');
|
62 |
+
}
|
63 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Einfochipscoupons4u/View.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U view block
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Einfochipscoupons4u_View extends Mage_Core_Block_Template{
|
25 |
+
/**
|
26 |
+
* get the current einfochipscoupons4u
|
27 |
+
* @access public
|
28 |
+
* @return mixed (Einfochips_Coupons4U_Model_Einfochipscoupons4u|null)
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
public function getCurrentEinfochipscoupons4u(){
|
32 |
+
return Mage::registry('current_coupons4u_einfochipscoupons4u');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Einfochipscoupons4u/Widget/Link.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U link widget block
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author Ultimate Module Creator
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Einfochipscoupons4u_Widget_Link extends Einfochips_Coupons4U_Block_Einfochipscoupons4u_Widget_View{
|
25 |
+
protected $_htmlTemplate = 'einfochips_coupons4u/einfochipscoupons4u/widget/link.phtml';
|
26 |
+
}
|
app/code/community/Einfochips/Coupons4U/Block/Einfochipscoupons4u/Widget/View.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U widget block
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Block_Einfochipscoupons4u_Widget_View extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface{
|
25 |
+
protected $_htmlTemplate = 'einfochips_coupons4u/einfochipscoupons4u/widget/view.phtml';
|
26 |
+
/**
|
27 |
+
* Prepare a for widget
|
28 |
+
* @access protected
|
29 |
+
* @return Einfochips_Coupons4U_Block_Einfochipscoupons4u_Widget_View
|
30 |
+
* @author e-Infochips
|
31 |
+
*/
|
32 |
+
protected function _beforeToHtml() {
|
33 |
+
parent::_beforeToHtml();
|
34 |
+
$einfochipscoupons4uId = $this->getData('einfochipscoupons4u_id');
|
35 |
+
if ($einfochipscoupons4uId) {
|
36 |
+
$einfochipscoupons4u = Mage::getModel('coupons4u/einfochipscoupons4u')
|
37 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
38 |
+
->load($einfochipscoupons4uId);
|
39 |
+
if ($einfochipscoupons4u->getStatus()) {
|
40 |
+
$this->setCurrentEinfochipscoupons4u($einfochipscoupons4u);
|
41 |
+
$this->setTemplate($this->_htmlTemplate);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
return $this;
|
45 |
+
}
|
46 |
+
}
|
app/code/community/Einfochips/Coupons4U/Controller/Adminhtml/Coupons4U.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* module base admin controller
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Controller_Adminhtml_Coupons4U extends Mage_Adminhtml_Controller_Action{
|
25 |
+
/**
|
26 |
+
* upload file and get the uploaded name
|
27 |
+
* @access public
|
28 |
+
* @param string $input
|
29 |
+
* @param string $destinationFolder
|
30 |
+
* @param array $data
|
31 |
+
* @return string
|
32 |
+
* @author e-Infochips
|
33 |
+
*/
|
34 |
+
protected function _uploadAndGetName($input, $destinationFolder, $data){
|
35 |
+
try{
|
36 |
+
if (isset($data[$input]['delete'])){
|
37 |
+
return '';
|
38 |
+
}
|
39 |
+
else{
|
40 |
+
$uploader = new Varien_File_Uploader($input);
|
41 |
+
$uploader->setAllowRenameFiles(true);
|
42 |
+
$uploader->setFilesDispersion(true);
|
43 |
+
$uploader->setAllowCreateFolders(true);
|
44 |
+
$result = $uploader->save($destinationFolder);
|
45 |
+
return $result['file'];
|
46 |
+
}
|
47 |
+
}
|
48 |
+
catch (Exception $e){
|
49 |
+
if ($e->getCode() != Varien_File_Uploader::TMP_NAME_EMPTY){
|
50 |
+
throw $e;
|
51 |
+
}
|
52 |
+
else{
|
53 |
+
if (isset($data[$input]['value'])){
|
54 |
+
return $data[$input]['value'];
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
return '';
|
59 |
+
}
|
60 |
+
}
|
app/code/community/Einfochips/Coupons4U/Controller/Router.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* Router
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Controller_Router extends Mage_Core_Controller_Varien_Router_Abstract{
|
25 |
+
/**
|
26 |
+
* init routes
|
27 |
+
* @access public
|
28 |
+
* @param Varien_Event_Observer $observer
|
29 |
+
* @return Einfochips_Coupons4U_Controller_Router
|
30 |
+
* @author e-Infochips
|
31 |
+
*/
|
32 |
+
public function initControllerRouters($observer){
|
33 |
+
$front = $observer->getEvent()->getFront();
|
34 |
+
$front->addRouter('coupons4u', $this);
|
35 |
+
return $this;
|
36 |
+
}
|
37 |
+
/**
|
38 |
+
* Validate and match entities and modify request
|
39 |
+
* @access public
|
40 |
+
* @param Zend_Controller_Request_Http $request
|
41 |
+
* @return bool
|
42 |
+
* @author e-Infochips
|
43 |
+
*/
|
44 |
+
public function match(Zend_Controller_Request_Http $request){
|
45 |
+
if (!Mage::isInstalled()) {
|
46 |
+
Mage::app()->getFrontController()->getResponse()
|
47 |
+
->setRedirect(Mage::getUrl('install'))
|
48 |
+
->sendResponse();
|
49 |
+
exit;
|
50 |
+
}
|
51 |
+
$urlKey = trim($request->getPathInfo(), '/');
|
52 |
+
$check = array();
|
53 |
+
$check['einfochipscoupons4u'] = new Varien_Object(array(
|
54 |
+
'model' =>'coupons4u/einfochipscoupons4u',
|
55 |
+
'controller' => 'einfochipscoupons4u',
|
56 |
+
'action' => 'view',
|
57 |
+
'param' => 'id',
|
58 |
+
));
|
59 |
+
foreach ($check as $key=>$settings){
|
60 |
+
$model = Mage::getModel($settings->getModel());
|
61 |
+
$id = $model->checkUrlKey($urlKey, Mage::app()->getStore()->getId());
|
62 |
+
if ($id){
|
63 |
+
$request->setModuleName('coupons4u')
|
64 |
+
->setControllerName($settings->getController())
|
65 |
+
->setActionName($settings->getAction())
|
66 |
+
->setParam($settings->getParam(), $id);
|
67 |
+
$request->setAlias(
|
68 |
+
Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS,
|
69 |
+
$urlKey
|
70 |
+
);
|
71 |
+
return true;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
return false;
|
75 |
+
}
|
76 |
+
}
|
app/code/community/Einfochips/Coupons4U/Helper/Data.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* Coupons4U default helper
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Helper_Data extends Mage_Core_Helper_Abstract{
|
25 |
+
/**
|
26 |
+
* get the url to the einfochipscoupons4u list page
|
27 |
+
* @access public
|
28 |
+
* @return string
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
/*public function getEinfochipscoupons4usUrl(){
|
32 |
+
return Mage::getUrl('coupons4u/einfochipscoupons4u/index');
|
33 |
+
}*/
|
34 |
+
}
|
app/code/community/Einfochips/Coupons4U/Helper/Einfochipscoupons4u.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U helper
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Helper_Einfochipscoupons4u extends Mage_Core_Helper_Abstract{
|
25 |
+
/**
|
26 |
+
* check if breadcrumbs can be used
|
27 |
+
* @access public
|
28 |
+
* @return bool
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
public function getUseBreadcrumbs(){
|
32 |
+
return Mage::getStoreConfigFlag('coupons4u/einfochipscoupons4u/breadcrumbs');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Einfochips/Coupons4U/Model/Einfochipscoupons4u.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U model
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Model_Einfochipscoupons4u extends Mage_Core_Model_Abstract{
|
25 |
+
/**
|
26 |
+
* Entity code.
|
27 |
+
* Can be used as part of method name for entity processing
|
28 |
+
*/
|
29 |
+
const ENTITY= 'coupons4u_einfochipscoupons4u';
|
30 |
+
const CACHE_TAG = 'coupons4u_einfochipscoupons4u';
|
31 |
+
/**
|
32 |
+
* Prefix of model events names
|
33 |
+
* @var string
|
34 |
+
*/
|
35 |
+
protected $_eventPrefix = 'coupons4u_einfochipscoupons4u';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Parameter name in event
|
39 |
+
* @var string
|
40 |
+
*/
|
41 |
+
protected $_eventObject = 'einfochipscoupons4u';
|
42 |
+
/**
|
43 |
+
* constructor
|
44 |
+
* @access public
|
45 |
+
* @return void
|
46 |
+
* @author e-Infochips
|
47 |
+
*/
|
48 |
+
public function _construct(){
|
49 |
+
parent::_construct();
|
50 |
+
$this->_init('coupons4u/einfochipscoupons4u');
|
51 |
+
}
|
52 |
+
/**
|
53 |
+
* before save einfochipscoupons4u
|
54 |
+
* @access protected
|
55 |
+
* @return Einfochips_Coupons4U_Model_Einfochipscoupons4u
|
56 |
+
* @author e-Infochips
|
57 |
+
*/
|
58 |
+
protected function _beforeSave(){
|
59 |
+
parent::_beforeSave();
|
60 |
+
$now = Mage::getSingleton('core/date')->gmtDate();
|
61 |
+
if ($this->isObjectNew()){
|
62 |
+
$this->setCreatedAt($now);
|
63 |
+
}
|
64 |
+
$this->setUpdatedAt($now);
|
65 |
+
return $this;
|
66 |
+
}
|
67 |
+
/**
|
68 |
+
* get the url to the einfochipscoupons4u details page
|
69 |
+
* @access public
|
70 |
+
* @return string
|
71 |
+
* @author e-Infochips
|
72 |
+
*/
|
73 |
+
public function getEinfochipscoupons4uUrl(){
|
74 |
+
if ($this->getUrlKey()){
|
75 |
+
return Mage::getUrl('', array('_direct'=>$this->getUrlKey()));
|
76 |
+
}
|
77 |
+
return Mage::getUrl('coupons4u/einfochipscoupons4u/view', array('id'=>$this->getId()));
|
78 |
+
}
|
79 |
+
/**
|
80 |
+
* check URL key
|
81 |
+
* @access public
|
82 |
+
* @param string $urlKey
|
83 |
+
* @param bool $active
|
84 |
+
* @return mixed
|
85 |
+
* @author e-Infochips
|
86 |
+
*/
|
87 |
+
public function checkUrlKey($urlKey, $active = true){
|
88 |
+
return $this->_getResource()->checkUrlKey($urlKey, $active);
|
89 |
+
}
|
90 |
+
/**
|
91 |
+
* save einfochipscoupons4u relation
|
92 |
+
* @access public
|
93 |
+
* @return Einfochips_Coupons4U_Model_Einfochipscoupons4u
|
94 |
+
* @author e-Infochips
|
95 |
+
*/
|
96 |
+
protected function _afterSave() {
|
97 |
+
return parent::_afterSave();
|
98 |
+
}
|
99 |
+
}
|
app/code/community/Einfochips/Coupons4U/Model/Email/Template.php
ADDED
@@ -0,0 +1,657 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Core
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Template model
|
29 |
+
*
|
30 |
+
* Example:
|
31 |
+
*
|
32 |
+
* // Loading of template
|
33 |
+
* $emailTemplate = Mage::getModel('core/email_template')
|
34 |
+
* ->load(Mage::getStoreConfig('path_to_email_template_id_config'));
|
35 |
+
* $variables = array(
|
36 |
+
* 'someObject' => Mage::getSingleton('some_model')
|
37 |
+
* 'someString' => 'Some string value'
|
38 |
+
* );
|
39 |
+
* $emailTemplate->send('some@domain.com', 'Name Of User', $variables);
|
40 |
+
*
|
41 |
+
* @method Mage_Core_Model_Resource_Email_Template _getResource()
|
42 |
+
* @method Mage_Core_Model_Resource_Email_Template getResource()
|
43 |
+
* @method string getTemplateCode()
|
44 |
+
* @method Mage_Core_Model_Email_Template setTemplateCode(string $value)
|
45 |
+
* @method string getTemplateText()
|
46 |
+
* @method Mage_Core_Model_Email_Template setTemplateText(string $value)
|
47 |
+
* @method string getTemplateStyles()
|
48 |
+
* @method Mage_Core_Model_Email_Template setTemplateStyles(string $value)
|
49 |
+
* @method int getTemplateType()
|
50 |
+
* @method Mage_Core_Model_Email_Template setTemplateType(int $value)
|
51 |
+
* @method string getTemplateSubject()
|
52 |
+
* @method Mage_Core_Model_Email_Template setTemplateSubject(string $value)
|
53 |
+
* @method string getTemplateSenderName()
|
54 |
+
* @method Mage_Core_Model_Email_Template setTemplateSenderName(string $value)
|
55 |
+
* @method string getTemplateSenderEmail()
|
56 |
+
* @method Mage_Core_Model_Email_Template setTemplateSenderEmail(string $value)
|
57 |
+
* @method string getAddedAt()
|
58 |
+
* @method Mage_Core_Model_Email_Template setAddedAt(string $value)
|
59 |
+
* @method string getModifiedAt()
|
60 |
+
* @method Mage_Core_Model_Email_Template setModifiedAt(string $value)
|
61 |
+
* @method string getOrigTemplateCode()
|
62 |
+
* @method Mage_Core_Model_Email_Template setOrigTemplateCode(string $value)
|
63 |
+
* @method string getOrigTemplateVariables()
|
64 |
+
* @method Mage_Core_Model_Email_Template setOrigTemplateVariables(string $value)
|
65 |
+
*
|
66 |
+
* @category Mage
|
67 |
+
* @package Mage_Core
|
68 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
69 |
+
*/
|
70 |
+
class Einfochips_Coupons4U_Model_Email_Template extends Mage_Core_Model_Template
|
71 |
+
{
|
72 |
+
/**
|
73 |
+
* Configuration path for default email templates
|
74 |
+
*/
|
75 |
+
const XML_PATH_TEMPLATE_EMAIL = 'global/template/email';
|
76 |
+
const XML_PATH_SENDING_SET_RETURN_PATH = 'system/smtp/set_return_path';
|
77 |
+
const XML_PATH_SENDING_RETURN_PATH_EMAIL = 'system/smtp/return_path_email';
|
78 |
+
const XML_PATH_DESIGN_EMAIL_LOGO = 'design/email/logo';
|
79 |
+
const XML_PATH_DESIGN_EMAIL_LOGO_ALT = 'design/email/logo_alt';
|
80 |
+
|
81 |
+
protected $_templateFilter;
|
82 |
+
protected $_preprocessFlag = false;
|
83 |
+
protected $_mail;
|
84 |
+
|
85 |
+
static protected $_defaultTemplates;
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Initialize email template model
|
89 |
+
*
|
90 |
+
*/
|
91 |
+
protected function _construct()
|
92 |
+
{
|
93 |
+
$this->_init('core/email_template');
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Return logo URL for emails
|
98 |
+
* Take logo from skin if custom logo is undefined
|
99 |
+
*
|
100 |
+
* @param Mage_Core_Model_Store|int|string $store
|
101 |
+
* @return string
|
102 |
+
*/
|
103 |
+
protected function _getLogoUrl($store)
|
104 |
+
{
|
105 |
+
$store = Mage::app()->getStore($store);
|
106 |
+
$fileName = $store->getConfig(self::XML_PATH_DESIGN_EMAIL_LOGO);
|
107 |
+
if ($fileName) {
|
108 |
+
$uploadDir = Mage_Adminhtml_Model_System_Config_Backend_Email_Logo::UPLOAD_DIR;
|
109 |
+
$fullFileName = Mage::getBaseDir('media') . DS . $uploadDir . DS . $fileName;
|
110 |
+
if (file_exists($fullFileName)) {
|
111 |
+
return Mage::getBaseUrl('media') . $uploadDir . '/' . $fileName;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
return Mage::getDesign()->getSkinUrl('images/logo_email.gif');
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Return logo alt for emails
|
119 |
+
*
|
120 |
+
* @param Mage_Core_Model_Store|int|string $store
|
121 |
+
* @return string
|
122 |
+
*/
|
123 |
+
protected function _getLogoAlt($store)
|
124 |
+
{
|
125 |
+
$store = Mage::app()->getStore($store);
|
126 |
+
$alt = $store->getConfig(self::XML_PATH_DESIGN_EMAIL_LOGO_ALT);
|
127 |
+
if ($alt) {
|
128 |
+
return $alt;
|
129 |
+
}
|
130 |
+
return $store->getFrontendName();
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Retrieve mail object instance
|
135 |
+
*
|
136 |
+
* @return Zend_Mail
|
137 |
+
*/
|
138 |
+
public function getMail()
|
139 |
+
{
|
140 |
+
/*if (is_null($this->_mail)) {
|
141 |
+
$this->_mail = new Zend_Mail('utf-8');
|
142 |
+
}
|
143 |
+
return $this->_mail;*/
|
144 |
+
|
145 |
+
|
146 |
+
if (is_null($this->_mail)) {
|
147 |
+
/* changes begin */
|
148 |
+
$my_smtp_host = Mage::getStoreConfig('system/smtp/host');
|
149 |
+
$my_smtp_port = Mage::getStoreConfig('system/smtp/port');
|
150 |
+
$my_smtp_usname = Mage::getStoreConfig('coupons4u/einfochipscoupons4u/smtp_username',Mage::app()->getStore());
|
151 |
+
$my_smtp_uspass = Mage::getStoreConfig('coupons4u/einfochipscoupons4u/smtp_password',Mage::app()->getStore());
|
152 |
+
|
153 |
+
$config = array(
|
154 |
+
'port' => $my_smtp_port,
|
155 |
+
'auth' => 'login',
|
156 |
+
'username' => "$my_smtp_usname",
|
157 |
+
'password' => "$my_smtp_uspass"
|
158 |
+
);
|
159 |
+
$transport = new Zend_Mail_Transport_Smtp($my_smtp_host, $config);
|
160 |
+
Zend_Mail::setDefaultTransport($transport);
|
161 |
+
/* Changes End */
|
162 |
+
$this->_mail = new Zend_Mail('utf-8');
|
163 |
+
}
|
164 |
+
return $this->_mail;
|
165 |
+
|
166 |
+
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Declare template processing filter
|
171 |
+
*
|
172 |
+
* @param Varien_Filter_Template $filter
|
173 |
+
* @return Mage_Core_Model_Email_Template
|
174 |
+
*/
|
175 |
+
public function setTemplateFilter(Varien_Filter_Template $filter)
|
176 |
+
{
|
177 |
+
$this->_templateFilter = $filter;
|
178 |
+
return $this;
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Get filter object for template processing logi
|
183 |
+
*
|
184 |
+
* @return Mage_Core_Model_Email_Template_Filter
|
185 |
+
*/
|
186 |
+
public function getTemplateFilter()
|
187 |
+
{
|
188 |
+
if (empty($this->_templateFilter)) {
|
189 |
+
$this->_templateFilter = Mage::getModel('core/email_template_filter');
|
190 |
+
$this->_templateFilter->setUseAbsoluteLinks($this->getUseAbsoluteLinks())
|
191 |
+
->setStoreId($this->getDesignConfig()->getStore());
|
192 |
+
}
|
193 |
+
return $this->_templateFilter;
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Load template by code
|
198 |
+
*
|
199 |
+
* @param string $templateCode
|
200 |
+
* @return Mage_Core_Model_Email_Template
|
201 |
+
*/
|
202 |
+
public function loadByCode($templateCode)
|
203 |
+
{
|
204 |
+
$this->addData($this->getResource()->loadByCode($templateCode));
|
205 |
+
return $this;
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Load default email template from locale translate
|
210 |
+
*
|
211 |
+
* @param string $templateId
|
212 |
+
* @param string $locale
|
213 |
+
*/
|
214 |
+
public function loadDefault($templateId, $locale=null)
|
215 |
+
{
|
216 |
+
$defaultTemplates = self::getDefaultTemplates();
|
217 |
+
if (!isset($defaultTemplates[$templateId])) {
|
218 |
+
return $this;
|
219 |
+
}
|
220 |
+
|
221 |
+
$data = &$defaultTemplates[$templateId];
|
222 |
+
$this->setTemplateType($data['type']=='html' ? self::TYPE_HTML : self::TYPE_TEXT);
|
223 |
+
|
224 |
+
$templateText = Mage::app()->getTranslator()->getTemplateFile(
|
225 |
+
$data['file'], 'email', $locale
|
226 |
+
);
|
227 |
+
|
228 |
+
if (preg_match('/<!--@subject\s*(.*?)\s*@-->/u', $templateText, $matches)) {
|
229 |
+
$this->setTemplateSubject($matches[1]);
|
230 |
+
$templateText = str_replace($matches[0], '', $templateText);
|
231 |
+
}
|
232 |
+
|
233 |
+
if (preg_match('/<!--@vars\s*((?:.)*?)\s*@-->/us', $templateText, $matches)) {
|
234 |
+
$this->setData('orig_template_variables', str_replace("\n", '', $matches[1]));
|
235 |
+
$templateText = str_replace($matches[0], '', $templateText);
|
236 |
+
}
|
237 |
+
|
238 |
+
if (preg_match('/<!--@styles\s*(.*?)\s*@-->/s', $templateText, $matches)) {
|
239 |
+
$this->setTemplateStyles($matches[1]);
|
240 |
+
$templateText = str_replace($matches[0], '', $templateText);
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Remove comment lines
|
245 |
+
*/
|
246 |
+
$templateText = preg_replace('#\{\*.*\*\}#suU', '', $templateText);
|
247 |
+
|
248 |
+
$this->setTemplateText($templateText);
|
249 |
+
$this->setId($templateId);
|
250 |
+
|
251 |
+
return $this;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Retrive default templates from config
|
256 |
+
*
|
257 |
+
* @return array
|
258 |
+
*/
|
259 |
+
static public function getDefaultTemplates()
|
260 |
+
{
|
261 |
+
if(is_null(self::$_defaultTemplates)) {
|
262 |
+
self::$_defaultTemplates = Mage::getConfig()->getNode(self::XML_PATH_TEMPLATE_EMAIL)->asArray();
|
263 |
+
}
|
264 |
+
|
265 |
+
return self::$_defaultTemplates;
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Retrive default templates as options array
|
270 |
+
*
|
271 |
+
* @return array
|
272 |
+
*/
|
273 |
+
static public function getDefaultTemplatesAsOptionsArray()
|
274 |
+
{
|
275 |
+
$options = array(
|
276 |
+
array('value'=>'', 'label'=> '')
|
277 |
+
);
|
278 |
+
|
279 |
+
$idLabel = array();
|
280 |
+
foreach (self::getDefaultTemplates() as $templateId => $row) {
|
281 |
+
if (isset($row['@']) && isset($row['@']['module'])) {
|
282 |
+
$module = $row['@']['module'];
|
283 |
+
} else {
|
284 |
+
$module = 'adminhtml';
|
285 |
+
}
|
286 |
+
$idLabel[$templateId] = Mage::helper($module)->__($row['label']);
|
287 |
+
}
|
288 |
+
asort($idLabel);
|
289 |
+
foreach ($idLabel as $templateId => $label) {
|
290 |
+
$options[] = array('value' => $templateId, 'label' => $label);
|
291 |
+
}
|
292 |
+
|
293 |
+
return $options;
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Return template id
|
298 |
+
* return int|null
|
299 |
+
*/
|
300 |
+
public function getId()
|
301 |
+
{
|
302 |
+
return $this->getTemplateId();
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Set id of template
|
307 |
+
* @param int $value
|
308 |
+
*/
|
309 |
+
public function setId($value)
|
310 |
+
{
|
311 |
+
return $this->setTemplateId($value);
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* Return true if this template can be used for sending queue as main template
|
316 |
+
*
|
317 |
+
* @return boolean
|
318 |
+
*/
|
319 |
+
public function isValidForSend()
|
320 |
+
{
|
321 |
+
return !Mage::getStoreConfigFlag('system/smtp/disable')
|
322 |
+
&& $this->getSenderName()
|
323 |
+
&& $this->getSenderEmail()
|
324 |
+
&& $this->getTemplateSubject();
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Getter for template type
|
329 |
+
*
|
330 |
+
* @return int|string
|
331 |
+
*/
|
332 |
+
public function getType(){
|
333 |
+
return $this->getTemplateType();
|
334 |
+
}
|
335 |
+
|
336 |
+
/**
|
337 |
+
* Process email template code
|
338 |
+
*
|
339 |
+
* @param array $variables
|
340 |
+
* @return string
|
341 |
+
*/
|
342 |
+
public function getProcessedTemplate(array $variables = array())
|
343 |
+
{
|
344 |
+
$processor = $this->getTemplateFilter();
|
345 |
+
$processor->setUseSessionInUrl(false)
|
346 |
+
->setPlainTemplateMode($this->isPlain());
|
347 |
+
|
348 |
+
if (!$this->_preprocessFlag) {
|
349 |
+
$variables['this'] = $this;
|
350 |
+
}
|
351 |
+
|
352 |
+
if (isset($variables['subscriber']) && ($variables['subscriber'] instanceof Mage_Newsletter_Model_Subscriber)) {
|
353 |
+
$processor->setStoreId($variables['subscriber']->getStoreId());
|
354 |
+
}
|
355 |
+
|
356 |
+
if (!isset($variables['logo_url'])) {
|
357 |
+
$variables['logo_url'] = $this->_getLogoUrl($processor->getStoreId());
|
358 |
+
}
|
359 |
+
if (!isset($variables['logo_alt'])) {
|
360 |
+
$variables['logo_alt'] = $this->_getLogoAlt($processor->getStoreId());
|
361 |
+
}
|
362 |
+
|
363 |
+
$processor->setIncludeProcessor(array($this, 'getInclude'))
|
364 |
+
->setVariables($variables);
|
365 |
+
|
366 |
+
$this->_applyDesignConfig();
|
367 |
+
try {
|
368 |
+
$processedResult = $processor->filter($this->getPreparedTemplateText());
|
369 |
+
}
|
370 |
+
catch (Exception $e) {
|
371 |
+
$this->_cancelDesignConfig();
|
372 |
+
throw $e;
|
373 |
+
}
|
374 |
+
$this->_cancelDesignConfig();
|
375 |
+
return $processedResult;
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Makes additional text preparations for HTML templates
|
380 |
+
*
|
381 |
+
* @return string
|
382 |
+
*/
|
383 |
+
public function getPreparedTemplateText()
|
384 |
+
{
|
385 |
+
if ($this->isPlain() || !$this->getTemplateStyles()) {
|
386 |
+
return $this->getTemplateText();
|
387 |
+
}
|
388 |
+
// wrap styles into style tag
|
389 |
+
$html = "<style type=\"text/css\">\n%s\n</style>\n%s";
|
390 |
+
return sprintf($html, $this->getTemplateStyles(), $this->getTemplateText());
|
391 |
+
}
|
392 |
+
|
393 |
+
/**
|
394 |
+
* Get template code for include directive
|
395 |
+
*
|
396 |
+
* @param string $template
|
397 |
+
* @param array $variables
|
398 |
+
* @return string
|
399 |
+
*/
|
400 |
+
public function getInclude($template, array $variables)
|
401 |
+
{
|
402 |
+
$thisClass = __CLASS__;
|
403 |
+
$includeTemplate = new $thisClass();
|
404 |
+
|
405 |
+
$includeTemplate->loadByCode($template);
|
406 |
+
|
407 |
+
return $includeTemplate->getProcessedTemplate($variables);
|
408 |
+
}
|
409 |
+
|
410 |
+
/**
|
411 |
+
* Send mail to recipient
|
412 |
+
*
|
413 |
+
* @param array|string $email E-mail(s)
|
414 |
+
* @param array|string|null $name receiver name(s)
|
415 |
+
* @param array $variables template variables
|
416 |
+
* @return boolean
|
417 |
+
**/
|
418 |
+
public function send($email, $name = null, array $variables = array())
|
419 |
+
{
|
420 |
+
if (!$this->isValidForSend()) {
|
421 |
+
Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
|
422 |
+
return false;
|
423 |
+
}
|
424 |
+
|
425 |
+
$emails = array_values((array)$email);
|
426 |
+
$names = is_array($name) ? $name : (array)$name;
|
427 |
+
$names = array_values($names);
|
428 |
+
foreach ($emails as $key => $email) {
|
429 |
+
if (!isset($names[$key])) {
|
430 |
+
$names[$key] = substr($email, 0, strpos($email, '@'));
|
431 |
+
}
|
432 |
+
}
|
433 |
+
|
434 |
+
$variables['email'] = reset($emails);
|
435 |
+
$variables['name'] = reset($names);
|
436 |
+
|
437 |
+
ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
|
438 |
+
ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
|
439 |
+
|
440 |
+
$mail = $this->getMail();
|
441 |
+
|
442 |
+
$setReturnPath = Mage::getStoreConfig(self::XML_PATH_SENDING_SET_RETURN_PATH);
|
443 |
+
switch ($setReturnPath) {
|
444 |
+
case 1:
|
445 |
+
$returnPathEmail = $this->getSenderEmail();
|
446 |
+
break;
|
447 |
+
case 2:
|
448 |
+
$returnPathEmail = Mage::getStoreConfig(self::XML_PATH_SENDING_RETURN_PATH_EMAIL);
|
449 |
+
break;
|
450 |
+
default:
|
451 |
+
$returnPathEmail = null;
|
452 |
+
break;
|
453 |
+
}
|
454 |
+
|
455 |
+
if ($returnPathEmail !== null) {
|
456 |
+
$mailTransport = new Zend_Mail_Transport_Sendmail("-f".$returnPathEmail);
|
457 |
+
Zend_Mail::setDefaultTransport($mailTransport);
|
458 |
+
}
|
459 |
+
|
460 |
+
foreach ($emails as $key => $email) {
|
461 |
+
$mail->addTo($email, '=?utf-8?B?' . base64_encode($names[$key]) . '?=');
|
462 |
+
}
|
463 |
+
|
464 |
+
$this->setUseAbsoluteLinks(true);
|
465 |
+
$text = $this->getProcessedTemplate($variables, true);
|
466 |
+
|
467 |
+
if($this->isPlain()) {
|
468 |
+
$mail->setBodyText($text);
|
469 |
+
} else {
|
470 |
+
$mail->setBodyHTML($text);
|
471 |
+
}
|
472 |
+
|
473 |
+
$mail->setSubject('=?utf-8?B?' . base64_encode($this->getProcessedTemplateSubject($variables)) . '?=');
|
474 |
+
$mail->setFrom($this->getSenderEmail(), $this->getSenderName());
|
475 |
+
|
476 |
+
try {
|
477 |
+
$mail->send();
|
478 |
+
$this->_mail = null;
|
479 |
+
}
|
480 |
+
catch (Exception $e) {
|
481 |
+
$this->_mail = null;
|
482 |
+
Mage::logException($e);
|
483 |
+
return false;
|
484 |
+
}
|
485 |
+
|
486 |
+
return true;
|
487 |
+
}
|
488 |
+
|
489 |
+
/**
|
490 |
+
* Send transactional email to recipient
|
491 |
+
*
|
492 |
+
* @param int $templateId
|
493 |
+
* @param string|array $sender sneder informatio, can be declared as part of config path
|
494 |
+
* @param string $email recipient email
|
495 |
+
* @param string $name recipient name
|
496 |
+
* @param array $vars varianles which can be used in template
|
497 |
+
* @param int|null $storeId
|
498 |
+
* @return Mage_Core_Model_Email_Template
|
499 |
+
*/
|
500 |
+
public function sendTransactional($templateId, $sender, $email, $name, $vars=array(), $storeId=null)
|
501 |
+
{
|
502 |
+
$this->setSentSuccess(false);
|
503 |
+
if (($storeId === null) && $this->getDesignConfig()->getStore()) {
|
504 |
+
$storeId = $this->getDesignConfig()->getStore();
|
505 |
+
}
|
506 |
+
|
507 |
+
if (is_numeric($templateId)) {
|
508 |
+
$this->load($templateId);
|
509 |
+
} else {
|
510 |
+
$localeCode = Mage::getStoreConfig('general/locale/code', $storeId);
|
511 |
+
$this->loadDefault($templateId, $localeCode);
|
512 |
+
}
|
513 |
+
|
514 |
+
if (!$this->getId()) {
|
515 |
+
throw Mage::exception('Mage_Core', Mage::helper('core')->__('Invalid transactional email code: %s', $templateId));
|
516 |
+
}
|
517 |
+
|
518 |
+
if (!is_array($sender)) {
|
519 |
+
$this->setSenderName(Mage::getStoreConfig('trans_email/ident_' . $sender . '/name', $storeId));
|
520 |
+
$this->setSenderEmail(Mage::getStoreConfig('trans_email/ident_' . $sender . '/email', $storeId));
|
521 |
+
} else {
|
522 |
+
$this->setSenderName($sender['name']);
|
523 |
+
$this->setSenderEmail($sender['email']);
|
524 |
+
}
|
525 |
+
|
526 |
+
if (!isset($vars['store'])) {
|
527 |
+
$vars['store'] = Mage::app()->getStore($storeId);
|
528 |
+
}
|
529 |
+
$this->setSentSuccess($this->send($email, $name, $vars));
|
530 |
+
return $this;
|
531 |
+
}
|
532 |
+
|
533 |
+
/**
|
534 |
+
* Process email subject
|
535 |
+
*
|
536 |
+
* @param array $variables
|
537 |
+
* @return string
|
538 |
+
*/
|
539 |
+
public function getProcessedTemplateSubject(array $variables)
|
540 |
+
{
|
541 |
+
$processor = $this->getTemplateFilter();
|
542 |
+
|
543 |
+
if(!$this->_preprocessFlag) {
|
544 |
+
$variables['this'] = $this;
|
545 |
+
}
|
546 |
+
|
547 |
+
$processor->setVariables($variables);
|
548 |
+
|
549 |
+
$this->_applyDesignConfig();
|
550 |
+
try{
|
551 |
+
$processedResult = $processor->filter($this->getTemplateSubject());
|
552 |
+
}
|
553 |
+
catch (Exception $e) {
|
554 |
+
$this->_cancelDesignConfig();
|
555 |
+
throw $e;
|
556 |
+
}
|
557 |
+
$this->_cancelDesignConfig();
|
558 |
+
return $processedResult;
|
559 |
+
}
|
560 |
+
|
561 |
+
public function addBcc($bcc)
|
562 |
+
{
|
563 |
+
if (is_array($bcc)) {
|
564 |
+
foreach ($bcc as $email) {
|
565 |
+
$this->getMail()->addBcc($email);
|
566 |
+
}
|
567 |
+
}
|
568 |
+
elseif ($bcc) {
|
569 |
+
$this->getMail()->addBcc($bcc);
|
570 |
+
}
|
571 |
+
return $this;
|
572 |
+
}
|
573 |
+
|
574 |
+
/**
|
575 |
+
* Set Return Path
|
576 |
+
*
|
577 |
+
* @param string $email
|
578 |
+
* @return Mage_Core_Model_Email_Template
|
579 |
+
*/
|
580 |
+
public function setReturnPath($email)
|
581 |
+
{
|
582 |
+
$this->getMail()->setReturnPath($email);
|
583 |
+
return $this;
|
584 |
+
}
|
585 |
+
|
586 |
+
/**
|
587 |
+
* Add Reply-To header
|
588 |
+
*
|
589 |
+
* @param string $email
|
590 |
+
* @return Mage_Core_Model_Email_Template
|
591 |
+
*/
|
592 |
+
public function setReplyTo($email)
|
593 |
+
{
|
594 |
+
$this->getMail()->setReplyTo($email);
|
595 |
+
return $this;
|
596 |
+
}
|
597 |
+
|
598 |
+
/**
|
599 |
+
* Parse variables string into array of variables
|
600 |
+
*
|
601 |
+
* @param string $variablesString
|
602 |
+
* @return array
|
603 |
+
*/
|
604 |
+
protected function _parseVariablesString($variablesString)
|
605 |
+
{
|
606 |
+
$variables = array();
|
607 |
+
if ($variablesString && is_string($variablesString)) {
|
608 |
+
$variablesString = str_replace("\n", '', $variablesString);
|
609 |
+
$variables = Zend_Json::decode($variablesString);
|
610 |
+
}
|
611 |
+
return $variables;
|
612 |
+
}
|
613 |
+
|
614 |
+
/**
|
615 |
+
* Retrieve option array of variables
|
616 |
+
*
|
617 |
+
* @param boolean $withGroup if true wrap variable options in group
|
618 |
+
* @return array
|
619 |
+
*/
|
620 |
+
public function getVariablesOptionArray($withGroup = false)
|
621 |
+
{
|
622 |
+
$optionArray = array();
|
623 |
+
$variables = $this->_parseVariablesString($this->getData('orig_template_variables'));
|
624 |
+
if ($variables) {
|
625 |
+
foreach ($variables as $value => $label) {
|
626 |
+
$optionArray[] = array(
|
627 |
+
'value' => '{{' . $value . '}}',
|
628 |
+
'label' => Mage::helper('core')->__('%s', $label)
|
629 |
+
);
|
630 |
+
}
|
631 |
+
if ($withGroup) {
|
632 |
+
$optionArray = array(
|
633 |
+
'label' => Mage::helper('core')->__('Template Variables'),
|
634 |
+
'value' => $optionArray
|
635 |
+
);
|
636 |
+
}
|
637 |
+
}
|
638 |
+
return $optionArray;
|
639 |
+
}
|
640 |
+
|
641 |
+
/**
|
642 |
+
* Validate email template code
|
643 |
+
*
|
644 |
+
* @return Mage_Core_Model_Email_Template
|
645 |
+
*/
|
646 |
+
protected function _beforeSave()
|
647 |
+
{
|
648 |
+
$code = $this->getTemplateCode();
|
649 |
+
if (empty($code)) {
|
650 |
+
Mage::throwException(Mage::helper('core')->__('The template Name must not be empty.'));
|
651 |
+
}
|
652 |
+
if($this->_getResource()->checkCodeUsage($this)) {
|
653 |
+
Mage::throwException(Mage::helper('core')->__('Duplicate Of Template Name'));
|
654 |
+
}
|
655 |
+
return parent::_beforeSave();
|
656 |
+
}
|
657 |
+
}
|
app/code/community/Einfochips/Coupons4U/Model/Resource/Einfochipscoupons4u.php
ADDED
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U resource model
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Model_Resource_Einfochipscoupons4u extends Mage_Core_Model_Resource_Db_Abstract{
|
25 |
+
/**
|
26 |
+
* constructor
|
27 |
+
* @access public
|
28 |
+
* @return void
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
public function _construct(){
|
32 |
+
$this->_init('coupons4u/einfochipscoupons4u', 'entity_id');
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Get store ids to which specified item is assigned
|
37 |
+
* @access public
|
38 |
+
* @param int $einfochipscoupons4uId
|
39 |
+
* @return array
|
40 |
+
* @author e-Infochips
|
41 |
+
*/
|
42 |
+
public function lookupStoreIds($einfochipscoupons4uId){
|
43 |
+
$adapter = $this->_getReadAdapter();
|
44 |
+
$select = $adapter->select()
|
45 |
+
->from($this->getTable('coupons4u/einfochipscoupons4u_store'), 'store_id')
|
46 |
+
->where('einfochipscoupons4u_id = ?',(int)$einfochipscoupons4uId);
|
47 |
+
return $adapter->fetchCol($select);
|
48 |
+
}
|
49 |
+
/**
|
50 |
+
* Perform operations after object load
|
51 |
+
* @access public
|
52 |
+
* @param Mage_Core_Model_Abstract $object
|
53 |
+
* @return Einfochips_Coupons4U_Model_Resource_Einfochipscoupons4u
|
54 |
+
* @author e-Infochips
|
55 |
+
*/
|
56 |
+
protected function _afterLoad(Mage_Core_Model_Abstract $object){
|
57 |
+
if ($object->getId()) {
|
58 |
+
$stores = $this->lookupStoreIds($object->getId());
|
59 |
+
$object->setData('store_id', $stores);
|
60 |
+
}
|
61 |
+
return parent::_afterLoad($object);
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Retrieve select object for load object data
|
66 |
+
*
|
67 |
+
* @param string $field
|
68 |
+
* @param mixed $value
|
69 |
+
* @param Einfochips_Coupons4U_Model_Einfochipscoupons4u $object
|
70 |
+
* @return Zend_Db_Select
|
71 |
+
*/
|
72 |
+
protected function _getLoadSelect($field, $value, $object){
|
73 |
+
$select = parent::_getLoadSelect($field, $value, $object);
|
74 |
+
if ($object->getStoreId()) {
|
75 |
+
$storeIds = array(Mage_Core_Model_App::ADMIN_STORE_ID, (int)$object->getStoreId());
|
76 |
+
$select->join(
|
77 |
+
array('coupons4u_einfochipscoupons4u_store' => $this->getTable('coupons4u/einfochipscoupons4u_store')),
|
78 |
+
$this->getMainTable() . '.entity_id = coupons4u_einfochipscoupons4u_store.einfochipscoupons4u_id',
|
79 |
+
array()
|
80 |
+
)
|
81 |
+
->where('coupons4u_einfochipscoupons4u_store.store_id IN (?)', $storeIds)
|
82 |
+
->order('coupons4u_einfochipscoupons4u_store.store_id DESC')
|
83 |
+
->limit(1);
|
84 |
+
}
|
85 |
+
return $select;
|
86 |
+
}
|
87 |
+
/**
|
88 |
+
* Assign einfochipscoupons4u to store views
|
89 |
+
* @access protected
|
90 |
+
* @param Mage_Core_Model_Abstract $object
|
91 |
+
* @return Einfochips_Coupons4U_Model_Resource_Einfochipscoupons4u
|
92 |
+
* @author e-Infochips
|
93 |
+
*/
|
94 |
+
protected function _afterSave(Mage_Core_Model_Abstract $object){
|
95 |
+
$oldStores = $this->lookupStoreIds($object->getId());
|
96 |
+
$newStores = (array)$object->getStores();
|
97 |
+
if (empty($newStores)) {
|
98 |
+
$newStores = (array)$object->getStoreId();
|
99 |
+
}
|
100 |
+
$table = $this->getTable('coupons4u/einfochipscoupons4u_store');
|
101 |
+
$insert = array_diff($newStores, $oldStores);
|
102 |
+
$delete = array_diff($oldStores, $newStores);
|
103 |
+
if ($delete) {
|
104 |
+
$where = array(
|
105 |
+
'einfochipscoupons4u_id = ?' => (int) $object->getId(),
|
106 |
+
'store_id IN (?)' => $delete
|
107 |
+
);
|
108 |
+
$this->_getWriteAdapter()->delete($table, $where);
|
109 |
+
}
|
110 |
+
if ($insert) {
|
111 |
+
$data = array();
|
112 |
+
foreach ($insert as $storeId) {
|
113 |
+
$data[] = array(
|
114 |
+
'einfochipscoupons4u_id' => (int) $object->getId(),
|
115 |
+
'store_id' => (int) $storeId
|
116 |
+
);
|
117 |
+
}
|
118 |
+
$this->_getWriteAdapter()->insertMultiple($table, $data);
|
119 |
+
}
|
120 |
+
return parent::_afterSave($object);
|
121 |
+
} /**
|
122 |
+
* check url key
|
123 |
+
* @access public
|
124 |
+
* @param string $urlKey
|
125 |
+
* @param bool $active
|
126 |
+
* @return mixed
|
127 |
+
* @author e-Infochips
|
128 |
+
*/
|
129 |
+
public function checkUrlKey($urlKey, $storeId, $active = true){
|
130 |
+
$stores = array(Mage_Core_Model_App::ADMIN_STORE_ID, $storeId);
|
131 |
+
$select = $this->_initCheckUrlKeySelect($urlKey, $stores);
|
132 |
+
if (!is_null($active)) {
|
133 |
+
$select->where('e.status = ?', $active);
|
134 |
+
}
|
135 |
+
$select->reset(Zend_Db_Select::COLUMNS)
|
136 |
+
->columns('e.entity_id')
|
137 |
+
->limit(1);
|
138 |
+
|
139 |
+
return $this->_getReadAdapter()->fetchOne($select);
|
140 |
+
}
|
141 |
+
/**
|
142 |
+
* init the check select
|
143 |
+
* @access protected
|
144 |
+
* @param string $urlKey
|
145 |
+
* @param array $store
|
146 |
+
* @return Zend_Db_Select
|
147 |
+
* @author e-Infochips
|
148 |
+
*/
|
149 |
+
protected function _initCheckUrlKeySelect($urlKey, $store){
|
150 |
+
$select = $this->_getReadAdapter()->select()
|
151 |
+
->from(array('e' => $this->getMainTable()))
|
152 |
+
->join(
|
153 |
+
array('es' => $this->getTable('coupons4u/einfochipscoupons4u_store')),
|
154 |
+
'e.entity_id = es.einfochipscoupons4u_id',
|
155 |
+
array())
|
156 |
+
->where('e.url_key = ?', $urlKey)
|
157 |
+
->where('es.store_id IN (?)', $store);
|
158 |
+
return $select;
|
159 |
+
}
|
160 |
+
/**
|
161 |
+
* Check for unique URL key
|
162 |
+
* @access public
|
163 |
+
* @param Mage_Core_Model_Abstract $object
|
164 |
+
* @return bool
|
165 |
+
* @author e-Infochips
|
166 |
+
*/
|
167 |
+
public function getIsUniqueUrlKey(Mage_Core_Model_Abstract $object){
|
168 |
+
if (Mage::app()->isSingleStoreMode() || !$object->hasStores()) {
|
169 |
+
$stores = array(Mage_Core_Model_App::ADMIN_STORE_ID);
|
170 |
+
}
|
171 |
+
else {
|
172 |
+
$stores = (array)$object->getData('stores');
|
173 |
+
}
|
174 |
+
$select = $this->_initCheckUrlKeySelect($object->getData('url_key'), $stores);
|
175 |
+
if ($object->getId()) {
|
176 |
+
$select->where('e.entity_id <> ?', $object->getId());
|
177 |
+
}
|
178 |
+
if ($this->_getWriteAdapter()->fetchRow($select)) {
|
179 |
+
return false;
|
180 |
+
}
|
181 |
+
return true;
|
182 |
+
}
|
183 |
+
/**
|
184 |
+
* Check if the URL key is numeric
|
185 |
+
* @access public
|
186 |
+
* @param Mage_Core_Model_Abstract $object
|
187 |
+
* @return bool
|
188 |
+
* @author e-Infochips
|
189 |
+
*/
|
190 |
+
protected function isNumericUrlKey(Mage_Core_Model_Abstract $object){
|
191 |
+
return preg_match('/^[0-9]+$/', $object->getData('url_key'));
|
192 |
+
}
|
193 |
+
/**
|
194 |
+
* Checkif the URL key is valid
|
195 |
+
* @access public
|
196 |
+
* @param Mage_Core_Model_Abstract $object
|
197 |
+
* @return bool
|
198 |
+
* @author e-Infochips
|
199 |
+
*/
|
200 |
+
protected function isValidUrlKey(Mage_Core_Model_Abstract $object){
|
201 |
+
return preg_match('/^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/', $object->getData('url_key'));
|
202 |
+
}
|
203 |
+
/**
|
204 |
+
* validate before saving
|
205 |
+
* @access protected
|
206 |
+
* @param $object
|
207 |
+
* @return Einfochips_Coupons4U_Model_Resource_Einfochipscoupons4u
|
208 |
+
* @author e-Infochips
|
209 |
+
*/
|
210 |
+
protected function _beforeSave(Mage_Core_Model_Abstract $object){
|
211 |
+
/*if (!$this->getIsUniqueUrlKey($object)) {
|
212 |
+
Mage::throwException(Mage::helper('coupons4u')->__('URL key already exists.'));
|
213 |
+
}
|
214 |
+
if (!$this->isValidUrlKey($object)) {
|
215 |
+
Mage::throwException(Mage::helper('coupons4u')->__('The URL key contains capital letters or disallowed symbols.'));
|
216 |
+
}
|
217 |
+
if ($this->isNumericUrlKey($object)) {
|
218 |
+
Mage::throwException(Mage::helper('coupons4u')->__('The URL key cannot consist only of numbers.'));
|
219 |
+
}*/
|
220 |
+
return parent::_beforeSave($object);
|
221 |
+
}}
|
app/code/community/Einfochips/Coupons4U/Model/Resource/Einfochipscoupons4u/Collection.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U collection resource model
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Model_Resource_Einfochipscoupons4u_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract{
|
25 |
+
protected $_joinedFields = array();
|
26 |
+
/**
|
27 |
+
* constructor
|
28 |
+
* @access public
|
29 |
+
* @return void
|
30 |
+
* @author e-Infochips
|
31 |
+
*/
|
32 |
+
public function _construct(){
|
33 |
+
parent::_construct();
|
34 |
+
$this->_init('coupons4u/einfochipscoupons4u');
|
35 |
+
$this->_map['fields']['store'] = 'store_table.store_id';
|
36 |
+
}
|
37 |
+
/**
|
38 |
+
* get einfochipscoupons4us as array
|
39 |
+
* @access protected
|
40 |
+
* @param string $valueField
|
41 |
+
* @param string $labelField
|
42 |
+
* @param array $additional
|
43 |
+
* @return array
|
44 |
+
* @author e-Infochips
|
45 |
+
*/
|
46 |
+
protected function _toOptionArray($valueField='entity_id', $labelField='coupon_id', $additional=array()){
|
47 |
+
return parent::_toOptionArray($valueField, $labelField, $additional);
|
48 |
+
}
|
49 |
+
/**
|
50 |
+
* get options hash
|
51 |
+
* @access protected
|
52 |
+
* @param string $valueField
|
53 |
+
* @param string $labelField
|
54 |
+
* @return array
|
55 |
+
* @author e-Infochips
|
56 |
+
*/
|
57 |
+
protected function _toOptionHash($valueField='entity_id', $labelField='coupon_id'){
|
58 |
+
return parent::_toOptionHash($valueField, $labelField);
|
59 |
+
}
|
60 |
+
/**
|
61 |
+
* Add filter by store
|
62 |
+
* @access public
|
63 |
+
* @param int|Mage_Core_Model_Store $store
|
64 |
+
* @param bool $withAdmin
|
65 |
+
* @return Einfochips_Coupons4U_Model_Resource_Einfochipscoupons4u_Collection
|
66 |
+
* @author e-Infochips
|
67 |
+
*/
|
68 |
+
public function addStoreFilter($store, $withAdmin = true){
|
69 |
+
if (!isset($this->_joinedFields['store'])){
|
70 |
+
if ($store instanceof Mage_Core_Model_Store) {
|
71 |
+
$store = array($store->getId());
|
72 |
+
}
|
73 |
+
if (!is_array($store)) {
|
74 |
+
$store = array($store);
|
75 |
+
}
|
76 |
+
if ($withAdmin) {
|
77 |
+
$store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
|
78 |
+
}
|
79 |
+
$this->addFilter('store', array('in' => $store), 'public');
|
80 |
+
$this->_joinedFields['store'] = true;
|
81 |
+
}
|
82 |
+
return $this;
|
83 |
+
}
|
84 |
+
/**
|
85 |
+
* Join store relation table if there is store filter
|
86 |
+
* @access protected
|
87 |
+
* @return Einfochips_Coupons4U_Model_Resource_Einfochipscoupons4u_Collection
|
88 |
+
* @author e-Infochips
|
89 |
+
*/
|
90 |
+
protected function _renderFiltersBefore(){
|
91 |
+
if ($this->getFilter('store')) {
|
92 |
+
$this->getSelect()->join(
|
93 |
+
array('store_table' => $this->getTable('coupons4u/einfochipscoupons4u_store')),
|
94 |
+
'main_table.entity_id = store_table.einfochipscoupons4u_id',
|
95 |
+
array()
|
96 |
+
)->group('main_table.entity_id');
|
97 |
+
/*
|
98 |
+
* Allow analytic functions usage because of one field grouping
|
99 |
+
*/
|
100 |
+
$this->_useAnalyticFunction = true;
|
101 |
+
}
|
102 |
+
return parent::_renderFiltersBefore();
|
103 |
+
}
|
104 |
+
/**
|
105 |
+
* Get SQL for get record count.
|
106 |
+
* Extra GROUP BY strip added.
|
107 |
+
* @access public
|
108 |
+
* @return Varien_Db_Select
|
109 |
+
* @author e-Infochips
|
110 |
+
*/
|
111 |
+
public function getSelectCountSql(){
|
112 |
+
$countSelect = parent::getSelectCountSql();
|
113 |
+
$countSelect->reset(Zend_Db_Select::GROUP);
|
114 |
+
return $countSelect;
|
115 |
+
}
|
116 |
+
}
|
app/code/community/Einfochips/Coupons4U/Model/Resource/Setup.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* Coupons4U setup
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup{
|
25 |
+
|
26 |
+
}
|
app/code/community/Einfochips/Coupons4U/Model/email.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Einfochips_Coupons4U_Model_Email extends Einfochips_Coupons4U_Model_Email_Template
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Send email to recipient
|
6 |
+
*
|
7 |
+
* @param string $templateId template identifier (see config.xml to know it)
|
8 |
+
* @param array $sender sender name with email ex. array('name' => 'John D.', 'email' => 'email@ex.com')
|
9 |
+
* @param string $email recipient email address
|
10 |
+
* @param string $name recipient name
|
11 |
+
* @param string $subject email subject
|
12 |
+
* @param array $params data array that will be passed into template
|
13 |
+
*/
|
14 |
+
public function sendEmail($templateId, $sender, $email, $name, $subject, $params = array())
|
15 |
+
{
|
16 |
+
$this->setDesignConfig(array('area' => 'frontend', 'store' => $this->getDesignConfig()->getStore()))
|
17 |
+
->setTemplateSubject($subject)
|
18 |
+
->sendTransactional(
|
19 |
+
$templateId,
|
20 |
+
$sender,
|
21 |
+
$email,
|
22 |
+
$name,
|
23 |
+
$params
|
24 |
+
);
|
25 |
+
}
|
26 |
+
}
|
app/code/community/Einfochips/Coupons4U/controllers/Adminhtml/Coupons4U/Einfochipscoupons4uController.php
ADDED
@@ -0,0 +1,511 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U admin controller
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Adminhtml_Coupons4U_Einfochipscoupons4uController extends Einfochips_Coupons4U_Controller_Adminhtml_Coupons4U{
|
25 |
+
/**
|
26 |
+
* init the einfochipscoupons4u
|
27 |
+
* @access protected
|
28 |
+
* @return Einfochips_Coupons4U_Model_Einfochipscoupons4u
|
29 |
+
*/
|
30 |
+
protected $_publicActions = array('view');
|
31 |
+
protected function _initEinfochipscoupons4u(){
|
32 |
+
$einfochipscoupons4uId = (int) $this->getRequest()->getParam('id');
|
33 |
+
$einfochipscoupons4u = Mage::getModel('coupons4u/einfochipscoupons4u');
|
34 |
+
if ($einfochipscoupons4uId) {
|
35 |
+
$einfochipscoupons4u->load($einfochipscoupons4uId);
|
36 |
+
}
|
37 |
+
Mage::register('current_einfochipscoupons4u', $einfochipscoupons4u);
|
38 |
+
return $einfochipscoupons4u;
|
39 |
+
}
|
40 |
+
/**
|
41 |
+
* default action
|
42 |
+
* @access public
|
43 |
+
* @return void
|
44 |
+
* @author e-Infochips
|
45 |
+
*/
|
46 |
+
|
47 |
+
public function viewAction() {
|
48 |
+
$this->loadLayout();
|
49 |
+
$this->_title(Mage::helper('coupons4u')->__('Coupons4U'))
|
50 |
+
->_title(Mage::helper('coupons4u')->__('EinfochipsCoupons4U'));
|
51 |
+
$this->renderLayout();
|
52 |
+
}
|
53 |
+
public function indexAction() {
|
54 |
+
$this->loadLayout();
|
55 |
+
$this->_title(Mage::helper('coupons4u')->__('Coupons4U'))
|
56 |
+
->_title(Mage::helper('coupons4u')->__('EinfochipsCoupons4U'));
|
57 |
+
$this->renderLayout();
|
58 |
+
}
|
59 |
+
/**
|
60 |
+
* grid action
|
61 |
+
* @access public
|
62 |
+
* @return void
|
63 |
+
* @author e-Infochips
|
64 |
+
*/
|
65 |
+
public function gridAction() {
|
66 |
+
$this->loadLayout()->renderLayout();
|
67 |
+
}
|
68 |
+
/**
|
69 |
+
* edit einfochipscoupons4u - action
|
70 |
+
* @access public
|
71 |
+
* @return void
|
72 |
+
* @author e-Infochips
|
73 |
+
*/
|
74 |
+
public function editAction() {
|
75 |
+
$einfochipscoupons4uId = $this->getRequest()->getParam('id');
|
76 |
+
$einfochipscoupons4u = $this->_initEinfochipscoupons4u();
|
77 |
+
if ($einfochipscoupons4uId && !$einfochipscoupons4u->getId()) {
|
78 |
+
$this->_getSession()->addError(Mage::helper('coupons4u')->__('This einfochipscoupons4u no longer exists.'));
|
79 |
+
$this->_redirect('*/*/');
|
80 |
+
return;
|
81 |
+
}
|
82 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
83 |
+
if (!empty($data)) {
|
84 |
+
$einfochipscoupons4u->setData($data);
|
85 |
+
}
|
86 |
+
Mage::register('einfochipscoupons4u_data', $einfochipscoupons4u);
|
87 |
+
$this->loadLayout();
|
88 |
+
$this->_title(Mage::helper('coupons4u')->__('Coupons4U'))
|
89 |
+
->_title(Mage::helper('coupons4u')->__('EinfochipsCoupons4U'));
|
90 |
+
if ($einfochipscoupons4u->getId()){
|
91 |
+
$this->_title($einfochipscoupons4u->getCouponId());
|
92 |
+
}
|
93 |
+
else{
|
94 |
+
//$this->_title(Mage::helper('coupons4u')->__('Add einfochipscoupons4u'));
|
95 |
+
}
|
96 |
+
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
|
97 |
+
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
|
98 |
+
}
|
99 |
+
$this->renderLayout();
|
100 |
+
}
|
101 |
+
/**
|
102 |
+
* new einfochipscoupons4u action
|
103 |
+
* @access public
|
104 |
+
* @return void
|
105 |
+
* @author e-Infochips
|
106 |
+
*/
|
107 |
+
public function newAction() {
|
108 |
+
$this->_forward('edit');
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Coupons mass assign action
|
113 |
+
*/
|
114 |
+
public function assignAction()
|
115 |
+
{
|
116 |
+
|
117 |
+
$this->loadLayout();
|
118 |
+
$coupons_array = array();
|
119 |
+
|
120 |
+
$codesIds = $this->getRequest()->getParam('ids');
|
121 |
+
if (is_array($codesIds)) {
|
122 |
+
|
123 |
+
$couponsCollection = Mage::getResourceModel('salesrule/coupon_collection')
|
124 |
+
->addFieldToFilter('coupon_id', array('in' => $codesIds));
|
125 |
+
|
126 |
+
foreach ($couponsCollection as $coupon) {
|
127 |
+
$coupons_array[0][$coupon->getId()] = $coupon->getCode();
|
128 |
+
$coupons_array[1] = $coupon->getRuleId();
|
129 |
+
$coupons_array[2] = $coupon->getUsageLimit();
|
130 |
+
$coupons_array[3] = $coupon->getUsagePerCustomer();
|
131 |
+
$coupons_array[4][$coupon->getId()] = $coupon->getTimesUsed();
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
Mage::getModel('core/session')->setData('couponsArray',$coupons_array);
|
136 |
+
$this->_addContent($this->getLayout()->createBlock('coupons4u/adminhtml_Einfochipscoupons4u_hello','UserCouponsAssign'));
|
137 |
+
$this->renderLayout();
|
138 |
+
}
|
139 |
+
|
140 |
+
/*
|
141 |
+
Assign to selected customre
|
142 |
+
*/
|
143 |
+
|
144 |
+
public function assignCouponsAction() {
|
145 |
+
|
146 |
+
$xcoupon = Mage::getModel('core/session')->getData('couponsArray');
|
147 |
+
$customersIds = $this->getRequest()->getParam('customer');
|
148 |
+
|
149 |
+
$resource = Mage::getSingleton('core/resource');
|
150 |
+
$readConnection = $resource->getConnection('core_read');
|
151 |
+
|
152 |
+
$query = 'select customer_id from '.$resource->getTableName('salesrule_customer').' where rule_id = '.$xcoupon[1].' AND times_used = '.$xcoupon[3];
|
153 |
+
|
154 |
+
$results = $readConnection->fetchCol($query);
|
155 |
+
|
156 |
+
if(count($results)!=0) {
|
157 |
+
$customersIds = array_diff($customersIds,$results);
|
158 |
+
}
|
159 |
+
|
160 |
+
$from_email = Mage::getStoreConfig('trans_email/ident_general/email'); //fetch sender email Admin
|
161 |
+
$from_name = Mage::getStoreConfig('trans_email/ident_general/name'); //fetch sender name Admin
|
162 |
+
|
163 |
+
$no_coupons = count($xcoupon[0]);
|
164 |
+
$no_customer = count($customersIds);
|
165 |
+
$couponIds = array_keys($xcoupon[0]);
|
166 |
+
$couponCodes = array_values($xcoupon[0]);
|
167 |
+
$usercouponsModel = Mage::getModel('coupons4u/einfochipscoupons4u');
|
168 |
+
|
169 |
+
$custData = array();
|
170 |
+
$customreCollection = Mage::getModel('customer/customer')->getCollection()
|
171 |
+
->addAttributeToSelect('entity_id')
|
172 |
+
->addAttributeToSelect('firstname')
|
173 |
+
->addAttributeToSelect('lastname')
|
174 |
+
->addAttributeToSelect('email')
|
175 |
+
->addFieldToFilter('entity_id',array('IN'=>$customersIds));
|
176 |
+
|
177 |
+
foreach($customreCollection as $customer) {
|
178 |
+
$custData[$customer->getEntityId()][0] = $customer->getEmail();
|
179 |
+
$custData[$customer->getEntityId()][1] = $customer->getFirstname();
|
180 |
+
}
|
181 |
+
|
182 |
+
if($no_customer==0 || $no_customer=="" ) {
|
183 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
184 |
+
Mage::helper('coupons4u/einfochipscoupons4u')->__('No Customer.')
|
185 |
+
);
|
186 |
+
}
|
187 |
+
else {
|
188 |
+
if($no_coupons > $no_customer){
|
189 |
+
//loop through customer and assign individual coupon to customer
|
190 |
+
|
191 |
+
for($i=0;$i<$no_customer;$i++){
|
192 |
+
$usercouponsModel->setRuleId($xcoupon[1]);
|
193 |
+
$usercouponsModel->setCustomerId($customersIds[$i]);
|
194 |
+
$usercouponsModel->setCouponId($couponIds[$i]);
|
195 |
+
$usercouponsModel->setCode($couponCodes[$i]);
|
196 |
+
$usercouponsModel->save();
|
197 |
+
|
198 |
+
Mage::getModel('coupons4u/email')->sendEmail(
|
199 |
+
'coupons4u_email_template',
|
200 |
+
array('name' => "$from_name", 'email' =>"$from_email"),
|
201 |
+
$custData[$customersIds[$i]][0],
|
202 |
+
$custData[$customersIds[$i]][1],
|
203 |
+
'UserCoupon Email',
|
204 |
+
array('CouponCode' => $couponCodes[$i])
|
205 |
+
);
|
206 |
+
$usercouponsModel->unsetData();
|
207 |
+
}
|
208 |
+
}
|
209 |
+
else{
|
210 |
+
// Coupons are less than number of customers
|
211 |
+
if($no_coupons==1){
|
212 |
+
// loop through the customer and assign single coupon to all the customer
|
213 |
+
$noLoop=0;
|
214 |
+
$nsplLoop = 0;
|
215 |
+
if($xcoupon[2]==1){
|
216 |
+
$noLoop = $xcoupon[2];
|
217 |
+
}
|
218 |
+
if($xcoupon[2] > $no_customer && $xcoupon[2] >1 ) {
|
219 |
+
$noLoop = $no_customer;
|
220 |
+
}
|
221 |
+
if($xcoupon[2] == $no_customer && $xcoupon[2] >1 ) {
|
222 |
+
$noLoop = $xcoupon[2];
|
223 |
+
}
|
224 |
+
if($xcoupon[2] < $no_customer && $xcoupon[2] >1) {
|
225 |
+
$noLoop = $xcoupon[2];
|
226 |
+
}
|
227 |
+
|
228 |
+
if($xcoupon[2]==0){
|
229 |
+
$nsplLoop = $no_customer;
|
230 |
+
}
|
231 |
+
|
232 |
+
for($i=0;$i<$nsplLoop;$i++) {
|
233 |
+
$usercouponsModel->setRuleId($xcoupon[1]);
|
234 |
+
$usercouponsModel->setCustomerId($customersIds[$i]);
|
235 |
+
$usercouponsModel->setCouponId($couponIds[0]);
|
236 |
+
$usercouponsModel->setCode($couponCodes[0]);
|
237 |
+
|
238 |
+
Mage::getModel('coupons4u/email')->sendEmail(
|
239 |
+
'coupons4u_email_template',
|
240 |
+
array('name' => "$from_name", 'email' =>"$from_email"),
|
241 |
+
$custData[$customersIds[$i]][0],
|
242 |
+
$custData[$customersIds[$i]][1],
|
243 |
+
'UserCoupon Email',
|
244 |
+
array('CouponCode' => $couponCodes[0])
|
245 |
+
);
|
246 |
+
$usercouponsModel->save();
|
247 |
+
$usercouponsModel->unsetData();
|
248 |
+
}
|
249 |
+
|
250 |
+
$couponusage =0;
|
251 |
+
for($j=0;$j<$noLoop;$j++) {
|
252 |
+
$usercouponsModel->setRuleId($xcoupon[1]);
|
253 |
+
$usercouponsModel->setCustomerId($customersIds[$j]);
|
254 |
+
|
255 |
+
if($couponusage<$xcoupon[2]) {
|
256 |
+
$usercouponsModel->setCouponId($couponIds[0]);
|
257 |
+
$usercouponsModel->setCode($couponCodes[0]);
|
258 |
+
$couponusage++;
|
259 |
+
Mage::getModel('coupons4u/email')->sendEmail(
|
260 |
+
'coupons4u_email_template',
|
261 |
+
array('name' => "$from_name", 'email' =>"$from_email"),
|
262 |
+
$custData[$customersIds[$j]][0],
|
263 |
+
$custData[$customersIds[$j]][1],
|
264 |
+
'UserCoupon Email',
|
265 |
+
array('CouponCode' => $couponCodes[0])
|
266 |
+
);
|
267 |
+
|
268 |
+
}
|
269 |
+
else {
|
270 |
+
$couponusage =0;
|
271 |
+
}
|
272 |
+
$usercouponsModel->save();
|
273 |
+
$usercouponsModel->unsetData();
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
277 |
+
if($no_coupons>1)
|
278 |
+
{
|
279 |
+
if($xcoupon[2]==1){
|
280 |
+
$noLoop = $xcoupon[2];
|
281 |
+
}
|
282 |
+
if($xcoupon[2] > $no_customer && $xcoupon[2] >1 ) {
|
283 |
+
$noLoop = $no_customer;
|
284 |
+
}
|
285 |
+
if($xcoupon[2] == $no_customer && $xcoupon[2] >1 ) {
|
286 |
+
$noLoop = $xcoupon[2];
|
287 |
+
}
|
288 |
+
if($xcoupon[2] < $no_customer && $xcoupon[2] >1) {
|
289 |
+
$noLoop = $xcoupon[2];
|
290 |
+
}
|
291 |
+
|
292 |
+
if($xcoupon[2]==0){
|
293 |
+
$nsplLoop = $no_customer;
|
294 |
+
}
|
295 |
+
|
296 |
+
for($i=0;$i<$nsplLoop;$i++) {
|
297 |
+
$usercouponsModel->setRuleId($xcoupon[1]);
|
298 |
+
$usercouponsModel->setCustomerId($customersIds[$i]);
|
299 |
+
$usercouponsModel->setCouponId($couponIds[0]);
|
300 |
+
$usercouponsModel->setCode($couponCodes[0]);
|
301 |
+
|
302 |
+
Mage::getModel('coupons4u/email')->sendEmail(
|
303 |
+
'coupons4u_email_template',
|
304 |
+
array('name' => "$from_name", 'email' =>"$from_email"),
|
305 |
+
$custData[$customersIds[$i]][0],
|
306 |
+
$custData[$customersIds[$i]][1],
|
307 |
+
'UserCoupon Email',
|
308 |
+
array('CouponCode' => $couponCodes[0])
|
309 |
+
);
|
310 |
+
$usercouponsModel->save();
|
311 |
+
$usercouponsModel->unsetData();
|
312 |
+
}
|
313 |
+
|
314 |
+
|
315 |
+
$k=0;
|
316 |
+
for($j=0;$j<$no_customer;$j++)
|
317 |
+
{
|
318 |
+
$usercouponsModel->setRuleId($xcoupon[1]);
|
319 |
+
$usercouponsModel->setCustomerId($customersIds[$j]);
|
320 |
+
|
321 |
+
if(count($couponIds)>$k)
|
322 |
+
{
|
323 |
+
$usercouponsModel->setCouponId($couponIds[$k]);
|
324 |
+
$usercouponsModel->setCode($couponCodes[$k]);
|
325 |
+
$k++;
|
326 |
+
|
327 |
+
Mage::getModel('coupons4u/email')->sendEmail(
|
328 |
+
'coupons4u_email_template',
|
329 |
+
array('name' => "$from_name", 'email' =>"$from_email"),
|
330 |
+
$custData[$customersIds[$k]][0],
|
331 |
+
$custData[$customersIds[$k]][1],
|
332 |
+
'UserCoupon Email',
|
333 |
+
array('CouponCode' => $couponCodes[$k])
|
334 |
+
);
|
335 |
+
$usercouponsModel->save();
|
336 |
+
$usercouponsModel->unsetData();
|
337 |
+
}
|
338 |
+
else {
|
339 |
+
$k=0;
|
340 |
+
}
|
341 |
+
}
|
342 |
+
}
|
343 |
+
}
|
344 |
+
}
|
345 |
+
$this->_redirect('*/coupons4u_einfochipscoupons4u/index');
|
346 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('Coupons Assigned to Customer.');
|
347 |
+
}
|
348 |
+
|
349 |
+
|
350 |
+
|
351 |
+
/**
|
352 |
+
* save einfochipscoupons4u - action
|
353 |
+
* @access public
|
354 |
+
* @return void
|
355 |
+
* @author e-Infochips
|
356 |
+
*/
|
357 |
+
public function saveAction() {
|
358 |
+
if ($data = $this->getRequest()->getPost('einfochipscoupons4u')) {
|
359 |
+
try {
|
360 |
+
$einfochipscoupons4u = $this->_initEinfochipscoupons4u();
|
361 |
+
$einfochipscoupons4u->addData($data);
|
362 |
+
$einfochipscoupons4u->save();
|
363 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('coupons4u')->__('EinfochipsCoupons4U was successfully saved'));
|
364 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
365 |
+
if ($this->getRequest()->getParam('back')) {
|
366 |
+
$this->_redirect('*/*/edit', array('id' => $einfochipscoupons4u->getId()));
|
367 |
+
return;
|
368 |
+
}
|
369 |
+
$this->_redirect('*/*/');
|
370 |
+
return;
|
371 |
+
}
|
372 |
+
catch (Mage_Core_Exception $e){
|
373 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
374 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
375 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
376 |
+
return;
|
377 |
+
}
|
378 |
+
catch (Exception $e) {
|
379 |
+
Mage::logException($e);
|
380 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('coupons4u')->__('There was a problem saving the einfochipscoupons4u.'));
|
381 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
382 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
383 |
+
return;
|
384 |
+
}
|
385 |
+
}
|
386 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('coupons4u')->__('Unable to find einfochipscoupons4u to save.'));
|
387 |
+
$this->_redirect('*/*/');
|
388 |
+
}
|
389 |
+
/**
|
390 |
+
* delete einfochipscoupons4u - action
|
391 |
+
* @access public
|
392 |
+
* @return void
|
393 |
+
* @author e-Infochips
|
394 |
+
*/
|
395 |
+
public function deleteAction() {
|
396 |
+
if( $this->getRequest()->getParam('id') > 0) {
|
397 |
+
try {
|
398 |
+
$einfochipscoupons4u = Mage::getModel('coupons4u/einfochipscoupons4u');
|
399 |
+
$einfochipscoupons4u->setId($this->getRequest()->getParam('id'))->delete();
|
400 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('coupons4u')->__('EinfochipsCoupons4U was successfully deleted.'));
|
401 |
+
$this->_redirect('*/*/');
|
402 |
+
return;
|
403 |
+
}
|
404 |
+
catch (Mage_Core_Exception $e){
|
405 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
406 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
407 |
+
}
|
408 |
+
catch (Exception $e) {
|
409 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('coupons4u')->__('There was an error deleteing einfochipscoupons4u.'));
|
410 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
411 |
+
Mage::logException($e);
|
412 |
+
return;
|
413 |
+
}
|
414 |
+
}
|
415 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('coupons4u')->__('Could not find einfochipscoupons4u to delete.'));
|
416 |
+
$this->_redirect('*/*/');
|
417 |
+
}
|
418 |
+
/**
|
419 |
+
* mass delete einfochipscoupons4u - action
|
420 |
+
* @access public
|
421 |
+
* @return void
|
422 |
+
* @author e-Infochips
|
423 |
+
*/
|
424 |
+
public function massDeleteAction() {
|
425 |
+
$einfochipscoupons4uIds = $this->getRequest()->getParam('einfochipscoupons4u');
|
426 |
+
if(!is_array($einfochipscoupons4uIds)) {
|
427 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('coupons4u')->__('Please select einfochipscoupons4u to delete.'));
|
428 |
+
}
|
429 |
+
else {
|
430 |
+
try {
|
431 |
+
foreach ($einfochipscoupons4uIds as $einfochipscoupons4uId) {
|
432 |
+
$einfochipscoupons4u = Mage::getModel('coupons4u/einfochipscoupons4u');
|
433 |
+
$einfochipscoupons4u->setId($einfochipscoupons4uId)->delete();
|
434 |
+
}
|
435 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('coupons4u')->__('Total of %d einfochipscoupons4u were successfully deleted.', count($einfochipscoupons4uIds)));
|
436 |
+
}
|
437 |
+
catch (Mage_Core_Exception $e){
|
438 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
439 |
+
}
|
440 |
+
catch (Exception $e) {
|
441 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('coupons4u')->__('There was an error deleteing einfochipscoupons4u.'));
|
442 |
+
Mage::logException($e);
|
443 |
+
}
|
444 |
+
}
|
445 |
+
$this->_redirect('*/*/index');
|
446 |
+
}
|
447 |
+
/**
|
448 |
+
* mass status change - action
|
449 |
+
* @access public
|
450 |
+
* @return void
|
451 |
+
* @author e-Infochips
|
452 |
+
*/
|
453 |
+
public function massStatusAction(){
|
454 |
+
$einfochipscoupons4uIds = $this->getRequest()->getParam('einfochipscoupons4u');
|
455 |
+
if(!is_array($einfochipscoupons4uIds)) {
|
456 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('coupons4u')->__('Please select einfochipscoupons4u.'));
|
457 |
+
}
|
458 |
+
else {
|
459 |
+
try {
|
460 |
+
foreach ($einfochipscoupons4uIds as $einfochipscoupons4uId) {
|
461 |
+
$einfochipscoupons4u = Mage::getSingleton('coupons4u/einfochipscoupons4u')->load($einfochipscoupons4uId)
|
462 |
+
->setStatus($this->getRequest()->getParam('status'))
|
463 |
+
->setIsMassupdate(true)
|
464 |
+
->save();
|
465 |
+
}
|
466 |
+
$this->_getSession()->addSuccess($this->__('Total of %d einfochipscoupons4u were successfully updated.', count($einfochipscoupons4uIds)));
|
467 |
+
}
|
468 |
+
catch (Mage_Core_Exception $e){
|
469 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
470 |
+
}
|
471 |
+
catch (Exception $e) {
|
472 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('coupons4u')->__('There was an error updating einfochipscoupons4u.'));
|
473 |
+
Mage::logException($e);
|
474 |
+
}
|
475 |
+
}
|
476 |
+
$this->_redirect('*/*/index');
|
477 |
+
}
|
478 |
+
/**
|
479 |
+
* export as csv - action
|
480 |
+
* @access public
|
481 |
+
* @return void
|
482 |
+
* @author e-Infochips
|
483 |
+
*/
|
484 |
+
public function exportCsvAction(){
|
485 |
+
$fileName = 'einfochipscoupons4u.csv';
|
486 |
+
$content = $this->getLayout()->createBlock('coupons4u/adminhtml_einfochipscoupons4u_grid')->getCsv();
|
487 |
+
$this->_prepareDownloadResponse($fileName, $content);
|
488 |
+
}
|
489 |
+
/**
|
490 |
+
* export as MsExcel - action
|
491 |
+
* @access public
|
492 |
+
* @return void
|
493 |
+
* @author e-Infochips
|
494 |
+
*/
|
495 |
+
public function exportExcelAction(){
|
496 |
+
$fileName = 'einfochipscoupons4u.xls';
|
497 |
+
$content = $this->getLayout()->createBlock('coupons4u/adminhtml_einfochipscoupons4u_grid')->getExcelFile();
|
498 |
+
$this->_prepareDownloadResponse($fileName, $content);
|
499 |
+
}
|
500 |
+
/**
|
501 |
+
* export as xml - action
|
502 |
+
* @access public
|
503 |
+
* @return void
|
504 |
+
* @author e-Infochips
|
505 |
+
*/
|
506 |
+
public function exportXmlAction(){
|
507 |
+
$fileName = 'einfochipscoupons4u.xml';
|
508 |
+
$content = $this->getLayout()->createBlock('coupons4u/adminhtml_einfochipscoupons4u_grid')->getXml();
|
509 |
+
$this->_prepareDownloadResponse($fileName, $content);
|
510 |
+
}
|
511 |
+
}
|
app/code/community/Einfochips/Coupons4U/controllers/Einfochipscoupons4uController.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* EinfochipsCoupons4U front contrller
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
class Einfochips_Coupons4U_Einfochipscoupons4uController extends Mage_Core_Controller_Front_Action{
|
25 |
+
/**
|
26 |
+
* default action
|
27 |
+
* @access public
|
28 |
+
* @return void
|
29 |
+
* @author e-Infochips
|
30 |
+
*/
|
31 |
+
public function indexAction(){
|
32 |
+
$this->loadLayout();
|
33 |
+
if (Mage::helper('coupons4u/einfochipscoupons4u')->getUseBreadcrumbs()){
|
34 |
+
if ($breadcrumbBlock = $this->getLayout()->getBlock('breadcrumbs')){
|
35 |
+
$breadcrumbBlock->addCrumb('home', array(
|
36 |
+
'label' => Mage::helper('coupons4u')->__('Home'),
|
37 |
+
'link' => Mage::getUrl(),
|
38 |
+
)
|
39 |
+
);
|
40 |
+
$breadcrumbBlock->addCrumb('einfochipscoupons4us', array(
|
41 |
+
'label' => Mage::helper('coupons4u')->__('EinfochipsCoupons4U'),
|
42 |
+
'link' => '',
|
43 |
+
)
|
44 |
+
);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
$headBlock = $this->getLayout()->getBlock('head');
|
48 |
+
if ($headBlock) {
|
49 |
+
$headBlock->setTitle(Mage::getStoreConfig('coupons4u/einfochipscoupons4u/meta_title'));
|
50 |
+
$headBlock->setKeywords(Mage::getStoreConfig('coupons4u/einfochipscoupons4u/meta_keywords'));
|
51 |
+
$headBlock->setDescription(Mage::getStoreConfig('coupons4u/einfochipscoupons4u/meta_description'));
|
52 |
+
}
|
53 |
+
$this->renderLayout();
|
54 |
+
}
|
55 |
+
/**
|
56 |
+
* view einfochipscoupons4u action
|
57 |
+
* @access public
|
58 |
+
* @return void
|
59 |
+
* @author e-Infochips
|
60 |
+
*/
|
61 |
+
public function viewAction(){
|
62 |
+
}
|
63 |
+
}
|
app/code/community/Einfochips/Coupons4U/controllers/IndexController.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Einfochips_Coupons4U_IndexController extends Mage_Core_Controller_Front_Action {
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
//var_dump(__METHOD__);
|
7 |
+
$this->loadLayout();
|
8 |
+
$this->renderLayout();
|
9 |
+
}
|
10 |
+
public function preDispatch()
|
11 |
+
{
|
12 |
+
parent::preDispatch();
|
13 |
+
$action = $this->getRequest()->getActionName();
|
14 |
+
$loginUrl = Mage::helper('customer')->getLoginUrl();
|
15 |
+
|
16 |
+
if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) {
|
17 |
+
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
18 |
+
}
|
19 |
+
}
|
20 |
+
}
|
app/code/community/Einfochips/Coupons4U/etc/adminhtml.xml
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Einfochips_Coupons4U extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the MIT License
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/mit-license.php
|
12 |
+
*
|
13 |
+
* @category Einfochips
|
14 |
+
* @package Einfochips_Coupons4U
|
15 |
+
* @copyright Copyright (c) 2014
|
16 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<acl>
|
21 |
+
<resources>
|
22 |
+
<admin>
|
23 |
+
<children>
|
24 |
+
<system>
|
25 |
+
<children>
|
26 |
+
<config>
|
27 |
+
<children>
|
28 |
+
<coupons4u translate="title" module="coupons4u">
|
29 |
+
<title>Coupons4U</title>
|
30 |
+
</coupons4u>
|
31 |
+
</children>
|
32 |
+
</config>
|
33 |
+
</children>
|
34 |
+
</system>
|
35 |
+
<coupons4u translate="title" module="coupons4u">
|
36 |
+
<title>Coupons4U</title>
|
37 |
+
<children>
|
38 |
+
<einfochipscoupons4u translate="title" module="coupons4u">
|
39 |
+
<title>EinfochipsCoupons4U</title>
|
40 |
+
</einfochipscoupons4u>
|
41 |
+
</children>
|
42 |
+
</coupons4u>
|
43 |
+
</children>
|
44 |
+
</admin>
|
45 |
+
</resources>
|
46 |
+
</acl>
|
47 |
+
<menu>
|
48 |
+
<coupons4u translate="title" module="coupons4u">
|
49 |
+
<title>Coupons4U</title>
|
50 |
+
<sort_order>2</sort_order>
|
51 |
+
<depends>
|
52 |
+
<module>Einfochips_Coupons4U</module>
|
53 |
+
</depends>
|
54 |
+
<children>
|
55 |
+
<einfochipscoupons4u translate="title" module="coupons4u">
|
56 |
+
<title>EinfochipsCoupons4U</title>
|
57 |
+
<action>adminhtml/coupons4u_einfochipscoupons4u</action>
|
58 |
+
<sort_order>0</sort_order>
|
59 |
+
</einfochipscoupons4u>
|
60 |
+
</children>
|
61 |
+
</coupons4u>
|
62 |
+
</menu>
|
63 |
+
</config>
|
app/code/community/Einfochips/Coupons4U/etc/config.xml
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Einfochips_Coupons4U extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the MIT License
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/mit-license.php
|
12 |
+
*
|
13 |
+
* @category Einfochips
|
14 |
+
* @package Einfochips_Coupons4U
|
15 |
+
* @copyright Copyright (c) 2014
|
16 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<modules>
|
21 |
+
<Einfochips_Coupons4U>
|
22 |
+
<version>0.0.1</version>
|
23 |
+
</Einfochips_Coupons4U>
|
24 |
+
</modules>
|
25 |
+
<global>
|
26 |
+
<resources>
|
27 |
+
<einfochips_coupons4u_setup>
|
28 |
+
<setup>
|
29 |
+
<module>Einfochips_Coupons4U</module>
|
30 |
+
<class>Einfochips_Coupons4U_Model_Resource_Setup</class>
|
31 |
+
</setup>
|
32 |
+
</einfochips_coupons4u_setup>
|
33 |
+
</resources>
|
34 |
+
<blocks>
|
35 |
+
<coupons4u>
|
36 |
+
<class>Einfochips_Coupons4U_Block</class>
|
37 |
+
</coupons4u>
|
38 |
+
</blocks>
|
39 |
+
<helpers>
|
40 |
+
<coupons4u>
|
41 |
+
<class>Einfochips_Coupons4U_Helper</class>
|
42 |
+
</coupons4u>
|
43 |
+
</helpers>
|
44 |
+
<models>
|
45 |
+
<coupons4u>
|
46 |
+
<class>Einfochips_Coupons4U_Model</class>
|
47 |
+
<resourceModel>coupons4u_resource</resourceModel>
|
48 |
+
</coupons4u>
|
49 |
+
<coupons4u_resource>
|
50 |
+
<class>Einfochips_Coupons4U_Model_Resource</class>
|
51 |
+
<entities>
|
52 |
+
<einfochipscoupons4u>
|
53 |
+
<table>coupons4u_einfochipscoupons4u</table>
|
54 |
+
</einfochipscoupons4u>
|
55 |
+
<einfochipscoupons4u_store>
|
56 |
+
<table>coupons4u_einfochipscoupons4u_store</table>
|
57 |
+
</einfochipscoupons4u_store>
|
58 |
+
</entities>
|
59 |
+
</coupons4u_resource>
|
60 |
+
</models>
|
61 |
+
<events>
|
62 |
+
<controller_front_init_routers>
|
63 |
+
<observers>
|
64 |
+
<einfochips_coupons4u>
|
65 |
+
<class>Einfochips_Coupons4U_Controller_Router</class>
|
66 |
+
<method>initControllerRouters</method>
|
67 |
+
</einfochips_coupons4u>
|
68 |
+
</observers>
|
69 |
+
</controller_front_init_routers>
|
70 |
+
</events>
|
71 |
+
<template>
|
72 |
+
<email>
|
73 |
+
<coupons4u_email_template translate="label" module="coupons4u">
|
74 |
+
<label>UserCoupons Email</label>
|
75 |
+
<file>usercoupons_email_template.html</file>
|
76 |
+
<type>html</type>
|
77 |
+
</coupons4u_email_template>
|
78 |
+
</email>
|
79 |
+
</template>
|
80 |
+
</global>
|
81 |
+
<adminhtml>
|
82 |
+
<layout>
|
83 |
+
<updates>
|
84 |
+
<einfochips_coupons4u>
|
85 |
+
<file>einfochips_coupons4u.xml</file>
|
86 |
+
</einfochips_coupons4u>
|
87 |
+
</updates>
|
88 |
+
</layout>
|
89 |
+
<translate>
|
90 |
+
<modules>
|
91 |
+
<Einfochips_Coupons4U>
|
92 |
+
<files>
|
93 |
+
<default>Einfochips_Coupons4U.csv</default>
|
94 |
+
</files>
|
95 |
+
</Einfochips_Coupons4U>
|
96 |
+
</modules>
|
97 |
+
</translate>
|
98 |
+
</adminhtml>
|
99 |
+
<admin>
|
100 |
+
<routers>
|
101 |
+
<adminhtml>
|
102 |
+
<args>
|
103 |
+
<modules>
|
104 |
+
<Einfochips_Coupons4U before="Mage_Adminhtml">Einfochips_Coupons4U_Adminhtml</Einfochips_Coupons4U>
|
105 |
+
</modules>
|
106 |
+
</args>
|
107 |
+
</adminhtml>
|
108 |
+
</routers>
|
109 |
+
</admin>
|
110 |
+
<frontend>
|
111 |
+
<routers>
|
112 |
+
<coupons4u>
|
113 |
+
<use>standard</use>
|
114 |
+
<args>
|
115 |
+
<module>Einfochips_Coupons4U</module>
|
116 |
+
<frontName>coupons4u</frontName>
|
117 |
+
</args>
|
118 |
+
</coupons4u>
|
119 |
+
</routers>
|
120 |
+
<layout>
|
121 |
+
<updates>
|
122 |
+
<einfochips_coupons4u>
|
123 |
+
<file>einfochips_coupons4u.xml</file>
|
124 |
+
</einfochips_coupons4u>
|
125 |
+
</updates>
|
126 |
+
</layout>
|
127 |
+
<translate>
|
128 |
+
<modules>
|
129 |
+
<Einfochips_Coupons4U>
|
130 |
+
<files>
|
131 |
+
<default>Einfochips_Coupons4U.csv</default>
|
132 |
+
</files>
|
133 |
+
</Einfochips_Coupons4U>
|
134 |
+
</modules>
|
135 |
+
</translate>
|
136 |
+
</frontend>
|
137 |
+
<default>
|
138 |
+
<coupons4u>
|
139 |
+
<einfochipscoupons4u>
|
140 |
+
<breadcrumbs>1</breadcrumbs>
|
141 |
+
<meta_title>EinfochipsCoupons4U</meta_title>
|
142 |
+
</einfochipscoupons4u>
|
143 |
+
</coupons4u>
|
144 |
+
</default>
|
145 |
+
</config>
|
app/code/community/Einfochips/Coupons4U/etc/system.xml
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Einfochips_Coupons4U extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the MIT License
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/mit-license.php
|
12 |
+
*
|
13 |
+
* @category Einfochips
|
14 |
+
* @package Einfochips_Coupons4U
|
15 |
+
* @copyright Copyright (c) 2014
|
16 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<tabs>
|
21 |
+
<einfochips translate="label" module="coupons4u">
|
22 |
+
<label>Einfochips</label>
|
23 |
+
<sort_order>2000</sort_order>
|
24 |
+
</einfochips>
|
25 |
+
</tabs>
|
26 |
+
<sections>
|
27 |
+
<coupons4u translate="label" module="coupons4u">
|
28 |
+
<class>separator-top</class>
|
29 |
+
<label>Coupons4U</label>
|
30 |
+
<tab>einfochips</tab>
|
31 |
+
<frontend_type>text</frontend_type>
|
32 |
+
<sort_order>100</sort_order>
|
33 |
+
<show_in_default>1</show_in_default>
|
34 |
+
<show_in_website>1</show_in_website>
|
35 |
+
<show_in_store>1</show_in_store>
|
36 |
+
<groups>
|
37 |
+
<einfochipscoupons4u translate="label" module="coupons4u">
|
38 |
+
<label>EinfochipsCoupons4U</label>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<sort_order>10</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
<fields>
|
45 |
+
<breadcrumbs translate="label" module="coupons4u">
|
46 |
+
<label>Use Breadcrumbs For EinfochipsCoupons4U Pages</label>
|
47 |
+
<frontend_type>select</frontend_type>
|
48 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
49 |
+
<sort_order>10</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
</breadcrumbs>
|
54 |
+
<smtp_username translate="label" module="coupons4u">
|
55 |
+
<label>SMTP Username</label>
|
56 |
+
<frontend_type>text</frontend_type>
|
57 |
+
<sort_order>20</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
</smtp_username>
|
62 |
+
<smtp_password translate="label" module="coupons4u">
|
63 |
+
<label>SMTP Password</label>
|
64 |
+
<frontend_type>password</frontend_type>
|
65 |
+
<sort_order>30</sort_order>
|
66 |
+
<show_in_default>1</show_in_default>
|
67 |
+
<show_in_website>1</show_in_website>
|
68 |
+
<show_in_store>1</show_in_store>
|
69 |
+
</smtp_password>
|
70 |
+
<meta_title translate="label" module="coupons4u">
|
71 |
+
<label>Meta title for einfochipscoupons4u list page</label>
|
72 |
+
<frontend_type>text</frontend_type>
|
73 |
+
<sort_order>40</sort_order>
|
74 |
+
<show_in_default>1</show_in_default>
|
75 |
+
<show_in_website>1</show_in_website>
|
76 |
+
<show_in_store>1</show_in_store>
|
77 |
+
</meta_title>
|
78 |
+
<meta_description translate="label" module="coupons4u">
|
79 |
+
<label>Meta description for einfochipscoupons4u list page</label>
|
80 |
+
<frontend_type>textarea</frontend_type>
|
81 |
+
<sort_order>50</sort_order>
|
82 |
+
<show_in_default>1</show_in_default>
|
83 |
+
<show_in_website>1</show_in_website>
|
84 |
+
<show_in_store>1</show_in_store>
|
85 |
+
</meta_description>
|
86 |
+
<meta_keywords translate="label" module="coupons4u">
|
87 |
+
<label>Meta keywords for einfochipscoupons4u list page</label>
|
88 |
+
<frontend_type>textarea</frontend_type>
|
89 |
+
<sort_order>60</sort_order>
|
90 |
+
<show_in_default>1</show_in_default>
|
91 |
+
<show_in_website>1</show_in_website>
|
92 |
+
<show_in_store>1</show_in_store>
|
93 |
+
</meta_keywords>
|
94 |
+
</fields>
|
95 |
+
</einfochipscoupons4u>
|
96 |
+
</groups>
|
97 |
+
</coupons4u>
|
98 |
+
</sections>
|
99 |
+
</config>
|
app/code/community/Einfochips/Coupons4U/etc/widget.xml
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Einfochips_Coupons4U extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the MIT License
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/mit-license.php
|
12 |
+
*
|
13 |
+
* @category Einfochips
|
14 |
+
* @package Einfochips_Coupons4U
|
15 |
+
* @copyright Copyright (c) 2014
|
16 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<widgets>
|
20 |
+
<coupons4u_einfochipscoupons4u_view type="coupons4u/einfochipscoupons4u_widget_view" translate="name description" module="coupons4u">
|
21 |
+
<name>EinfochipsCoupons4U view</name>
|
22 |
+
<description>EinfochipsCoupons4U view widget</description>
|
23 |
+
<is_email_compatible>0</is_email_compatible>
|
24 |
+
<parameters>
|
25 |
+
<einfochipscoupons4u_id type="complex" translate="label">
|
26 |
+
<visible>1</visible>
|
27 |
+
<required>1</required>
|
28 |
+
<label>EinfochipsCoupons4U</label>
|
29 |
+
<type>label</type>
|
30 |
+
<helper_block>
|
31 |
+
<type>coupons4u/adminhtml_einfochipscoupons4u_widget_chooser</type>
|
32 |
+
<data>
|
33 |
+
<button translate="open">
|
34 |
+
<open>Select EinfochipsCoupons4U</open>
|
35 |
+
</button>
|
36 |
+
</data>
|
37 |
+
</helper_block>
|
38 |
+
<sort_order>120</sort_order>
|
39 |
+
</einfochipscoupons4u_id>
|
40 |
+
</parameters>
|
41 |
+
</coupons4u_einfochipscoupons4u_view>
|
42 |
+
<coupons4u_einfochipscoupons4u_link type="coupons4u/einfochipscoupons4u_widget_link" translate="name description" module="coupons4u">
|
43 |
+
<name>EinfochipsCoupons4U link</name>
|
44 |
+
<description>EinfochipsCoupons4U link widget</description>
|
45 |
+
<is_email_compatible>0</is_email_compatible>
|
46 |
+
<parameters>
|
47 |
+
<einfochipscoupons4u_id type="complex" translate="label">
|
48 |
+
<visible>1</visible>
|
49 |
+
<required>1</required>
|
50 |
+
<label>EinfochipsCoupons4U</label>
|
51 |
+
<type>label</type>
|
52 |
+
<helper_block>
|
53 |
+
<type>coupons4u/adminhtml_einfochipscoupons4u_widget_chooser</type>
|
54 |
+
<data>
|
55 |
+
<button translate="open">
|
56 |
+
<open>Select EinfochipsCoupons4U</open>
|
57 |
+
</button>
|
58 |
+
</data>
|
59 |
+
</helper_block>
|
60 |
+
<sort_order>130</sort_order>
|
61 |
+
</einfochipscoupons4u_id>
|
62 |
+
</parameters>
|
63 |
+
</coupons4u_einfochipscoupons4u_link>
|
64 |
+
</widgets>
|
app/code/community/Einfochips/Coupons4U/sql/einfochips_coupons4u_setup/install-0.0.1.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Einfochips_Coupons4U extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Einfochips
|
13 |
+
* @package Einfochips_Coupons4U
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* Coupons4U module install script
|
19 |
+
*
|
20 |
+
* @category Einfochips
|
21 |
+
* @package Einfochips_Coupons4U
|
22 |
+
* @author e-Infochips
|
23 |
+
*/
|
24 |
+
$this->startSetup();
|
25 |
+
$table = $this->getConnection()
|
26 |
+
->newTable($this->getTable('coupons4u/einfochipscoupons4u'))
|
27 |
+
->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
28 |
+
'identity' => true,
|
29 |
+
'nullable' => false,
|
30 |
+
'primary' => true,
|
31 |
+
), 'EinfochipsCoupons4U ID')
|
32 |
+
->addColumn('rule_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
33 |
+
'unsigned' => true,
|
34 |
+
), 'RuleId')
|
35 |
+
|
36 |
+
->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
37 |
+
'unsigned' => true,
|
38 |
+
), 'CustomerId')
|
39 |
+
|
40 |
+
->addColumn('coupon_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
41 |
+
'nullable' => false,
|
42 |
+
'unsigned' => true,
|
43 |
+
), 'CouponId')
|
44 |
+
|
45 |
+
->addColumn('code', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
46 |
+
), 'CouponCode')
|
47 |
+
|
48 |
+
->addColumn('url_key', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
49 |
+
), 'URL key')
|
50 |
+
|
51 |
+
->addColumn('status', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
52 |
+
), 'Status')
|
53 |
+
|
54 |
+
->addColumn('meta_title', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
55 |
+
), 'Meta title')
|
56 |
+
|
57 |
+
->addColumn('meta_keywords', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
|
58 |
+
), 'Meta keywords')
|
59 |
+
|
60 |
+
->addColumn('meta_description', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
|
61 |
+
), 'Meta description')
|
62 |
+
|
63 |
+
->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
64 |
+
), 'EinfochipsCoupons4U Creation Time')
|
65 |
+
->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
66 |
+
), 'EinfochipsCoupons4U Modification Time')
|
67 |
+
->setComment('EinfochipsCoupons4U Table');
|
68 |
+
$this->getConnection()->createTable($table);
|
69 |
+
|
70 |
+
$table = $this->getConnection()
|
71 |
+
->newTable($this->getTable('coupons4u/einfochipscoupons4u_store'))
|
72 |
+
->addColumn('einfochipscoupons4u_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
73 |
+
'nullable' => false,
|
74 |
+
'primary' => true,
|
75 |
+
), 'EinfochipsCoupons4U ID')
|
76 |
+
->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
77 |
+
'unsigned' => true,
|
78 |
+
'nullable' => false,
|
79 |
+
'primary' => true,
|
80 |
+
), 'Store ID')
|
81 |
+
->addIndex($this->getIdxName('coupons4u/einfochipscoupons4u_store', array('store_id')), array('store_id'))
|
82 |
+
->addForeignKey($this->getFkName('coupons4u/einfochipscoupons4u_store', 'einfochipscoupons4u_id', 'coupons4u/einfochipscoupons4u', 'entity_id'), 'einfochipscoupons4u_id', $this->getTable('coupons4u/einfochipscoupons4u'), 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
|
83 |
+
->addForeignKey($this->getFkName('coupons4u/einfochipscoupons4u_store', 'store_id', 'core/store', 'store_id'), 'store_id', $this->getTable('core/store'), 'store_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
|
84 |
+
->setComment('EinfochipsCoupons4U To Store Linkage Table');
|
85 |
+
$this->getConnection()->createTable($table);
|
86 |
+
$this->endSetup();
|
app/design/adminhtml/default/default/layout/einfochips_coupons4u.xml
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Einfochips_Coupons4U extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the MIT License
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/mit-license.php
|
12 |
+
*
|
13 |
+
* @category Einfochips
|
14 |
+
* @package Einfochips_Coupons4U
|
15 |
+
* @copyright Copyright (c) 2014
|
16 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<layout>
|
20 |
+
<!-- EinfochipsCoupons4U grid action -->
|
21 |
+
<adminhtml_coupons4u_einfochipscoupons4u_index>
|
22 |
+
<reference name="menu">
|
23 |
+
<action method="setActive">
|
24 |
+
<menupath>coupons4u/einfochipscoupons4u</menupath>
|
25 |
+
</action>
|
26 |
+
</reference>
|
27 |
+
<reference name="content">
|
28 |
+
<block type="coupons4u/adminhtml_einfochipscoupons4u" name="einfochipscoupons4u" />
|
29 |
+
</reference>
|
30 |
+
</adminhtml_coupons4u_einfochipscoupons4u_index>
|
31 |
+
<adminhtml_coupons4u_einfochipscoupons4u_grid>
|
32 |
+
<block type="core/text_list" name="root" output="toHtml">
|
33 |
+
<block type="coupons4u/adminhtml_einfochipscoupons4u_grid" name="einfochipscoupons4u_grid"/>
|
34 |
+
</block>
|
35 |
+
</adminhtml_coupons4u_einfochipscoupons4u_grid>
|
36 |
+
<!-- Einfochipscoupons4u add/edit action -->
|
37 |
+
<adminhtml_coupons4u_einfochipscoupons4u_edit>
|
38 |
+
<update handle="editor"/>
|
39 |
+
<reference name="menu">
|
40 |
+
<action method="setActive">
|
41 |
+
<menupath>coupons4u/einfochipscoupons4u</menupath>
|
42 |
+
</action>
|
43 |
+
</reference>
|
44 |
+
<reference name="content">
|
45 |
+
<block type="coupons4u/adminhtml_einfochipscoupons4u_edit" name="einfochipscoupons4u_edit"></block>
|
46 |
+
</reference>
|
47 |
+
<reference name="left">
|
48 |
+
<block type="coupons4u/adminhtml_einfochipscoupons4u_edit_tabs" name="einfochipscoupons4u_tabs"></block>
|
49 |
+
</reference>
|
50 |
+
</adminhtml_coupons4u_einfochipscoupons4u_edit>
|
51 |
+
|
52 |
+
<adminhtml_coupons4u_einfochipscoupons4u_view>
|
53 |
+
<reference name="content">
|
54 |
+
<block type="coupons4u/adminhtml_einfochipscoupons4u_view" name="coupons4u.einfochipscoupons4u.view"></block>
|
55 |
+
</reference>
|
56 |
+
<reference name="left">
|
57 |
+
<block type="coupons4u/adminhtml_einfochipscoupons4u_view_tabs" name="coupons4u.einfochipscoupons4u.tabs"></block>
|
58 |
+
</reference>
|
59 |
+
</adminhtml_coupons4u_einfochipscoupons4u_view>
|
60 |
+
|
61 |
+
|
62 |
+
</layout>
|
app/etc/modules/Einfochips_Coupons4U.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Einfochips_Coupons4U extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the MIT License
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/mit-license.php
|
12 |
+
*
|
13 |
+
* @category Einfochips
|
14 |
+
* @package Einfochips_Coupons4U
|
15 |
+
* @copyright Copyright (c) 2014
|
16 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<modules>
|
21 |
+
<Einfochips_Coupons4U>
|
22 |
+
<active>true</active>
|
23 |
+
<codePool>community</codePool>
|
24 |
+
<depends>
|
25 |
+
<Mage_Core />
|
26 |
+
</depends>
|
27 |
+
</Einfochips_Coupons4U>
|
28 |
+
</modules>
|
29 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Coupons4U</name>
|
4 |
+
<version>1.0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Coupouns for u</summary>
|
10 |
+
<description>Coupons</description>
|
11 |
+
<notes>User Coupons</notes>
|
12 |
+
<authors><author><name>e-Infochips</name><user>Kishor</user><email>kishor.koshti@einfochips.com</email></author></authors>
|
13 |
+
<date>2014-07-23</date>
|
14 |
+
<time>09:02:53</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Einfochips"><dir name="Coupons4U"><dir name="Block"><dir name="Adminhtml"><dir name="Einfochipscoupons4u"><dir name="Edit"><file name="Form.php" hash="d6f0b09035174e0bbce05713061fea56"/><dir name="Tab"><file name="Form.php" hash="ad2fa91925457c82be183ef93124c20b"/><file name="Meta.php" hash="7812933378b2446bebf81372e41eee5b"/><file name="Stores.php" hash="ba556282a094b0a6207e8259e10e2b76"/><file name="Viewassigncoupons.php" hash="6f8f042d56518b3035e93e6649014d53"/></dir><file name="Tabs.php" hash="9dfa46caa0851b8313d4040698d3581a"/></dir><file name="Edit.php" hash="f46560de3fe9ec6ab1bfabec68b9caa1"/><file name="Grid.php" hash="50d442488d7225e717991c1e55331603"/><file name="Hello.php" hash="b039a300f7ff520fbffe953d84a33ea4"/><dir name="View"><file name="Form.php" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="Tabs.php" hash="c68f6315a9fe7eebe545d00955ca18c8"/></dir><file name="View.php" hash="d09acb353e15870ef459e65c0659c855"/><dir name="Widget"><file name="Chooser.php" hash="11ff838d1952f65347f5ab626258e92b"/></dir></dir><file name="Einfochipscoupons4u.php" hash="ee436d3ccab94b3e65786ce7fe6ab791"/></dir><dir name="Einfochipscoupons4u"><file name="List.php" hash="a5a691902d7fdec49374b7c609d0b6b2"/><file name="View.php" hash="ed370a8483e5c760198280ccbca89437"/><dir name="Widget"><file name="Link.php" hash="57cd3a6979a8c5071960f96727e993e4"/><file name="View.php" hash="7005aa118f539052850dc09c1b7bd52e"/></dir></dir></dir><dir name="Controller"><dir name="Adminhtml"><file name="Coupons4U.php" hash="1ee3188bfb91863024239cbae46da76c"/></dir><file name="Router.php" hash="521e73c2bd0888760a341aa8114a9096"/></dir><dir name="Helper"><file name="Data.php" hash="8b3b3cf8c9076d489a17d98b59845bf1"/><file name="Einfochipscoupons4u.php" hash="bf4268644b89e2297f64708b509329dd"/></dir><dir name="Model"><file name="Einfochipscoupons4u.php" hash="06203bfeb8d9071081d39f6c69d87836"/><dir name="Email"><file name="Template.php" hash="0f6aa76ecf18ced9b0e904950f2de0dc"/></dir><dir name="Resource"><dir name="Einfochipscoupons4u"><file name="Collection.php" hash="9d2117b69fcb845fce1e3b78ff9482d1"/></dir><file name="Einfochipscoupons4u.php" hash="2eeb48c8ff223fa9b1ce321f4d950deb"/><file name="Setup.php" hash="ea449a2308a7095e3660f52b32ab244b"/></dir><file name="email.php" hash="b83ac6e6462cc81c6e62894cf13dfb68"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Coupons4U"><file name="Einfochipscoupons4uController.php" hash="d304813b1cb07cb84a47bcedebde8408"/></dir></dir><file name="Einfochipscoupons4uController.php" hash="3ae0770082bd4c07d066cf7beb2f70c0"/><file name="IndexController.php" hash="1b18617141b5df486513c40a7d0b976c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="95c04b290525bef98cdf5e95132e9e4f"/><file name="config.xml" hash="65dd07ec31f0123fa49e1ef1601ad884"/><file name="system.xml" hash="c411d5a4c74590ddfd3af67e6a0e0949"/><file name="widget.xml" hash="7b2f29f8fa3667ac550c5e2832da9b2f"/></dir><dir name="sql"><dir name="einfochips_coupons4u_setup"><file name="install-0.0.1.php" hash="61c95c69474fcb673abfcd6e78c2e723"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Einfochips_Coupons4U.xml" hash="1afc74331dded241724c6f4f3a34c241"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="einfochips_coupons4u.xml" hash="26837f4d9027a18a6492a4c05287f05e"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="einfochips_coupons4u.xml" hash=""/></dir></dir></dir></dir><dir/></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.3.0</min><max>5.5.12</max></php></required></dependencies>
|
18 |
+
</package>
|