EasyMultiwebsite_Creation - Version 1.0.0

Version Notes

Initial functionality of creating and deleting the website is added in this module. Further more enhancement in the next version of this module

Download this release

Release Info

Developer Commerce Bees
Extension EasyMultiwebsite_Creation
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Ameex/EasyMultiwebsite/Block/Adminhtml/Easymultiwebsite.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ameex_EasyMultiwebsite_Block_Adminhtml_EasyMultiwebsite extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->addColumn('foldername', array(
7
+ 'label' => Mage::helper('easymultiwebsite')->__('Folder Name'),
8
+ 'style' => 'width:120px',
9
+ ));
10
+ $this->addColumn('websitename', array(
11
+ 'label' => Mage::helper('easymultiwebsite')->__('Website Name'),
12
+ 'style' => 'width:120px',
13
+ ));
14
+ $this->addColumn('storename', array(
15
+ 'label' => Mage::helper('easymultiwebsite')->__('Store Name'),
16
+ 'style' => 'width:120px',
17
+ ));
18
+ $this->addColumn('storeviewname', array(
19
+ 'label' => Mage::helper('easymultiwebsite')->__('Storeview Name'),
20
+ 'style' => 'width:120px',
21
+ ));
22
+ $this->_addAfter = false;
23
+ $this->_addButtonLabel = Mage::helper('easymultiwebsite')->__('Add New');
24
+ parent::__construct();
25
+ $this->setTemplate('easymultiwebsite/array_delete.phtml');
26
+ }
27
+ }
app/code/community/Ameex/EasyMultiwebsite/Helper/Data.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Ameex_EasyMultiwebsite_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
app/code/community/Ameex/EasyMultiwebsite/Model/Observer.php ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ameex_EasyMultiwebsite_Model_Observer
3
+ {
4
+ public function creation(Varien_Event_Observer $observer)
5
+ {
6
+ $postdata = Mage::app()->getRequest()->getPost();
7
+ $websitedetails = $postdata['groups']['setting']['fields'];
8
+ if(isset($websitedetails['storeviewname']['value']['__empty']))
9
+ {
10
+ unset($websitedetails['storeviewname']['value']['__empty']);
11
+ }
12
+ foreach($websitedetails['storeviewname']['value'] as $websitedetail)
13
+ {
14
+ $foldername = $websitedetail['foldername'];
15
+ if (!file_exists($foldername))
16
+ {
17
+ mkdir($foldername, 0777, true);
18
+ chmod($foldername, 0777);
19
+ copy('index.php', $foldername .'/index.php'); // copy index.php to created folder
20
+ copy('.htaccess', $foldername .'/.htaccess'); // copy .htaccess to created folder
21
+ $search = ". '/";
22
+ $replace =". '/../";
23
+ file_put_contents($foldername .'/index.php', str_replace($search, $replace, file_get_contents($foldername .'/index.php'))); // redirect to our folder
24
+ }
25
+ /* to create a root category */
26
+ $categories = Mage::getResourceModel('catalog/category_collection');
27
+ $categories ->addAttributeToFilter('is_active', 1)
28
+ ->addAttributeToFilter('name', $foldername)
29
+ ->setCurPage(1)->setPageSize(1)
30
+ ->load();
31
+ $pId = $categories->getData();
32
+ $pId = $pId[0]['entity_id'];
33
+ if (!$pId)
34
+ {
35
+ $category = Mage::getModel('catalog/category')->setStoreId(0);
36
+ $rootcategory['name'] = $foldername;
37
+ $rootcategory['path'] = "1";
38
+ $rootcategory['display_mode'] = "PRODUCTS";
39
+ $rootcategory['is_active'] = 1;
40
+ $rootcategory['is_anchor'] = 1;
41
+ $category->addData($rootcategory);
42
+ try
43
+ {
44
+ $category->save();
45
+ $rootcategoryid = $category->getId();
46
+ }
47
+ catch (Exception $e)
48
+ {
49
+ echo $e->getMessage();
50
+ }
51
+ }
52
+ /* to create a website */
53
+ $websitename = $websitedetail['websitename'];
54
+ $websitecode = strtolower($websitename);
55
+ $website = Mage::getModel('core/website')->load($websitecode, 'code');
56
+ if(!($website->getId()))
57
+ {
58
+ $websitedata = Mage::getModel('core/website')->setCode($websitecode)->setName($websitename);
59
+ try
60
+ {
61
+ $websitedata->save();
62
+ $websiteid = $websitedata->getId();
63
+ }
64
+ catch(Exception $e)
65
+ {
66
+ echo $e->getMessage();
67
+ }
68
+ /* to create store */
69
+ $storename = $websitedetail['storename'];
70
+ $storedata = Mage::getModel('core/store_group')->setWebsiteId($websiteid)->setName($storename)->setRootCategoryId($rootcategoryid);
71
+ try
72
+ {
73
+ $storedata->save();
74
+ $storeId=$storedata->getId();
75
+ }
76
+ catch(Exception $e)
77
+ {
78
+ echo $e->getMessage();
79
+ }
80
+ /* assign base url */
81
+ $currentbaseurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
82
+ $newbaseurl = $currentbaseurl.$foldername."/";
83
+ $baseurl = "$newbaseurl";
84
+ $unsecurebaseurl = Mage::getModel('core/config')->saveConfig('web/unsecure/base_url',$baseurl,'websites',$websiteid);
85
+ $securebaseurl = Mage::getModel('core/config')->saveConfig('web/secure/base_url',$baseurl,'websites',$websiteid);
86
+ /* assign skin url */
87
+ $skinurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
88
+ $unsecureskinurl = Mage::getModel('core/config')->saveConfig('web/unsecure/base_skin_url',$skinurl,'websites',$websiteid);
89
+ $secureskinurl = Mage::getModel('core/config')->saveConfig('web/secure/base_skin_url',$skinurl,'websites',$websiteid);
90
+ /* assign media url */
91
+ $mediaurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
92
+ $unsecuremediaurl = Mage::getModel('core/config')->saveConfig('web/unsecure/base_media_url',$mediaurl,'websites',$websiteid);
93
+ $securemediaurl = Mage::getModel('core/config')->saveConfig('web/secure/base_media_url',$mediaurl,'websites',$websiteid);
94
+ /*assign js url */
95
+ $jsurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
96
+ $unsecurejsurl = Mage::getModel('core/config')->saveConfig('web/unsecure/base_js_url',$jsurl,'websites',$websiteid);
97
+ $securejsurl = Mage::getModel('core/config')->saveConfig('web/secure/base_js_url',$jsurl,'websites',$websiteid);
98
+ /* to create storeview */
99
+ $storeview = $websitedetail['storeviewname'];
100
+ $storeviewcode = strtolower($storeview);
101
+ $storeviewdata = Mage::getModel('core/store')->setCode($storeviewcode)->setWebsiteId($websiteid)->setGroupId($storeId)->setName($storeview)->setIsActive(1);
102
+ try
103
+ {
104
+ $storeviewdata->save();
105
+ $storeviewId=$storeviewdata->getId();
106
+ }
107
+ catch(Exception $e)
108
+ {
109
+ echo $e->getMessage();
110
+ }
111
+ /* to create subcategory */
112
+ $category = Mage::getModel('catalog/category')->setStoreId($storeviewId);
113
+ $subcategory['name'] = $foldername;
114
+ $subcategory['path'] = "1";
115
+ $subcategory['display_mode'] = "PRODUCTS";
116
+ $subcategory['is_active'] = 1;
117
+ $subcategory['is_anchor'] = 1;
118
+ $category->addData($subcategory);
119
+ $parentCategory = Mage::getModel('catalog/category')->load($rootcategoryid);
120
+ $category->setPath($parentCategory->getPath());
121
+ try
122
+ {
123
+ $category->save();
124
+ }
125
+ catch (Exception $e)
126
+ {
127
+ echo $e->getMessage();
128
+ }
129
+ /* to run our website */
130
+ file_put_contents($foldername .'/index.php', str_replace('store',
131
+ 'website', file_get_contents($foldername .'/index.php')));
132
+ file_put_contents($foldername .'/index.php',
133
+ str_replace("''",
134
+ "'$websitecode'", file_get_contents($foldername .'/index.php')));
135
+ }
136
+ }
137
+ /* delete the created website */
138
+ $deletedata = $postdata['fieldname'];
139
+ $deletedata = strtolower($deletedata);
140
+ $deletefields = explode(",",$deletedata);
141
+ foreach($deletefields as $deletefield)
142
+ {
143
+ $deletefield=trim($deletefield);
144
+ if(!empty($deletefield))
145
+ {
146
+ $store = Mage::getModel('core/website')->load($deletefield, 'code')->getId();
147
+ $categorynames = Mage::getResourceModel('catalog/category_collection')
148
+ ->addFieldToFilter('name', $deletefield)
149
+ ->getFirstItem();
150
+ $categoryId = $categorynames->getId();
151
+ Mage::register('isSecureArea', true);
152
+ $model = Mage::getModel('core/website')->load($store);
153
+ $model->delete();
154
+ $categorymodel = Mage::getModel('catalog/category')->load($categoryId);
155
+ $categorymodel->delete();
156
+ Mage::unregister('isSecureArea');
157
+ }
158
+ }
159
+
160
+ $folderdata = $postdata['folder'];
161
+ $folderdata = strtolower($folderdata);
162
+ $folderfields = explode(",",$folderdata);
163
+ foreach($folderfields as $folderfield)
164
+ {
165
+ $folderfield=trim($folderfield);
166
+ if(!empty($folderfield))
167
+ {
168
+ if (is_dir($folderfield))
169
+ {
170
+ $objects = scandir($folderfield);
171
+ foreach ($objects as $object)
172
+ {
173
+ if ($object != "." && $object != "..")
174
+ {
175
+ if (filetype($folderfield."/".$object) == "dir")
176
+ rrmdir($folderfield."/".$object);
177
+ else unlink ($folderfield."/".$object);
178
+ }
179
+ }
180
+ reset($objects);
181
+ rmdir($folderfield);
182
+ }
183
+ }
184
+ }
185
+ }
186
+ }
app/code/community/Ameex/EasyMultiwebsite/controllers/IndexController.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class Ameex_EasyMultiwebsite_IndexController extends Mage_Core_Controller_Front_Action{
3
+ public function indexAction()
4
+ {
5
+ }
6
+ }
app/code/community/Ameex/EasyMultiwebsite/etc/config.xml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ameex_EasyMultiwebsite>
5
+ <version>1.0.0</version>
6
+ </Ameex_EasyMultiwebsite>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <easymultiwebsite>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Ameex_EasyMultiwebsite</module>
14
+ <frontName>easymultiwebsite</frontName>
15
+ </args>
16
+ </easymultiwebsite>
17
+ </routers>
18
+ </frontend>
19
+ <global>
20
+ <blocks>
21
+ <easymultiwebsite>
22
+ <class>Ameex_EasyMultiwebsite_Block</class>
23
+ </easymultiwebsite>
24
+ <easymultiwebsite_adminhtml>
25
+ <class>Ameex_EasyMultiwebsite_Block_Adminhtml</class>
26
+ </easymultiwebsite_adminhtml>
27
+ </blocks>
28
+ <helpers>
29
+ <easymultiwebsite>
30
+ <class>Ameex_EasyMultiwebsite_Helper</class>
31
+ </easymultiwebsite>
32
+ </helpers>
33
+ <models>
34
+ <easymultiwebsite>
35
+ <class>Ameex_EasyMultiwebsite_Model</class>
36
+ </easymultiwebsite>
37
+ </models>
38
+ <events>
39
+ <admin_system_config_changed_section_easymultiwebsite_options>
40
+ <observers>
41
+ <easymultiwebsite_options>
42
+ <type>singleton</type>
43
+ <class>Ameex_EasyMultiwebsite_Model_Observer</class>
44
+ <method>creation</method>
45
+ </easymultiwebsite_options>
46
+ </observers>
47
+ </admin_system_config_changed_section_easymultiwebsite_options>
48
+ </events>
49
+ </global>
50
+ <adminhtml>
51
+ <acl>
52
+ <resources>
53
+ <admin>
54
+ <children>
55
+ <system>
56
+ <children>
57
+ <config>
58
+ <children>
59
+ <easymultiwebsite_options translate="title">
60
+ <title>Easy multiwebsite configuration</title>
61
+ </easymultiwebsite_options>
62
+ </children>
63
+ </config>
64
+ </children>
65
+ </system>
66
+ </children>
67
+ </admin>
68
+ </resources>
69
+ </acl>
70
+ </adminhtml>
71
+ </config>
app/code/community/Ameex/EasyMultiwebsite/etc/system.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <easymultiwebsite translate="label" module="easymultiwebsite">
5
+ <label>Easymultiwebsite Configuration</label>
6
+ <sort_order>1</sort_order>
7
+ </easymultiwebsite>
8
+ </tabs>
9
+ <sections>
10
+ <easymultiwebsite_options translate="label" module="easymultiwebsite">
11
+ <label>Multi website setting</label>
12
+ <tab>easymultiwebsite</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>1</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <setting translate="label">
20
+ <label>Configure the settings</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>1</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <storeviewname>
28
+ <label>Click Add new button to create multiple website </label>
29
+ <frontend_model>easymultiwebsite_adminhtml/easymultiwebsite</frontend_model>
30
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
31
+ <sort_order>1000</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </storeviewname>
36
+ </fields>
37
+ </setting>
38
+ </groups>
39
+ </easymultiwebsite_options>
40
+ </sections>
41
+ </config>
42
+
app/design/adminhtml/default/default/template/easymultiwebsite/array_delete.phtml ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <?php
29
+ $_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
30
+
31
+ $_colspan = 2;
32
+ if (!$this->_addAfter) {
33
+ $_colspan -= 1;
34
+ }
35
+ $_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
36
+ ?>
37
+
38
+ <div class="grid" id="grid<?php echo $_htmlId ?>">
39
+ <table cellpadding="0" cellspacing="0" class="border" id="tableid">
40
+ <tbody>
41
+
42
+ <tr class="headings" id="headings<?php echo $_htmlId ?>">
43
+ <?php foreach ($this->_columns as $columnName => $column):?>
44
+ <th><?php echo $column['label'] ?></th>
45
+ <?php endforeach;?>
46
+ <th <?php echo $_colspan?>></th>
47
+ </tr>
48
+
49
+ <tr id="addRow<?php echo $_htmlId ?>">
50
+ <td colspan="<?php echo count($this->_columns) ?>"></td>
51
+ <td <?php echo $_colspan?>>
52
+ <button style="" onclick="" class="scalable add" type="button" id="addToEndBtn<?php echo $_htmlId ?>">
53
+ <span><span><span><?php echo $this->_addButtonLabel ?></span></span></span>
54
+ </button>
55
+ </td>
56
+ </tr>
57
+
58
+ </tbody>
59
+ </table>
60
+
61
+ <input type="hidden" name="<?php echo $this->getElement()->getName() ?>[__empty]" value="" />
62
+ </div>
63
+ <div id="empty<?php echo $_htmlId ?>">
64
+ <button style="" onclick="" class="scalable add" type="button" id="emptyAddBtn<?php echo $_htmlId ?>">
65
+ <span><span><span><?php echo $this->_addButtonLabel ?></span></span></span>
66
+ </button>
67
+ </div>
68
+
69
+ <script type="text/javascript">
70
+ //<![CDATA[
71
+ // create row creator
72
+
73
+ var arrayRow<?php echo $_htmlId ?> = {
74
+ // define row prototypeJS template
75
+ template : new Template(
76
+ '<tr id="#{_id}">'
77
+ <?php foreach ($this->_columns as $columnName => $column):?>
78
+ +'<td>'
79
+ +'<?php echo $this->_renderCellTemplate($columnName)?>'
80
+ +'<\/td>'
81
+ <?php endforeach;?>
82
+ <?php if ($this->_addAfter):?>
83
+ +'<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><span><span><?php echo Mage::helper('adminhtml')->__('Add after') ?><\/span><\/span><\/span><\/button><\/td>'
84
+ <?php endif;?>
85
+ +'<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><span><span><?php echo Mage::helper('adminhtml')->__('Delete') ?><\/span><\/span><\/span><\/button><\/td>'
86
+ +'<\/tr>'
87
+ ),
88
+
89
+ rowsCount : 0,
90
+
91
+ add : function(templateData, insertAfterId)
92
+ {
93
+ // generate default template data
94
+ if ('' == templateData) {
95
+ var d = new Date();
96
+ var templateData = {
97
+ <?php foreach ($this->_columns as $columnName => $column):?>
98
+ <?php echo $columnName ?> : '',
99
+ <?php endforeach;?>
100
+ _id : '_' + d.getTime() + '_' + d.getMilliseconds()
101
+ };
102
+ }
103
+
104
+ // insert before last row
105
+ if ('' == insertAfterId) {
106
+ Element.insert($('addRow<?php echo $_htmlId ?>'), {before: this.template.evaluate(templateData)});
107
+ }
108
+ // insert after specified row
109
+ else {
110
+ Element.insert($(insertAfterId), {after: this.template.evaluate(templateData)});
111
+ }
112
+
113
+ <?php if ($this->_addAfter):?>
114
+ Event.observe('addAfterBtn' + templateData._id, 'click', this.add.bind(this, '', templateData._id));
115
+ <?php endif;?>
116
+
117
+ this.rowsCount += 1;
118
+ },
119
+
120
+ del : function(rowId)
121
+ {
122
+ $(rowId).remove();
123
+ this.rowsCount -= 1;
124
+ if (0 == this.rowsCount) {
125
+ this.showButtonOnly();
126
+ }
127
+ },
128
+
129
+ showButtonOnly : function()
130
+ {
131
+ $('grid<?php echo $_htmlId ?>').hide();
132
+ $('empty<?php echo $_htmlId ?>').show();
133
+ }
134
+ }
135
+
136
+ // bind add action to "Add" button in last row
137
+ Event.observe('addToEndBtn<?php echo $_htmlId ?>', 'click', arrayRow<?php echo $_htmlId ?>.add.bind(arrayRow<?php echo $_htmlId ?>, '', ''));
138
+
139
+ // add existing rows
140
+ <?php
141
+ $_addAfterId = "headings{$_htmlId}";
142
+ foreach ($this->getArrayRows() as $_rowId => $_row) {
143
+ echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
144
+ $_addAfterId = $_rowId;
145
+ }
146
+ ?>
147
+
148
+ // initialize standalone button
149
+ $('empty<?php echo $_htmlId ?>').hide();
150
+ Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
151
+ $('grid<?php echo $_htmlId ?>').show();
152
+ $('empty<?php echo $_htmlId ?>').hide();
153
+ arrayRow<?php echo $_htmlId ?>.add('', '');
154
+ });
155
+
156
+ // if no rows, hide grid and show button only
157
+ <?php if (!$this->getArrayRows()):?>
158
+ arrayRow<?php echo $_htmlId ?>.showButtonOnly();
159
+ <?php endif;?>
160
+
161
+ // toggle the grid, if element is disabled (depending on scope)
162
+ <?php if ($this->getElement()->getDisabled()):?>
163
+ toggleValueElements({checked:true}, $('grid<?php echo $_htmlId ?>').parentNode);
164
+ <?php endif;?>
165
+
166
+ //]]>
167
+ </script>
168
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
169
+ <script type="text/javascript">
170
+ var del=jQuery.noConflict();
171
+ del('#tableid tbody').append('<input type="hidden" name="fieldname" value="" id="deleteid" class="delete" />');
172
+ del('#tableid tbody').append('<input type="hidden" name="folder" value="" id="folderid" class="folderdelete" />');
173
+ del('.scalable.delete').click(function(event)
174
+ {
175
+ var $tr = del(this).closest('tr');
176
+ var values = $tr.children('td').eq(1).find('input').val();
177
+ var vals=del("#deleteid").val();
178
+ if(!vals=="")
179
+ {
180
+ values=vals+","+values;
181
+ }
182
+ var elem = document.getElementById("deleteid");
183
+ elem.value = values;
184
+ var $trvalue = del(this).closest('tr');
185
+ var foldervalue = $trvalue.children('td:first').find('input').val();
186
+ var foldervals=del("#folderid").val();
187
+ if(!foldervals=="")
188
+ {
189
+ foldervalue=foldervals+","+foldervalue;
190
+ }
191
+ var elem = document.getElementById("folderid");
192
+ elem.value = foldervalue;
193
+ });
194
+ </script>
app/etc/modules/Ameex_EasyMultiwebsite.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <modules>
4
+ <Ameex_EasyMultiwebsite>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Ameex_EasyMultiwebsite>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>EasyMultiwebsite_Creation</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>EasyMultiwebsite creation module allows to create multiple website in a single step and also allows to delete the website that is created</summary>
10
+ <description>EasyMultiwebsite creation Module will create multiple website in a quick way.It wll create the website by just entering foldername, website name, storename, storeview name.&#xD;
11
+ first step is it create a root folder with index.php and .htaccess inside.&#xD;
12
+ second step is it create a root category with name we given for website.&#xD;
13
+ third step is it create a website,store and storeview.&#xD;
14
+ fourth step is it edits the baseurl for the website we created.</description>
15
+ <notes>Initial functionality of creating and deleting the website is added in this module. Further more enhancement in the next version of this module</notes>
16
+ <authors><author><name>commercebees</name><user>CommerceBees</user><email>support@commercebees.com</email></author></authors>
17
+ <date>2015-09-01</date>
18
+ <time>11:05:44</time>
19
+ <contents><target name="magecommunity"><dir><dir name="Ameex"><dir name="EasyMultiwebsite"><dir name="Block"><dir name="Adminhtml"><file name="Easymultiwebsite.php" hash="16829814531a1d219d4c6f4d705e4fa5"/></dir></dir><dir name="Helper"><file name="Data.php" hash="a38668a41143fec281e064fae6077cf4"/></dir><dir name="Model"><file name="Observer.php" hash="111684d1ada789efbfcca83f23bf414e"/></dir><dir name="controllers"><file name="IndexController.php" hash="7cf9074c2d2166e42af469acef3f54b3"/></dir><dir name="etc"><file name="config.xml" hash="b91011a58b58f167a0b39c09707b0969"/><file name="system.xml" hash="690d0100cd5250a5d740ebe9cd389717"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Ameex_EasyMultiwebsite.xml" hash="97ab7081fc9f1dcf282edab0cbe8288e"/></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="easymultiwebsite"><file name="array_delete.phtml" hash="640891feaf37f39bc5f1b7967afa33e6"/></dir></dir></dir></dir></dir></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies><required><php><min>5.1.0</min><max>5.5.0</max></php></required></dependencies>
22
+ </package>