kiyoh_customerreview - Version 1.6.0

Version Notes

KiyOh.nl-gebruikers kunnen met deze plug-in automatisch klantbeoordelingen verzamelen, publiceren en delen in social media. Wanneer een klant een bestelling heeft gemaakt in uw Magento Shop, wordt een e-mail uitnodiging automatisch na een paar dagen verstuurd om u te beoordelen. De e-mail wordt uit naam en e-mailadres van uw organisatie gestuurd, zodat uw klanten u herkennen. De e-mail tekst is aanpasbaar en bevat een persoonlijke en veilige link naar de pagina om te beoordelen. Vanaf nu worden de beoordelingen dus automatisch verzameld, gepubliceerd en gedeeld. Dat is nog eens handig!

Download this release

Release Info

Developer Magento Core Team
Extension kiyoh_customerreview
Version 1.6.0
Comparing to
See all releases


Version 1.6.0

Files changed (25) hide show
  1. app/code/community/Kiyoh/Customerreview/Block/Adminhtml/Customerreview.php +12 -0
  2. app/code/community/Kiyoh/Customerreview/Block/Adminhtml/Customerreview/Edit.php +45 -0
  3. app/code/community/Kiyoh/Customerreview/Block/Adminhtml/Customerreview/Edit/Form.php +19 -0
  4. app/code/community/Kiyoh/Customerreview/Block/Adminhtml/Customerreview/Edit/Tab/Form.php +58 -0
  5. app/code/community/Kiyoh/Customerreview/Block/Adminhtml/Customerreview/Edit/Tabs.php +24 -0
  6. app/code/community/Kiyoh/Customerreview/Block/Adminhtml/Customerreview/Grid.php +116 -0
  7. app/code/community/Kiyoh/Customerreview/Block/Customerreview.php +17 -0
  8. app/code/community/Kiyoh/Customerreview/Helper/Data.php +6 -0
  9. app/code/community/Kiyoh/Customerreview/Model/Customerreview.php +10 -0
  10. app/code/community/Kiyoh/Customerreview/Model/Mysql4/Customerreview.php +10 -0
  11. app/code/community/Kiyoh/Customerreview/Model/Mysql4/Customerreview/Collection.php +10 -0
  12. app/code/community/Kiyoh/Customerreview/Model/Status.php +15 -0
  13. app/code/community/Kiyoh/Customerreview/controllers/Adminhtml/CustomerreviewController.php +306 -0
  14. app/code/community/Kiyoh/Customerreview/controllers/Adminhtml/Sales/Order/ShipmentController.php +164 -0
  15. app/code/community/Kiyoh/Customerreview/controllers/IndexController.php +47 -0
  16. app/code/community/Kiyoh/Customerreview/etc/adminhtml.xml +32 -0
  17. app/code/community/Kiyoh/Customerreview/etc/config.xml +128 -0
  18. app/code/community/Kiyoh/Customerreview/sql/customerreview_setup/mysql4-install-0.1.0.php +24 -0
  19. app/design/adminhtml/default/default/layout/customerreview.xml +8 -0
  20. app/design/adminhtml/default/default/template/customerreview/view.phtml +113 -0
  21. app/design/frontend/default/default/layout/customerreview.xml +19 -0
  22. app/design/frontend/default/default/template/checkout/success1.phtml +131 -0
  23. app/design/frontend/default/default/template/customerreview/customerreview.phtml +65 -0
  24. app/etc/modules/Kiyoh_Customerreview.xml +17 -0
  25. package.xml +18 -0
