Jefferson_Cartabandoned - Version 1.0.0

Version Notes

Up to date features not found any failure that prevents the functioning of this extension

Download this release

Release Info

Developer Jefferson Batista Porto
Extension Jefferson_Cartabandoned
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (34) hide show
  1. app/code/community/Jefferson/Cartabandoned/Block/Adminhtml/Abandoned.php +33 -0
  2. app/code/community/Jefferson/Cartabandoned/Block/Adminhtml/Abandoned/Grid.php +44 -0
  3. app/code/community/Jefferson/Cartabandoned/Block/Adminhtml/Abandonedreport.php +208 -0
  4. app/code/community/Jefferson/Cartabandoned/Block/Adminhtml/Abandonedreport/Grid.php +97 -0
  5. app/code/community/Jefferson/Cartabandoned/Block/Adminhtml/Abandonedreport/Grid/Renderer/Action.php +28 -0
  6. app/code/community/Jefferson/Cartabandoned/Block/Adminhtml/Abandonedreport/Grid/Renderer/Option.php +33 -0
  7. app/code/community/Jefferson/Cartabandoned/Block/Frontend/Cartabandoned.php +4 -0
  8. app/code/community/Jefferson/Cartabandoned/Block/Frontend/Disparo.php +267 -0
  9. app/code/community/Jefferson/Cartabandoned/Helper/Data.php +251 -0
  10. app/code/community/Jefferson/Cartabandoned/Model/Adminhtml/System/Config/Source/Statusoptions.php +23 -0
  11. app/code/community/Jefferson/Cartabandoned/Model/Cartabandoned.php +101 -0
  12. app/code/community/Jefferson/Cartabandoned/Model/Filaenvio.php +164 -0
  13. app/code/community/Jefferson/Cartabandoned/Model/Itemenvio.php +80 -0
  14. app/code/community/Jefferson/Cartabandoned/Model/Mysql4/Cartabandoned.php +10 -0
  15. app/code/community/Jefferson/Cartabandoned/Model/Mysql4/Cartabandoned/Collection.php +10 -0
  16. app/code/community/Jefferson/Cartabandoned/Model/Mysql4/Filaenvio.php +10 -0
  17. app/code/community/Jefferson/Cartabandoned/Model/Mysql4/Filaenvio/Collection.php +10 -0
  18. app/code/community/Jefferson/Cartabandoned/Model/Mysql4/Itemenvio.php +10 -0
  19. app/code/community/Jefferson/Cartabandoned/Model/Mysql4/Itemenvio/Collection.php +10 -0
  20. app/code/community/Jefferson/Cartabandoned/controllers/Adminhtml/AbandonedController.php +59 -0
  21. app/code/community/Jefferson/Cartabandoned/controllers/Adminhtml/AbandonedreportController.php +74 -0
  22. app/code/community/Jefferson/Cartabandoned/controllers/DisparoController.php +17 -0
  23. app/code/community/Jefferson/Cartabandoned/controllers/IndexController.php +81 -0
  24. app/code/community/Jefferson/Cartabandoned/etc/config.xml +223 -0
  25. app/code/community/Jefferson/Cartabandoned/etc/system.xml +118 -0
  26. app/code/community/Jefferson/Cartabandoned/sql/jefferson_cartabandoned_setup/mysql4-install-1.0.0.php +44 -0
  27. app/design/adminhtml/default/default/layout/jefferson/cartabandoned/jefferson_cartabandoned.xml +16 -0
  28. app/design/adminhtml/default/default/template/jefferson/cartabandoned/cartabandoned_report.phtml +206 -0
  29. app/etc/modules/Jefferson_Cartabandoned.xml +10 -0
  30. app/locale/en_US/jefferson/cartabandoned/jefferson_cartabandoned.csv +0 -0
  31. app/locale/en_US/template/email/jefferson/cartabandoned/cartabandoned.html +106 -0
  32. app/locale/pt_BR/jefferson/cartabandoned/jefferson_cartabandoned.csv +49 -0
  33. app/locale/pt_BR/template/email/jefferson/cartabandoned/cartabandoned.html +106 -0
  34. package.xml +18 -0
