prashant_customer_invoice - Version 1.0.0

Version Notes

First Release

Download this release

Release Info

Developer Prashant Kumar
Extension prashant_customer_invoice
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Prashant/CustomerInvoices/Block/Index.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Prashant_CustomerInvoices_Block_Index extends Mage_Core_Block_Template
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate('customer/account/invoices.phtml');
9
+
10
+ $this->setInvoices( $this->getAllInvoices() );
11
+ }
12
+
13
+ public function getAllInvoices()
14
+ {
15
+ $invoices = Mage::getResourceModel('sales/order_invoice_collection');
16
+ $select = $invoices->getSelect();
17
+ $select->joinLeft(array('order' => Mage::getModel('core/resource')->getTableName('sales/order')), 'order.entity_id=main_table.order_id', array('customer_id' => 'customer_id'));
18
+ $customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
19
+ $invoices->addFieldToFilter('customer_id',$customerId);
20
+ return $invoices;
21
+ }
22
+
23
+ protected function _prepareLayout()
24
+ {
25
+ parent::_prepareLayout();
26
+
27
+ $pager = $this->getLayout()->createBlock('page/html_pager', 'invoices.pager');
28
+ $pager->setAvailableLimit(array(10=>10, 15=>15, 30=>30, $this->getInvoices()->getSize() => $this->__('All') ));
29
+ $pager->setCollection( $this->getInvoices() );
30
+
31
+ $this->setChild('pager', $pager);
32
+ $this->getInvoices()->load();
33
+
34
+ return $this;
35
+ }
36
+
37
+ public function getPagerHtml()
38
+ {
39
+ return $this->getChildHtml('pager');
40
+ }
41
+ }
app/code/community/Prashant/CustomerInvoices/controllers/CustomerInvoiceController.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Prashant_CustomerInvoices_CustomerInvoiceController extends Mage_Core_Controller_Front_Action {
3
+
4
+ public function indexAction() {
5
+ $this->loadLayout();
6
+ $this->getLayout()->getBlock("head")->setTitle($this->__("Invoices"));
7
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
8
+ $breadcrumbs->addCrumb("home", array(
9
+ "label" => $this->__("Home Page"),
10
+ "title" => $this->__("Home Page"),
11
+ "link" => Mage::getBaseUrl()
12
+ ));
13
+
14
+ $breadcrumbs->addCrumb("customer-invoices", array(
15
+ "label" => $this->__("Invoices"),
16
+ "title" => $this->__("Invoices")
17
+ ));
18
+ $this->renderLayout();
19
+ }
20
+
21
+
22
+ public function viewAction() {
23
+ $orderId = (int) $this->getRequest()->getParam('order_id');
24
+ $order = Mage::getModel('sales/order')->load($orderId);
25
+
26
+ if ($this->_canViewOrder($order)) {
27
+ $invoices = Mage::getResourceModel('sales/order_invoice_collection')
28
+ ->setOrderFilter($order->getId())
29
+ ->load();
30
+ if ($invoices->getSize() > 0) {
31
+ $pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf($invoices);
32
+
33
+ return $this->_prepareDownloadResponse(
34
+ 'invoice-'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').'.pdf', $pdf->render(),
35
+ 'application/pdf'
36
+ );
37
+
38
+ }
39
+ }
40
+ }
41
+
42
+ public function preDispatch()
43
+ {
44
+ parent::preDispatch();
45
+ $action = $this->getRequest()->getActionName();
46
+ $loginUrl = Mage::helper('customer')->getLoginUrl();
47
+
48
+ if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) {
49
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
50
+ }
51
+ }
52
+
53
+ protected function _canViewOrder($order)
54
+ {
55
+ $customerId = Mage::getSingleton('customer/session')->getCustomerId();
56
+ $availableStates = Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates();
57
+ if ($order->getId() && $order->getCustomerId() && ($order->getCustomerId() == $customerId)
58
+ && in_array($order->getState(), $availableStates, $strict = true)
59
+ ) {
60
+ return true;
61
+ }
62
+ return false;
63
+ }
64
+ }
app/code/community/Prashant/CustomerInvoices/etc/config.xml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Prashant_CustomerInvoices>
5
+ <version>1.0.0</version>
6
+ </Prashant_CustomerInvoices>
7
+ </modules>
8
+
9
+ <frontend>
10
+ <routers>
11
+ <prashant>
12
+ <use>standard</use>
13
+ <args>
14
+ <module>Prashant_CustomerInvoices</module>
15
+ <frontName>prashant</frontName>
16
+ </args>
17
+ </prashant>
18
+ </routers>
19
+
20
+ <layout>
21
+ <updates>
22
+ <prashant>
23
+ <file>customerinvoices.xml</file>
24
+ </prashant>
25
+ </updates>
26
+ </layout>
27
+ </frontend>
28
+
29
+ <global>
30
+ <blocks>
31
+ <invoices>
32
+ <class>Prashant_CustomerInvoices_Block</class>
33
+ </invoices>
34
+ </blocks>
35
+ </global>
36
+ </config>
app/code/community/Prashant/Headerlogo/Block/Html/Header.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Prashant_Headerlogo_Block_html_Header extends Mage_Core_Block_Template
3
+ {
4
+ public function _construct()
5
+ {
6
+ $this->setTemplate('page/html/header.phtml');
7
+ }
8
+
9
+ public function getIsHomePage()
10
+ {
11
+ return $this->getUrl('') == $this->getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true));
12
+ }
13
+
14
+ public function setLogo($logo_src, $logo_alt)
15
+ {
16
+ $this->setLogoSrc($logo_src);
17
+ $this->setLogoAlt($logo_alt);
18
+ return $this;
19
+ }
20
+
21
+ public function getLogoSrc()
22
+ {
23
+
24
+ if (empty($this->_data['logo_src'])) {
25
+ $this->_data['logo_src'] = $this->_getLogoFile();
26
+ }
27
+ return $this->_data['logo_src'];
28
+ }
29
+
30
+ protected function _getLogoFile()
31
+ {
32
+ $folderName = Prashant_Headerlogo_Model_System_Config_Backend_Image_Logo::UPLOAD_DIR;
33
+ $storeConfig = Mage::getStoreConfig('design/header/logo_src');
34
+ $logoFile = Mage::getBaseUrl('media') . $folderName . '/' . $storeConfig;
35
+ $absolutePath = Mage::getBaseDir('media') . '/' . $folderName . '/' . $storeConfig;
36
+
37
+ if(!is_null($storeConfig) && $this->_isFile($absolutePath)) {
38
+ $url = $logoFile;
39
+ } else {
40
+ $url = $this->getSkinUrl('images/media/logo.png');
41
+ }
42
+ return $url;
43
+ }
44
+
45
+ protected function _isFile($filename) {
46
+ if (Mage::helper('core/file_storage_database')->checkDbUsage() && !is_file($filename)) {
47
+ Mage::helper('core/file_storage_database')->saveFileToFilesystem($filename);
48
+ }
49
+ return is_file($filename);
50
+ }
51
+ }
app/code/community/Prashant/Headerlogo/Helper/Data.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Prashant_Headerlogo_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+ }
app/code/community/Prashant/Headerlogo/Model/System/Config/Backend/Image/Logo.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Prashant_Headerlogo_Model_System_Config_Backend_Image_Logo extends Mage_Adminhtml_Model_System_Config_Backend_Image
3
+ {
4
+ const UPLOAD_DIR = 'logoimage';
5
+ const UPLOAD_ROOT = 'media';
6
+
7
+ protected function _getUploadDir()
8
+ {
9
+ $newdirPath = Mage::getBaseDir('media') . DS . "logoimage";
10
+ if (!file_exists($newdirPath)) {
11
+ mkdir($newdirPath, 0777);
12
+ }
13
+ $uploadDir = $this->_appendScopeInfo(self::UPLOAD_DIR);
14
+ $uploadRoot = $this->_getUploadRoot(self::UPLOAD_ROOT);
15
+ $uploadDir = $uploadRoot . '/' . $uploadDir;
16
+ return $uploadDir;
17
+ }
18
+
19
+ protected function _addWhetherScopeInfo()
20
+ {
21
+ return true;
22
+ }
23
+
24
+ protected function _getAllowedExtensions()
25
+ {
26
+ return array('ico', 'png', 'gif', 'jpg', 'jpeg', 'apng', 'svg');
27
+ }
28
+
29
+ protected function _getUploadRoot($token) {
30
+ return Mage::getBaseDir($token);
31
+ }
32
+
33
+ }
app/code/community/Prashant/Headerlogo/etc/adminhtml.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <adminhtml>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <prashant_headerlogo>
12
+ <title>Prashant Headerlogo</title>
13
+ </prashant_headerlogo>
14
+ </children>
15
+ </config>
16
+ </children>
17
+ </system>
18
+ </children>
19
+ </admin>
20
+ </resources>
21
+ </acl>
22
+ </adminhtml>
app/code/community/Prashant/Headerlogo/etc/config.xml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Prashant_Headerlogo>
5
+ <version>0.1.0</version>
6
+ </Prashant_Headerlogo>
7
+ </modules>
8
+ <adminhtml>
9
+ <acl>
10
+ <resources>
11
+ <all>
12
+ <title>Allow Everything</title>
13
+ </all>
14
+ <admin>
15
+ <children>
16
+ <Prashant_Headerlogo>
17
+ <title>Headerlogo</title>
18
+ <sort_order>10</sort_order>
19
+ </Prashant_Headerlogo>
20
+ </children>
21
+ </admin>
22
+ </resources>
23
+ </acl>
24
+ </adminhtml>
25
+ <global>
26
+ <models>
27
+ <headerlogo>
28
+ <class>Prashant_Headerlogo_Model</class>
29
+ </headerlogo>
30
+ </models>
31
+ <blocks>
32
+ <page>
33
+ <rewrite>
34
+ <html_header>Prashant_Headerlogo_Block_Html_Header</html_header>
35
+ </rewrite>
36
+ </page>
37
+ </blocks>
38
+ <helpers>
39
+ <headerlogo>
40
+ <class>Prashant_Headerlogo_Helper</class>
41
+ </headerlogo>
42
+ </helpers>
43
+ </global>
44
+ </config>
app/code/community/Prashant/Headerlogo/etc/system.xml ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <prashant_extension_tab translate="label" module="headerlogo">
5
+ <label>Prashant Extensions</label>
6
+ <sort_order>120</sort_order>
7
+ </prashant_extension_tab>
8
+ </tabs>
9
+ <sections>
10
+ <prashant_headerlogo module="headerlogo" translate="label">
11
+ <label>Store Logo Upload </label>
12
+ <sort_order>200</sort_order>
13
+ <show_in_default>1</show_in_default>
14
+ <show_in_website>1</show_in_website>
15
+ <show_in_store>1</show_in_store>
16
+ <tab>prashant_extension_tab</tab>
17
+ <groups>
18
+ <header_setting translate="label">
19
+ <label>Store logo Settings</label>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>200</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <enabled>
27
+ <label>Enable Store logo</label>
28
+ <frontend_type>select</frontend_type>
29
+ <source_model>adminhtml/system_config_source_yesno</source_model>
30
+ <sort_order>150</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ <comment>Enable Headerlogo script</comment>
35
+ </enabled>
36
+ </fields>
37
+ </header_setting>
38
+ </groups>
39
+ </prashant_headerlogo>
40
+ <design translate="label" module="core">
41
+ <groups>
42
+ <head translate="label">
43
+ <label>HTML Head</label>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>20</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ <fields>
50
+ <shortcut_icon translate="label comment">
51
+ <label>Favicon Icon</label>
52
+ <comment>Allowed file types: ICO, PNG, GIF, JPG, JPEG, APNG, SVG. Not all browsers support all these formats!</comment>
53
+ <frontend_type>image</frontend_type>
54
+ <backend_model>adminhtml/system_config_backend_image_favicon</backend_model>
55
+ <base_url type="media" scope_info="1">favicon</base_url>
56
+ <sort_order>5</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ </shortcut_icon>
61
+ <default_title translate="label">
62
+ <label>Default Title</label>
63
+ <frontend_type>text</frontend_type>
64
+ <sort_order>10</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ </default_title>
69
+ <title_prefix translate="label">
70
+ <label>Title Prefix</label>
71
+ <frontend_type>text</frontend_type>
72
+ <sort_order>12</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </title_prefix>
77
+ <title_suffix translate="label">
78
+ <label>Title Suffix</label>
79
+ <frontend_type>text</frontend_type>
80
+ <sort_order>14</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </title_suffix>
85
+ <default_description translate="label">
86
+ <label>Default Description</label>
87
+ <frontend_type>textarea</frontend_type>
88
+ <sort_order>20</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ </default_description>
93
+ <default_keywords translate="label">
94
+ <label>Default Keywords</label>
95
+ <frontend_type>textarea</frontend_type>
96
+ <sort_order>30</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ </default_keywords>
101
+ <default_robots translate="label">
102
+ <label>Default Robots</label>
103
+ <frontend_type>select</frontend_type>
104
+ <source_model>adminhtml/system_config_source_design_robots</source_model>
105
+ <sort_order>40</sort_order>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>1</show_in_website>
108
+ <show_in_store>1</show_in_store>
109
+ </default_robots>
110
+ <includes translate="label comment">
111
+ <label>Miscellaneous Scripts</label>
112
+ <comment>This will be included before head closing tag in page HTML.</comment>
113
+ <frontend_type>textarea</frontend_type>
114
+ <sort_order>70</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ </includes>
119
+ <demonotice translate="label comment">
120
+ <label>Display Demo Store Notice</label>
121
+ <frontend_type>select</frontend_type>
122
+ <source_model>adminhtml/system_config_source_yesno</source_model>
123
+ <sort_order>80</sort_order>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ <show_in_store>1</show_in_store>
127
+ </demonotice>
128
+ </fields>
129
+ </head>
130
+ <header translate="label">
131
+ <label>Header</label>
132
+ <frontend_type>text</frontend_type>
133
+ <sort_order>30</sort_order>
134
+ <show_in_default>1</show_in_default>
135
+ <show_in_website>1</show_in_website>
136
+ <show_in_store>1</show_in_store>
137
+ <fields>
138
+ <logo_src translate="label comment">
139
+ <label>Logo Image Source</label>
140
+ <comment>Allowed file types: PNG, GIF, JPEG. Not all browsers support all these formats!</comment>
141
+ <frontend_type>image</frontend_type>
142
+ <backend_model>headerlogo/system_config_backend_image_logo</backend_model>
143
+ <base_url type="media" scope_info="1">logoimage</base_url>
144
+ <sort_order>10</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>1</show_in_website>
147
+ <show_in_store>1</show_in_store>
148
+ </logo_src>
149
+ <logo_alt translate="label">
150
+ <label>Logo Image Alt</label>
151
+ <frontend_type>text</frontend_type>
152
+ <sort_order>20</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>1</show_in_store>
156
+ </logo_alt>
157
+ <logo_src_small translate="label">
158
+ <label>Small Logo Image Src</label>
159
+ <frontend_type>text</frontend_type>
160
+ <sort_order>25</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>1</show_in_website>
163
+ <show_in_store>1</show_in_store>
164
+ </logo_src_small>
165
+ <welcome translate="label">
166
+ <label>Welcome Text</label>
167
+ <frontend_type>text</frontend_type>
168
+ <sort_order>30</sort_order>
169
+ <show_in_default>1</show_in_default>
170
+ <show_in_website>1</show_in_website>
171
+ <show_in_store>1</show_in_store>
172
+ </welcome>
173
+ </fields>
174
+ </header>
175
+ <footer translate="label">
176
+ <label>Footer</label>
177
+ <frontend_type>text</frontend_type>
178
+ <sort_order>40</sort_order>
179
+ <show_in_default>1</show_in_default>
180
+ <show_in_website>1</show_in_website>
181
+ <show_in_store>1</show_in_store>
182
+ <fields>
183
+ <copyright translate="label">
184
+ <label>Copyright</label>
185
+ <frontend_type>textarea</frontend_type>
186
+ <sort_order>10</sort_order>
187
+ <show_in_default>1</show_in_default>
188
+ <show_in_website>1</show_in_website>
189
+ <show_in_store>1</show_in_store>
190
+ </copyright>
191
+ <absolute_footer translate="label comment">
192
+ <label>Miscellaneous HTML</label>
193
+ <comment>This will be displayed just before body closing tag.</comment>
194
+ <frontend_type>textarea</frontend_type>
195
+ <sort_order>20</sort_order>
196
+ <show_in_default>1</show_in_default>
197
+ <show_in_website>1</show_in_website>
198
+ <show_in_store>1</show_in_store>
199
+ </absolute_footer>
200
+ </fields>
201
+ </footer>
202
+ </groups>
203
+ <depends><enabled>1</enabled></depends>
204
+ </design>
205
+ </sections>
206
+ </config>
app/design/frontend/base/default/layout/customerinvoices.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+
4
+ <customer_account>
5
+ <reference name="customer_account_navigation">
6
+ <action method="addLink" translate="label">
7
+ <name>customerinvoices</name>
8
+ <path>prashant/customerInvoice</path>
9
+ <label>My Invoices</label>
10
+ </action>
11
+ </reference>
12
+ </customer_account>
13
+
14
+ <prashant_customerinvoice_index translate="label">
15
+ <label>Customer Invoices</label>
16
+ <update handle="customer_account"/>
17
+
18
+ <reference name="my.account.wrapper">
19
+ <block type="invoices/index" name="customer.invoices" template="customer/account/invoices.phtml"/>
20
+ </reference>
21
+ </prashant_customerinvoice_index>
22
+
23
+ </layout>
app/design/frontend/base/default/template/customer/account/invoices.phtml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="customer-invoices">
2
+ <?php if( $this->getInvoices()->getSize() ): ?>
3
+
4
+ <div class="page-title">
5
+ <h1><?php echo $this->__('My Invoices'); ?></h1>
6
+ </div>
7
+
8
+ <div class="toolbar"><?php echo $this->getPagerHtml(); ?></div>
9
+ <table id="invoices-table" class="data-table">
10
+ <thead>
11
+ <tr>
12
+ <th><strong><?php echo $this->__('Invoice Number'); ?></strong></th>
13
+ <th><strong><?php echo $this->__('Invoice Date'); ?></strong></th>
14
+ <th><strong><?php echo $this->__('Order #'); ?></strong></th>
15
+ <th><strong><?php echo $this->__('Order Date'); ?></strong></th>
16
+ <th width="15%"><strong><?php echo $this->__('Actions'); ?></strong></th>
17
+ </tr>
18
+ </thead>
19
+ <?php
20
+ foreach( $this->getInvoices() as $invoice): ?>
21
+ <tr>
22
+ <td>
23
+ <?php echo $invoice->getIncrementId(); ?>
24
+ </td>
25
+ <td>
26
+ <?php echo $invoice->getCreatedAt(); ?>
27
+ </td>
28
+ <td>
29
+ <a href="<?php echo $this->getUrl('sales/order/view', array('order_id' => $invoice->getOrder()->getId())); ?>">
30
+ <?php echo $invoice->getOrder()->getRealOrderId(); ?>
31
+ </a>
32
+ </td>
33
+ <td>
34
+ <?php echo $invoice->getOrder()->getCreatedAt(); ?>
35
+ </td>
36
+ <td>
37
+ <a href="<?php echo $this->getUrl('prashant/customerInvoice/view',
38
+ array('order_id' => $invoice->getOrder()->getId())); ?>">
39
+ <i class="fa fa-file-pdf-o"></i>
40
+ <?php echo $this->__('Create PDF'); ?>
41
+ </a>
42
+ |
43
+ <a href="<?php echo $this->getUrl('sales/order/invoice', array('order_id' => $invoice->getOrder()->getId()))
44
+ ?>">
45
+ <i class="fa fa-eye"></i>
46
+ <?php echo $this->__('View'); ?>
47
+ </a>
48
+ </td>
49
+ </tr>
50
+ <?php endforeach;
51
+ ?>
52
+ </table>
53
+ <div class="toolbar toolbar-bottom"><?php echo $this->getPagerHtml(); ?></div>
54
+ <?php else: ?>
55
+ <p class="notice-msg"><?php echo $this->__('No invoices'); ?></p>
56
+ <?php endif; ?>
57
+ </div>
app/etc/modules/Prashant_CustomerInvoices.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Prashant_CustomerInvoices>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Prashant_CustomerInvoices>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>prashant_customer_invoice</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Allow customers to view list of generated invoices and download Invoice PDF files.</summary>
10
+ <description>Allow customers to view list of all generated invoices and download Invoice PDF files.</description>
11
+ <notes>First Release</notes>
12
+ <authors><author><name>Prashant Kumar</name><user>prashantkr</user><email>vicky.bgp@gmail.com</email></author></authors>
13
+ <date>2016-07-19</date>
14
+ <time>10:59:42</time>
15
+ <contents><target name="magecommunity"><dir name="Prashant"><dir name="CustomerInvoices"><dir name="Block"><file name="Index.php" hash="3d00d79682f66ea527929d9b37bc37f4"/></dir><dir name="controllers"><file name="CustomerInvoiceController.php" hash="1036e82508ec6608571fce9f1bb74568"/></dir><dir name="etc"><file name="config.xml" hash="81d5216dc02582912f7a478e0f3e165f"/></dir></dir><dir name="Headerlogo"><dir name="Block"><dir name="Html"><file name="Header.php" hash="5d565da73eff1c14b0247d5f92c86901"/></dir></dir><dir name="Helper"><file name="Data.php" hash="c6a27189bf862febceb2425309022ecc"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Image"><file name="Logo.php" hash="48a43b5b95d007dc65d56869cb59a91e"/></dir></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="6935d5e4758764ba080c0c2d2ffb7165"/><file name="config.xml" hash="8c1be5eca26dfb5cd5f662cfb1a550d3"/><file name="system.xml" hash="768b55ccef08fe9709666223257a3c72"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Prashant_CustomerInvoices.xml" hash="19d70c91217a5bfbb5ee6a2cb4a922c3"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="customerinvoices.xml" hash="88a5f72607f6b08bcefa960d68939680"/></dir><dir name="template"><dir name="customer"><dir name="account"><file name="invoices.phtml" hash="ff2685fd4267c0b30106387babec1b7b"/></dir></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>