Cubix_AddressLabel - Version 1.0.0

Version Notes

-

Download this release

Release Info

Developer Magento Core Team
Extension Cubix_AddressLabel
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Cubix/AddressLabel/Block/Adminhtml/System/Config/Form/Fieldset/Modules/AddressLabel.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Harshit Jain <support@cubixws.co.uk>
4
+ * @category Cubix
5
+ * @package Cubix_AddressLabel
6
+ */
7
+ class Cubix_AddressLabel_Block_Adminhtml_System_Config_Form_Fieldset_Modules_AddressLabel extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
8
+
9
+ /**
10
+ * Return header html for fieldset
11
+ *
12
+ * @param Varien_Data_Form_Element_Abstract $element
13
+ * @return string
14
+ */
15
+ protected function _getHeaderHtml($element)
16
+ {
17
+ $html = parent::_getHeaderHtml($element);
18
+ $html = '<img src="' . $this->getSkinUrl('images/cubix_addresslabel.png') . '" alt="Cubix Address Label explanation" />' . $html;
19
+ return $html;
20
+ }
21
+ }
app/code/local/Cubix/AddressLabel/Helper/Data.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Harshit Jain <support@cubixws.co.uk>
4
+ * @category Cubix
5
+ * @package Cubix_AddressLabel
6
+ */
7
+ class Cubix_AddressLabel_Helper_Data extends Mage_Core_Helper_Abstract {
8
+
9
+ }
app/code/local/Cubix/AddressLabel/Model/Observer.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Harshit Jain <support@cubixws.co.uk>
4
+ * @category Cubix
5
+ * @package Cubix_AddressLabel
6
+ */
7
+ class Cubix_AddressLabel_Model_Observer extends Mage_Core_Model_Abstract {
8
+
9
+ /**
10
+ * Add address label massaction
11
+ *
12
+ * @param Varien_Event_Observer $observer
13
+ * @return Cubix_AddressLabel_Model_Observer
14
+ */
15
+ public function addMassaction($observer) {
16
+ if (!($observer->getEvent()->getBlock() instanceof Mage_Adminhtml_Block_Sales_Order_Grid)) {
17
+ return $this;
18
+ }
19
+ $block = $observer->getEvent()->getBlock();
20
+ $block->getMassactionBlock()->addItem('print_addresslabel', array(
21
+ 'label'=> Mage::helper('cubix_addresslabel')->__('Print Address Label'),
22
+ 'url' => Mage::getUrl('addresslabeladmin/adminhtml_pdf/printLabel'),
23
+ ));
24
+ }
25
+ }
app/code/local/Cubix/AddressLabel/Model/Pdf.php ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Harshit Jain <support@cubixws.co.uk>
4
+ * @category Cubix
5
+ * @package Cubix_AddressLabel
6
+ * @copyright Cubix Web Solutions <http://www.cubixws.co.uk>
7
+ */
8
+ class Cubix_AddressLabel_Model_Pdf extends Mage_Sales_Model_Order_Pdf_Abstract {
9
+
10
+ const XML_FONTSIZE = 'cubix/addresslabel/font_size';
11
+ const XML_PAGEWIDTH = 'cubix/addresslabel/page_width';
12
+ const XML_PAGEHEIGHT = 'cubix/addresslabel/page_height';
13
+ const XML_TOPMARGIN = 'cubix/addresslabel/top_margin';
14
+ const XML_SIDEMARGIN = 'cubix/addresslabel/side_margin';
15
+ const XML_NUMBERDOWN = 'cubix/addresslabel/number_down';
16
+ const XML_NUMBERACROSS = 'cubix/addresslabel/number_across';
17
+ const XML_VERTICALPITCH = 'cubix/addresslabel/vertical_pitch';
18
+ const XML_HORIZONTALPITCH = 'cubix/addresslabel/horizontal_pitch';
19
+ const XML_BOLDNAME = 'cubix/addresslabel/bold_name';
20
+ const XML_STARTFROM = 'cubix/addresslabel/start_from';
21
+ const XML_TOPPADDING = 'cubix/addresslabel/top_padding';
22
+ const XML_LEFTPADDING = 'cubix/addresslabel/left_padding';
23
+
24
+ protected $_configSettings = array();
25
+ protected $_currLabel;
26
+ protected $_currRow;
27
+ protected $_currColumn;
28
+ protected $x;
29
+
30
+
31
+ /**
32
+ * Get store config
33
+ *
34
+ * @param string $config
35
+ * @return string
36
+ */
37
+ protected function _config($config) {
38
+ if (!isset($this->_configSettings[$config])) {
39
+ $this->_configSettings[$config] = Mage::getStoreConfig($config);
40
+ }
41
+ return $this->_configSettings[$config];
42
+ }
43
+
44
+ /**
45
+ * Convert to postscript points
46
+ *
47
+ * @param int $inch
48
+ * @return int
49
+ */
50
+ protected function _convertInchToPoints($inch) {
51
+ return floor($inch * 72);
52
+ }
53
+
54
+ protected function _setFontRegular($object, $size = 8)
55
+ {
56
+ $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
57
+ $object->setFont($font, $size);
58
+ return $font;
59
+ }
60
+
61
+ protected function _setFontBold($object, $size = 8)
62
+ {
63
+ $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD);
64
+ $object->setFont($font, $size);
65
+ return $font;
66
+ }
67
+
68
+ /**
69
+ * Validate all configuration settings
70
+ *
71
+ * @return mixed
72
+ */
73
+ public function validate() {
74
+ $helper = Mage::helper('cubix_addresslabel');
75
+ if ((float)$this->_config(self::XML_FONTSIZE) < 1) {
76
+ return $helper->__('Invalid setting: Font Size. Go to System > Configuration > Address Labels');
77
+ }
78
+ if ((float)$this->_config(self::XML_PAGEWIDTH) < 1) {
79
+ return $helper->__('Invalid setting: Page Width. Go to System > Configuration > Address Labels');
80
+ }
81
+ if ((float)$this->_config(self::XML_PAGEHEIGHT) < 1) {
82
+ return $helper->__('Invalid setting: Page Height. Go to System > Configuration > Address Labels');
83
+ }
84
+ if ((float)$this->_config(self::XML_TOPMARGIN) < 0) {
85
+ return $helper->__('Invalid setting: Top Margin. Go to System > Configuration > Address Labels');
86
+ }
87
+ if ((float)$this->_config(self::XML_SIDEMARGIN) < 0) {
88
+ return $helper->__('Invalid setting: Side Margin. Go to System > Configuration > Address Labels');
89
+ }
90
+ if ((float)$this->_config(self::XML_LEFTPADDING) < 0) {
91
+ return $helper->__('Invalid setting: Left Padding. Go to System > Configuration > Address Labels');
92
+ }
93
+ if ((float)$this->_config(self::XML_TOPPADDING) < 0) {
94
+ return $helper->__('Invalid setting: Top Padding. Go to System > Configuration > Address Labels');
95
+ }
96
+ if ((int)$this->_config(self::XML_NUMBERDOWN) < 1) {
97
+ return $helper->__('Invalid setting: Number Down. Go to System > Configuration > Address Labels');
98
+ }
99
+ if ((int)$this->_config(self::XML_NUMBERACROSS) < 1) {
100
+ return $helper->__('Invalid setting: Number Across. Go to System > Configuration > Address Labels');
101
+ }
102
+ if ((float)$this->_config(self::XML_VERTICALPITCH) < 1) {
103
+ return $helper->__('Invalid setting: Vertical Pitch. Go to System > Configuration > Address Labels');
104
+ }
105
+ if ((float)$this->_config(self::XML_HORIZONTALPITCH) < 1) {
106
+ return $helper->__('Invalid setting: Horizontal Pitch. Go to System > Configuration > Address Labels');
107
+ }
108
+ $startFrom = trim($this->_config(self::XML_STARTFROM));
109
+ if ($startFrom != "") {
110
+ if (!preg_match('/^\d*,\d*$/', $startFrom)) {
111
+ return $helper->__('Invalid setting: Start printing from label. Use format row,column. Go to System > Configuration > Address Labels');
112
+ }
113
+ list($startRow, $startCol) = explode(',', $startFrom);
114
+ if ($startRow > (int)$this->_config(self::XML_NUMBERDOWN) || $startCol > (int)$this->_config(self::XML_NUMBERACROSS)) {
115
+ return $helper->__('Invalid setting: Start printing from label. Start row and column need to be less or equal to Number Down and Number Across settings respectively. Go to System > Configuration > Address Labels');
116
+ }
117
+ }
118
+ return true;
119
+ }
120
+
121
+ /**
122
+ * Config font size
123
+ *
124
+ * @return int
125
+ */
126
+ protected function _getConfigFontSize() {
127
+ return (float)$this->_config(self::XML_FONTSIZE);
128
+ }
129
+
130
+ /**
131
+ * Move one label row down and reset x position to first column
132
+ *
133
+ * @return \Cubix_AddressLabel_Model_Pdf
134
+ */
135
+ protected function _moveRow($keepColPos = false) {
136
+ $this->_currRow++;
137
+ $this->y -= floor($this->_convertInchToPoints((float)$this->_config(self::XML_VERTICALPITCH))) - $this->_getConfigFontSize();
138
+ if (!$keepColPos) {
139
+ $this->x = floor($this->_convertInchToPoints((float)$this->_config(self::XML_SIDEMARGIN)));
140
+ }
141
+ return $this;
142
+ }
143
+
144
+ /**
145
+ * Move one label column right
146
+ *
147
+ * @return \Cubix_AddressLabel_Model_Pdf
148
+ */
149
+ protected function _moveColumn() {
150
+ $this->_currColumn++;
151
+ $this->x += floor($this->_convertInchToPoints($this->_config(self::XML_HORIZONTALPITCH)));
152
+ return $this;
153
+ }
154
+
155
+ /**
156
+ * New page
157
+ *
158
+ * @param array $settings
159
+ * @return Zend_Pdf_Page
160
+ */
161
+ public function newPage(array $settings = array()) {
162
+ $pageWidth = $this->_convertInchToPoints((float)$this->_config(self::XML_PAGEWIDTH));
163
+ $pageHeight = $this->_convertInchToPoints((float)$this->_config(self::XML_PAGEHEIGHT));
164
+ $settings = array('page_size' => $pageWidth.":".$pageHeight.":");
165
+ $page = parent::newPage($settings);
166
+ $this->x = floor($this->_convertInchToPoints((float)$this->_config(self::XML_SIDEMARGIN)));
167
+ $this->y = floor($pageHeight - $this->_convertInchToPoints((float)$this->_config(self::XML_TOPMARGIN))) - $this->_getConfigFontSize();
168
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
169
+ $this->_setFontRegular($page, $this->_getConfigFontSize());
170
+ $this->_currLabel = 1;
171
+ $this->_currRow = 1;
172
+ $this->_currColumn = 1;
173
+ return $page;
174
+ }
175
+
176
+ /**
177
+ * Print labels
178
+ *
179
+ * @param array $orderIds
180
+ * @return Zend_Pdf
181
+ */
182
+ public function getPdf($orderIds = array()) {
183
+ $fontSize = $this->_getConfigFontSize();
184
+ $this->_beforeGetPdf();
185
+ $pdf = new Zend_Pdf();
186
+ $this->_setPdf($pdf);
187
+ $style = new Zend_Pdf_Style();
188
+ $this->_setFontRegular($style, $fontSize);
189
+ $page = $this->newPage();
190
+ $numberAcross = (int)$this->_config(self::XML_NUMBERACROSS);
191
+ $numberDown = (int)$this->_config(self::XML_NUMBERDOWN);
192
+ $totalInSheet = $numberAcross * $numberDown;
193
+ $startRow = 1;
194
+ $startCol = 1;
195
+ $startFrom = trim($this->_config(self::XML_STARTFROM));
196
+ if ($startFrom != "") {
197
+ list($startRow, $startCol) = explode(',', $startFrom);
198
+ }
199
+ $adjusted = false;
200
+ foreach ($orderIds as $orderId) {
201
+ $order = Mage::getModel('sales/order')->load($orderId);
202
+ if ($order->getIsVirtual()) {
203
+ continue;
204
+ }
205
+
206
+ /**
207
+ * Keep moving till you reach your start position
208
+ */
209
+ $adjusted1 = false;
210
+ if (!$adjusted) {
211
+ while ($this->_currRow < $startRow || $this->_currColumn < $startCol) {
212
+ if ($this->_currRow < $startRow) {
213
+ $this->_moveRow(true);
214
+ $this->_currLabel += $numberAcross;
215
+ }
216
+ if ($this->_currColumn < $startCol) {
217
+ $this->_moveColumn();
218
+ $this->_currLabel += 1;
219
+ }
220
+ if ($this->_currLabel > 1000) {
221
+ Mage::throwException('Error');
222
+ }
223
+ $adjusted = $adjusted1 = true;
224
+ }
225
+ }
226
+
227
+ /*
228
+ * Start new page
229
+ */
230
+ if ($this->_currLabel > $totalInSheet) {
231
+ $page = $this->newPage();
232
+ }
233
+
234
+ /* If number across done then move row */
235
+ if (!$adjusted1 && $this->_currLabel > 1 && ($this->_currLabel - 1) % $numberAcross == 0) {
236
+ $this->_moveRow();
237
+ }
238
+
239
+ /* Draw shiping address */
240
+ $tempY = $this->y;
241
+ $tempX = $this->x;
242
+ $shippingAddress = $this->_formatAddress($order->getShippingAddress()->format('addresslabel'));
243
+ $this->y -= $this->_convertInchToPoints((float)$this->_config(self::XML_TOPPADDING));
244
+ $this->x += $this->_convertInchToPoints((float)$this->_config(self::XML_LEFTPADDING));
245
+ $firstLine = true;
246
+ foreach ($shippingAddress as $value){
247
+ if ($this->_config(self::XML_BOLDNAME)) {
248
+ if ($firstLine) {
249
+ $this->_setFontBold($page, $this->_getConfigFontSize());
250
+ $firstLine = false;
251
+ }
252
+ else {
253
+ $this->_setFontRegular($page, $this->_getConfigFontSize());
254
+ }
255
+ }
256
+ if ($value!=='') {
257
+ $page->drawText(strip_tags(ltrim($value)), $this->x, $this->y, 'UTF-8');
258
+ $this->y -= $fontSize + ($fontSize * 0.2);
259
+ }
260
+ }
261
+ $this->y = $tempY;
262
+ $this->x = $tempX;
263
+
264
+ /* Move column */
265
+ $this->_moveColumn();
266
+
267
+ /* Increase label count */
268
+ $this->_currLabel++;
269
+ }
270
+ $this->_afterGetPdf();
271
+ return $pdf;
272
+ }
273
+ }
app/code/local/Cubix/AddressLabel/controllers/Adminhtml/PdfController.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Harshit Jain <support@cubixws.co.uk>
4
+ * @category Cubix
5
+ * @package Cubix_AddressLabel
6
+ */
7
+ class Cubix_AddressLabel_Adminhtml_PdfController extends Mage_Adminhtml_Controller_Action {
8
+
9
+ /**
10
+ * Create PDF for label
11
+ *
12
+ * @return PDF
13
+ */
14
+ public function printLabelAction() {
15
+ $orderIds = $this->getRequest()->getPost('order_ids');
16
+ $model = Mage::getModel('cubix_addresslabel/pdf');
17
+ if (!empty($orderIds)) {
18
+ $validate = $model->validate();
19
+ if ($validate !== true) {
20
+ $this->_getSession()->addError($validate);
21
+ }
22
+ else {
23
+ $pdf = $model->getPdf($orderIds);
24
+ return $this->_prepareDownloadResponse('label-'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').'.pdf', $pdf->render(), 'application/pdf');
25
+ }
26
+ }
27
+ $this->_getSession()->addError($this->__('Unable to print address labels'));
28
+ $this->_redirect('adminhtml/sales_order');
29
+ }
30
+ }
app/code/local/Cubix/AddressLabel/etc/adminhtml.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <cubix translate="title" module="cubix_addresslabel">
12
+ <title>Cubix Modules Section</title>
13
+ <sort_order>60</sort_order>
14
+ <children>
15
+ <addresslabel translate="title" module="cubix_addresslabel">
16
+ <title>Cubix Address Label Section</title>
17
+ <sort_order>60</sort_order>
18
+ </addresslabel>
19
+ </children>
20
+ </cubix>
21
+ </children>
22
+ </config>
23
+ </children>
24
+ </system>
25
+ </children>
26
+ </admin>
27
+ </resources>
28
+ </acl>
29
+ </config>
app/code/local/Cubix/AddressLabel/etc/config.xml ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Harshit Jain <support@cubixws.co.uk>
5
+ * @category Cubix
6
+ * @package Cubix_AddressLabel
7
+ */
8
+ -->
9
+ <config>
10
+ <modules>
11
+ <Cubix_AddressLabel>
12
+ <version>1.0.0</version>
13
+ </Cubix_AddressLabel>
14
+ </modules>
15
+
16
+ <admin>
17
+ <routers>
18
+ <cubix_addresslabel>
19
+ <use>admin</use>
20
+ <args>
21
+ <module>Cubix_AddressLabel</module>
22
+ <frontName>addresslabeladmin</frontName>
23
+ </args>
24
+ </cubix_addresslabel>
25
+ </routers>
26
+ </admin>
27
+
28
+ <global>
29
+ <events>
30
+ <adminhtml_block_html_before>
31
+ <observers>
32
+ <add_massaction_order_grid>
33
+ <class>cubix_addresslabel/observer</class>
34
+ <method>addMassaction</method>
35
+ </add_massaction_order_grid>
36
+ </observers>
37
+ </adminhtml_block_html_before>
38
+ </events>
39
+
40
+ <blocks>
41
+ <cubix_addresslabel>
42
+ <class>Cubix_AddressLabel_Block</class>
43
+ </cubix_addresslabel>
44
+ </blocks>
45
+
46
+ <models>
47
+ <cubix_addresslabel>
48
+ <class>Cubix_AddressLabel_Model</class>
49
+ <resourceModel>cubix_addresslabel_mysql4</resourceModel>
50
+ </cubix_addresslabel>
51
+ <cubix_addresslabel_mysql4>
52
+ <class>Cubix_AddressLabel_Model_Mysql4</class>
53
+ </cubix_addresslabel_mysql4>
54
+ </models>
55
+
56
+ <helpers>
57
+ <cubix_addresslabel>
58
+ <class>Cubix_AddressLabel_Helper</class>
59
+ </cubix_addresslabel>
60
+ </helpers>
61
+
62
+ <resources>
63
+ <cubix_addresslabel_setup>
64
+ <setup>
65
+ <module>Cubix_AddressLabel</module>
66
+ <class>Mage_Core_Model_Resource_Setup</class>
67
+ </setup>
68
+ <connection>
69
+ <use>core_setup</use>
70
+ </connection>
71
+ </cubix_addresslabel_setup>
72
+ <cubix_addresslabel_write>
73
+ <connection>
74
+ <use>core_write</use>
75
+ </connection>
76
+ </cubix_addresslabel_write>
77
+ <cubix_addresslabel_read>
78
+ <connection>
79
+ <use>core_read</use>
80
+ </connection>
81
+ </cubix_addresslabel_read>
82
+ </resources>
83
+
84
+ <customer>
85
+ <address>
86
+ <formats>
87
+ <addresslabel translate="title" module="cubix_addresslabel">
88
+ <title>Address Label</title>
89
+ </addresslabel>
90
+ </formats>
91
+ </address>
92
+ </customer>
93
+ </global>
94
+
95
+ <default>
96
+ <customer>
97
+ <address_templates>
98
+ <addresslabel><![CDATA[{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}|
99
+ {{depend company}}{{var company}}|{{/depend}}
100
+ {{if street1}}{{var street1}}
101
+ {{/if}}
102
+ {{depend street2}}{{var street2}}|{{/depend}}
103
+ {{depend street3}}{{var street3}}|{{/depend}}
104
+ {{depend street4}}{{var street4}}|{{/depend}}|
105
+ {{if city}}{{var city}}{{/if}}|
106
+ {{if region}}{{var region}}{{/if}}|
107
+ {{if postcode}}{{var postcode}}{{/if}}|
108
+ {{var country}}|]]></addresslabel>
109
+ </address_templates>
110
+ </customer>
111
+
112
+ <cubix>
113
+ <addresslabel>
114
+ <font_size>10</font_size>
115
+ <bold_name>1</bold_name>
116
+ </addresslabel>
117
+ </cubix>
118
+ </default>
119
+
120
+ </config>
app/code/local/Cubix/AddressLabel/etc/system.xml ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Harshit Jain <support@cubixws.co.uk>
5
+ * @category Cubix
6
+ * @package Cubix_AddressLabel
7
+ */
8
+ -->
9
+ <config>
10
+ <tabs>
11
+ <cubix_modules translate="label" module="cubix_addresslabel">
12
+ <label>Cubix Modules</label>
13
+ <sort_order>500</sort_order>
14
+ </cubix_modules>
15
+ </tabs>
16
+ <sections>
17
+ <cubix translate="label" module="cubix_addresslabel">
18
+ <class>separator-top</class>
19
+ <label>Address Labels</label>
20
+ <tab>cubix_modules</tab>
21
+ <sort_order>100</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
+ <groups>
26
+ <addresslabel translate="label">
27
+ <label>Label Settings</label>
28
+ <frontend_type>text</frontend_type>
29
+ <frontend_model>cubix_addresslabel/adminhtml_system_config_form_fieldset_modules_addressLabel</frontend_model>
30
+ <sort_order>10</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
+ <fields>
35
+ <number_down translate="label">
36
+ <label>Number down</label>
37
+ <frontend_type>text</frontend_type>
38
+ <sort_order>10</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ </number_down>
43
+ <number_across translate="label">
44
+ <label>Number across</label>
45
+ <frontend_type>text</frontend_type>
46
+ <sort_order>20</sort_order>
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
+ </number_across>
51
+ <page_height translate="label comment">
52
+ <label>Page Height</label>
53
+ <frontend_type>text</frontend_type>
54
+ <sort_order>30</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
57
+ <show_in_store>1</show_in_store>
58
+ <comment><![CDATA[In inches, without any metric symbol. For eg. 8.7]]></comment>
59
+ </page_height>
60
+ <page_width translate="label">
61
+ <label>Page Width</label>
62
+ <frontend_type>text</frontend_type>
63
+ <sort_order>40</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>1</show_in_store>
67
+ <comment><![CDATA[In inches, without any metric symbol. For eg. 6.6]]></comment>
68
+ </page_width>
69
+ <width translate="label">
70
+ <label>Label Width</label>
71
+ <frontend_type>text</frontend_type>
72
+ <sort_order>50</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
+ <comment><![CDATA[In inches, without any metric symbol. For eg. 2.95]]></comment>
77
+ </width>
78
+ <height translate="label">
79
+ <label>Label Height</label>
80
+ <frontend_type>text</frontend_type>
81
+ <sort_order>60</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ <comment><![CDATA[In inches, without any metric symbol. For eg. 2]]></comment>
86
+ </height>
87
+ <vertical_pitch translate="label">
88
+ <label>Vertical pitch</label>
89
+ <frontend_type>text</frontend_type>
90
+ <sort_order>70</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ <comment><![CDATA[In inches, without any metric symbol. For eg. 2.2]]></comment>
95
+ </vertical_pitch>
96
+ <horizontal_pitch translate="label">
97
+ <label>Horizontal pitch</label>
98
+ <frontend_type>text</frontend_type>
99
+ <sort_order>80</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ <comment><![CDATA[In inches, without any metric symbol. For eg. 3.2]]></comment>
104
+ </horizontal_pitch>
105
+ <top_margin translate="label">
106
+ <label>Top margin</label>
107
+ <frontend_type>text</frontend_type>
108
+ <sort_order>90</sort_order>
109
+ <show_in_default>1</show_in_default>
110
+ <show_in_website>1</show_in_website>
111
+ <show_in_store>1</show_in_store>
112
+ <comment><![CDATA[In inches, without any metric symbol. For eg. 0.1]]></comment>
113
+ </top_margin>
114
+ <side_margin translate="label">
115
+ <label>Side margin</label>
116
+ <frontend_type>text</frontend_type>
117
+ <sort_order>100</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>1</show_in_store>
121
+ <comment><![CDATA[In inches, without any metric symbol. For eg. 0.3]]></comment>
122
+ </side_margin>
123
+ <top_padding translate="label">
124
+ <label>Top padding</label>
125
+ <frontend_type>text</frontend_type>
126
+ <sort_order>103</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>1</show_in_store>
130
+ <comment><![CDATA[In inches, without any metric symbol. For eg. 0.1]]></comment>
131
+ </top_padding>
132
+ <left_padding translate="label">
133
+ <label>Left padding</label>
134
+ <frontend_type>text</frontend_type>
135
+ <sort_order>106</sort_order>
136
+ <show_in_default>1</show_in_default>
137
+ <show_in_website>1</show_in_website>
138
+ <show_in_store>1</show_in_store>
139
+ <comment><![CDATA[In inches, without any metric symbol. For eg. 0.1]]></comment>
140
+ </left_padding>
141
+ <font_size translate="label">
142
+ <label>Font Size</label>
143
+ <frontend_type>text</frontend_type>
144
+ <sort_order>110</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
+ <comment><![CDATA[For eg. 10]]></comment>
149
+ </font_size>
150
+ <start_from translate="label">
151
+ <label>Start printing from label</label>
152
+ <frontend_type>text</frontend_type>
153
+ <sort_order>120</sort_order>
154
+ <comment><![CDATA[row,column format. Eg. To start from 2nd row 1st column enter 2,1. Leave blank to start printing from first row, first column]]></comment>
155
+ <show_in_default>1</show_in_default>
156
+ <show_in_website>1</show_in_website>
157
+ <show_in_store>1</show_in_store>
158
+ </start_from>
159
+ <bold_name translate="label">
160
+ <label>Bold customer name?</label>
161
+ <frontend_type>select</frontend_type>
162
+ <source_model>adminhtml/system_config_source_yesno</source_model>
163
+ <sort_order>130</sort_order>
164
+ <show_in_default>1</show_in_default>
165
+ <show_in_website>1</show_in_website>
166
+ <show_in_store>1</show_in_store>
167
+ </bold_name>
168
+ </fields>
169
+ </addresslabel>
170
+ </groups>
171
+ </cubix>
172
+ </sections>
173
+ </config>
app/etc/modules/Cubix_AddressLabel.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Cubix_AddressLabel>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Cubix_AddressLabel>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Cubix_AddressLabel</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Print address labels directly from Magento admin. Ability to configure address label sheet size and other parameters</summary>
10
+ <description>Cubix Address Label Printing&#xD;
11
+ &#xD;
12
+ &lt;br /&gt;&lt;br /&gt;Do you need to print Address labels directly from the Magento admin panel? The latest extension from Cubix allows you to just do that. You can select multiple orders from the Order grid and print address labels in just one click. You can configure the label sheet dimensions. You can also specify the label (row and column number) from where yoru printing should start.&#xD;
13
+ &#xD;
14
+ &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Features:&lt;/strong&gt;&lt;br /&gt;&#xD;
15
+ * Lightweight and compatible with all extensions.&lt;br /&gt;&#xD;
16
+ * Ability to specify the exact dimensions of the address label sheet.&lt;br /&gt;&#xD;
17
+ * Ability to specify the starting row and column label in the address label sheet. No need to throw away the half used sheets.&lt;br /&gt;&#xD;
18
+ &#xD;
19
+ &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Demo:&lt;/strong&gt; &lt;a href="http://magedemo1.cubixws.co.uk"&gt;http://magedemo1.cubixws.co.uk&lt;/a&gt;&#xD;
20
+ &#xD;
21
+ &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Installation instructions:&lt;/strong&gt;&lt;br /&gt;&#xD;
22
+ * Go to Admin Panel &gt; System &gt; Magento Connect &gt; Magento Connect Manager and install the extension.&lt;br /&gt;&#xD;
23
+ * Refresh all cache. go to Admin Panel &gt; System &gt; Cache Management, click on 'Select All' to select all your cache, choose 'Refresh' from Actions and click on Submit.&lt;br /&gt;&#xD;
24
+ &#xD;
25
+ &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Instructions for use:&lt;/strong&gt;&lt;br /&gt;&#xD;
26
+ * Go to Admin Panel &gt; Sales &gt; Orders. &lt;br /&gt;&#xD;
27
+ * Select the orders for which you would like an address label.&lt;br /&gt;&#xD;
28
+ * Under 'Actions' dropdown select 'Print Address Labels' and press Submit. Your Address Labels PDF will be downloaded&lt;br /&gt;&#xD;
29
+ * &lt;strong&gt;Important:&lt;/strong&gt; The Address Labels PDF is generated based on the size you specify in the Magento admin panel. However you will need to configure your custom label sheet page height and width in your printer properties. By default most printers will print PDF files on A4 size which may not be your label sheet size.</description>
30
+ <notes>-</notes>
31
+ <authors><author><name>Harshit Jain</name><user>auto-converted</user><email>enquiry@cubixws.com</email></author></authors>
32
+ <date>2012-06-14</date>
33
+ <time>21:37:48</time>
34
+ <contents><target name="magelocal"><dir name="Cubix"><dir name="AddressLabel"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="Modules"><file name="AddressLabel.php" hash="485dc81ac16f28ec2414d26cae130523"/></dir></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="5c21d42b7afd762f6c82cc685c4f5a77"/></dir><dir name="Model"><file name="Observer.php" hash="e07d1e809cd1c20e79b285b412881c13"/><file name="Pdf.php" hash="4bac76da330d04208dd95c9521f3f147"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PdfController.php" hash="00456a5fb6a968017181cb94511f072a"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="796b30d8a9f33dade2c4be0d9cc84de1"/><file name="config.xml" hash="0e0aa67c5d4cfb87c7ae3f5c7dfadfe9"/><file name="system.xml" hash="351b42a672032dd70546b4099538eb41"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cubix_AddressLabel.xml" hash="a7ed0bb339eb42ddc4d6e3e3416f8504"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="cubix_addresslabel.png" hash="54fb643a8d3f48f60211c674a36e9c5a"/></dir></dir></dir></dir></target></contents>
35
+ <compatible/>
36
+ <dependencies/>
37
+ </package>
skin/adminhtml/default/default/images/cubix_addresslabel.png ADDED
Binary file