app/code/community/Jefferson/Cartabandoned/Block/Adminhtml/Abandoned.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jefferson_Cartabandoned_Block_Adminhtml_Abandoned extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+
5
+ public function __construct(){
6
+
7
+ //Nome do controller
8
+ $this->_controller = 'adminhtml_abandoned';
9
+
10
+ //Nome do módulo
11
+ $this->_blockGroup = 'cartabandoned';
12
+
13
+ //Label do cabeçalho da página
14
+ $this->_headerText = Mage::helper('cartabandoned')->__('List customers cart abandoned');
15
+
16
+ //Herdando o construtor
17
+ parent::__construct();
18
+
19
+ //Adicionando um button de atalho para os relatórios
20
+ $this->addButton('relatorio', array(
21
+ 'label' => Mage::helper('cartabandoned')->__('Repor'),
22
+ 'onclick' => "setLocation('".$this->getUrl("*/adminhtml_abandonedreport/")."')",
23
+ 'class' => 'rebuild',
24
+ ));
25
+
26
+ $this->_removeButton('save');
27
+ $this->_removeButton('add');
28
+ $this->_removeButton('reset');
29
+ $this->_removeButton('delete');
30
+ }
31
+
32
+
33
+ }
app/code/community/Jefferson/Cartabandoned/Block/Adminhtml/Abandoned/Grid.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jefferson_Cartabandoned_Block_Adminhtml_Abandoned_Grid extends Mage_Adminhtml_Block_Report_Shopcart_Abandoned_Grid{
3
+
4
+ /**
5
+ * Inicia o grid
6
+ * @param id do Grid
7
+ * @param primary key da tabela
8
+ * @param ordem
9
+ */
10
+ public function __construct(){
11
+ parent::__construct();
12
+ $this->setId('CartAbandonedGrid');
13
+ $this->setDefaultDir('ASC');
14
+ $this->setSaveParametersInSession(true);
15
+ }
16
+
17
+ protected function _prepareColumns(){
18
+ $this->addColumn('entity_id', array(
19
+ 'header' => Mage::helper('cartabandoned')->__('ID'),
20
+ 'align' => 'center',
21
+ 'width' => '50px',
22
+ 'index' => 'entity_id',
23
+ 'type' => 'number',
24
+ ));
25
+ return parent::_prepareColumns();
26
+ }
27
+
28
+ protected function _prepareMassaction(){
29
+ $this->setMassactionIdField('id');
30
+ $this->getMassactionBlock()->setFormFieldName('cartabandoned');
31
+ $this->getMassactionBlock()->addItem('Enviar', array(
32
+ 'label' => Mage::helper('cartabandoned')->__('Send'),
33
+ 'url' => $this->getUrl('*/*/massEnviar'),
34
+ 'confirm' => Mage::helper('cartabandoned')->__('Are you sure?')
35
+ ));
36
+
37
+ }
38
+
39
+ public function getRowUrl($row) {
40
+ return $this->getUrl('adminhtml/customer/edit', array('id'=>$row->getCustomerId(), 'active_tab'=>'cart'));
41
+ }
42
+
43
+ }
44
+ ?>
app/code/community/Jefferson/Cartabandoned/Block/Adminhtml/Abandonedreport.php ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jefferson_Cartabandoned_Block_Adminhtml_Abandonedreport extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+
5
+ public function __construct(){
6
+
7
+ //Nome do controller
8
+ $this->_controller = 'adminhtml_abandonedreport';
9
+
10
+ //Nome do módulo
11
+ $this->_blockGroup = 'cartabandoned';
12
+
13
+ //Label do cabeçalho da página
14
+ $this->_headerText = Mage::helper('cartabandoned')->__('Submissions made');
15
+
16
+ //Herdando o construtor
17
+ parent::__construct();
18
+
19
+ $this->addButton('disparo', array(
20
+ 'label' => Mage::helper('cartabandoned')->__('Shoot'),
21
+ 'onclick' => "setLocation('".$this->getUrl("*/adminhtml_abandoned/")."')",
22
+ 'class' => 'rebuild',
23
+ ));
24
+
25
+
26
+ //Adicionando um button para zerar a fila
27
+ $this->addButton('stopFila', array(
28
+ 'label' => Mage::helper('cartabandoned')->__('Stop line'),
29
+ 'onclick' => "setLocation('".$this->getUrl("*/adminhtml_abandonedreport/stopfila")."')",
30
+ 'class' => 'rebuild',
31
+ ));
32
+
33
+
34
+ $this->_removeButton('save');
35
+ $this->_removeButton('add');
36
+ $this->_removeButton('reset');
37
+ $this->_removeButton('delete');
38
+ }
39
+
40
+ public function listItemsEnvio(){
41
+
42
+ $idFila = (int)$this->getData('id');
43
+
44
+ $collection = Mage::getModel('cartabandoned/itemenvio')
45
+ ->getCollection()
46
+ ->addFieldToSelect('*')
47
+ ->addFieldToFilter('id_fila_envio_item_envio', $idFila);
48
+
49
+ if(count($collection->getData()) > 0){
50
+
51
+ foreach($collection as $data){
52
+ $html .= "<tr>";
53
+ $html .= "<td>".$data->getData('id_item_envio')."</td>";
54
+ $html .= "<td>".$data->getData('email_customer')."</td>";
55
+ $html .= "<td>".$data->getData('data_envio_item_envio')."</td>";
56
+ $html .= "<td>".$data->getData('click')."</td>";
57
+ $html .= "<td>".$data->getData('open')."</td>";
58
+ $html .= "</tr>";
59
+ }
60
+
61
+
62
+ }else{
63
+ $html = "<tr>".Mage::helper('cartabandoned')->__('No information found')."</tr>";
64
+ }
65
+
66
+ return $html;
67
+
68
+ }
69
+
70
+ public function getCountClick(){
71
+
72
+ $idFila = (int)$this->getData('id');
73
+
74
+ $collection = Mage::getModel('cartabandoned/itemenvio')
75
+ ->getCollection()
76
+ ->addFieldToSelect('*')
77
+ ->addFieldToFilter('id_fila_envio_item_envio', $idFila)
78
+ ->addFieldToFilter('click','Sim');
79
+
80
+
81
+ if(count($collection->getData()) > 0){
82
+ echo count($collection->getData());
83
+ }else{
84
+ echo 0;
85
+ }
86
+
87
+
88
+ }
89
+
90
+ public function getCountNotClick(){
91
+
92
+ $idFila = (int)$this->getData('id');
93
+
94
+ $collection = Mage::getModel('cartabandoned/itemenvio')
95
+ ->getCollection()
96
+ ->addFieldToSelect('*')
97
+ ->addFieldToFilter('id_fila_envio_item_envio', $idFila)
98
+ ->addFieldToFilter('click','Não');
99
+
100
+
101
+ if(count($collection->getData()) > 0){
102
+ echo count($collection->getData());
103
+ }else{
104
+ echo 0;
105
+ }
106
+
107
+
108
+ }
109
+
110
+ public function getCountOpen(){
111
+ $idFila = (int)$this->getData('id');
112
+
113
+ $collection = Mage::getModel('cartabandoned/itemenvio')
114
+ ->getCollection()
115
+ ->addFieldToSelect('*')
116
+ ->addFieldToFilter('id_fila_envio_item_envio', $idFila)
117
+ ->addFieldToFilter('open','Sim');
118
+
119
+
120
+ if(count($collection->getData()) > 0){
121
+ echo count($collection->getData());
122
+ }else{
123
+ echo 0;
124
+ }
125
+ }
126
+
127
+ public function getCountNotOpen(){
128
+ $idFila = (int)$this->getData('id');
129
+
130
+ $collection = Mage::getModel('cartabandoned/itemenvio')
131
+ ->getCollection()
132
+ ->addFieldToSelect('*')
133
+ ->addFieldToFilter('id_fila_envio_item_envio', $idFila)
134
+ ->addFieldToFilter('open','Não');
135
+
136
+
137
+ if(count($collection->getData()) > 0){
138
+ echo count($collection->getData());
139
+ }else{
140
+ echo 0;
141
+ }
142
+ }
143
+
144
+ public function getQtyCartAfter(){
145
+ $collection = Mage::getResourceModel('reports/quote_collection');
146
+ $collection->prepareForAbandonedReport(Mage::app()->getStore()->getStoreId());
147
+ echo count($collection->getData());
148
+ }
149
+
150
+ public function getQtyCartBefore(){
151
+
152
+ $idFila = (int)$this->getData('id');
153
+
154
+ $collection = Mage::getModel('cartabandoned/itemenvio')
155
+ ->getCollection()
156
+ ->addFieldToSelect('*')
157
+ ->addFieldToFilter('main_table.id_fila_envio_item_envio', $idFila)
158
+ ->setPageSize(1);
159
+
160
+ $collection->getSelect()->join(
161
+ 'cart_abandonedj_fila_envio',
162
+ 'main_table.id_fila_envio_item_envio = cart_abandonedj_fila_envio.id_fila_envio',
163
+ array('*'));
164
+
165
+ if(count($collection->getData('data_envio_fila_envio'))){
166
+
167
+ foreach($collection->getData() as $data);
168
+ echo $data['qty_cart'];
169
+
170
+ }else{
171
+ echo 0;
172
+ }
173
+
174
+ }
175
+
176
+ public function getCountEnvio(){
177
+ $idFila = (int)$this->getData('id');
178
+
179
+ $collection = Mage::getModel('cartabandoned/itemenvio')
180
+ ->getCollection()
181
+ ->addFieldToSelect('*')
182
+ ->addFieldToFilter('id_fila_envio_item_envio', $idFila);
183
+
184
+
185
+
186
+ if(count($collection->getData()) > 0){
187
+ echo count($collection->getData());
188
+ }else{
189
+ echo 0;
190
+ }
191
+ }
192
+
193
+
194
+
195
+ }
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
app/code/community/Jefferson/Cartabandoned/Block/Adminhtml/Abandonedreport/Grid.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jefferson_Cartabandoned_Block_Adminhtml_Abandonedreport_Grid extends Mage_Adminhtml_Block_Widget_Grid{
3
+
4
+ /**
5
+ * Inicia o grid
6
+ * @param id do Grid
7
+ * @param primary key da tabela
8
+ * @param ordem
9
+ */
10
+ public function __construct(){
11
+ parent::__construct();
12
+ $this->setId('CartAbandonedreportGrid');
13
+ $this->setDefaultSort('id_fila_envio');
14
+ $this->setDefaultDir('DESC');
15
+ $this->setSaveParametersInSession(true);
16
+ }
17
+
18
+ /**
19
+ * Collection dos dados
20
+ * Apenas chamar a collection do módulo
21
+ */
22
+
23
+ protected function _prepareCollection(){
24
+
25
+ $collection = Mage::getModel('cartabandoned/filaenvio')
26
+ ->getCollection()
27
+ ->addFieldToSelect('*');
28
+
29
+
30
+ $this->setCollection($collection);
31
+ return parent::_prepareCollection();
32
+
33
+ }
34
+
35
+ protected function _prepareColumns(){
36
+
37
+ $this->addColumn('id_fila_envio', array(
38
+ 'header' => Mage::helper('cartabandoned')->__('ID'),
39
+ 'align' => 'center',
40
+ 'width' => '50px',
41
+ 'index' => 'id_fila_envio',
42
+ 'type' => 'number',
43
+ ));
44
+
45
+ $this->addColumn('data_envio_fila_envio', array(
46
+ 'header' => Mage::helper('cartabandoned')->__('Date'),
47
+ 'align' => 'center',
48
+ 'width' => '50px',
49
+ 'index' => 'data_envio_fila_envio',
50
+ 'type' => 'datetime',
51
+ ));
52
+
53
+
54
+ $this->addColumn('status', array(
55
+ 'header' => Mage::helper('cartabandoned')->__('Status'),
56
+ 'align' => 'center',
57
+ 'width' => '50px',
58
+ 'index' => 'status',
59
+ 'type' => 'options',
60
+ 'filter' => false,
61
+ 'renderer' => 'Jefferson_Cartabandoned_Block_Adminhtml_Abandonedreport_Grid_Renderer_Option',
62
+ ));
63
+
64
+ $this->addColumn('action', array(
65
+ 'header' => Mage::helper('cartabandoned')->__('Show'),
66
+ 'align' => 'center',
67
+ 'width' => '100',
68
+ 'type' => 'action',
69
+ 'getter' => 'getId',
70
+ 'filter' => false,
71
+ 'sortable' => false,
72
+ 'index' => 'stores',
73
+ 'is_system' => true,
74
+ 'renderer' => 'Jefferson_Cartabandoned_Block_Adminhtml_Abandonedreport_Grid_Renderer_Action'
75
+ ));
76
+
77
+ return parent::_prepareColumns();
78
+ }
79
+
80
+ }
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
app/code/community/Jefferson/Cartabandoned/Block/Adminhtml/Abandonedreport/Grid/Renderer/Action.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jefferson_Cartabandoned_Block_Adminhtml_Abandonedreport_Grid_Renderer_Action
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action {
4
+
5
+
6
+
7
+ public function render(Varien_Object $row){
8
+ $url = $this->getUrl('*/adminhtml_abandonedreport/preview',array('id'=>$row->getData('id_fila_envio')));
9
+ $actions[] = array(
10
+ // 'url' => $this->getUrl('*/adminhtml_abandonedreport/preview',array('id'=>$row->getData('id_fila_envio'))),
11
+ 'caption' => Mage::helper('cartabandoned')->__('Preview'),
12
+ 'onclick' =>
13
+ "window.open('".$url."','page','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=800,menubar=no,directories=no'); return false;",
14
+ // 'popup' => true
15
+ );
16
+
17
+ $this->getColumn()->setActions($actions);
18
+ return parent::render($row);
19
+
20
+
21
+ }
22
+
23
+
24
+
25
+
26
+
27
+
28
+ }
app/code/community/Jefferson/Cartabandoned/Block/Adminhtml/Abandonedreport/Grid/Renderer/Option.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jefferson_Cartabandoned_Block_Adminhtml_Abandonedreport_Grid_Renderer_Option
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
4
+
5
+
6
+
7
+ public function render(Varien_Object $row){
8
+ return $this->_getValue($row);
9
+ }
10
+
11
+ protected function _getValue(Varien_Object $row){
12
+
13
+ $collection = Mage::getModel('cartabandoned/filaenvio')
14
+ ->load($row->getData('id_fila_envio'));
15
+
16
+
17
+ if($collection->getData('status') == '1'){
18
+
19
+ return Mage::helper('cartabandoned')->__("Executando");
20
+
21
+ }else if($collection->getData('status') == '2'){
22
+
23
+ return Mage::helper('cartabandoned')->__("Finalizado");
24
+
25
+ }
26
+
27
+ }
28
+
29
+
30
+
31
+
32
+
33
+ }
app/code/community/Jefferson/Cartabandoned/Block/Frontend/Cartabandoned.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Jefferson_Cartabandoned_Block_Frontend_Cartabandoned extends Mage_Core_Block_Abstract {
3
+ }
4
+
app/code/community/Jefferson/Cartabandoned/Block/Frontend/Disparo.php ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jefferson_Cartabandoned_Block_Frontend_Disparo extends Mage_Core_Block_Abstract {
3
+
4
+ private $item;
5
+ private $data;
6
+ private $grand_total;
7
+ private $subtotal;
8
+ private $discount;
9
+ private $idFila;
10
+ private $modelItem;
11
+ private $qtyCart;
12
+
13
+
14
+ /**
15
+ * Inicia o disparo dos e-mails
16
+ * @return mixed
17
+ */
18
+
19
+ public function execDisparo(){
20
+
21
+ /*Pega os carrinhos marcados para enviar e-mail*/
22
+ $post = $this->getData();
23
+
24
+ /*Instâncias*/
25
+ $model = Mage::getModel('cartabandoned/cartabandoned');
26
+ $helper = Mage::helper('cartabandoned');
27
+ $collection = Mage::getResourceModel('reports/quote_collection')
28
+ ->addFieldToFilter('main_table.items_qty', array('gt' => 0 ));
29
+ $product = Mage::getModel('catalog/product');
30
+ $this->modelItem = Mage::getModel('cartabandoned/itemenvio');
31
+ $modelFila = Mage::getModel('cartabandoned/filaenvio');
32
+
33
+
34
+ /*Verifica se tem alguma fila sendo executada*/
35
+ if($modelFila->checkExistFila()){
36
+
37
+ if(count($post) > 0){
38
+ Mage::getSingleton('core/session')
39
+ ->addError(Mage::helper('cartabandoned')
40
+ ->__("There's a line running, wait for this queue is over to start a new line."));
41
+ }
42
+
43
+ return;
44
+ exit;
45
+ }
46
+
47
+ /*Verifica se a requisição vem do painel ou cron*/
48
+ if(!count($post) > 0){
49
+
50
+ /*Se a requisição vier do CRON verifica se o próximo envio pode ser executado de acordo com o tempo configurado*/
51
+ if(!$helper->checkLastSend()){
52
+ //echo "Ainda não";
53
+ return;
54
+ exit;
55
+ }else{
56
+ //echo "agora sim";
57
+ }
58
+ }
59
+
60
+ /*Filtrando os carrinhos abandonadoas da loja*/
61
+ $collection->setOrder('entity_id','DESC');
62
+ $collection->prepareForAbandonedReport(Mage::app()->getStore()->getStoreId());
63
+
64
+
65
+ /*Verifica se a requisição vem por um Cron ou Admin*/
66
+ if(count($post) > 0){
67
+
68
+ /*Filtrando os resultados que vieram via post*/
69
+ $collection->addFieldToFilter('main_table.entity_id', array('in' => $post));
70
+ }
71
+
72
+ /*Pegando a quantidade de carrinhos abandonados antes do envio*/
73
+ $modelFila->qtyCart = count(Mage::getResourceModel('reports/quote_collection')
74
+ ->prepareForAbandonedReport(Mage::app()->getStore()->getStoreId())
75
+ ->addFieldToFilter('main_table.items_qty', array('gt' => 0 ))
76
+ ->getData());
77
+
78
+
79
+
80
+ /*Verifica se tem carrinho abandonado*/
81
+ if(!$modelFila->qtyCart > 0 ){
82
+ //echo "<br />sem carrinho";
83
+
84
+ /*Verifica se a requisição vem do painel*/
85
+ if(count($post) > 0){
86
+
87
+ /*Lançando mensagem de erro para o painel*/
88
+ Mage::getSingleton('core/session')
89
+ ->addError(Mage::helper('cartabandoned')
90
+ ->__('Not found abandoned cart'));
91
+ }
92
+
93
+ return;
94
+ exit;
95
+ }
96
+
97
+ /*Grava a fila que esta sendo iniciada e pega o id retornado*/
98
+ $this->idFila = $modelFila->setFila()->getData('id_fila_envio');
99
+
100
+ /*Correndo os usuários dos carrinhos abandonados*/
101
+ $tt = 0;foreach($collection as $this->item){
102
+
103
+ /*Verifica se a fila corrente foi parada a força*/
104
+ if(Mage::getModel('cartabandoned/filaenvio')->checkExistFilaById($this->idFila)){
105
+ continue 1;
106
+ }
107
+
108
+ /*Zera as variáveis para carregar o próximo carrinho*/
109
+ unset($html);
110
+ unset($listProducts);
111
+
112
+
113
+ /*Pega a quantidade de carrinho abandonado*/
114
+ $this->qtyCart = $this->item->getData();
115
+
116
+ /*Método que pega os itens do carrinho do usuário corrente*/
117
+ foreach($this->item->getAllVisibleItems() as $i){
118
+
119
+ /*Carregando o produto corrente*/
120
+ $product->load($i->getProductId());
121
+
122
+ try{
123
+ $img = (string)Mage::helper('catalog/image')->init($product, 'small_image')->keepFrame(true)->resize(150,100);
124
+ }catch(Exception $e){
125
+ $img = '';
126
+ }
127
+
128
+ /*Populando o array com os parametros do item corrente*/
129
+ $listProducts[] = array(
130
+ 'name' => $i->getName(),
131
+ 'price' => Mage::helper('core')->currency($i->getPrice(), true, false),
132
+ 'image' => $img,
133
+ 'qty' => $i->getQty(),
134
+ 'total' => Mage::helper('core')->currency($i->getData('base_row_total_incl_tax'), true, false),
135
+ );
136
+
137
+ }
138
+
139
+ /*Calcula o desconto do carrinho*/
140
+ $ds = ($this->item->getData('base_subtotal') - $this->item->getData('grand_total'));
141
+
142
+ //Pegando as variaveis do carrinho
143
+ $this->grand_total = Mage::helper('core')->currency($this->item->getData('grand_total'), true, false);
144
+ $this->subtotal = Mage::helper('core')->currency($this->item->getData('base_subtotal'), true, false);
145
+ $this->discount = Mage::helper('core')->currency($ds, true, false);
146
+
147
+ /*Método que monta as linhas do carrinho com os itens*/
148
+ $html = $helper->mountLinesCart($listProducts);
149
+
150
+ /*Chamando o método que gera a chave de autenticação*/
151
+ $key = $helper->generateKey($this->item->getEmail(), $this->item->getCustomerId());
152
+
153
+ /*Atribuindo os valores aos objetos da classe Itemenvio*/
154
+ $this->modelItem->idFilaEnvio = $this->idFila;
155
+ $this->modelItem->emailCustomer = $this->item->getEmail();
156
+ $this->modelItem->idCustomer = $this->item->getId();
157
+
158
+ /*Gravando os itens enviados na tabela de relatório e pegando o id*/
159
+ $idOpen = $this->modelItem->setItemEnvio()->getData('id_item_envio');
160
+
161
+ /*Pegando as configurações do desconto*/
162
+ $discountEnable = Mage::getStoreConfig('cartabandoned_options/cartabandoned_general/cartabandoned_discount_enabled');
163
+ $discountInfoCoupon = Mage::getStoreConfig('cartabandoned_options/cartabandoned_general/cartabandoned_info_coupon');
164
+ $discountInfoQty = Mage::getStoreConfig('cartabandoned_options/cartabandoned_general/cartabandoned_info_qty_coupon');
165
+
166
+ /*Retorna uma determinada url dependendo se tem cupom*/
167
+ if($discountEnable == '1' && !empty($discountInfoCoupon)){
168
+ $url = Mage::getUrl('cartabandonedj/index/execlogin/id/'.$idOpen.'/key/'.$key.'/discount/1');
169
+ }else{
170
+ $url = Mage::getUrl('cartabandonedj/index/execlogin/id/'.$idOpen.'/key/'.$key);
171
+ }
172
+
173
+
174
+ /*Passando as variaveis a serem utilizados no e-mail*/
175
+ $args = array(
176
+ 'customer_name' => $this->item->getCustomerName(),
177
+ 'customer_email' => $this->item->getEmail(),
178
+ 'link' => $url,
179
+ 'html' => $html,
180
+ 'grand_total' => $this->grand_total,
181
+ 'subtotal' => $this->subtotal,
182
+ 'discount' => $this->discount,
183
+ 'linkOpen' => Mage::getUrl('cartabandonedj/index/setopenmail/key/'.$idOpen)
184
+
185
+ );
186
+
187
+ /*Se tiver desconto seta as variaveis de cupom no template de email*/
188
+ if($discountEnable == 1 && !empty($discountInfoCoupon)){
189
+ $args['cupom'] = $discountInfoCoupon;
190
+ $args['cupom_qty'] = $discountInfoQty;
191
+ }
192
+
193
+ /*Verifica se tem os argumentos mínimos para criar o template html*/
194
+ if(!empty($args['customer_name']) && !empty($args['customer_email']) && !empty($args['link'])){
195
+
196
+ /*Populando o objeto do método setKeyData*/
197
+ $model->key = $key;
198
+ $model->idCustomer = $this->item->getCustomerId();
199
+
200
+ /*Método que grava a chave de autenticação quando o usuário clicar no link*/
201
+ $model->setKeyData();
202
+
203
+ /*Disparando o e-mail*/
204
+ $send = $helper->sendMail($args);
205
+
206
+ /*Verifica se o e-mail foi enviado com sucesso*/
207
+ if($send === true){
208
+ $y[] = $this->item->getEmail();
209
+ }else{
210
+ $x[] = $this->item->getEmail();
211
+
212
+ /*Deleta o item enviado da tabela caso ocorra falha no envio do mesmo*/
213
+ $this->modelItem->id = $idOpen;
214
+ $this->modelItem->deleteItemEnvio();
215
+
216
+ }
217
+ }
218
+
219
+ /*Executa o disparo a cada X segundo*/
220
+
221
+ //Fecha a conexão antes de colocar o server para dormir
222
+ Mage::getSingleton('core/resource')->getConnection('core_read')->closeConnection();
223
+ sleep((int)$helper->getTimeEnvio());
224
+
225
+ }
226
+
227
+ if(count($post) > 0){
228
+ /*Lança na tela o alert se houve erro e e-mails enviados com sucesso*/
229
+ $helper->deployError($x, $y);
230
+ }
231
+
232
+
233
+ /**
234
+ * Registra o fim da fila corrente
235
+ */
236
+
237
+ $modelFila->idFila = $this->idFila;
238
+ $modelFila->setFilaEnd();
239
+
240
+ }
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+ }
app/code/community/Jefferson/Cartabandoned/Helper/Data.php ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jefferson_Cartabandoned_Helper_Data extends Mage_Core_Helper_Abstract {
3
+
4
+
5
+ /**
6
+ * Efetua o disparo do e-mail
7
+ * @param array $param
8
+ * @return boolean
9
+ */
10
+
11
+ public function sendMail($param = Array()){
12
+
13
+ //Pega o id da loja
14
+ $storeId = Mage::app()->getStore()->getStoreId();
15
+
16
+ try{
17
+ //Carrega o template para envio
18
+ $emailTemplate = Mage::getModel('core/email_template')->loadDefault('cartabandoned_email_template');
19
+
20
+ //Pega o nome de identificação da loja /E-mail Geral
21
+ $senderName = Mage::getStoreConfig('trans_email/ident_general/name');
22
+
23
+ //Pega o e-mail de identificação da loja /E-mail Geral
24
+ $senderEmail = Mage::getStoreConfig('trans_email/ident_general/email');
25
+
26
+ //Variáveis do template de e-mail
27
+ $emailTemplateVariables = array(
28
+ 'customer_name' => $param['customer_name'],
29
+ 'customer_email' => $param['customer_email'],
30
+ 'link' => $param['link'],
31
+ 'html' => $param['html'],
32
+ 'grand_total' => $param['grand_total'],
33
+ 'subtotal' => $param['subtotal'],
34
+ 'discount' => $param['discount'],
35
+ 'linkOpen' => $param['linkOpen'],
36
+ 'subject' => Mage::getStoreConfig('cartabandoned_options/cartabandoned_general/cartabandoned_subject_fila')
37
+ );
38
+
39
+ /*Verifica se a qty e o cupom estão sendo informados*/
40
+ if(!empty($param['cupom']) && !empty($param['cupom_qty'])){
41
+ $emailTemplateVariables['cupom'] = $param['cupom'];
42
+ $emailTemplateVariables['cupom_qty'] = $param['cupom_qty'];
43
+ }
44
+
45
+ //Setando as variáveis personalizadas no template
46
+ $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
47
+
48
+ /*Renderiza o template e lança na tela*/
49
+ //echo $processedTemplate;
50
+
51
+ //Pega o e-mail geral da loja
52
+ $emailTemplate->setSenderEmail(Mage::getStoreConfig('trans_email/ident_general/email', $storeId));
53
+
54
+ //Pega o nome do e-mail geral da loja
55
+ $emailTemplate->setSenderName(Mage::getStoreConfig('trans_email/ident_general/name', $storeId));
56
+
57
+ //Seta o tipo de dados
58
+ $emailTemplate->setType('html');
59
+
60
+ //Executa o envio
61
+ $senddv = $emailTemplate->send($emailTemplateVariables['customer_email'], $emailTemplateVariables['customer_name'], $emailTemplateVariables);
62
+
63
+ if($senddv === true){
64
+ return true;
65
+ }
66
+ Mage::log(Mage::helper('cartabandoned')->__('Unable to send to the following recipient: '.$mailCustomer));
67
+ return false;
68
+ }catch(Exception $e){
69
+ throw new exception($e->getMessage());
70
+ return false;
71
+ }
72
+ }
73
+
74
+
75
+ /**
76
+ * Gera a chave de autenticação
77
+ * @param string $emailCustomer
78
+ * @param string $idCustomer
79
+ * @return string
80
+ */
81
+
82
+ public function generateKey($emailCustomer,$idCustomer){
83
+ $key = md5($emailCustomer.$idCustomer);
84
+ return $key;
85
+ }
86
+
87
+ /**
88
+ * Ocasiona um redirecionamento para a url informada
89
+ * @param string $msg
90
+ * @param string $url
91
+ * @param string $type
92
+ */
93
+
94
+ public function setMsgRedirect($msg, $url, $type = null){
95
+ if($type == 'error' || $type == null){
96
+
97
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cartabandoned')->__($msg));
98
+ Mage::app()->getResponse()->setRedirect(Mage::getUrl($url))->sendResponse();
99
+
100
+ }else if($type == 'success'){
101
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cartabandoned')->__($msg));
102
+ Mage::app()->getResponse()->setRedirect(Mage::getUrl($url))->sendResponse();
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Monta um html com os itens do carrinho
108
+ * @param array $data
109
+ * @return string
110
+ */
111
+
112
+ public function mountLinesCart($data){
113
+ if($data){
114
+
115
+ unset($x);
116
+
117
+ $x=0; foreach($data as $p){
118
+
119
+ if($x == 0):
120
+ $html .= "<tr class='teste_$x'>";
121
+ $x=1;
122
+ endif;
123
+
124
+ $html .="<td align='center' width='200' style='text-align: left;'>
125
+ <div style='margin: 0 auto;width:200px;'>
126
+ <img src='".$p['image']."' alt='".$p['name']."' title='".$p['name']."' />
127
+ <h2 style='color: #ff6447; font-size: 15px;font-family:Arial; font-style:normal;margin: 5px 0;width: 200px;text-align: left;'>".$p['name']."</h2>
128
+ <h3 style='color: #56834A;font-weight: 100;font-family:Arial; font-style:normal;margin: 5px 0;font-size: 15px;width: 200px;text-align: left;'>".$p['price']."</h3>
129
+ <a href='{{var link}}'>
130
+ <h4 style='background: #56834A;width: 100px;border-radius: 5px;color: #fff;text-align: center;float:left; text-transform: uppercase;font-weight: 400;font-family:Arial; font-style:normal;font-size: 15px; margin: 5px 0 50px 0;'>".$this->__('BUY')."</h4>
131
+ </a>
132
+ </div>
133
+ </td>";
134
+
135
+ if($x == 3):
136
+ $html .= "</tr>";
137
+ $x= -1;
138
+ endif;
139
+
140
+ $x++; }
141
+
142
+ unset($x);
143
+ return $html;
144
+ }
145
+ }
146
+
147
+ /**
148
+ * Pega a data e hora
149
+ * @return string
150
+ */
151
+
152
+ public function getDateTimeCurrent(){
153
+ $dateTime = date('Y-m-d H:i:s', Mage::getModel('core/date')->timestamp(time()));
154
+ return $dateTime;
155
+ }
156
+
157
+ /**
158
+ * Lança as mensagens de erros na tela
159
+ * @param array $x
160
+ * @param array $y
161
+ * @return mixed
162
+ */
163
+
164
+ public function deployError($x, $y){
165
+ if(count($x) != 0){
166
+ return Mage::getSingleton('core/session')->addError(
167
+ Mage::helper('cartabandoned')->__('Unable to send alert to the following recipients: '.implode(',',$x))
168
+ );
169
+ }
170
+
171
+ if(count($y) != 0){
172
+ return Mage::getSingleton('core/session')->addSuccess(
173
+ Mage::helper('cartabandoned')->__('The email has been sent to the following recipients: '.implode(',',$y))
174
+ );
175
+ }
176
+ }
177
+
178
+ /**
179
+ * Retorna a configuração do intervalo da execução da fila
180
+ * @return int
181
+ */
182
+
183
+ public function getTimeIntervalFila(){
184
+ $config = (int)Mage::getStoreConfig('cartabandoned_options/cartabandoned_general/cartabandoned_time_interval_fila');
185
+ return $config;
186
+ }
187
+
188
+ /**
189
+ * Retorna a configuração do intervalo da execução do envio entre um e-mail e outro
190
+ * @return string
191
+ */
192
+
193
+ public function getTimeEnvio(){
194
+ $config = (int)Mage::getStoreConfig('cartabandoned_options/cartabandoned_general/cartabandoned_time_envio');
195
+ return $config;
196
+ }
197
+
198
+ /**
199
+ * Verifica se esta dentro do tempo de envio
200
+ * @return boolean
201
+ */
202
+
203
+ public function checkLastSend(){
204
+
205
+ $model = Mage::getModel('cartabandoned/filaenvio');
206
+
207
+ $interval = '+'.self::getTimeIntervalFila().'hours';
208
+ $dateCurrent = self::getDateTimeCurrent();
209
+ $dateLastSend = $model->getLastFila();
210
+
211
+ if($dateLastSend){
212
+ if(strtotime($dateCurrent) >= strtotime($dateLastSend.$interval)){
213
+ return true;
214
+ }
215
+ return false;
216
+ }
217
+ return true;
218
+ }
219
+
220
+ }
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
app/code/community/Jefferson/Cartabandoned/Model/Adminhtml/System/Config/Source/Statusoptions.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jefferson_Cartabandoned_Model_Adminhtml_System_Config_Source_Statusoptions
3
+ extends Mage_Adminhtml_Model_System_Config_Source_Category {
4
+
5
+ protected function _construct(){
6
+ $this->_init('cartabandoned/adminhtml_system_config_source_statusoptions');
7
+ }
8
+
9
+ public function toOptionArray($addEmpty = true)
10
+ {
11
+ $options = array();
12
+
13
+ $options = array(
14
+ '01 Mês' => '01 Mês',
15
+ '01 Semana' => '01 Semana',
16
+ '15 Quinzenal' => '15 Quinzenal'
17
+ );
18
+
19
+ return $options;
20
+ }
21
+
22
+ }
23
+ ?>
app/code/community/Jefferson/Cartabandoned/Model/Cartabandoned.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jefferson_Cartabandoned_Model_Cartabandoned extends Mage_Core_Model_Abstract {
4
+
5
+ private $key;
6
+ private $idCustomer;
7
+
8
+ protected function _construct(){
9
+ parent::_construct();
10
+ $this->_init('cartabandoned/cartabandoned');
11
+ }
12
+
13
+ /**
14
+ * Grava os dados da chave de login no banco
15
+ */
16
+
17
+ public function setKeyData(){
18
+
19
+ $data = self::getKeyData();
20
+
21
+ if($data['result'] == false){
22
+ $collection = Mage::getModel('cartabandoned/cartabandoned');
23
+ $collection->setData('id_customer_cart_abandonedj', $this->idCustomer)
24
+ ->setData('key_cart_abandonedj', $this->key)
25
+ ->save();
26
+ }
27
+
28
+ }
29
+
30
+ /**
31
+ * Efetua o login através do id do usuário
32
+ * @return array
33
+ */
34
+
35
+ public function loginCustomer(){
36
+
37
+ $session = Mage::getSingleton('customer/session');
38
+
39
+ try {
40
+
41
+ if(!$session->isLoggedIn()){
42
+
43
+ $session->loginById($this->idCustomer);
44
+
45
+ if($session->getCustomer()->getId()){
46
+ $data = true;
47
+ }else{
48
+ $data = false;
49
+ }
50
+ }else{
51
+ $data = true;
52
+ }
53
+
54
+ return $data;
55
+
56
+ } catch (Mage_Core_Exception $e) {
57
+ return false;
58
+ }
59
+
60
+ }
61
+
62
+
63
+ /**
64
+ * Verifica se a chave existe no banco
65
+ * @return array
66
+ */
67
+
68
+ public function getKeyData(){
69
+ $collection = Mage::getModel('cartabandoned/cartabandoned')
70
+ ->getCollection()
71
+ ->addFieldToFilter('key_cart_abandonedj', $this->key);
72
+
73
+ foreach($collection as $data);
74
+
75
+ if($collection->count() > 0){
76
+ $data = array(
77
+ 'result' => true,
78
+ 'id' => $data->getData('id_customer_cart_abandonedj')
79
+ );
80
+ }else{
81
+ $data = array('result' => false);
82
+ }
83
+
84
+ return $data;
85
+ }
86
+
87
+
88
+ /**
89
+ * Métodos SET & GET
90
+ */
91
+
92
+ public function __get($propriedade){
93
+ return $this->$propriedade;
94
+ }
95
+
96
+ public function __set($propriedade, $valor){
97
+ $this->$propriedade = $valor;
98
+ }
99
+
100
+
101
+ }
app/code/community/Jefferson/Cartabandoned/Model/Filaenvio.php ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Jefferson_Cartabandoned_Model_Filaenvio extends Mage_Core_Model_Abstract {
5
+
6
+ private $qtyCart;
7
+ private $idFila;
8
+
9
+ protected function _construct(){
10
+ parent::_construct();
11
+ $this->_init('cartabandoned/filaenvio');
12
+ }
13
+
14
+
15
+ /**
16
+ * Registra a data de envio da disparo
17
+ * @return array
18
+ */
19
+ public function setFila(){
20
+ $helper = Mage::helper('cartabandoned');
21
+ $collection = Mage::getModel('cartabandoned/filaenvio')
22
+ ->setData('data_envio_fila_envio', $helper->getDateTimeCurrent())
23
+ ->setData('qty_cart', $this->qtyCart);
24
+
25
+ return $collection->save();
26
+
27
+ }
28
+
29
+ /**
30
+ * Registra o fim do envio da fila
31
+ * @return array
32
+ */
33
+ public function setFilaEnd(){
34
+ $collection = Mage::getModel('cartabandoned/filaenvio')->load($this->idFila)
35
+ ->setData('status', '2')
36
+ ->setData('end_envio', Mage::helper('cartabandoned')->getDateTimeCurrent());
37
+
38
+ return $collection->save();
39
+ }
40
+
41
+ /**
42
+ * Pega o últmo envio
43
+ * @return mixed
44
+ */
45
+
46
+ public function getLastFila(){
47
+ $collection = Mage::getModel('cartabandoned/filaenvio')
48
+ ->getCollection()
49
+ ->addFieldToSelect('*');
50
+
51
+ if(count($collection->getData()) > 0){
52
+ foreach($collection as $item){
53
+ $id = $item->getData('end_envio');
54
+ }
55
+
56
+ return $id;
57
+ }else{
58
+ return true;
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Verifica se existe uma fila em execução
64
+ * @return boolean
65
+ */
66
+
67
+ public function checkExistFila(){
68
+ $collection = Mage::getModel('cartabandoned/filaenvio')
69
+ ->getCollection()
70
+ ->addFieldToSelect('*')
71
+ ->addFieldToFilter('status', '1');
72
+
73
+ if(count($collection->getData()) > 0){
74
+ return true;
75
+ }else{
76
+ return false;
77
+ }
78
+
79
+ }
80
+
81
+ /**
82
+ * Verifica se a última fila foi parada a força
83
+ * @param string $id
84
+ * @return boolean
85
+ */
86
+
87
+ public function checkExistFilaById($id){
88
+ $collection = Mage::getModel('cartabandoned/filaenvio')->load($id);
89
+
90
+ if($collection->getData('status') == '2'){
91
+ return true;
92
+ }else{
93
+ return false;
94
+ }
95
+
96
+ }
97
+
98
+ /**
99
+ * Finaliza todas as filas de envio em execução
100
+ * @return boolean
101
+ */
102
+
103
+ public function stopFila(){
104
+ $collection = Mage::getModel('cartabandoned/filaenvio')
105
+ ->getCollection()
106
+ ->addFieldToSelect('*')
107
+ ->addFieldToFilter('status', '1');
108
+
109
+ if(count($collection->getData()) > 0){
110
+
111
+ foreach ($collection as $data){
112
+ $id = $data->getData('id_fila_envio');
113
+
114
+ Mage::getModel('cartabandoned/filaenvio')
115
+ ->load($id)
116
+ ->setData('status','2')
117
+ ->save();
118
+ }
119
+ return true;
120
+ exit;
121
+ }else{
122
+ return false;
123
+ exit;
124
+ }
125
+ }
126
+
127
+
128
+
129
+
130
+ /**
131
+ * Métodos SET & GET
132
+ */
133
+
134
+ public function __get($propriedade){
135
+ return $this->$propriedade;
136
+ }
137
+
138
+ public function __set($propriedade, $valor){
139
+ $this->$propriedade = $valor;
140
+ }
141
+
142
+
143
+
144
+ }
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
app/code/community/Jefferson/Cartabandoned/Model/Itemenvio.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jefferson_Cartabandoned_Model_Itemenvio extends Mage_Core_Model_Abstract {
4
+
5
+ private $idFilaEnvio;
6
+ private $emailCustomer;
7
+ private $idCustomer;
8
+ private $model;
9
+ private $helper;
10
+ private $key;
11
+ private $id;
12
+ private $idClick;
13
+
14
+ protected function _construct(){
15
+ parent::_construct();
16
+ $this->_init('cartabandoned/itemenvio');
17
+ $this->helper = Mage::helper('cartabandoned');
18
+ }
19
+
20
+ /**
21
+ * Grava na tabela o e-mail do usuários que foi disparado o envio
22
+ * @return object
23
+ */
24
+
25
+ public function setItemEnvio(){
26
+ $collection = Mage::getModel('cartabandoned/itemenvio');
27
+ $collection->setData('id_fila_envio_item_envio', $this->idFilaEnvio)
28
+ ->setData('data_envio_item_envio', $this->helper->getDateTimeCurrent())
29
+ ->setData('email_customer', $this->emailCustomer)
30
+ ->setData('id_customer', $this->idCustomer);
31
+
32
+ return $collection->save();
33
+
34
+ }
35
+
36
+ /**
37
+ * Deleta da tabela de rela tório o e-mail do usuário que ocorreu falha no envio
38
+ */
39
+
40
+ public function deleteItemEnvio($id){
41
+ Mage::getModel('cartabandoned/itemenvio')->load($id)->delete();
42
+ }
43
+
44
+ /**
45
+ * Atualiza o status Abriu/Não abriu do item enviado
46
+ * Evento chamado quando o usuário abri o e-mail
47
+ */
48
+
49
+ public function setOpenMail(){
50
+ $collection = Mage::getModel('cartabandoned/itemenvio')->load($this->key);
51
+ if(count($collection->getData()) > 0){
52
+ $collection->setData('open','Sim')->save();
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Registra o click do e-mail que foi clicado
58
+ */
59
+
60
+ public function setClickMail(){
61
+ $collection = Mage::getModel('cartabandoned/itemenvio')->load($this->idClick);
62
+ if(count($collection->getData()) > 0){
63
+ $collection->setData('click','Sim')->save();
64
+ }
65
+
66
+ }
67
+
68
+
69
+ /**
70
+ * Métodos SET & GET
71
+ */
72
+
73
+ public function __get($propriedade){
74
+ return $this->$propriedade;
75
+ }
76
+
77
+ public function __set($propriedade, $valor){
78
+ $this->$propriedade = $valor;
79
+ }
80
+ }
app/code/community/Jefferson/Cartabandoned/Model/Mysql4/Cartabandoned.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jefferson_Cartabandoned_Model_Mysql4_Cartabandoned extends Mage_Core_Model_Mysql4_Abstract{
4
+
5
+ protected function _construct(){
6
+ $this->_init('cartabandoned/cartabandoned', 'id_cart_abandonedj');
7
+ }
8
+
9
+
10
+ }
app/code/community/Jefferson/Cartabandoned/Model/Mysql4/Cartabandoned/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jefferson_Cartabandoned_Model_Mysql4_Cartabandoned_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('cartabandoned/cartabandoned');
9
+ }
10
+ }
app/code/community/Jefferson/Cartabandoned/Model/Mysql4/Filaenvio.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jefferson_Cartabandoned_Model_Mysql4_Filaenvio extends Mage_Core_Model_Mysql4_Abstract{
4
+
5
+ protected function _construct(){
6
+ $this->_init('cartabandoned/filaenvio', 'id_fila_envio');
7
+ }
8
+
9
+
10
+ }
app/code/community/Jefferson/Cartabandoned/Model/Mysql4/Filaenvio/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jefferson_Cartabandoned_Model_Mysql4_Filaenvio_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('cartabandoned/filaenvio');
9
+ }
10
+ }
app/code/community/Jefferson/Cartabandoned/Model/Mysql4/Itemenvio.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jefferson_Cartabandoned_Model_Mysql4_Itemenvio extends Mage_Core_Model_Mysql4_Abstract{
4
+
5
+ protected function _construct(){
6
+ $this->_init('cartabandoned/itemenvio', 'id_item_envio');
7
+ }
8
+
9
+
10
+ }
app/code/community/Jefferson/Cartabandoned/Model/Mysql4/Itemenvio/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jefferson_Cartabandoned_Model_Mysql4_Itemenvio_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('cartabandoned/itemenvio');
9
+ }
10
+ }
app/code/community/Jefferson/Cartabandoned/controllers/Adminhtml/AbandonedController.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jefferson_Cartabandoned_Adminhtml_AbandonedController extends Mage_Adminhtml_Controller_action {
4
+
5
+ /**
6
+ * Carrega o layout
7
+ */
8
+
9
+ public function indexAction(){
10
+ $this->_initAction()
11
+ ->renderLayout();
12
+ }
13
+
14
+ /**
15
+ * Inicia a criação do layout
16
+ */
17
+
18
+ protected function _initAction() {
19
+ $this->loadLayout()
20
+ ->_setActiveMenu('newsletter/cartabandoned')
21
+ ->_addBreadcrumb(Mage::helper('cartabandoned')->__('Abandoned Cart'));
22
+ return $this;
23
+ }
24
+
25
+ /**
26
+ * Executa o disparo dos e-mails e pega os carrinhos abandonados
27
+ */
28
+
29
+ public function massEnviarAction(){
30
+
31
+ /*Pega os carrinhos marcados para enviar e-mail*/
32
+ $post = $this->getRequest()->getPost('cartabandoned');
33
+
34
+ $block = $this->getLayout()
35
+ ->createBlock('cartabandoned/frontend_disparo')
36
+ ->setData($post)
37
+ ->execDisparo();
38
+
39
+ /*Redireciona para a tela do grid*/
40
+ $this->_redirect('*/*/index');
41
+
42
+ }
43
+
44
+ }
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
app/code/community/Jefferson/Cartabandoned/controllers/Adminhtml/AbandonedreportController.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Jefferson_Cartabandoned_Adminhtml_AbandonedreportController extends Mage_Adminhtml_Controller_action {
4
+
5
+ /**
6
+ * Carrega o layout
7
+ */
8
+
9
+ public function indexAction(){
10
+ $this->_initAction()
11
+ ->renderLayout();
12
+ }
13
+
14
+ /**
15
+ * Inicia a criação do layout
16
+ */
17
+
18
+ protected function _initAction() {
19
+ $this->loadLayout()
20
+ ->_setActiveMenu('report/cartabandoned_reports')
21
+ ->_addBreadcrumb(Mage::helper('cartabandoned')->__('Report abandoned shopping cart shipping'));
22
+ return $this;
23
+ }
24
+
25
+ public function previewAction(){
26
+
27
+ $data = $this->getRequest()->getParams();
28
+
29
+ $data['preview_store_id'] = Mage::app()->getAnyStoreView()->getId();
30
+
31
+ echo $this->getLayout()
32
+ ->createBlock('cartabandoned/adminhtml_abandonedreport')
33
+ ->setTemplate('jefferson/cartabandoned/cartabandoned_report.phtml')
34
+ ->setData($data)
35
+ ->toHtml();
36
+
37
+
38
+ }
39
+
40
+ /*
41
+ * Para a fila que esta sendo executada
42
+ */
43
+
44
+ public function stopFilaAction(){
45
+ $model = Mage::getSingleton('cartabandoned/filaenvio');
46
+
47
+ if($model->stopFila()){
48
+
49
+ Mage::helper('cartabandoned')
50
+ ->setMsgRedirect('All the lines were successfully stops','*/*/index','success');
51
+
52
+ }else{
53
+ Mage::helper('cartabandoned')
54
+ ->setMsgRedirect('There is no running queues','*/*/index');
55
+ }
56
+ }
57
+
58
+ }
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
app/code/community/Jefferson/Cartabandoned/controllers/DisparoController.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ set_time_limit(0);
4
+ ini_set('max_execution_time', 0);
5
+ ini_set ('mysql.connect_timeout ', 0);
6
+ ini_set ('default_socket_timeout', 0);
7
+
8
+ class Jefferson_Cartabandoned_DisparoController extends Mage_Core_Controller_Front_Action {
9
+
10
+ public function indexAction(){
11
+ $post = array();
12
+ $block = $this->getLayout()
13
+ ->createBlock('cartabandoned/frontend_disparo')
14
+ ->setData($post)
15
+ ->execDisparo();
16
+ }
17
+ }
app/code/community/Jefferson/Cartabandoned/controllers/IndexController.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Jefferson_Cartabandoned_IndexController extends Mage_Core_Controller_Front_Action {
3
+
4
+ /**
5
+ * Executa o disparo dos e-mails e pega os carrinhos abandonados
6
+ */
7
+
8
+ public function indexAction(){}
9
+
10
+ /**
11
+ * Atualiza o status do email aberto para Visualizado
12
+ */
13
+
14
+ public function setOpenMailAction(){
15
+ $model = Mage::getModel('cartabandoned/itemenvio');
16
+ $model->key = $this->getRequest()->getParam('key');
17
+ $model->setOpenMail();
18
+ }
19
+
20
+ /**
21
+ * Efetua o login do usuário e redireciona para o carrinho
22
+ */
23
+
24
+ public function execLoginAction(){
25
+
26
+ $key = $this->getRequest()->getParam('key');
27
+
28
+ $id = (int)$this->getRequest()->getParam('id');
29
+
30
+ $discount = (int)$this->getRequest()->getParam('discount');
31
+
32
+ $model = Mage::getModel('cartabandoned/cartabandoned');
33
+
34
+ $helper = Mage::helper('cartabandoned');
35
+
36
+ $model->key = $key;
37
+
38
+ $checkKey = $model->getKeyData();
39
+
40
+ if($checkKey['result'] == true){
41
+
42
+ $model->idCustomer = $checkKey['id'];
43
+
44
+ if($model->loginCustomer() == true){
45
+
46
+ $modelClick = Mage::getModel('cartabandoned/itemenvio');
47
+
48
+ $modelClick->idClick = $id;
49
+
50
+ $modelClick->setClickMail();
51
+
52
+ if($discount == 1) {
53
+ $coupon = Mage::getStoreConfig('cartabandoned_options/cartabandoned_general/cartabandoned_info_coupon');
54
+ $this->_forward('couponPost','cart','checkout',array('coupon_code' => $coupon));
55
+
56
+ }else{
57
+ $this->_redirect('checkout/cart/');
58
+ }
59
+
60
+ }else{
61
+ $helper->setMsgRedirect('Failed to login', 'customer/login/');
62
+ }
63
+
64
+ }else{
65
+ $helper->setMsgRedirect('Cart not found', '');
66
+ }
67
+
68
+ }
69
+
70
+ }
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
app/code/community/Jefferson/Cartabandoned/etc/config.xml ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+
3
+ <config>
4
+
5
+ <modules>
6
+ <Jefferson_Cartabandoned>
7
+ <version>1.0.0</version>
8
+ </Jefferson_Cartabandoned>
9
+ </modules>
10
+
11
+ <frontend>
12
+ <layout>
13
+ <updates>
14
+ <Jefferson_Cartabandoned>
15
+ <file>jefferson/cartabandoned/jefferson_cartabandoned.xml</file>
16
+ </Jefferson_Cartabandoned>
17
+ </updates>
18
+ </layout>
19
+
20
+ <routers>
21
+ <cartabandonedj>
22
+ <use>standard</use>
23
+ <args>
24
+ <module>Jefferson_Cartabandoned</module>
25
+ <frontName>cartabandonedj</frontName>
26
+ </args>
27
+ </cartabandonedj>
28
+ </routers>
29
+
30
+ <translate>
31
+ <modules>
32
+ <Jefferson_Cartabandoned>
33
+ <files>
34
+ <default>jefferson/cartabandoned/jefferson_cartabandoned.csv</default>
35
+ </files>
36
+ </Jefferson_Cartabandoned>
37
+ </modules>
38
+ </translate>
39
+
40
+ </frontend>
41
+
42
+ <adminhtml>
43
+
44
+ <menu>
45
+
46
+ <report>
47
+ <children>
48
+ <cartabandoned_reports translate="title" module="cartabandoned">
49
+ <title>Report abandoned shopping cart shipping</title>
50
+ <sort_order>800</sort_order>
51
+ <action>cartabandonedj/adminhtml_abandonedreport</action>
52
+ </cartabandoned_reports>
53
+ </children>
54
+ </report>
55
+
56
+ <newsletter>
57
+ <children>
58
+ <cartabandoned translate="title" module="cartabandoned">
59
+ <title>Abandoned Cart</title>
60
+ <sort_order>810</sort_order>
61
+ <action>cartabandonedj/adminhtml_abandoned</action>
62
+ </cartabandoned>
63
+ </children>
64
+ </newsletter>
65
+ </menu>
66
+
67
+ <acl>
68
+ <resources>
69
+ <admin>
70
+ <children>
71
+
72
+ <newsletter>
73
+ <children>
74
+ <cartabandoned translate="title" module="cartabandoned">
75
+ <title>Abandoned Cart</title>
76
+ </cartabandoned>
77
+ </children>
78
+ </newsletter>
79
+
80
+ <report>
81
+ <children>
82
+ <cartabandoned_reports translate="title" module="cartabandoned">
83
+ <title>Report abandoned shopping cart shipping</title>
84
+ </cartabandoned_reports>
85
+ </children>
86
+ </report>
87
+
88
+ <system>
89
+ <children>
90
+ <config>
91
+ <children>
92
+ <cartabandoned_options>
93
+ <title>Abandoned Cart</title>
94
+ </cartabandoned_options>
95
+ </children>
96
+ </config>
97
+ </children>
98
+ </system>
99
+
100
+ </children>
101
+ </admin>
102
+ </resources>
103
+ </acl>
104
+
105
+ <layout>
106
+ <updates>
107
+ <cartabandoned>
108
+ <file>jefferson/cartabandoned/jefferson_cartabandoned.xml</file>
109
+ </cartabandoned>
110
+ </updates>
111
+ </layout>
112
+
113
+ <translate>
114
+ <modules>
115
+ <Jefferson_Cartabandoned>
116
+ <files>
117
+ <default>jefferson/cartabandoned/jefferson_cartabandoned.csv</default>
118
+ </files>
119
+ </Jefferson_Cartabandoned>
120
+ </modules>
121
+ </translate>
122
+
123
+ </adminhtml>
124
+
125
+ <admin>
126
+ <routers>
127
+ <cartabandonedj>
128
+ <use>admin</use>
129
+ <args>
130
+ <module>Jefferson_Cartabandoned</module>
131
+ <frontName>cartabandonedj</frontName>
132
+ </args>
133
+ </cartabandonedj>
134
+ </routers>
135
+ </admin>
136
+
137
+ <global>
138
+ <template>
139
+ <email>
140
+ <cartabandoned_email_template translate="label">
141
+ <label>Abandoned Cart</label>
142
+ <file>jefferson/cartabandoned/cartabandoned.html</file>
143
+ <type>html</type>
144
+ </cartabandoned_email_template>
145
+ </email>
146
+ </template>
147
+
148
+ <blocks>
149
+ <cartabandoned>
150
+ <class>Jefferson_Cartabandoned_Block</class>
151
+ </cartabandoned>
152
+ </blocks>
153
+
154
+ <helpers>
155
+ <cartabandoned>
156
+ <class>Jefferson_Cartabandoned_Helper</class>
157
+ </cartabandoned>
158
+ </helpers>
159
+
160
+ <models>
161
+
162
+ <cartabandoned>
163
+ <class>Jefferson_Cartabandoned_Model</class>
164
+ <resourceModel>cartabandoned_mysql4</resourceModel>
165
+ </cartabandoned>
166
+
167
+ <cartabandoned_mysql4>
168
+ <class>Jefferson_Cartabandoned_Model_Mysql4</class>
169
+ <entities>
170
+ <cartabandoned>
171
+ <table>cart_abandonedj</table>
172
+ </cartabandoned>
173
+
174
+ <filaenvio>
175
+ <table>cart_abandonedj_fila_envio</table>
176
+ </filaenvio>
177
+
178
+ <itemenvio>
179
+ <table>cart_abandonedj_item_envio</table>
180
+ </itemenvio>
181
+ </entities>
182
+ </cartabandoned_mysql4>
183
+
184
+ </models>
185
+
186
+ <resources>
187
+
188
+ <jefferson_cartabandoned_setup>
189
+ <setup>
190
+ <module>Jefferson_Cartabandoned</module>
191
+ </setup>
192
+ <connection>
193
+ <use>core_setup</use>
194
+ </connection>
195
+ </jefferson_cartabandoned_setup>
196
+
197
+
198
+ <jefferson_cartabandoned_write>
199
+ <connection>
200
+ <use>core_write</use>
201
+ </connection>
202
+ </jefferson_cartabandoned_write>
203
+
204
+ <jefferson_cartabandoned_read>
205
+ <connection>
206
+ <use>core_read</use>
207
+ </connection>
208
+ </jefferson_cartabandoned_read>
209
+
210
+ </resources>
211
+ </global>
212
+ <default>
213
+ <cartabandoned_options>
214
+ <cartabandoned_general>
215
+ <cartabandoned_enabled>1</cartabandoned_enabled>
216
+ <cartabandoned_time_envio>60</cartabandoned_time_envio>
217
+ <cartabandoned_time_interval_fila>72</cartabandoned_time_interval_fila>
218
+ <cartabandoned_subject_fila>Finalize your purchase</cartabandoned_subject_fila>
219
+ </cartabandoned_general>
220
+ </cartabandoned_options>
221
+ </default>
222
+
223
+ </config>
app/code/community/Jefferson/Cartabandoned/etc/system.xml ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <cartabandoned translate="label" module="cartabandoned">
5
+ <label>Abandoned Cart</label>
6
+ <sort_order>99999</sort_order>
7
+ </cartabandoned>
8
+ </tabs>
9
+ <!--Click view click-->
10
+ <sections>
11
+ <cartabandoned_options translate="label" module="cartabandoned">
12
+ <label>Abandoned cart email marketing</label>
13
+ <tab>cartabandoned</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>1000</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+
20
+ <groups translate="label">
21
+
22
+ <cartabandoned_general>
23
+ <label>General</label>
24
+ <frontend_type>text</frontend_type>
25
+ <sort_order>1</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+
30
+ <fields>
31
+
32
+ <cartabandoned_enabled translate="label">
33
+ <label>Enabled</label>
34
+ <frontend_type>select</frontend_type>
35
+ <source_model>adminhtml/system_config_source_yesno</source_model>
36
+ <sort_order>10</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ </cartabandoned_enabled>
41
+
42
+ <cartabandoned_time_envio>
43
+ <label>Trigger speed</label>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>20</sort_order>
46
+ <validate>required-entry</validate>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ <comment>Time in seconds between a clock sending and other (In seconds)</comment>
51
+ </cartabandoned_time_envio>
52
+
53
+ <cartabandoned_time_interval_fila>
54
+ <label>The queue run interval</label>
55
+ <frontend_type>text</frontend_type>
56
+ <sort_order>30</sort_order>
57
+ <validate>required-entry</validate>
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
+ <comment>Run time in queue hours</comment>
62
+ </cartabandoned_time_interval_fila>
63
+
64
+ <cartabandoned_subject_fila>
65
+ <label>Subject of e-mail</label>
66
+ <frontend_type>text</frontend_type>
67
+ <sort_order>30</sort_order>
68
+ <validate>required-entry</validate>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>1</show_in_store>
72
+ <comment>Enter the e-mail subject</comment>
73
+ </cartabandoned_subject_fila>
74
+
75
+ <!-- <cartabandoned_discount_enabled translate="label">
76
+ <label>Enabled Discount</label>
77
+ <frontend_type>select</frontend_type>
78
+ <source_model>adminhtml/system_config_source_yesno</source_model>
79
+ <sort_order>40</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>1</show_in_store>
83
+ </cartabandoned_discount_enabled>
84
+
85
+ <cartabandoned_info_coupon>
86
+ <label>Discount Coupon</label>
87
+ <frontend_type>text</frontend_type>
88
+ <sort_order>50</sort_order>
89
+ <validate>required-entry</validate>
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
+ <depends><cartabandoned_discount_enabled>1</cartabandoned_discount_enabled></depends>
94
+ <comment>Enter the discount coupon created (the coupon will be created through the menu promotion)</comment>
95
+ </cartabandoned_info_coupon>
96
+
97
+ <cartabandoned_info_qty_coupon>
98
+ <label>Discount amount</label>
99
+ <frontend_type>text</frontend_type>
100
+ <sort_order>60</sort_order>
101
+ <validate>required-entry</validate>
102
+ <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
+ <show_in_store>1</show_in_store>
105
+ <depends><cartabandoned_discount_enabled>1</cartabandoned_discount_enabled></depends>
106
+ <comment>Discount amount (e.g. 10% or $10.00)</comment>
107
+ </cartabandoned_info_qty_coupon>-->
108
+
109
+
110
+ </fields>
111
+
112
+ </cartabandoned_general>
113
+
114
+ </groups>
115
+
116
+ </cartabandoned_options>
117
+ </sections>
118
+ </config>
app/code/community/Jefferson/Cartabandoned/sql/jefferson_cartabandoned_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+ DROP TABLE IF EXISTS {$installer->getTable('cartabandoned/cartabandoned')};
9
+ CREATE TABLE {$installer->getTable('cartabandoned/cartabandoned')}
10
+ (
11
+ id_cart_abandonedj INT AUTO_INCREMENT NOT NULL,
12
+ id_customer_cart_abandonedj INT NOT NULL,
13
+ key_cart_abandonedj VARCHAR(500) NOT NULL,
14
+ PRIMARY KEY (id_cart_abandonedj)
15
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
16
+
17
+ DROP TABLE IF EXISTS {$installer->getTable('cartabandoned/filaenvio')};
18
+ CREATE TABLE {$installer->getTable('cartabandoned/filaenvio')}
19
+ (
20
+ id_fila_envio INT NOT NULL AUTO_INCREMENT,
21
+ data_envio_fila_envio DATETIME NOT NULL,
22
+ qty_cart INT NOT NULL,
23
+ status CHAR(1) NOT NULL DEFAULT 1,
24
+ end_envio DATETIME NOT NULL,
25
+ PRIMARY KEY (id_fila_envio)
26
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
27
+
28
+ DROP TABLE IF EXISTS {$installer->getTable('cartabandoned/itemenvio')};
29
+ CREATE TABLE {$installer->getTable('cartabandoned/itemenvio')}
30
+ (
31
+ id_item_envio INT NOT NULL AUTO_INCREMENT,
32
+ id_fila_envio_item_envio INT NOT NULL,
33
+ id_customer INT NOT NULL,
34
+ email_customer VARCHAR(500) NOT NULL,
35
+ data_envio_item_envio DATETIME NOT NULL,
36
+ click VARCHAR(10) NOT NULL DEFAULT 'Não',
37
+ open VARCHAR(10) NOT NULL DEFAULT 'Não',
38
+ PRIMARY KEY (id_item_envio)
39
+
40
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
41
+
42
+ ");
43
+
44
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/jefferson/cartabandoned/jefferson_cartabandoned.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+
4
+ <cartabandonedj_adminhtml_abandoned_index>
5
+ <reference name="content">
6
+ <block type="cartabandoned/adminhtml_abandoned" name="cartabandoned.abandoned" />
7
+ </reference>
8
+ </cartabandonedj_adminhtml_abandoned_index>
9
+
10
+ <cartabandonedj_adminhtml_abandonedreport_index>
11
+ <reference name="content">
12
+ <block type="cartabandoned/adminhtml_abandonedreport" name="cartabandoned.abandonedreport" />
13
+ </reference>
14
+ </cartabandonedj_adminhtml_abandonedreport_index>
15
+
16
+ </layout>
app/design/adminhtml/default/default/template/jefferson/cartabandoned/cartabandoned_report.phtml ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="pt-br">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+
6
+ <link rel="stylesheet" href="https://cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css" media="all" />
7
+ <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css">
8
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
9
+
10
+ <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
11
+ <script src="https://cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js"></script>
12
+ <script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
13
+ <script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script>
14
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>
15
+
16
+
17
+
18
+ <script>
19
+ $(function(){
20
+
21
+ //Gráfico
22
+
23
+ new Morris.Donut({
24
+ element: 'filas',
25
+ data: [
26
+ {label: "<?php echo $this->__('Queue') ?>", value: <?php $this->getQtyCartBefore(); ?> },
27
+ ]
28
+ });
29
+
30
+ new Morris.Donut({
31
+ element: 'disparados',
32
+ data: [
33
+ {label: "<?php echo $this->__('Raised') ?>", value: <?php $this->getCountEnvio(); ?> },
34
+ ]
35
+ });
36
+
37
+ new Morris.Donut({
38
+ element: 'cart',
39
+ data: [
40
+ {label: "<?php echo $this->__('Before') ?>", value: <?php $this->getQtyCartBefore(); ?> },
41
+ {label: "<?php echo $this->__('After') ?>", value: <?php $this->getQtyCartAfter(); ?> },
42
+ ]
43
+ });
44
+
45
+ new Morris.Donut({
46
+ element: 'enviadosAbertos',
47
+ data: [
48
+ {label: "<?php echo $this->__('Viewed') ?>", value: <?php $this->getCountOpen(); ?> },
49
+ {label: "<?php echo $this->__('Not displayed') ?>", value: <?php $this->getCountNotOpen(); ?> },
50
+ ]
51
+ });
52
+
53
+ new Morris.Donut({
54
+ element: 'clicadosAbertos',
55
+ data: [
56
+ {label: "<?php echo $this->__('Clicked') ?>", value: <?php $this->getCountClick(); ?> },
57
+ {label: "<?php echo $this->__('Not clicked') ?>", value: <?php $this->getCountNotClick(); ?> },
58
+
59
+ ]
60
+ });
61
+
62
+ new Morris.Bar({
63
+ // ID of the element in which to draw the chart.
64
+ element: 'myfirstchart',
65
+
66
+ // Chart data records -- each entry in this array corresponds to a point on
67
+ // the chart.
68
+ data: [
69
+ { Dados: '<?php echo $this->__('Queue') ?>', value: <?php $this->getQtyCartBefore(); ?> },
70
+ { Dados: '<?php echo $this->__('Fired') ?>', value: <?php $this->getCountEnvio(); ?> },
71
+ { Dados: '<?php echo $this->__('Viewed') ?>', value: <?php $this->getCountOpen(); ?> },
72
+ { Dados: '<?php echo $this->__('Clicked') ?>', value: <?php $this->getCountClick(); ?> },
73
+ { Dados: '<?php echo $this->__('Not clicked') ?>', value: <?php $this->getCountNotClick(); ?> },
74
+ { Dados: '<?php echo $this->__('Not displayed') ?>', value: <?php $this->getCountNotOpen(); ?> },
75
+
76
+ ],
77
+
78
+ // The name of the data record attribute that contains x-values.
79
+ xkey: 'Dados',
80
+
81
+ // A list of names of data record attributes that contain y-values.
82
+ ykeys: ['value'],
83
+
84
+ // Labels for the ykeys -- will be displayed when you hover over the
85
+ // chart.
86
+ labels: ['Qty']
87
+ });
88
+
89
+ //Data Table
90
+ var table = $('#table').DataTable({"order": []});
91
+
92
+ new $.fn.dataTable.AutoFill(table);
93
+
94
+
95
+ });
96
+ </script>
97
+ </head>
98
+ <body>
99
+
100
+ <div class="container-fluid">
101
+
102
+ <div class="row">
103
+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
104
+ <div class="panel panel-primary">
105
+ <div class="panel-heading">
106
+ <h3 class="panel-title"><?php echo $this->__('General Report') ?></h3>
107
+ </div>
108
+
109
+ <div class="panel-body" style="margin: 0 auto; max-width: 600px;">
110
+ <div id="myfirstchart" style="height: 250px;"></div>
111
+ </div>
112
+ </div>
113
+ </div>
114
+ </div>
115
+
116
+ <div class="row">
117
+ <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
118
+ <div class="panel panel-primary">
119
+ <div class="panel-heading">
120
+ <h3 class="panel-title"><?php echo $this->__('Queue') ?></h3>
121
+ </div>
122
+ <div class="panel-body">
123
+ <div id="filas" class="enviadosAbertos" style="height: 250px"></div>
124
+ </div>
125
+ </div>
126
+ </div>
127
+
128
+ <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
129
+ <div class="panel panel-primary">
130
+ <div class="panel-heading">
131
+ <h3 class="panel-title"><?php echo $this->__('Fired') ?></h3>
132
+ </div>
133
+ <div class="panel-body">
134
+ <div id="disparados" class="enviadosAbertos" style="height: 250px"></div>
135
+ </div>
136
+ </div>
137
+ </div>
138
+ </div>
139
+
140
+ <div class="row">
141
+ <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
142
+ <div class="panel panel-primary">
143
+ <div class="panel-heading">
144
+ <h3 class="panel-title"><?php echo $this->__('Viewed') ?></h3>
145
+ </div>
146
+ <div class="panel-body">
147
+ <div id="enviadosAbertos" class="enviadosAbertos" style="height: 250px"></div>
148
+ </div>
149
+ </div>
150
+ </div>
151
+
152
+ <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
153
+ <div class="panel panel-primary">
154
+ <div class="panel-heading">
155
+ <h3 class="panel-title"><?php echo $this->__('Clicked') ?></h3>
156
+ </div>
157
+ <div class="panel-body">
158
+ <div id="clicadosAbertos" class="clicadosAbertos" style="height: 250px"></div>
159
+ </div>
160
+ </div>
161
+ </div>
162
+
163
+ <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
164
+ <div class="panel panel-primary">
165
+ <div class="panel-heading">
166
+ <h3 class="panel-title"><?php echo $this->__('Amount of abandoned carts') ?></h3>
167
+ </div>
168
+ <div class="panel-body">
169
+ <div id="cart" class="cart" style="height: 250px"></div>
170
+ </div>
171
+ </div>
172
+ </div>
173
+ </div>
174
+
175
+ <div class="row">
176
+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
177
+ <div class="panel panel-primary">
178
+ <div class="panel-heading">
179
+ <h3 class="panel-title"><?php echo $this->__('List of shots') ?></h3>
180
+ </div>
181
+
182
+
183
+ <div class="panel-body">
184
+ <table id="table" style="width: 100% !important">
185
+ <thead>
186
+ <tr>
187
+ <td><?php echo $this->__('ID') ?></td>
188
+ <td><?php echo $this->__('E-mail') ?></td>
189
+ <td><?php echo $this->__('Date') ?></td>
190
+ <td><?php echo $this->__('Clicked?') ?></td>
191
+ <td><?php echo $this->__('Viewed?') ?></td>
192
+ </tr>
193
+ </thead>
194
+
195
+ <tbody><?php echo $this->listItemsEnvio(); ?></tbody>
196
+ </table>
197
+ </div>
198
+ </div>
199
+ </div>
200
+ </div>
201
+
202
+ </div>
203
+
204
+
205
+ </body>
206
+ </html>
app/etc/modules/Jefferson_Cartabandoned.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Jefferson_Cartabandoned>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>1.0.0</version>
8
+ </Jefferson_Cartabandoned>
9
+ </modules>
10
+ </config>
app/locale/en_US/jefferson/cartabandoned/jefferson_cartabandoned.csv ADDED
File without changes
app/locale/en_US/template/email/jefferson/cartabandoned/cartabandoned.html ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var subject}} @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ @-->
7
+
8
+
9
+ <div style="background: url('{{var linkOpen}}')">
10
+ {{template config_path="design/email/header"}}
11
+ {{inlinecss file="email-inline.css"}}
12
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
13
+ <tr>
14
+ <td align="center" valign="top">
15
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
16
+ <tr>
17
+ <td align="center" valign="top">
18
+ <a href="{{store url=''}}" target="_blank">
19
+ <img src="http://oi65.tinypic.com/8whwud.jpg" style="display:block" alt="{{var store.getFrontendName()}}" width="800" />
20
+ </a>
21
+ </td>
22
+ </tr>
23
+ </table>
24
+ </td>
25
+ </tr>
26
+ </table>
27
+
28
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
29
+ <tr>
30
+ <td width="66"></td>
31
+ <td width="426">
32
+ <font style="font-family:Arial; font-style:normal; font-size:20px; color:#4d853d; line-height:35px">
33
+ Hello how are you?
34
+ </font>
35
+ </td>
36
+
37
+ <td align="right">
38
+ <img src="http://www.unius.com.br/img-emkt/quitandinha/03-11-2015/banner_2.jpg" style="disp lay:block" alt="{{var store.getFrontendName()}}"/>
39
+ </td>
40
+ </tr>
41
+ </table>
42
+
43
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
44
+ <tr>
45
+ <td width="66"></td>
46
+ <td width="426">
47
+ <font style="font-family:Arial; font-style:normal; font-size:20px; color:#4d853d; line-height:35px">
48
+ Found in your cart the <br />products you chose, <br />We want to remind you that you still <br />You can complete your purchase!
49
+ </font>
50
+ </td>
51
+ <td align="right">
52
+ <img src="http://i63.tinypic.com/swwu35.jpg" style="display:block" alt="{{var store.getFrontendName()}}"/>
53
+ </td>
54
+ </tr>
55
+ </table>
56
+
57
+
58
+ <table width="670" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto;">{{var html}}</table>
59
+
60
+
61
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
62
+ <tr>
63
+ <td height="20" align="center"></td>
64
+ </tr>
65
+ </table>
66
+
67
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
68
+ <tr>
69
+ <td align="center">
70
+ <a href="{{var link}}" target="_blank">
71
+ <font style="font-family:Arial; font-style:normal; font-size:20px; color:#4d853d; line-height:35px">
72
+ BUY
73
+ </font>
74
+ </a>
75
+ </td>
76
+ </tr>
77
+ </table>
78
+
79
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
80
+ <tr>
81
+ <td height="20" align="center"></td>
82
+ </tr>
83
+ </table>
84
+
85
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
86
+ <tr>
87
+ <td width="66"></td>
88
+ <td width="800" height="35" align="left">
89
+ <font style="font-family:Arial; font-style:normal; font-size:20px; color:#4d853d; line-height:35px">
90
+ <p>After all, you made the right choice by selecting products that will bring many benefits to your life.</p>
91
+ <p>If you still have any questions about your purchases, please contact us and tell us what happened!</p>
92
+ <p>We are waiting for your confirmation to deliver fresh and healthy products in your home.</p>
93
+ </font>
94
+ </td>
95
+ <td width="52"></td>
96
+ </tr>
97
+ </table>
98
+
99
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
100
+ <tr>
101
+ <td height="20" align="center"></td>
102
+ </tr>
103
+ </table>
104
+ {{template config_path="design/email/footer"}}
105
+ </div>
106
+
app/locale/pt_BR/jefferson/cartabandoned/jefferson_cartabandoned.csv ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Abandoned cart email marketing","E-mail marketing carrinho abandonado"
2
+ "Abandoned Cart","Carrinho abandonado"
3
+ "General","Geral"
4
+ "Enabled","Habilitar"
5
+ "select","Selecione"
6
+ "Trigger speed","Tempo de disparo"
7
+ "Time in seconds between a clock sending and other (In seconds)","Tempo em segundos entre um envio e outro (Em segundos)"
8
+ "The queue run interval","Tempo de intervalo da fila"
9
+ "Enabled Discount","Habilitar desconto"
10
+ "Discount Coupon","Cupom de desconto"
11
+ "Enter the discount coupon created (the coupon will be created through the menu promotion)","Digite o cupom de desconto criado (o cupom será criado através da promoção de menu)"
12
+ "Discount amount","Quantidade de desconto"
13
+ "Discount amount (e.g. 10% or $10.00)","Quantidade de desconto (Ex: 10% ou $10,00)"
14
+ "Report abandoned shopping cart shipping","Relatório do envio de carrinho abandonado"
15
+ "List customers cart abandoned","Lista clientes carrinho abandonado"
16
+ "Shoot","Disparar"
17
+ "Stop line","Parar fila"
18
+ "No information found","Nenhuma informação encontrada"
19
+ "Submissions made","Envios realizados"
20
+ "Send","Enviar"
21
+ "There's a line running, wait for this queue is over to start a new line.","Existe uma fila em execução, aguarde essa fila acabar para iniciar uma nova fila."
22
+ "Not found abandoned cart","Não foi encontrado carrinho abandonado"
23
+ "Failed to login","Falha ao efetuar o login"
24
+ "Cart not found","Carrinho não encontrado"
25
+ "Report abandoned shopping cart shipping","Relatório de envio carrinho abandonado"
26
+ "All the lines were successfully stops","Todas as filas foram paradas com sucesso"
27
+ "There is no running queues","Não existe filas em execução"
28
+ "General Report","Relatório Geral"
29
+ "Queue","Fila"
30
+ "Fired","Disparados"
31
+ "Viewed","Visualizados"
32
+ "Clicked","Clicados"
33
+ "Amount of abandoned carts","Quantidade de carrinhos abandonados"
34
+ "List of shots","Lista de disparos"
35
+ "Clicked?","Clicou?"
36
+ "Viewed?","Visualizou?"
37
+ "Not clicked","Não clicados"
38
+ "Not displayed","Não visualizados"
39
+ "Raised","Disparado"
40
+ "After","Depois"
41
+ "Before","Antes"
42
+ "Subject of e-mail","Assunto do e-mail"
43
+ "Enter the e-mail subject","Informe o assunto do e-mail"
44
+ "Run time in queue hours","Tempo de execução em horas de fila"
45
+ "Unable to send to the following recipient: ","Não foi possível enviar para o seguinte destinatário: "
46
+ "Unable to send alert to the following recipients: ","Não foi possível enviar o alerta para os seguintes destinatários: "
47
+ "The email has been sent to the following recipients: ","O e-mail foi enviado para os seguintes destinatários: "
48
+ "Repor","Relatório"
49
+ "Enter the e-mail subject",""
app/locale/pt_BR/template/email/jefferson/cartabandoned/cartabandoned.html ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var subject}} @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ @-->
7
+
8
+
9
+ <div style="background: url('{{var linkOpen}}')">
10
+ {{template config_path="design/email/header"}}
11
+ {{inlinecss file="email-inline.css"}}
12
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
13
+ <tr>
14
+ <td align="center" valign="top">
15
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
16
+ <tr>
17
+ <td align="center" valign="top">
18
+ <a href="{{store url=''}}" target="_blank">
19
+ <img src="http://oi65.tinypic.com/8whwud.jpg" style="display:block" alt="{{var store.getFrontendName()}}" width="800" />
20
+ </a>
21
+ </td>
22
+ </tr>
23
+ </table>
24
+ </td>
25
+ </tr>
26
+ </table>
27
+
28
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
29
+ <tr>
30
+ <td width="66"></td>
31
+ <td width="426">
32
+ <font style="font-family:Arial; font-style:normal; font-size:20px; color:#4d853d; line-height:35px">
33
+ Hello how are you?
34
+ </font>
35
+ </td>
36
+
37
+ <td align="right">
38
+ <img src="http://www.unius.com.br/img-emkt/quitandinha/03-11-2015/banner_2.jpg" style="disp lay:block" alt="{{var store.getFrontendName()}}"/>
39
+ </td>
40
+ </tr>
41
+ </table>
42
+
43
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
44
+ <tr>
45
+ <td width="66"></td>
46
+ <td width="426">
47
+ <font style="font-family:Arial; font-style:normal; font-size:20px; color:#4d853d; line-height:35px">
48
+ Found in your cart the <br />products you chose, <br />We want to remind you that you still <br />You can complete your purchase!
49
+ </font>
50
+ </td>
51
+ <td align="right">
52
+ <img src="http://i63.tinypic.com/swwu35.jpg" style="display:block" alt="{{var store.getFrontendName()}}"/>
53
+ </td>
54
+ </tr>
55
+ </table>
56
+
57
+
58
+ <table width="670" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto;">{{var html}}</table>
59
+
60
+
61
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
62
+ <tr>
63
+ <td height="20" align="center"></td>
64
+ </tr>
65
+ </table>
66
+
67
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
68
+ <tr>
69
+ <td align="center">
70
+ <a href="{{var link}}" target="_blank">
71
+ <font style="font-family:Arial; font-style:normal; font-size:20px; color:#4d853d; line-height:35px">
72
+ BUY
73
+ </font>
74
+ </a>
75
+ </td>
76
+ </tr>
77
+ </table>
78
+
79
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
80
+ <tr>
81
+ <td height="20" align="center"></td>
82
+ </tr>
83
+ </table>
84
+
85
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
86
+ <tr>
87
+ <td width="66"></td>
88
+ <td width="800" height="35" align="left">
89
+ <font style="font-family:Arial; font-style:normal; font-size:20px; color:#4d853d; line-height:35px">
90
+ <p>After all, you made the right choice by selecting products that will bring many benefits to your life.</p>
91
+ <p>If you still have any questions about your purchases, please contact us and tell us what happened!</p>
92
+ <p>We are waiting for your confirmation to deliver fresh and healthy products in your home.</p>
93
+ </font>
94
+ </td>
95
+ <td width="52"></td>
96
+ </tr>
97
+ </table>
98
+
99
+ <table width="800" align="center" cellpadding="0" cellspacing="0">
100
+ <tr>
101
+ <td height="20" align="center"></td>
102
+ </tr>
103
+ </table>
104
+ {{template config_path="design/email/footer"}}
105
+ </div>
106
+
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Jefferson_Cartabandoned</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://opensource.org/licenses/OSL-3.0">The Open Software License 3.0 (OSL-3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Triggers emails to customers with abandoned cart</summary>
10
+ <description>Triggers emails to customers with abandoned cart</description>
11
+ <notes>Up to date features not found any failure that prevents the functioning of this extension</notes>
12
+ <authors><author><name>Jefferson Batista Porto</name><user>fdsa451</user><email>jefferson.b.porto@gmail.com</email></author></authors>
13
+ <date>2015-12-15</date>
14
+ <time>20:29:38</time>
15
+ <contents><target name="magecommunity"><dir name="Jefferson"><dir name="Cartabandoned"><dir name="Block"><dir name="Adminhtml"><dir name="Abandoned"><file name="Grid.php" hash="707a4bd977171ac2022a8bcd154b9d8d"/></dir><file name="Abandoned.php" hash="f5e8c3470205188bfa13d5c25eb475ec"/><dir name="Abandonedreport"><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="5d7a9855803358aabe30510bb35cac61"/><file name="Option.php" hash="ae0626dd429e9519d33ce21b8abc478c"/></dir></dir><file name="Grid.php" hash="f899bc06cc4cf78ac7b84ae136659fa6"/></dir><file name="Abandonedreport.php" hash="7bc2c860c5fbcb24381231bd6d249574"/></dir><dir name="Frontend"><file name="Cartabandoned.php" hash="4b48e3e5db06d7348f8380caa39ec7cf"/><file name="Disparo.php" hash="e228405529410f4bd6e10a99f9fd1b61"/></dir></dir><dir name="Helper"><file name="Data.php" hash="597b6bd6783c75971b7d6e8f48c781cd"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Statusoptions.php" hash="557516bef74a7fa4bccdf85cbe26c6a5"/></dir></dir></dir></dir><file name="Cartabandoned.php" hash="6855e7a8123248e97b9912c1ccb16a2b"/><file name="Filaenvio.php" hash="d3e6eb9540039c8d6b32dd45e13d45e7"/><file name="Itemenvio.php" hash="4cdc5fa6c1ee2952db8b3ad298272ddf"/><dir name="Mysql4"><dir name="Cartabandoned"><file name="Collection.php" hash="92260affa9c8ec025260fe71b732fdde"/></dir><file name="Cartabandoned.php" hash="832a27ca991479e42fe571da5721123f"/><dir name="Filaenvio"><file name="Collection.php" hash="655494c728e829443aedb7144331f3c4"/></dir><file name="Filaenvio.php" hash="9d2a004440c261b53edf4e39936fa752"/><dir name="Itemenvio"><file name="Collection.php" hash="6298c56c0100e3fa921c520385a3f271"/></dir><file name="Itemenvio.php" hash="d532b1ea5c4cff450eba42abeef4f4c4"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AbandonedController.php" hash="7fa0c8d10cf3ab59387c21cea3ba7ec6"/><file name="AbandonedreportController.php" hash="964aa86d4fb83c9bb662589e4126f573"/></dir><file name="DisparoController.php" hash="64b2455e3caf23c961285898840ceda3"/><file name="IndexController.php" hash="0fe91be549e724c10a1044380dd10406"/></dir><dir name="etc"><file name="config.xml" hash="c7ae4434f157c44927710c07b17988fe"/><file name="system.xml" hash="a7b29c60714cfa2b92b8f4666a274e45"/></dir><dir name="sql"><dir name="jefferson_cartabandoned_setup"><file name="mysql4-install-1.0.0.php" hash="d33b7ea8519ade1537f4f4f8007b483d"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Jefferson_Cartabandoned.xml" hash="f4a27d2c50cf171a5ec58f50f9cbaabc"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="jefferson"><dir><dir name="cartabandoned"><file name="cartabandoned_report.phtml" hash="dc5c0f89d77f2612108f467e06d0ce54"/></dir></dir></dir></dir><dir name="layout"><dir name="jefferson"><dir><dir name="cartabandoned"><file name="jefferson_cartabandoned.xml" hash="d8135433951303a957cc23cae1df335e"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><dir name="jefferson"><dir name="cartabandoned"><file name="jefferson_cartabandoned.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir><dir name="template"><dir name="email"><dir name="jefferson"><dir name="cartabandoned"><file name="cartabandoned.html" hash="f6245b4e9c4e6f4f07250e0235ccc648"/></dir></dir></dir></dir></dir><dir name="pt_BR"><dir name="jefferson"><dir name="cartabandoned"><file name="jefferson_cartabandoned.csv" hash="9ad41221c11f8b5bd1046d9969390be7"/></dir></dir><dir name="template"><dir name="email"><dir name="jefferson"><dir name="cartabandoned"><file name="cartabandoned.html" hash="f6245b4e9c4e6f4f07250e0235ccc648"/></dir></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>