app/code/community/Kiyoh/Customerreview/Block/Adminhtml/Customerreview.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Kiyoh_Customerreview_Block_Adminhtml_Customerreview extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_customerreview';
7
+ $this->_blockGroup = 'customerreview';
8
+ $this->_headerText = Mage::helper('customerreview')->__('Item Manager');
9
+ $this->_addButtonLabel = Mage::helper('customerreview')->__('Add Item');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/community/Kiyoh/Customerreview/Block/Adminhtml/Customerreview/Edit.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kiyoh_Customerreview_Block_Adminhtml_Customerreview_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'customerreview';
11
+ $this->_controller = 'adminhtml_customerreview';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('customerreview')->__('Save Item'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('customerreview')->__('Delete Item'));
15
+
16
+ $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);
21
+
22
+ $this->_formScripts[] = "
23
+ function toggleEditor() {
24
+ if (tinyMCE.getInstanceById('customerreview_content') == null) {
25
+ tinyMCE.execCommand('mceAddControl', false, 'customerreview_content');
26
+ } else {
27
+ tinyMCE.execCommand('mceRemoveControl', false, 'customerreview_content');
28
+ }
29
+ }
30
+
31
+ function saveAndContinueEdit(){
32
+ editForm.submit($('edit_form').action+'back/edit/');
33
+ }
34
+ ";
35
+ }
36
+
37
+ public function getHeaderText()
38
+ {
39
+ if( Mage::registry('customerreview_data') && Mage::registry('customerreview_data')->getId() ) {
40
+ return Mage::helper('customerreview')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('customerreview_data')->getTitle()));
41
+ } else {
42
+ return Mage::helper('customerreview')->__('Add Item');
43
+ }
44
+ }
45
+ }
app/code/community/Kiyoh/Customerreview/Block/Adminhtml/Customerreview/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kiyoh_Customerreview_Block_Adminhtml_Customerreview_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/community/Kiyoh/Customerreview/Block/Adminhtml/Customerreview/Edit/Tab/Form.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kiyoh_Customerreview_Block_Adminhtml_Customerreview_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('customerreview_form', array('legend'=>Mage::helper('customerreview')->__('Item information')));
10
+
11
+ $fieldset->addField('title', 'text', array(
12
+ 'label' => Mage::helper('customerreview')->__('Title'),
13
+ 'class' => 'required-entry',
14
+ 'required' => true,
15
+ 'name' => 'title',
16
+ ));
17
+
18
+ $fieldset->addField('filename', 'file', array(
19
+ 'label' => Mage::helper('customerreview')->__('File'),
20
+ 'required' => false,
21
+ 'name' => 'filename',
22
+ ));
23
+
24
+ $fieldset->addField('status', 'select', array(
25
+ 'label' => Mage::helper('customerreview')->__('Status'),
26
+ 'name' => 'status',
27
+ 'values' => array(
28
+ array(
29
+ 'value' => 1,
30
+ 'label' => Mage::helper('customerreview')->__('Enabled'),
31
+ ),
32
+
33
+ array(
34
+ 'value' => 2,
35
+ 'label' => Mage::helper('customerreview')->__('Disabled'),
36
+ ),
37
+ ),
38
+ ));
39
+
40
+ $fieldset->addField('content', 'editor', array(
41
+ 'name' => 'content',
42
+ 'label' => Mage::helper('customerreview')->__('Content'),
43
+ 'title' => Mage::helper('customerreview')->__('Content'),
44
+ 'style' => 'width:700px; height:500px;',
45
+ 'wysiwyg' => false,
46
+ 'required' => true,
47
+ ));
48
+
49
+ if ( Mage::getSingleton('adminhtml/session')->getCustomerreviewData() )
50
+ {
51
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getCustomerreviewData());
52
+ Mage::getSingleton('adminhtml/session')->setCustomerreviewData(null);
53
+ } elseif ( Mage::registry('customerreview_data') ) {
54
+ $form->setValues(Mage::registry('customerreview_data')->getData());
55
+ }
56
+ return parent::_prepareForm();
57
+ }
58
+ }
app/code/community/Kiyoh/Customerreview/Block/Adminhtml/Customerreview/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kiyoh_Customerreview_Block_Adminhtml_Customerreview_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('customerreview_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('customerreview')->__('Item Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('customerreview')->__('Item Information'),
18
+ 'title' => Mage::helper('customerreview')->__('Item Information'),
19
+ 'content' => $this->getLayout()->createBlock('customerreview/adminhtml_customerreview_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/community/Kiyoh/Customerreview/Block/Adminhtml/Customerreview/Grid.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kiyoh_Customerreview_Block_Adminhtml_Customerreview_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('customerreviewGrid');
9
+ $this->setDefaultSort('customerreview_id');
10
+ $this->setDefaultDir('ASC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('customerreview/customerreview')->getCollection();
17
+ $this->setCollection($collection);
18
+ return parent::_prepareCollection();
19
+ }
20
+
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn('customerreview_id', array(
24
+ 'header' => Mage::helper('customerreview')->__('ID'),
25
+ 'align' =>'right',
26
+ 'width' => '50px',
27
+ 'index' => 'customerreview_id',
28
+ ));
29
+
30
+ $this->addColumn('title', array(
31
+ 'header' => Mage::helper('customerreview')->__('Title'),
32
+ 'align' =>'left',
33
+ 'index' => 'title',
34
+ ));
35
+
36
+ /*
37
+ $this->addColumn('content', array(
38
+ 'header' => Mage::helper('customerreview')->__('Item Content'),
39
+ 'width' => '150px',
40
+ 'index' => 'content',
41
+ ));
42
+ */
43
+
44
+ $this->addColumn('status', array(
45
+ 'header' => Mage::helper('customerreview')->__('Status'),
46
+ 'align' => 'left',
47
+ 'width' => '80px',
48
+ 'index' => 'status',
49
+ 'type' => 'options',
50
+ 'options' => array(
51
+ 1 => 'Enabled',
52
+ 2 => 'Disabled',
53
+ ),
54
+ ));
55
+
56
+ $this->addColumn('action',
57
+ array(
58
+ 'header' => Mage::helper('customerreview')->__('Action'),
59
+ 'width' => '100',
60
+ 'type' => 'action',
61
+ 'getter' => 'getId',
62
+ 'actions' => array(
63
+ array(
64
+ 'caption' => Mage::helper('customerreview')->__('Edit'),
65
+ 'url' => array('base'=> '*/*/edit'),
66
+ 'field' => 'id'
67
+ )
68
+ ),
69
+ 'filter' => false,
70
+ 'sortable' => false,
71
+ 'index' => 'stores',
72
+ 'is_system' => true,
73
+ ));
74
+
75
+ $this->addExportType('*/*/exportCsv', Mage::helper('customerreview')->__('CSV'));
76
+ $this->addExportType('*/*/exportXml', Mage::helper('customerreview')->__('XML'));
77
+
78
+ return parent::_prepareColumns();
79
+ }
80
+
81
+ protected function _prepareMassaction()
82
+ {
83
+ $this->setMassactionIdField('customerreview_id');
84
+ $this->getMassactionBlock()->setFormFieldName('customerreview');
85
+
86
+ $this->getMassactionBlock()->addItem('delete', array(
87
+ 'label' => Mage::helper('customerreview')->__('Delete'),
88
+ 'url' => $this->getUrl('*/*/massDelete'),
89
+ 'confirm' => Mage::helper('customerreview')->__('Are you sure?')
90
+ ));
91
+
92
+ $statuses = Mage::getSingleton('customerreview/status')->getOptionArray();
93
+
94
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
95
+ $this->getMassactionBlock()->addItem('status', array(
96
+ 'label'=> Mage::helper('customerreview')->__('Change status'),
97
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
98
+ 'additional' => array(
99
+ 'visibility' => array(
100
+ 'name' => 'status',
101
+ 'type' => 'select',
102
+ 'class' => 'required-entry',
103
+ 'label' => Mage::helper('customerreview')->__('Status'),
104
+ 'values' => $statuses
105
+ )
106
+ )
107
+ ));
108
+ return $this;
109
+ }
110
+
111
+ public function getRowUrl($row)
112
+ {
113
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
114
+ }
115
+
116
+ }
app/code/community/Kiyoh/Customerreview/Block/Customerreview.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Kiyoh_Customerreview_Block_Customerreview extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getCustomerreview()
10
+ {
11
+ if (!$this->hasData('customerreview')) {
12
+ $this->setData('customerreview', Mage::registry('customerreview'));
13
+ }
14
+ return $this->getData('customerreview');
15
+
16
+ }
17
+ }
app/code/community/Kiyoh/Customerreview/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kiyoh_Customerreview_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/Kiyoh/Customerreview/Model/Customerreview.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kiyoh_Customerreview_Model_Customerreview extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('customerreview/customerreview');
9
+ }
10
+ }
app/code/community/Kiyoh/Customerreview/Model/Mysql4/Customerreview.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kiyoh_Customerreview_Model_Mysql4_Customerreview extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the customerreview_id refers to the key field in your database table.
8
+ $this->_init('customerreview/customerreview', 'customerreview_id');
9
+ }
10
+ }
app/code/community/Kiyoh/Customerreview/Model/Mysql4/Customerreview/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kiyoh_Customerreview_Model_Mysql4_Customerreview_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('customerreview/customerreview');
9
+ }
10
+ }
app/code/community/Kiyoh/Customerreview/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kiyoh_Customerreview_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('customerreview')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('customerreview')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/community/Kiyoh/Customerreview/controllers/Adminhtml/CustomerreviewController.php ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kiyoh_Customerreview_Adminhtml_CustomerreviewController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('customerreview/items')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ // $config is an array
16
+ $tableNN = $this->getRequest()->getModuleName();
17
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
18
+ $dataF = Mage::getSingleton('core/resource')->getConnection('core_write');
19
+
20
+ $conntectionDetail = $dataF->getConfig();
21
+
22
+ /*************custom database conntection in magento***************/
23
+ $hostN = $conntectionDetail['host'];
24
+ $userN = $conntectionDetail['username'];
25
+ $passwordN = $conntectionDetail['password'];
26
+ $dbName = $conntectionDetail['dbname'];
27
+
28
+ $confire = mysql_connect($hostN,$userN,$passwordN);
29
+ mysql_select_db($dbName,$confire);
30
+
31
+
32
+
33
+ /*************custom database conntection in magento***************/
34
+
35
+ // now $write is an instance of Zend_Db_Ad
36
+ if(mysql_query("select * from customerreview"))
37
+ {
38
+
39
+ }
40
+ else
41
+ {
42
+ mysql_query("CREATE TABLE `customerreview` (
43
+ `customerreview_id` int(11) unsigned NOT NULL auto_increment,
44
+ `Connector` varchar(255) NOT NULL default '',
45
+ `action` varchar(255) NOT NULL default '',
46
+ `user` text NOT NULL,
47
+ `delay` smallint(6) NOT NULL default '0',
48
+ `created_time` datetime default NULL,
49
+ `update_time` datetime default NULL,
50
+ `event` varchar(255) NOT NULL,
51
+ PRIMARY KEY (`customerreview_id`)
52
+ )");
53
+ }
54
+
55
+
56
+
57
+ //////////////creation of table instllation/////////////////////
58
+
59
+ $model = Mage::getModel('customerreview/customerreview');
60
+
61
+ $collection = $model->getCollection();
62
+
63
+ foreach($collection as $item){
64
+ $data = $item->getData();
65
+
66
+ }
67
+
68
+ Mage::register('data1', $data);
69
+
70
+ $this->_initAction()
71
+ ->renderLayout();
72
+ }
73
+
74
+ public function editAction() {
75
+ $data = $this->getRequest()->getPost();
76
+
77
+ $id = $data['ids'];
78
+
79
+ /*****************update autoreview table*************/
80
+ $dataF = Mage::getSingleton('core/resource')->getConnection('core_write');
81
+ $connector= $data['Connector'];
82
+ $action = $data['action'];
83
+ $user = $data['user'];
84
+ $delay = $data['delay'];
85
+ $event = $data['event'];
86
+ $conntectionDetail = $dataF->getConfig();
87
+
88
+ /*************custom database conntection in magento***************/
89
+ $hostN = $conntectionDetail['host'];
90
+ $userN = $conntectionDetail['username'];
91
+ $passwordN = $conntectionDetail['password'];
92
+ $dbName = $conntectionDetail['dbname'];
93
+
94
+ $confire = mysql_connect($hostN,$userN,$passwordN);
95
+ mysql_select_db($dbName,$confire);
96
+ mysql_query("Update customerreview set Connector = '$connector',action='$action',user = '$user',delay = '$delay',event = '$event' where customerreview_id = $id ");
97
+
98
+ /*****************update autoreview table*************/
99
+ // $model = Mage::getModel('autoreview/autoreview')->load($id)->addData($data);
100
+ try {
101
+ //$model->setId($id)->save();
102
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('customerreview')->__('Item was successfully Updated'));
103
+ $this->_redirect('*/*/');
104
+ } catch (Exception $e){
105
+ echo $e->getMessage();
106
+ }
107
+ }
108
+
109
+ public function newAction() {
110
+ $this->_forward('edit');
111
+ }
112
+
113
+ public function saveAction() {
114
+
115
+
116
+ $data = $this->getRequest()->getPost();
117
+
118
+
119
+
120
+ if ($data = $this->getRequest()->getPost()) {
121
+
122
+ if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
123
+ try {
124
+ /* Starting upload */
125
+ $uploader = new Varien_File_Uploader('filename');
126
+
127
+ // Any extention would work
128
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
129
+ $uploader->setAllowRenameFiles(false);
130
+
131
+ // Set the file upload mode
132
+ // false -> get the file directly in the specified folder
133
+ // true -> get the file in the product like folders
134
+ // (file.jpg will go in something like /media/f/i/file.jpg)
135
+ $uploader->setFilesDispersion(false);
136
+
137
+ // We set media as the upload dir
138
+ $path = Mage::getBaseDir('media') . DS ;
139
+ $uploader->save($path, $_FILES['filename']['name'] );
140
+
141
+ } catch (Exception $e) {
142
+
143
+ }
144
+
145
+ //this way the name is saved in DB
146
+ $data['filename'] = $_FILES['filename']['name'];
147
+ }
148
+
149
+
150
+ $model = Mage::getModel('customerreview/customerreview');
151
+
152
+ $model->setData($data)
153
+ ->setId($this->getRequest()->getParam('id'));
154
+
155
+ try {
156
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
157
+ $model->setCreatedTime(now())
158
+ ->setUpdateTime(now());
159
+ } else {
160
+ $model->setUpdateTime(now());
161
+ }
162
+
163
+ /***********save data**********/
164
+ //$model->save();
165
+ $dataF = Mage::getSingleton('core/resource')->getConnection('core_write');
166
+
167
+ $conntectionDetail = $dataF->getConfig();
168
+
169
+ /*************custom database conntection in magento***************/
170
+ $hostN = $conntectionDetail['host'];
171
+ $userN = $conntectionDetail['username'];
172
+ $passwordN = $conntectionDetail['password'];
173
+ $dbName = $conntectionDetail['dbname'];
174
+
175
+ $confire = mysql_connect($hostN,$userN,$passwordN);
176
+ mysql_select_db($dbName,$confire);
177
+ $connector= $data['Connector'];
178
+ $action = $data['action'];
179
+ $user = $data['user'];
180
+ $delay = $data['delay'];
181
+ $event = $data['event'];
182
+
183
+
184
+ mysql_query("insert into customerreview (Connector,action,user,delay,event) values('$connector','$action','$user','$delay','$event')");
185
+
186
+ /*******************save data***********************/
187
+
188
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('customerreview')->__('Item was successfully saved'));
189
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
190
+
191
+ if ($this->getRequest()->getParam('back')) {
192
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
193
+ return;
194
+ }
195
+ $this->_redirect('*/*/');
196
+ return;
197
+ } catch (Exception $e) {
198
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
199
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
200
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
201
+ return;
202
+ }
203
+ }
204
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('customerreview')->__('Unable to find item to save'));
205
+ $this->_redirect('*/*/');
206
+ }
207
+
208
+
209
+ public function deleteAction() {
210
+ if( $this->getRequest()->getParam('id') > 0 ) {
211
+ try {
212
+ $model = Mage::getModel('customerreview/customerreview');
213
+
214
+ $model->setId($this->getRequest()->getParam('id'))
215
+ ->delete();
216
+
217
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
218
+ $this->_redirect('*/*/');
219
+ } catch (Exception $e) {
220
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
221
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
222
+ }
223
+ }
224
+ $this->_redirect('*/*/');
225
+ }
226
+
227
+ public function massDeleteAction() {
228
+ $customerreviewIds = $this->getRequest()->getParam('customerreview');
229
+ if(!is_array($customerreviewIds)) {
230
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
231
+ } else {
232
+ try {
233
+ foreach ($customerreviewIds as $customerreviewId) {
234
+ $customerreview = Mage::getModel('customerreview/customerreview')->load($customerreviewId);
235
+ $customerreview->delete();
236
+ }
237
+ Mage::getSingleton('adminhtml/session')->addSuccess(
238
+ Mage::helper('adminhtml')->__(
239
+ 'Total of %d record(s) were successfully deleted', count($customerreviewIds)
240
+ )
241
+ );
242
+ } catch (Exception $e) {
243
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
244
+ }
245
+ }
246
+ $this->_redirect('*/*/index');
247
+ }
248
+
249
+ public function massStatusAction()
250
+ {
251
+ $customerreviewIds = $this->getRequest()->getParam('customerreview');
252
+ if(!is_array($customerreviewIds)) {
253
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
254
+ } else {
255
+ try {
256
+ foreach ($customerreviewIds as $customerreviewId) {
257
+ $customerreview = Mage::getSingleton('customerreview/customerreview')
258
+ ->load($customerreviewId)
259
+ ->setStatus($this->getRequest()->getParam('status'))
260
+ ->setIsMassupdate(true)
261
+ ->save();
262
+ }
263
+ $this->_getSession()->addSuccess(
264
+ $this->__('Total of %d record(s) were successfully updated', count($customerreviewIds))
265
+ );
266
+ } catch (Exception $e) {
267
+ $this->_getSession()->addError($e->getMessage());
268
+ }
269
+ }
270
+ $this->_redirect('*/*/index');
271
+ }
272
+
273
+ public function exportCsvAction()
274
+ {
275
+ $fileName = 'customerreview.csv';
276
+ $content = $this->getLayout()->createBlock('customerreview/adminhtml_customerreview_grid')
277
+ ->getCsv();
278
+
279
+ $this->_sendUploadResponse($fileName, $content);
280
+ }
281
+
282
+ public function exportXmlAction()
283
+ {
284
+ $fileName = 'customerreview.xml';
285
+ $content = $this->getLayout()->createBlock('customerreview/adminhtml_customerreview_grid')
286
+ ->getXml();
287
+
288
+ $this->_sendUploadResponse($fileName, $content);
289
+ }
290
+
291
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
292
+ {
293
+ $response = $this->getResponse();
294
+ $response->setHeader('HTTP/1.1 200 OK','');
295
+ $response->setHeader('Pragma', 'public', true);
296
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
297
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
298
+ $response->setHeader('Last-Modified', date('r'));
299
+ $response->setHeader('Accept-Ranges', 'bytes');
300
+ $response->setHeader('Content-Length', strlen($content));
301
+ $response->setHeader('Content-type', $contentType);
302
+ $response->setBody($content);
303
+ $response->sendResponse();
304
+ die;
305
+ }
306
+ }
app/code/community/Kiyoh/Customerreview/controllers/Adminhtml/Sales/Order/ShipmentController.php ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'Mage\Adminhtml\controllers\Sales\Order\ShipmentController.php';
3
+
4
+ /**
5
+ * Magento
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * DISCLAIMER
18
+ *
19
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
20
+ * versions in the future. If you wish to customize Magento for your
21
+ * needs please refer to http://www.magentocommerce.com for more information.
22
+ *
23
+ * @category Mage
24
+ * @package Mage_Adminhtml
25
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * Adminhtml sales order shipment controller
31
+ *
32
+ * @category Mage
33
+ * @package Mage_Adminhtml
34
+ * @author Magento Core Team <core@magentocommerce.com>
35
+ */
36
+ class Kiyoh_Customerreview_Adminhtml_Sales_Order_ShipmentController extends Mage_Adminhtml_Sales_Order_ShipmentController
37
+ {
38
+
39
+ /**
40
+ * Initialize shipment items QTY
41
+ */
42
+
43
+ /**
44
+ * Save shipment
45
+ * We can save only new shipment. Existing shipments are not editable
46
+ */
47
+ public function saveAction()
48
+ {
49
+
50
+ $data = $this->getRequest()->getPost('shipment');
51
+ if (!empty($data['comment_text'])) {
52
+ Mage::getSingleton('adminhtml/session')->setCommentText($data['comment_text']);
53
+ }
54
+
55
+ try {
56
+ if ($shipment = $this->_initShipment()) {
57
+ $shipment->register();
58
+
59
+ $comment = '';
60
+ if (!empty($data['comment_text'])) {
61
+ $shipment->addComment($data['comment_text'], isset($data['comment_customer_notify']), isset($data['is_visible_on_front']));
62
+ if (isset($data['comment_customer_notify'])) {
63
+ $comment = $data['comment_text'];
64
+ }
65
+ }
66
+
67
+ if (!empty($data['send_email'])) {
68
+ $shipment->setEmailSent(true);
69
+ }
70
+
71
+ $shipment->getOrder()->setCustomerNoteNotify(!empty($data['send_email']));
72
+ $this->_saveShipment($shipment);
73
+ $shipment->sendEmail(!empty($data['send_email']), $comment);
74
+
75
+ /*********************autoreview work****************/
76
+ $cuId = $shipment->getData();
77
+ $idss = $cuId['customer_id'];
78
+ $model = Mage::getModel('customer/customer')->load($idss);
79
+
80
+ $collection = $model->getCollection();
81
+
82
+ foreach($collection as $item)
83
+ {
84
+ $data11 = $item->getData();
85
+ }
86
+
87
+ $email = $data11['email'];
88
+ $model = Mage::getModel('customerreview/customerreview');
89
+
90
+ $collection1 = $model->getCollection();
91
+
92
+ foreach($collection1 as $item1){
93
+ $datareview = $item1->getData();
94
+
95
+ }
96
+
97
+ if($datareview['event'] == 'shipping')
98
+ {
99
+ $connector = $datareview['Connector'];
100
+ $action = $datareview['action'];
101
+ $user = $datareview['user'];
102
+ $delay = $datareview['delay'];
103
+
104
+ ////call url
105
+ // create a new cURL resource
106
+ //Create a curl handle
107
+ $url = 'https://www.kiyoh.nl/set.php?user='.$user.'&connector='.$connector.'&action='.$action.'&targetMail='.$email.'&delay='.$delay;
108
+
109
+ // create a new cURL resource
110
+ $curl = curl_init();
111
+
112
+ // set URL and other appropriate options
113
+ curl_setopt($curl, CURLOPT_URL, $url);
114
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
115
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
116
+ curl_setopt($curl, CURLOPT_HEADER, false);
117
+
118
+
119
+ // grab URL and pass it to the browser
120
+
121
+ curl_exec($curl);
122
+
123
+ if (curl_errno($curl)) {
124
+ print curl_error($curl);exit;
125
+ } else {
126
+
127
+ curl_close($curl);
128
+ }
129
+
130
+
131
+
132
+ // Close handle
133
+ curl_close($ch);
134
+
135
+
136
+
137
+ ////call url
138
+
139
+
140
+ }
141
+
142
+ /*********************autoreview work****************/
143
+
144
+ $this->_getSession()->addSuccess($this->__('The shipment has been created.'));
145
+ Mage::getSingleton('adminhtml/session')->getCommentText(true);
146
+ $this->_redirect('*/sales_order/view', array('order_id' => $shipment->getOrderId()));
147
+ return;
148
+ } else {
149
+ $this->_forward('noRoute');
150
+ return;
151
+ }
152
+ } catch (Mage_Core_Exception $e) {
153
+ $this->_getSession()->addError($e->getMessage());
154
+ } catch (Exception $e) {
155
+ $this->_getSession()->addError($this->__('Cannot save shipment.'));
156
+ }
157
+ $this->_redirect('*/*/new', array('order_id' => $this->getRequest()->getParam('order_id')));
158
+ }
159
+
160
+ /**
161
+ * Send email with shipment data to customer
162
+ */
163
+
164
+ }
app/code/community/Kiyoh/Customerreview/controllers/IndexController.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Kiyoh_Customerreview_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+
7
+ /*
8
+ * Load an object by id
9
+ * Request looking like:
10
+ * http://site.com/customerreview?id=15
11
+ * or
12
+ * http://site.com/customerreview/id/15
13
+ */
14
+ /*
15
+ $customerreview_id = $this->getRequest()->getParam('id');
16
+
17
+ if($customerreview_id != null && $customerreview_id != '') {
18
+ $customerreview = Mage::getModel('customerreview/customerreview')->load($customerreview_id)->getData();
19
+ } else {
20
+ $customerreview = null;
21
+ }
22
+ */
23
+
24
+ /*
25
+ * If no param we load a the last created item
26
+ */
27
+ /*
28
+ if($customerreview == null) {
29
+ $resource = Mage::getSingleton('core/resource');
30
+ $read= $resource->getConnection('core_read');
31
+ $customerreviewTable = $resource->getTableName('customerreview');
32
+
33
+ $select = $read->select()
34
+ ->from($customerreviewTable,array('customerreview_id','title','content','status'))
35
+ ->where('status',1)
36
+ ->order('created_time DESC') ;
37
+
38
+ $customerreview = $read->fetchRow($select);
39
+ }
40
+ Mage::register('customerreview', $customerreview);
41
+ */
42
+
43
+
44
+ $this->loadLayout();
45
+ $this->renderLayout();
46
+ }
47
+ }
app/code/community/Kiyoh/Customerreview/etc/adminhtml.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <customerreview module="customerreview">
5
+ <title>Customerreview</title>
6
+ <sort_order>71</sort_order>
7
+ <children>
8
+ <items module="customerreview">
9
+ <title>Setting</title>
10
+ <sort_order>0</sort_order>
11
+ <action>customerreview/adminhtml_customerreview</action>
12
+ </items>
13
+ </children>
14
+ </customerreview>
15
+ </menu>
16
+ <acl>
17
+ <resources>
18
+ <all>
19
+ <title>Allow Everything</title>
20
+ </all>
21
+ <admin>
22
+ <children>
23
+ <Kiyoh_Customerreview>
24
+ <title>Customerreview Module</title>
25
+ <sort_order>10</sort_order>
26
+ </Kiyoh_Customerreview>
27
+ </children>
28
+ </admin>
29
+ </resources>
30
+ </acl>
31
+
32
+ </config>
app/code/community/Kiyoh/Customerreview/etc/config.xml ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Kiyoh
5
+ * @package Kiyoh_Customerreview
6
+ * @author ModuleCreator
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Kiyoh_Customerreview>
13
+ <version>0.1.0</version>
14
+ </Kiyoh_Customerreview>
15
+ </modules>
16
+ <frontend>
17
+ <routers>
18
+ <customerreview>
19
+ <use>standard</use>
20
+ <args>
21
+ <module>Kiyoh_Customerreview</module>
22
+ <frontName>customerreview</frontName>
23
+ </args>
24
+ </customerreview>
25
+ </routers>
26
+ <layout>
27
+ <updates>
28
+ <customerreview>
29
+ <file>customerreview.xml</file>
30
+ </customerreview>
31
+ </updates>
32
+ </layout>
33
+ </frontend>
34
+ <admin>
35
+ <routers>
36
+ <customerreview>
37
+ <use>admin</use>
38
+ <args>
39
+ <module>Kiyoh_Customerreview</module>
40
+ <frontName>customerreview</frontName>
41
+ </args>
42
+ </customerreview>
43
+ </routers>
44
+ </admin>
45
+ <adminhtml>
46
+ <menu>
47
+ <customerreview module="customerreview">
48
+ <title>Customerreview</title>
49
+ <sort_order>71</sort_order>
50
+ <children>
51
+ <items module="customerreview">
52
+ <title>Setting</title>
53
+ <sort_order>0</sort_order>
54
+ <action>customerreview/adminhtml_customerreview</action>
55
+ </items>
56
+ </children>
57
+ </customerreview>
58
+ </menu>
59
+ <acl>
60
+ <resources>
61
+ <all>
62
+ <title>Allow Everything</title>
63
+ </all>
64
+ <admin>
65
+ <children>
66
+ <Kiyoh_Customerreview>
67
+ <title>Customerreview Module</title>
68
+ <sort_order>10</sort_order>
69
+ </Kiyoh_Customerreview>
70
+ </children>
71
+ </admin>
72
+ </resources>
73
+ </acl>
74
+ <layout>
75
+ <updates>
76
+ <customerreview>
77
+ <file>customerreview.xml</file>
78
+ </customerreview>
79
+ </updates>
80
+ </layout>
81
+ </adminhtml>
82
+ <global>
83
+ <models>
84
+ <customerreview>
85
+ <class>Kiyoh_Customerreview_Model</class>
86
+ <resourceModel>customerreview_mysql4</resourceModel>
87
+ </customerreview>
88
+ <customerreview_mysql4>
89
+ <class>Kiyoh_Customerreview_Model_Mysql4</class>
90
+ <entities>
91
+ <customerreview>
92
+ <table>customerreview</table>
93
+ </customerreview>
94
+ </entities>
95
+ </customerreview_mysql4>
96
+ </models>
97
+ <resources>
98
+ <customerreview_setup>
99
+ <setup>
100
+ <module>Kiyoh_Customerreview</module>
101
+ </setup>
102
+ <connection>
103
+ <use>core_setup</use>
104
+ </connection>
105
+ </customerreview_setup>
106
+ <customerreview_write>
107
+ <connection>
108
+ <use>core_write</use>
109
+ </connection>
110
+ </customerreview_write>
111
+ <customerreview_read>
112
+ <connection>
113
+ <use>core_read</use>
114
+ </connection>
115
+ </customerreview_read>
116
+ </resources>
117
+ <blocks>
118
+ <customerreview>
119
+ <class>Kiyoh_Customerreview_Block</class>
120
+ </customerreview>
121
+ </blocks>
122
+ <helpers>
123
+ <customerreview>
124
+ <class>Kiyoh_Customerreview_Helper</class>
125
+ </customerreview>
126
+ </helpers>
127
+ </global>
128
+ </config>
app/code/community/Kiyoh/Customerreview/sql/customerreview_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ -- DROP TABLE IF EXISTS {$this->getTable('customerreview')};
10
+ CREATE TABLE {$this->getTable('customerreview')} (
11
+ `customerreview_id` int(11) unsigned NOT NULL auto_increment,
12
+ `Connector` varchar(255) NOT NULL default '',
13
+ `action` varchar(255) NOT NULL default '',
14
+ `user` text NOT NULL,
15
+ `delay` smallint(6) NOT NULL default '0',
16
+ `created_time` datetime default NULL,
17
+ `update_time` datetime default NULL,
18
+ `event` varchar(255) NOT NULL,
19
+ PRIMARY KEY (`customerreview_id`)
20
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
21
+
22
+ ");
23
+
24
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/customerreview.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <customerreview_adminhtml_customerreview_index>
4
+ <reference name="content">
5
+ <block type="adminhtml/template" name="customerreview" template="customerreview/view.phtml"/>
6
+ </reference>
7
+ </customerreview_adminhtml_customerreview_index>
8
+ </layout>
app/design/adminhtml/default/default/template/customerreview/view.phtml ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $data = Mage::registry('data1');
3
+
4
+ ?>
5
+ <div class="content-header">
6
+ <table cellspacing="0" class="grid-header">
7
+ <tr>
8
+ <td><h3><?=$this->__('Review Setting')?></h3></td>
9
+ <td class="a-right">
10
+ <button onclick="editForm.submit()" class="scalable save" type="button"><span>Submit my form</span></button>
11
+ </td>
12
+ </tr>
13
+ </table>
14
+ </div>
15
+ <div class="entry-edit">
16
+ <?php
17
+ if(!isset($data['customerreview_id']))
18
+ {
19
+ ?>
20
+ <form id="edit_form" name="edit_form" method="post" action="<?=$this->getUrl('*/*/save')?>">
21
+ <?php
22
+ }
23
+
24
+ else
25
+ {
26
+ ?>
27
+ <form id="edit_form" name="edit_form" method="post" action="<?=$this->getUrl('*/*/edit')?>">
28
+ <?php
29
+ }
30
+ ?>
31
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
32
+ <h4 class="icon-head head-edit-form fieldset-legend"><?=$this->__('Manage Setting')?></h4>
33
+ <fieldset id="my-fieldset">
34
+ <table cellspacing="0" class="form-list">
35
+ <tr>
36
+ <td class="label"><?=$this->__('Enter Connector')?> <span class="required">*</span></td>
37
+ <td class="input-ele"><input class="input-text required-entry" name="Connector" value="<?php echo $data['Connector'];?>" size="60" />
38
+ <br/><span style="font-size:10px;color:#CC3300;">Enter here the Kiyoh Connector Code from your Kiyoh Account.</span>
39
+ </td>
40
+
41
+ </tr>
42
+
43
+
44
+
45
+ <tr style="display:none">
46
+ <td class="label"><?=$this->__('Enter action')?> <span class="required">*</span></td>
47
+ <td class="input-ele"><input class="input-text required-entry" name="action" value="<?php echo $data['action'];?>" size="60"/><br/><span style="font-size:10px;color:#CC3300;">holds the action that will be taken, in this case invite (value: sendInvitation)</span></td>
48
+ </tr>
49
+ <tr>
50
+ <td class="label"><?=$this->__('Enter User')?> <span class="required">*</span></td>
51
+ <td class="input-ele"><input class="input-text required-entry" name="user" value="<?php echo $data['user'];?>" size="60"/><br/><span style="font-size:10px;color:#CC3300;">Enter here your email address using which you registered at Kiyoh.</span></td>
52
+ </tr>
53
+ <tr>
54
+ <td class="label"><?=$this->__('Enter delay')?> <span class="required">*</span></td>
55
+ <td class="input-ele"><input class="input-text required-entry" name="delay" value="<?php echo $data['delay'];?>" size="60"/><br/><span style="font-size:10px;color:#CC3300;">Enter here the delay(number of days) after which you would like to send review invite to your customer. This delay applies after customer event(Shipping/Purchase).
56
+ You may enter 0 to send review invite immediately after customer event(Shipping/Purchase).</span></td>
57
+ </tr>
58
+
59
+ <tr>
60
+ <td class="label"><?=$this->__('Enter Event')?> <span class="required">*</span></td>
61
+ <td class="input-ele">
62
+ <select name="event">
63
+ <?php
64
+ if(isset($data['event']))
65
+ {
66
+ if($data['event'] == 'shipping')
67
+ {
68
+ ?>
69
+ <option value="shipping" selected="selected">Shipping</option>
70
+ <option value="purchase">Purchase</option>
71
+ <?php
72
+ }
73
+
74
+ if($data['event'] == 'purchase')
75
+ {
76
+ ?>
77
+ <option value="shipping" >Shipping</option>
78
+ <option value="purchase" selected="selected">Purchase</option>
79
+ <?php
80
+ }
81
+ }
82
+ else
83
+ {
84
+ ?>
85
+ <option value="shipping">Shipping</option>
86
+ <option value="purchase">Purchase</option>
87
+ <?php
88
+ }
89
+ ?>
90
+ </select>
91
+
92
+
93
+
94
+ <br/><span style="font-size:10px;color:#CC3300;">Enter here the event after which you would like to send review invitation to your customer.
95
+ Enter Shipping if your store sells products that need shipping.
96
+ Enter Purchase if your store sells downloadable products(softwares).</span> </td>
97
+ </tr>
98
+ <?php
99
+ if(isset($data['customerreview_id']))
100
+ {
101
+ ?>
102
+ <input type="hidden" class="input-text required-entry" name="ids" value="<?php echo $data['customerreview_id'];?>"/>
103
+ <?php
104
+ }
105
+ ?>
106
+ </table>
107
+ </fieldset>
108
+ </form>
109
+ </div>
110
+
111
+ <script type="text/javascript">
112
+ var editForm = new varienForm('edit_form');
113
+ </script>
app/design/frontend/default/default/layout/customerreview.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <customerreview_index_index>
6
+ <reference name="content">
7
+ <block type="customerreview/customerreview" name="customerreview" template="customerreview/customerreview.phtml" />
8
+ </reference>
9
+ </customerreview_index_index>
10
+ <checkout_onepage_success translate="label">
11
+ <label>One Page Checkout Success</label>
12
+ <reference name="root">
13
+ <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
14
+ </reference>
15
+ <reference name="content">
16
+ <block type="checkout/onepage_success" name="checkout.success" template="checkout/success1.phtml"/>
17
+ </reference>
18
+ </checkout_onepage_success>
19
+ </layout>
app/design/frontend/default/default/template/checkout/success1.phtml ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category design
23
+ * @package base_default
24
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ /***************connect***************/
28
+ if (Mage::isInstalled() && Mage::getSingleton('customer/session')->isLoggedIn()) {
29
+ $this->_data['email'] = $this->__($this->htmlEscape(Mage::getSingleton('customer/session')->getCustomer()->getEmail()));
30
+ }
31
+ $email = $this->_data['email'];
32
+
33
+ $model = Mage::getModel('customerreview/customerreview');
34
+
35
+ $collection = $model->getCollection();
36
+
37
+ foreach($collection as $item){
38
+ $data = $item->getData();
39
+
40
+ }
41
+
42
+ if($data['event'] == 'purchase')
43
+ {
44
+ $connector = $data['Connector'];
45
+ $action = $data['action'];
46
+ $user = $data['user'];
47
+ $delay = $data['delay'];
48
+
49
+ ////call url
50
+
51
+ // create a new cURL resource
52
+
53
+ // Create a curl handle
54
+ $url = 'https://www.kiyoh.nl/set.php?user='.$user.'&connector='.$connector.'&action='.$action.'&targetMail='.$email.'&delay='.$delay;
55
+
56
+
57
+ // create a new cURL resource
58
+ $curl = curl_init();
59
+
60
+ // set URL and other appropriate options
61
+ curl_setopt($curl, CURLOPT_URL, $url);
62
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
63
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
64
+ curl_setopt($curl, CURLOPT_HEADER, false);
65
+
66
+
67
+ // grab URL and pass it to the browser
68
+
69
+ curl_exec($curl);
70
+
71
+ if (curl_errno($curl)) {
72
+ print curl_error($curl);exit;
73
+ } else {
74
+
75
+ curl_close($curl);
76
+ }
77
+
78
+
79
+
80
+ // Close handle
81
+ curl_close($ch);
82
+
83
+
84
+
85
+ ////call url
86
+
87
+
88
+ }
89
+ //echo 'https://www.kiyoh.nl/set.php?user='.$user.'&connector='.$connector.'&action='.$action.'&targetMail='.$email.'&delay='.$delay;
90
+ /***************connect***************/
91
+
92
+ ?>
93
+
94
+ <div class="page-title">
95
+ <h1><?php echo $this->__('Your order has been received') ?></h1>
96
+ </div>
97
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
98
+ <h2 class="sub-title"><?php echo $this->__('Thank you for your purchase!') ?></h2>
99
+
100
+ <?php if ($this->getOrderId()):?>
101
+ <?php if ($this->getCanViewOrder()) :?>
102
+ <p><?php echo $this->__('Your order # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?></p>
103
+ <?php else :?>
104
+ <p><?php echo $this->__('Your order # is: %s.', $this->escapeHtml($this->getOrderId())) ?>.</p>
105
+ <?php endif;?>
106
+ <p><?php echo $this->__('You will receive an order confirmation email with details of your order and a link to track its progress.') ?></p>
107
+ <?php if ($this->getViewOrder() && $this->getCanPrintOrder()) :?>
108
+ <p>
109
+ <?php echo $this->__('Click <a href="%s" onclick="this.target=\'_blank\'">here to print</a> a copy of your order confirmation.', $this->getPrintUrl()) ?>
110
+ <?php echo $this->getChildHtml() ?>
111
+ </p>
112
+ <?php endif;?>
113
+ <?php endif;?>
114
+
115
+ <?php if ($this->getAgreementRefId()): ?>
116
+ <p><?php echo $this->__('Your billing agreement # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId())))?></p>
117
+ <?php endif;?>
118
+
119
+ <?php if ($profiles = $this->getRecurringProfiles()):?>
120
+ <p><?php echo $this->__('Your recurring payment profiles:'); ?></p>
121
+ <ul class="disc">
122
+ <?php foreach($profiles as $profile):?>
123
+ <?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id')));?>
124
+ <li><?php echo $this->__('Payment profile # %s: "%s".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description')))?></li>
125
+ <?php endforeach;?>
126
+ </ul>
127
+ <?php endif;?>
128
+
129
+ <div class="buttons-set">
130
+ <button type="button" class="button" title="<?php echo $this->__('Continue Shopping') ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
131
+ </div>
app/design/frontend/default/default/template/customerreview/customerreview.phtml ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h4><?php echo $this->__('Module List') ?></h4>
2
+ <?php
3
+
4
+ /*
5
+ This shows how to load specific fields from a record in the database.
6
+ 1) Note the load(15), this corresponds to saying "select * from table where table_id = 15"
7
+ 2) You can then just use the get(fieldname) to pull specific data from the table.
8
+ 3) If you have a field named news_id, then it becomes getNewsId, etc.
9
+ */
10
+ /*
11
+ $news = Mage::getModel('customerreview/customerreview')->load(15);
12
+ echo $news->getNewsId();
13
+ echo $news->getTitle();
14
+ echo $news->getContent();
15
+ echo $news->getStatus();
16
+ */
17
+
18
+ /*
19
+ This shows an alternate way of loading datas from a record using the database the "Magento Way" (using blocks and controller).
20
+ Uncomment blocks in /app/code/local/Namespace/Module/controllers/IndexController.php if you want to use it.
21
+
22
+ */
23
+ /*
24
+ $object = $this->getCustomerreview();
25
+ echo 'id: '.$object['test_id'].'<br/>';
26
+ echo 'title: '.$object['title'].'<br/>';
27
+ echo 'content: '.$object['content'].'<br/>';
28
+ echo 'status: '.$object['status'].'<br/>';
29
+ */
30
+
31
+
32
+ /*
33
+ This shows how to load multiple rows in a collection and save a change to them.
34
+ 1) The setPageSize function will load only 5 records per page and you can set the current Page with the setCurPage function.
35
+ 2) The $collection->walk('save') allows you to save everything in the collection after all changes have been made.
36
+ */
37
+ /*
38
+ $i = 0;
39
+
40
+ $collection = Mage::getModel('customerreview/customerreview')->getCollection();
41
+ $collection->setPageSize(5);
42
+ $collection->setCurPage(2);
43
+ $size = $collection->getSize();
44
+ $cnt = count($collection);
45
+ foreach ($collection as $item) {
46
+ $i = $i+1;
47
+ $item->setTitle($i);
48
+ echo $item->getTitle();
49
+ }
50
+
51
+ $collection->walk('save');
52
+ */
53
+
54
+ /*
55
+ This shows how to load a single record and save a change.
56
+ 1) Note the setTitle, this corresponds to the table field name, title, and then you pass it the text to change.
57
+ 2) Call the save() function only on a single record.
58
+ */
59
+ /*
60
+ $object = Mage::getModel('customerreview/customerreview')->load(1);
61
+ $object->setTitle('This is a changed title');
62
+ $object->save();
63
+ */
64
+
65
+ ?>
app/etc/modules/Kiyoh_Customerreview.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Kiyoh
5
+ * @package Kiyoh_Customerreview
6
+ * @author ModuleCreator
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Kiyoh_Customerreview>
13
+ <active>true</active>
14
+ <codePool>community</codePool>
15
+ </Kiyoh_Customerreview>
16
+ </modules>
17
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>kiyoh_customerreview</name>
4
+ <version>1.6.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>KiyOh.nl-gebruikers kunnen met deze plug-in automatisch klantbeoordelingen verzamelen,</summary>
10
+ <description>KiyOh.nl-gebruikers kunnen met deze plug-in automatisch klantbeoordelingen verzamelen, publiceren en delen in social media. Wanneer een klant een bestelling heeft gemaakt in uw Magento Shop, wordt een e-mail uitnodiging automatisch na een paar dagen verstuurd om u te beoordelen. De e-mail wordt uit naam en e-mailadres van uw organisatie gestuurd, zodat uw klanten u herkennen. De e-mail tekst is aanpasbaar en bevat een persoonlijke en veilige link naar de pagina om te beoordelen. Vanaf nu worden de beoordelingen dus automatisch verzameld, gepubliceerd en gedeeld. Dat is nog eens handig!</description>
11
+ <notes>KiyOh.nl-gebruikers kunnen met deze plug-in automatisch klantbeoordelingen verzamelen, publiceren en delen in social media. Wanneer een klant een bestelling heeft gemaakt in uw Magento Shop, wordt een e-mail uitnodiging automatisch na een paar dagen verstuurd om u te beoordelen. De e-mail wordt uit naam en e-mailadres van uw organisatie gestuurd, zodat uw klanten u herkennen. De e-mail tekst is aanpasbaar en bevat een persoonlijke en veilige link naar de pagina om te beoordelen. Vanaf nu worden de beoordelingen dus automatisch verzameld, gepubliceerd en gedeeld. Dat is nog eens handig!</notes>
12
+ <authors><author><name>kiyoh_m</name><user>auto-converted</user><email>kiyoh.autoreview@gmail.com</email></author></authors>
13
+ <date>2011-04-21</date>
14
+ <time>12:28:28</time>
15
+ <contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Kiyoh"><dir name="Customerreview"><dir name="Block"><dir name="Adminhtml"><dir name="Customerreview"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="a50cb6d28768e5a0161753a0ed360cb5"/></dir><file name="Form.php" hash="f852059f7d07e8d0a93c65359d79cd08"/><file name="Tabs.php" hash="11eb0974977b5b27004e5b015d46680b"/></dir><file name="Edit.php" hash="673f999d1aa63b9477769a97d816f3e1"/><file name="Grid.php" hash="2ee706abce845bc76b9afadca49aacda"/></dir><file name="Customerreview.php" hash="b18441bf48af3c809d68193b0e31e4a6"/></dir><file name="Customerreview.php" hash="be8fa564fc669477445c9d8d1c7fba5c"/></dir><dir name="Helper"><file name="Data.php" hash="fda5c34b4da4ade55e107f88fc7c6287"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Customerreview"><file name="Collection.php" hash="d5a6959c3f95e2c72742512b7a5ffc77"/></dir><file name="Customerreview.php" hash="b61962026b3eec52549160689f3ea106"/></dir><file name="Customerreview.php" hash="fb2f4a070079adce2670b871c1a4cd6a"/><file name="Status.php" hash="644c20690349400e33f3e4bf606f2471"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="ShipmentController.php" hash="8527f5dab15ca517f34e7a1dbf9a87c8"/></dir></dir><file name="CustomerreviewController.php" hash="b211503a4430d8bb2413a6a77319342e"/></dir><file name="IndexController.php" hash="2c3974763eac5929e0610afeb7fe252f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c99b84cf706cf2ad801595e3a16a1541"/><file name="config.xml" hash="22265a944191824679df5ab7fafb57fb"/></dir><dir name="sql"><dir name="customerreview_setup"><file name="mysql4-install-0.1.0.php" hash="c943078158c883ef93ac80499747c473"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Kiyoh_Customerreview.xml" hash="bbaf093738bc2b0835c48341a8849acb"/></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="customerreview.xml" hash="a264228bd530b64ab9915659cd1f00cb"/></dir><dir name="template"><dir name="customerreview"><file name="view.phtml" hash="0b2a05a76caea7db33d20f96e93ee84a"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="customerreview.xml" hash="abe2f7a36df2e432346f00a50fdc92c1"/></dir><dir name="template"><dir name="customerreview"><file name="customerreview.phtml" hash="c692037d1baf7c41be15ff9a2b0e126e"/></dir><dir name="checkout"><file name="success1.phtml" hash="605944d981e04af9ebd960e88f9b2e70"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>