Version Notes
Update to some text and functionality.
Download this release
Release Info
Developer | SaveTheMage |
Extension | Custom_Invoice_And_Order_Numbers |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.2.0
- app/code/local/SaveTheMage/ChangeOrderNumber/Block/BlockForFormChangeOrderNumber.php +12 -0
- app/code/local/SaveTheMage/ChangeOrderNumber/Block/ShowTabsAdminBlock.php +40 -0
- app/code/local/SaveTheMage/ChangeOrderNumber/Helper/Data.php +6 -0
- app/code/local/SaveTheMage/ChangeOrderNumber/Model/numbers.php +75 -0
- app/code/local/SaveTheMage/ChangeOrderNumber/controllers/AdminControllersHere/ChangeOrderNumberController.php +125 -0
- app/code/local/SaveTheMage/ChangeOrderNumber/etc/config.xml +61 -0
- app/design/adminhtml/default/default/template/SaveTheMage/tab_container_FormChangeOrderNumber.phtml +120 -0
- app/etc/modules/SaveTheMage_ChangeOrderNumber.xml +9 -0
- package.xml +9 -7
app/code/local/SaveTheMage/ChangeOrderNumber/Block/BlockForFormChangeOrderNumber.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SaveTheMage_ChangeOrderNumber_Block_BlockForFormChangeOrderNumber extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setTemplate('SaveTheMage/tab_container_FormChangeOrderNumber.phtml');
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
app/code/local/SaveTheMage/ChangeOrderNumber/Block/ShowTabsAdminBlock.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SaveTheMage_ChangeOrderNumber_Block_ShowTabsAdminBlock extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('tabs_ChangeOrderNumber');
|
9 |
+
|
10 |
+
$this->setTitle(Mage::helper('ChangeOrderNumberHelper1')->__('To Change Order and Invoice Numbers'));
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function _beforeToHtml()
|
14 |
+
{
|
15 |
+
$this->addTab('tab1_ChangeOrderNumber', array(
|
16 |
+
'label' => Mage::helper('ChangeOrderNumberHelper1')->__('Change Order and Invoice Numbers'),
|
17 |
+
'title' => Mage::helper('ChangeOrderNumberHelper1')->__('Change Order and Invoice Numbers'),
|
18 |
+
'content' => $this->getLayout()->createBlock("ChangeOrderNumberBlock1/BlockForFormChangeOrderNumber")->toHtml(),
|
19 |
+
'active' => true
|
20 |
+
));
|
21 |
+
|
22 |
+
|
23 |
+
$about="<fieldset class='box' style='clear: both;'><table>
|
24 |
+
<tr><td>
|
25 |
+
<a title='SaveTheMage Magento Extensions' href='http://www.savethemage.com/'>
|
26 |
+
<img alt='SaveTheMage Magento Extensions' src='http://www.savethemage.com/skin/frontend/default/magik_aura/images/savethemage-logo-icon.png'>
|
27 |
+
</a>
|
28 |
+
</td></tr>
|
29 |
+
<tr><td><a href='mailto:support@savethemage.com'>Email Us</a></td></tr>
|
30 |
+
</table></fieldset>";
|
31 |
+
$this->addTab('tab2_about', array(
|
32 |
+
'label' => Mage::helper('ChangeOrderNumberHelper1')->__('About'),
|
33 |
+
'title' => Mage::helper('ChangeOrderNumberHelper1')->__('About'),
|
34 |
+
'content' => $about,
|
35 |
+
'active' => false
|
36 |
+
));
|
37 |
+
|
38 |
+
return parent::_beforeToHtml();
|
39 |
+
}
|
40 |
+
}
|
app/code/local/SaveTheMage/ChangeOrderNumber/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SaveTheMage_ChangeOrderNumber_Helper_Data extends Mage_Core_Helper_Data
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/SaveTheMage/ChangeOrderNumber/Model/numbers.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Description of Numbers
|
4 |
+
*
|
5 |
+
* @author Rezoanul Alam @ www.SaveTheMage.com
|
6 |
+
*/
|
7 |
+
class SaveTheMage_ChangeOrderNumber_Model_Numbers {
|
8 |
+
public function getOrderNumber($storeId)
|
9 |
+
{
|
10 |
+
return $this->_returnIncrement_last_id('order', $storeId);
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getInvoiceNumber($storeId)
|
14 |
+
{
|
15 |
+
return $this->_returnIncrement_last_id('invoice', $storeId);
|
16 |
+
}
|
17 |
+
|
18 |
+
private function _returnIncrement_last_id($entity_type_code, $storeId)
|
19 |
+
{
|
20 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
21 |
+
$sql ="select increment_last_id from ". $prefix ."eav_entity_store ees
|
22 |
+
inner join ". $prefix ."eav_entity_type eet
|
23 |
+
on ees.entity_type_id = eet.entity_type_id and eet.entity_type_code = '" . $entity_type_code . "'";
|
24 |
+
|
25 |
+
if( $storeId > -1 )
|
26 |
+
{
|
27 |
+
$sql .=' where ees.store_id = ' . $storeId;
|
28 |
+
}
|
29 |
+
|
30 |
+
$sql .=' limit 0, 1 ';
|
31 |
+
|
32 |
+
$inc_last_id = "";
|
33 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
34 |
+
$results = $read->fetchAll( $sql );
|
35 |
+
foreach( $results as $arr_row)
|
36 |
+
{
|
37 |
+
$inc_last_id = $arr_row['increment_last_id'];
|
38 |
+
}
|
39 |
+
|
40 |
+
return $inc_last_id;
|
41 |
+
}
|
42 |
+
|
43 |
+
public function saveNumber($storeId, $number, $entity_type_code = 'order')
|
44 |
+
{
|
45 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
46 |
+
|
47 |
+
$inc_last_id = $this->_returnIncrement_last_id($entity_type_code, $storeId);
|
48 |
+
if( !empty( $inc_last_id ) ){
|
49 |
+
$sql = "update ". $prefix ."eav_entity_store ees
|
50 |
+
inner join ". $prefix ."eav_entity_type eet on ees.entity_type_id = eet.entity_type_id and eet.entity_type_code = '". $entity_type_code ."'
|
51 |
+
set ees.increment_last_id = '" . $number ."'
|
52 |
+
where ees.store_id = " . $storeId;
|
53 |
+
}
|
54 |
+
else{
|
55 |
+
$sql = "SELECT entity_type_id FROM ". $prefix ."eav_entity_type WHERE entity_type_code='" . $entity_type_code ."'";
|
56 |
+
|
57 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
58 |
+
$results = $read->fetchAll( $sql );
|
59 |
+
$entity_type_id = "";
|
60 |
+
foreach( $results as $arr_row)
|
61 |
+
{
|
62 |
+
$entity_type_id = $arr_row['entity_type_id'];
|
63 |
+
}
|
64 |
+
|
65 |
+
$sql =" INSERT INTO ". $prefix ."eav_entity_store (entity_type_id, store_id, increment_prefix, increment_last_id)
|
66 |
+
VALUES(". $entity_type_id .", ". $storeId .", 1, '". $number ."')";
|
67 |
+
}
|
68 |
+
|
69 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
70 |
+
$write->query( $sql );
|
71 |
+
}
|
72 |
+
|
73 |
+
}
|
74 |
+
|
75 |
+
?>
|
app/code/local/SaveTheMage/ChangeOrderNumber/controllers/AdminControllersHere/ChangeOrderNumberController.php
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SaveTheMage_ChangeOrderNumber_AdminControllersHere_ChangeOrderNumberController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
$this->loadLayout();
|
8 |
+
|
9 |
+
$this->_addLeft($this->getLayout()->createBlock('SaveTheMage_ChangeOrderNumber_Block_ShowTabsAdminBlock'));
|
10 |
+
|
11 |
+
$this->renderLayout();
|
12 |
+
|
13 |
+
}
|
14 |
+
|
15 |
+
public function postAction()
|
16 |
+
{
|
17 |
+
|
18 |
+
$post = $this->getRequest();
|
19 |
+
|
20 |
+
try {
|
21 |
+
if (empty($post)) {
|
22 |
+
Mage::throwException($this->__('Invalid value.'));
|
23 |
+
}
|
24 |
+
|
25 |
+
$storeIds = $post->getParam('storeIds'); //Done
|
26 |
+
$OrderNumbers = $post->getParam('OrderNumbers'); //Done
|
27 |
+
$InvoiceNumbers = $post->getParam('InvoiceNumbers'); //Done
|
28 |
+
|
29 |
+
$noNumber="";
|
30 |
+
foreach($OrderNumbers as $_on)
|
31 |
+
{
|
32 |
+
if( !empty( $_on ) ){
|
33 |
+
$noNumber = $_on;
|
34 |
+
break;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
if( empty( $noNumber ) ){
|
38 |
+
foreach($InvoiceNumbers as $_in)
|
39 |
+
{
|
40 |
+
if( !empty( $_in ) ){
|
41 |
+
$noNumber = $_in;
|
42 |
+
break;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
if( empty( $noNumber ) )
|
47 |
+
{
|
48 |
+
Mage::getSingleton('adminhtml/session')->addError("Order Number or Invoice Number is required.");
|
49 |
+
}
|
50 |
+
else
|
51 |
+
{
|
52 |
+
|
53 |
+
$msg = "";
|
54 |
+
|
55 |
+
$model = Mage::getModel('savethemagechangeordernumber/numbers');
|
56 |
+
if( empty( $model ) )
|
57 |
+
{
|
58 |
+
require_once ( Mage::getBaseDir('app') . '/code/local/SaveTheMage/ChangeOrderNumber/Model/numbers.php');
|
59 |
+
$model = new SaveTheMage_ChangeOrderNumber_Model_Numbers();
|
60 |
+
}
|
61 |
+
|
62 |
+
$ONumber = "";
|
63 |
+
$INumber = "";
|
64 |
+
$i = 0;
|
65 |
+
$count = count($storeIds);
|
66 |
+
while( $i < $count )
|
67 |
+
{
|
68 |
+
if( !empty( $OrderNumbers[$i] ) )
|
69 |
+
{
|
70 |
+
$model->saveNumber($storeIds[$i], $OrderNumbers[$i], 'order');
|
71 |
+
$ONumber = $OrderNumbers[$i];
|
72 |
+
}
|
73 |
+
|
74 |
+
if( !empty( $InvoiceNumbers[$i] ) )
|
75 |
+
{
|
76 |
+
$model->saveNumber($storeIds[$i], $InvoiceNumbers[$i], 'invoice');
|
77 |
+
$INumber = $InvoiceNumbers[$i];
|
78 |
+
}
|
79 |
+
|
80 |
+
++$i;
|
81 |
+
}
|
82 |
+
|
83 |
+
if( !empty( $ONumber ) )
|
84 |
+
{
|
85 |
+
$msg = "Next Order Numbers changed successfully.";
|
86 |
+
}
|
87 |
+
|
88 |
+
if( !empty( $msg ) && !empty( $INumber ) )
|
89 |
+
$msg = "Next Invoice Numbers and " . $msg;
|
90 |
+
else if( empty( $ONumber ) )
|
91 |
+
$msg = "Next Invoice Numbers changed successfully.";
|
92 |
+
|
93 |
+
if( !empty( $msg ) )
|
94 |
+
{
|
95 |
+
$message = $this->__( $msg );
|
96 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
97 |
+
}
|
98 |
+
else
|
99 |
+
{
|
100 |
+
Mage::getSingleton('adminhtml/session')->addError("Order Number or Invoice Number is required. 2");
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
} catch (Exception $e) {
|
105 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
106 |
+
}
|
107 |
+
$this->_redirect('*/*');
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
public function getOrderInvoiceNumbersAction() { //UnUsed
|
112 |
+
|
113 |
+
$model = Mage::getModel('savethemagechangeordernumber/numbers');
|
114 |
+
$output = array();
|
115 |
+
$output['OrderNumber'] = $model->getOrderNumber( 1 );
|
116 |
+
$output['InvoiceNumber'] = $model->getInvoiceNumber( 1 );
|
117 |
+
|
118 |
+
$json = json_encode($output);
|
119 |
+
|
120 |
+
$this->getResponse()
|
121 |
+
->clearHeaders()
|
122 |
+
->setHeader('Content-Type', 'application/json')
|
123 |
+
->setBody($json);
|
124 |
+
}
|
125 |
+
}
|
app/code/local/SaveTheMage/ChangeOrderNumber/etc/config.xml
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<SaveTheMage_ChangeOrderNumber>
|
6 |
+
<version>1.1.1</version>
|
7 |
+
</SaveTheMage_ChangeOrderNumber>
|
8 |
+
</modules>
|
9 |
+
|
10 |
+
<global>
|
11 |
+
<blocks>
|
12 |
+
<ChangeOrderNumberBlock1>
|
13 |
+
<class>SaveTheMage_ChangeOrderNumber_Block</class>
|
14 |
+
</ChangeOrderNumberBlock1>
|
15 |
+
</blocks>
|
16 |
+
<helpers>
|
17 |
+
<ChangeOrderNumberHelper1>
|
18 |
+
<class>SaveTheMage_ChangeOrderNumber_Helper</class>
|
19 |
+
</ChangeOrderNumberHelper1>
|
20 |
+
</helpers>
|
21 |
+
<models>
|
22 |
+
<!-- ... -->
|
23 |
+
<savethemagechangeordernumber>
|
24 |
+
<class>SaveTheMage_ChangeOrderNumber_Model</class>
|
25 |
+
</savethemagechangeordernumber>
|
26 |
+
<!-- ... -->
|
27 |
+
</models>
|
28 |
+
</global>
|
29 |
+
|
30 |
+
<admin>
|
31 |
+
<routers>
|
32 |
+
<ChangeOrderNumber>
|
33 |
+
<use>admin</use>
|
34 |
+
<args>
|
35 |
+
<module>SaveTheMage_ChangeOrderNumber_AdminControllersHere</module>
|
36 |
+
<frontName>ChangeOrderNumber</frontName>
|
37 |
+
<modules>
|
38 |
+
<changeordernumber after="SaveTheMage_ChangeOrderNumber_AdminControllersHere">Mage_Adminhtml</changeordernumber>
|
39 |
+
</modules>
|
40 |
+
</args>
|
41 |
+
</ChangeOrderNumber>
|
42 |
+
</routers>
|
43 |
+
</admin>
|
44 |
+
|
45 |
+
<adminhtml>
|
46 |
+
<menu>
|
47 |
+
<SaveTheMageMenu translate="title" module="ChangeOrderNumberHelper1">
|
48 |
+
<title>SaveTheMage</title>
|
49 |
+
<sort_order>201</sort_order>
|
50 |
+
<children>
|
51 |
+
<ChangeOrderNumberChildItem1 translate="title" module="ChangeOrderNumberHelper1">
|
52 |
+
<title>Change Order and Invoice Numbers</title>
|
53 |
+
<action>ChangeOrderNumber/ChangeOrderNumber</action>
|
54 |
+
<sort_order>3</sort_order>
|
55 |
+
</ChangeOrderNumberChildItem1>
|
56 |
+
</children>
|
57 |
+
</SaveTheMageMenu>
|
58 |
+
</menu>
|
59 |
+
</adminhtml>
|
60 |
+
|
61 |
+
</config>
|
app/design/adminhtml/default/default/template/SaveTheMage/tab_container_FormChangeOrderNumber.phtml
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- Jquery UI -->
|
2 |
+
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
|
3 |
+
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
|
4 |
+
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
|
5 |
+
<!-- Jquery UI -->
|
6 |
+
|
7 |
+
<script type="text/javascript">
|
8 |
+
// <![CDATA[
|
9 |
+
var $j = jQuery.noConflict();
|
10 |
+
//]]>
|
11 |
+
</script>
|
12 |
+
|
13 |
+
|
14 |
+
<div class="content-header main-col-inner">
|
15 |
+
<table cellspacing="0" class="grid-header">
|
16 |
+
<tr>
|
17 |
+
<td><h3 id="">Change default Order and Invoice Numbers</h3></td>
|
18 |
+
<td class="a-right">
|
19 |
+
<button onclick="javascript:ShowConfirmationAndSubmit();" class="scalable save" type="button"><span>Change</span></button>
|
20 |
+
</td>
|
21 |
+
</tr>
|
22 |
+
</table>
|
23 |
+
</div>
|
24 |
+
<div class="entry-edit">
|
25 |
+
<form id="edit_form" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/post') ?>">
|
26 |
+
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
27 |
+
<h4 class="fieldset-legend"><?php echo $this->__('Change default Order and Invoice Numbers')?></h4>
|
28 |
+
<fieldset id="my-fieldset1">
|
29 |
+
<table cellspacing="0" class="form-list" style='border: 1px solid'>
|
30 |
+
<thead>
|
31 |
+
<tr>
|
32 |
+
<th class="label">
|
33 |
+
<?php echo $this->__('Store Id') ?>
|
34 |
+
</th>
|
35 |
+
<th class="label">
|
36 |
+
<?php echo $this->__('Store') ?><a class="link-store-scope" title="What is this?" onclick="this.target='_blank'" href="http://www.magentocommerce.com/knowledge-base/entry/understanding-store-scopes">What is this?</a>
|
37 |
+
</th>
|
38 |
+
<th class="label">
|
39 |
+
<?php echo $this->__('Next Starting Order #') ?>
|
40 |
+
</th>
|
41 |
+
<th class="label">
|
42 |
+
<?php echo $this->__('Next Starting Invoice #') ?>
|
43 |
+
</th>
|
44 |
+
</tr>
|
45 |
+
</thead>
|
46 |
+
<tbody>
|
47 |
+
<?php
|
48 |
+
$model = Mage::getModel('savethemagechangeordernumber/Numbers');
|
49 |
+
if( empty( $model ) )
|
50 |
+
{
|
51 |
+
require_once ( Mage::getBaseDir('app') . '/code/local/SaveTheMage/ChangeOrderNumber/Model/numbers.php');
|
52 |
+
$model = new SaveTheMage_ChangeOrderNumber_Model_Numbers();
|
53 |
+
}
|
54 |
+
$websites = Mage::app()->getWebsites();
|
55 |
+
if (count($websites) > 0 ) { ?>
|
56 |
+
<?php foreach ($websites as $website): ?>
|
57 |
+
<?php foreach ($website->getGroups() as $group): ?>
|
58 |
+
<?php foreach (Mage::app()->getStores($group) as $store): ?>
|
59 |
+
<tr>
|
60 |
+
<td class="label">
|
61 |
+
<?php echo $this->escapeHtml($store->getId()) ?>
|
62 |
+
<input type="hidden" value="<?php echo $this->escapeHtml($store->getId())?>" id="storeIds_<?=$this->escapeHtml($store->getId())?>" name="storeIds[]">
|
63 |
+
</td>
|
64 |
+
<td class="label">
|
65 |
+
<?php echo $this->escapeHtml($store->getName()) ?>
|
66 |
+
</td>
|
67 |
+
<?php
|
68 |
+
$orderNo = "";
|
69 |
+
$invoiceNo = "";
|
70 |
+
if( !empty( $model ) ){
|
71 |
+
$orderNo = $model->getOrderNumber( $this->escapeHtml($store->getId()) );
|
72 |
+
$invoiceNo = $model->getInvoiceNumber( $this->escapeHtml($store->getId()) );
|
73 |
+
}
|
74 |
+
?>
|
75 |
+
<td class="input-ele">
|
76 |
+
<input type='number' id='OrderNumbers_<?php echo $this->escapeHtml($store->getId()) ?>' value="<?php echo $orderNo ?>" class="input-text validate-number" name="OrderNumbers[]" />
|
77 |
+
</td>
|
78 |
+
<td class="input-ele">
|
79 |
+
<input type='number' id='InvoiceNumbers_<?php echo $this->escapeHtml($store->getId()) ?>' value="<?php echo $invoiceNo ?>" class="input-text validate-number" name="InvoiceNumbers[]" />
|
80 |
+
</td>
|
81 |
+
</tr>
|
82 |
+
<?php endforeach; ?>
|
83 |
+
<?php endforeach; ?>
|
84 |
+
<?php endforeach; ?>
|
85 |
+
<?php } ?>
|
86 |
+
</tbody>
|
87 |
+
</table>
|
88 |
+
</fieldset>
|
89 |
+
</form>
|
90 |
+
</div>
|
91 |
+
|
92 |
+
<div id="dialog-confirm" title="Change Order And Invoice Number?" style='display: none;'>
|
93 |
+
<p id='confmsg'><span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span></p>
|
94 |
+
</div>
|
95 |
+
<script type="text/javascript">
|
96 |
+
var editForm = new varienForm('edit_form');
|
97 |
+
|
98 |
+
function ShowConfirmationAndSubmit()
|
99 |
+
{
|
100 |
+
$j('#confmsg').text( 'This will change the next starting order and invoice numbers. Are you sure? ' );
|
101 |
+
|
102 |
+
$j( "#dialog-confirm" ).dialog({
|
103 |
+
resizable: false,
|
104 |
+
height:180,
|
105 |
+
modal: true,
|
106 |
+
buttons: {
|
107 |
+
"Confirm": function() {
|
108 |
+
editForm.submit();
|
109 |
+
$j( this ).dialog( "close" );
|
110 |
+
},
|
111 |
+
Cancel: function() {
|
112 |
+
//
|
113 |
+
$j( this ).dialog( "close" );
|
114 |
+
}
|
115 |
+
}
|
116 |
+
});
|
117 |
+
|
118 |
+
|
119 |
+
}
|
120 |
+
</script>
|
app/etc/modules/SaveTheMage_ChangeOrderNumber.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<SaveTheMage_ChangeOrderNumber>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</SaveTheMage_ChangeOrderNumber>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
CHANGED
@@ -1,18 +1,20 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Custom_Invoice_And_Order_Numbers</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license>GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description>This extension
|
11 |
-
|
|
|
|
|
12 |
<authors><author><name>SaveTheMage</name><user>SaveTheMage</user><email>support@savethemage.com</email></author></authors>
|
13 |
-
<date>2013-05-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="SaveTheMage"><file name="tab_container_FormChangeOrderNumber.phtml" hash=""/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SaveTheMage_ChangeOrderNumber.xml" hash=""/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Custom_Invoice_And_Order_Numbers</name>
|
4 |
+
<version>1.2.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Customize your invoice and order numbers. No more starting at 100000001. </summary>
|
10 |
+
<description>This extension allows you to change the next invoice and order numbers in your stores. No more counting from 100000001.
|
11 |
+

|
12 |
+
Change your Invoice and/or Order number to something like 34584 or 1001 (or any other number) and it will start to count from that point on. </description>
|
13 |
+
<notes>Update to some text and functionality.</notes>
|
14 |
<authors><author><name>SaveTheMage</name><user>SaveTheMage</user><email>support@savethemage.com</email></author></authors>
|
15 |
+
<date>2013-05-22</date>
|
16 |
+
<time>01:10:41</time>
|
17 |
+
<contents><target name="magelocal"><dir name="SaveTheMage"><dir name="ChangeOrderNumber"><dir name="Block"><file name="BlockForFormChangeOrderNumber.php" hash="f1e19141685cfec4a89632c0b6227310"/><file name="ShowTabsAdminBlock.php" hash="c82988da3389580d192007295eb4f4ec"/></dir><dir name="Helper"><file name="Data.php" hash="9f8d6fe0ae26f33d1ca9cdf11972f9ad"/></dir><dir name="Model"><file name="numbers.php" hash="92760abd11dd716485ecb0569d9d7eaf"/></dir><dir name="controllers"><dir name="AdminControllersHere"><file name="ChangeOrderNumberController.php" hash="fd1fc8b1a508e09faa856f596ce39066"/></dir></dir><dir name="etc"><file name="config.xml" hash="395d2ed1a0a86bc981f345ff1410ca69"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="SaveTheMage"><file name="tab_container_FormChangeOrderNumber.phtml" hash="224a135cbf659510e45e3615dd114707"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SaveTheMage_ChangeOrderNumber.xml" hash="bfe7796410c551417906a26062d257e9"/></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
</package>
|