Version Notes
Easy to add a custom State / Province / Region to a Country
Download this release
Release Info
Developer | iifire |
Extension | state_province_manager |
Version | 1.6.1 |
Comparing to | |
See all releases |
Version 1.6.1
- app/code/community/Iifire/Directory/Block/Adminhtml/Continent.php +72 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Default.php +43 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Default/Assign.php +51 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Default/Assign/Form.php +63 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Default/Grid.php +71 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Default/New.php +52 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Default/New/Form.php +42 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Form.php +41 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Grid.php +88 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Continent/New.php +52 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Continent/New/Form.php +57 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Continents.php +56 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Country.php +73 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Country/Form.php +51 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Default.php +38 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Default/Country.php +60 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Default/Country/Form.php +42 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Default/Edit.php +67 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Default/Edit/Form.php +76 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Default/Grid.php +78 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Manage.php +24 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Province.php +80 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Province/Form.php +68 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Provinces.php +52 -0
- app/code/community/Iifire/Directory/Block/Adminhtml/Provinces/Grid.php +94 -0
- app/code/community/Iifire/Directory/Helper/Data.php +256 -0
- app/code/community/Iifire/Directory/Model/Continent.php +29 -0
- app/code/community/Iifire/Directory/Model/Mysql4/Continent.php +22 -0
- app/code/community/Iifire/Directory/Model/Mysql4/Continent/Collection.php +8 -0
- app/code/community/Iifire/Directory/controllers/Adminhtml/IDirectoryController.php +237 -0
- app/code/community/Iifire/Directory/etc/adminhtml.xml +59 -0
- app/code/community/Iifire/Directory/etc/config.xml +84 -0
- app/code/community/Iifire/Directory/sql/iifire_directory_setup/mysql4-upgrade-1.6.0-1.6.1.php +45 -0
- app/design/adminhtml/default/default/template/iifire/directory/continent.phtml +24 -0
- app/design/adminhtml/default/default/template/iifire/directory/continent/default.phtml +16 -0
- app/design/adminhtml/default/default/template/iifire/directory/continent/new.phtml +23 -0
- app/design/adminhtml/default/default/template/iifire/directory/continents.phtml +16 -0
- app/design/adminhtml/default/default/template/iifire/directory/country.phtml +28 -0
- app/design/adminhtml/default/default/template/iifire/directory/default.phtml +14 -0
- app/design/adminhtml/default/default/template/iifire/directory/default/country.phtml +27 -0
- app/design/adminhtml/default/default/template/iifire/directory/default/edit.phtml +31 -0
- app/design/adminhtml/default/default/template/iifire/directory/province.phtml +32 -0
- app/design/adminhtml/default/default/template/iifire/directory/provinces.phtml +15 -0
- app/etc/modules/Iifire_Directory.xml +20 -0
- package.xml +18 -0
app/code/community/Iifire/Directory/Block/Adminhtml/Continent.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Continent extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->setTemplate('iifire/directory/continent.phtml');
|
13 |
+
parent::__construct();
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _prepareLayout()
|
17 |
+
{
|
18 |
+
$this->setChild('reset_button',
|
19 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
20 |
+
->setData(array(
|
21 |
+
'label' => Mage::helper('iifire_directory')->__('Reset'),
|
22 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/continent', array('_current'=>true)).'\')'
|
23 |
+
))
|
24 |
+
);
|
25 |
+
$this->setChild('manage_default_continent',
|
26 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
27 |
+
->setData(array(
|
28 |
+
'label' => Mage::helper('iifire_directory')->__('Manage Default States/Province'),
|
29 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/continentDefault').'\')'
|
30 |
+
))
|
31 |
+
);
|
32 |
+
$this->setChild('continue_button',
|
33 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
34 |
+
->setData(array(
|
35 |
+
'label' => Mage::helper('iifire_directory')->__('Continue'),
|
36 |
+
'onclick' => "setSettings('".$this->getContinueUrl()."','locale')",
|
37 |
+
'class' => 'save'
|
38 |
+
))
|
39 |
+
);
|
40 |
+
|
41 |
+
return parent::_prepareLayout();
|
42 |
+
}
|
43 |
+
public function getForm()
|
44 |
+
{
|
45 |
+
return $this->getLayout()
|
46 |
+
->createBlock('iifire_directory/adminhtml_continent_form')
|
47 |
+
->toHtml();
|
48 |
+
}
|
49 |
+
public function getResetButtonHtml()
|
50 |
+
{
|
51 |
+
return $this->getChildHtml('reset_button');
|
52 |
+
}
|
53 |
+
public function getManageDefaultButtonHtml()
|
54 |
+
{
|
55 |
+
return $this->getChildHtml('manage_default_button');
|
56 |
+
}
|
57 |
+
public function getContinueButtonHtml()
|
58 |
+
{
|
59 |
+
return $this->getChildHtml('continue_button');
|
60 |
+
}
|
61 |
+
public function getHeaderText()
|
62 |
+
{
|
63 |
+
return Mage::helper('iifire_directory')->__('Manage State/Province');
|
64 |
+
}
|
65 |
+
public function getContinueUrl()
|
66 |
+
{
|
67 |
+
return $this->getUrl('*/*/listContinent', array(
|
68 |
+
'_current' => true,
|
69 |
+
'locale' => '{{locale}}',
|
70 |
+
));
|
71 |
+
}
|
72 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Default.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Continent_Default extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->setTemplate('iifire/directory/continent/default.phtml');
|
13 |
+
parent::__construct();
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _prepareLayout()
|
17 |
+
{
|
18 |
+
$this->setChild('new_button',
|
19 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
20 |
+
->setData(array(
|
21 |
+
'label' => Mage::helper('iifire_directory')->__('New Continent'),
|
22 |
+
'onclick' => "setLocation('".$this->getUrl('*/*/addDefaultContinent')."')",
|
23 |
+
'class' => 'new'
|
24 |
+
))
|
25 |
+
);
|
26 |
+
$this->setChild('grid', $this->getLayout()->createBlock('iifire_directory/adminhtml_continent_default_grid', 'continent.grid'));
|
27 |
+
return parent::_prepareLayout();
|
28 |
+
}
|
29 |
+
public function getForm()
|
30 |
+
{
|
31 |
+
return $this->getLayout()
|
32 |
+
->createBlock('iifire_directory/adminhtml_continent_form')
|
33 |
+
->toHtml();
|
34 |
+
}
|
35 |
+
public function getNewButtonHtml()
|
36 |
+
{
|
37 |
+
return $this->getChildHtml('new_button');
|
38 |
+
}
|
39 |
+
public function getHeaderText()
|
40 |
+
{
|
41 |
+
return Mage::helper('iifire_directory')->__('Manage Continent(default locale)');
|
42 |
+
}
|
43 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Default/Assign.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Iifire_Directory_Block_Adminhtml_Continent_Default_Assign extends Mage_Adminhtml_Block_Template
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->setTemplate('iifire/directory/continent/new.phtml');
|
7 |
+
parent::__construct();
|
8 |
+
}
|
9 |
+
|
10 |
+
protected function _prepareLayout()
|
11 |
+
{
|
12 |
+
$this->setChild('reset_button',
|
13 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
14 |
+
->setData(array(
|
15 |
+
'label' => Mage::helper('iifire_directory')->__('Reset'),
|
16 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/assignContinent').'\')'
|
17 |
+
))
|
18 |
+
);
|
19 |
+
$this->setChild('save_button',
|
20 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
21 |
+
->setData(array(
|
22 |
+
'label' => Mage::helper('iifire_directory')->__('Save'),
|
23 |
+
'onclick' => 'continentControl.save()'
|
24 |
+
))
|
25 |
+
);
|
26 |
+
return parent::_prepareLayout();
|
27 |
+
}
|
28 |
+
public function getForm()
|
29 |
+
{
|
30 |
+
return $this->getLayout()
|
31 |
+
->createBlock('iifire_directory/adminhtml_continent_default_assign_form')
|
32 |
+
->toHtml();
|
33 |
+
}
|
34 |
+
public function getResetButtonHtml()
|
35 |
+
{
|
36 |
+
return $this->getChildHtml('reset_button');
|
37 |
+
}
|
38 |
+
public function getSaveButtonHtml()
|
39 |
+
{
|
40 |
+
return $this->getChildHtml('save_button');
|
41 |
+
}
|
42 |
+
public function getSaveUrl()
|
43 |
+
{
|
44 |
+
return $this->getUrl("*/*/saveContinentAssign");
|
45 |
+
}
|
46 |
+
public function getHeaderText()
|
47 |
+
{
|
48 |
+
return Mage::helper('iifire_directory')->__('Assign Country To Continent');
|
49 |
+
}
|
50 |
+
}
|
51 |
+
?>
|
app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Default/Assign/Form.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Continent_Default_Assign_Form extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
}
|
14 |
+
protected function _prepareForm()
|
15 |
+
{
|
16 |
+
$form = new Varien_Data_Form(array(
|
17 |
+
'id' => 'edit_form',
|
18 |
+
'action' => $this->getData('action'),
|
19 |
+
'method' => 'post'
|
20 |
+
));
|
21 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
22 |
+
'legend' => Mage::helper('iifire_directory')->__('Assign Country To Continent'),
|
23 |
+
'class' => 'fieldset-wide'
|
24 |
+
));
|
25 |
+
$continentCode = $this->getRequest()->getParam('continent');
|
26 |
+
if ($continentCode) {
|
27 |
+
$fieldset->addField('continent_copy', 'label', array(
|
28 |
+
'label' => Mage::helper('iifire_directory')->__('Continent Code'),
|
29 |
+
'value' => $continentCode,
|
30 |
+
));
|
31 |
+
$fieldset->addField('continent', 'hidden', array(
|
32 |
+
'name' => 'continent',
|
33 |
+
'value' => $continentCode,
|
34 |
+
));
|
35 |
+
} else {
|
36 |
+
$fieldset->addField('continent', 'select', array(
|
37 |
+
'name' => 'continent',
|
38 |
+
'label' => Mage::helper('iifire_directory')->__('Continent Code'),
|
39 |
+
'value' => $continentCode,
|
40 |
+
'options' => Mage::getSingleton('iifire_directory/continent')->getContinentOptions(),
|
41 |
+
));
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
$values = Mage::helper('iifire_directory')->getCountriesByContinent($continentCode);
|
46 |
+
$fieldset->addField('multiselect', 'multiselect', array(
|
47 |
+
'label' => Mage::helper('iifire_directory')->__('Country'),
|
48 |
+
'class' => 'required-entry',
|
49 |
+
'required' => true,
|
50 |
+
'name' => 'country[]',
|
51 |
+
'values' => $continentCode ? Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(false): '',
|
52 |
+
'disabled' => false,
|
53 |
+
'value' => $values,
|
54 |
+
'readonly' => false,
|
55 |
+
//'after_element_html' => '<small>Comments</small>',
|
56 |
+
'tabindex' => 1
|
57 |
+
));
|
58 |
+
|
59 |
+
$this->setForm($form);
|
60 |
+
|
61 |
+
return parent::_prepareForm();
|
62 |
+
}
|
63 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Default/Grid.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Continent_Default_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
9 |
+
{
|
10 |
+
protected $_continentTable;
|
11 |
+
protected $_continentNameTable;
|
12 |
+
protected $_locale;
|
13 |
+
|
14 |
+
|
15 |
+
public function __construct()
|
16 |
+
{
|
17 |
+
parent::__construct();
|
18 |
+
$this->setId('continentGrid');
|
19 |
+
$this->setDefaultSort('continent_id', 'desc');
|
20 |
+
$this->_continentTable = Mage::getSingleton('core/resource')->getTableName('iifire_directory_continent');
|
21 |
+
}
|
22 |
+
protected function _construct()
|
23 |
+
{
|
24 |
+
$this->setEmptyText(Mage::helper('iifire_directory')->__('No Record Found'));
|
25 |
+
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function _prepareCollection()
|
29 |
+
{
|
30 |
+
$collection = Mage::getResourceSingleton('iifire_directory/continent_collection');
|
31 |
+
$this->setCollection($collection);
|
32 |
+
|
33 |
+
return parent::_prepareCollection();
|
34 |
+
}
|
35 |
+
|
36 |
+
protected function _prepareColumns()
|
37 |
+
{
|
38 |
+
$this->addColumn('continent_id',array(
|
39 |
+
'header'=>Mage::helper('iifire_directory')->__('Continent ID'),
|
40 |
+
'align'=>'center',
|
41 |
+
'index'=>'continent_id'
|
42 |
+
));
|
43 |
+
$this->addColumn('continent_code',array(
|
44 |
+
'header'=>Mage::helper('iifire_directory')->__('Continent Code'),
|
45 |
+
'align'=>'center',
|
46 |
+
'index'=>'code'
|
47 |
+
));
|
48 |
+
$this->addColumn('continent_name',array(
|
49 |
+
'header'=>Mage::helper('iifire_directory')->__('Continent Name'),
|
50 |
+
'align'=>'center',
|
51 |
+
'index'=>'default_name'
|
52 |
+
));
|
53 |
+
return $this;
|
54 |
+
}
|
55 |
+
protected function _prepareMassaction()
|
56 |
+
{
|
57 |
+
$this->setMassactionIdField('region_id');
|
58 |
+
$this->getMassactionBlock()->setFormFieldName('region');
|
59 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
60 |
+
'label' => Mage::helper('iifire_directory')->__('Delete'),
|
61 |
+
'url' => $this->getUrl('*/*/deleteRegion',array('locale'=>$this->_locale,'country'=>$this->_country)),
|
62 |
+
'confirm' => Mage::helper('iifire_directory')->__('Are you sure?')
|
63 |
+
));
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
public function getRowUrl($row)
|
67 |
+
{
|
68 |
+
return $this->getUrl('*/*/assignContinent', array('continent'=>$row->getCode()));
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Default/New.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Iifire_Directory_Block_Adminhtml_Continent_Default_New extends Mage_Adminhtml_Block_Template
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->setTemplate('iifire/directory/continent/new.phtml');
|
7 |
+
parent::__construct();
|
8 |
+
}
|
9 |
+
|
10 |
+
protected function _prepareLayout()
|
11 |
+
{
|
12 |
+
$locale = $this->getRequest()->getParam('locale');
|
13 |
+
$this->setChild('reset_button',
|
14 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
+
->setData(array(
|
16 |
+
'label' => Mage::helper('iifire_directory')->__('Reset'),
|
17 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/addDefaultContinent').'\')'
|
18 |
+
))
|
19 |
+
);
|
20 |
+
$this->setChild('save_button',
|
21 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
22 |
+
->setData(array(
|
23 |
+
'label' => Mage::helper('iifire_directory')->__('Save Continent'),
|
24 |
+
'onclick' => 'continentControl.save()'
|
25 |
+
))
|
26 |
+
);
|
27 |
+
return parent::_prepareLayout();
|
28 |
+
}
|
29 |
+
public function getForm()
|
30 |
+
{
|
31 |
+
return $this->getLayout()
|
32 |
+
->createBlock('iifire_directory/adminhtml_continent_default_new_form')
|
33 |
+
->toHtml();
|
34 |
+
}
|
35 |
+
public function getResetButtonHtml()
|
36 |
+
{
|
37 |
+
return $this->getChildHtml('reset_button');
|
38 |
+
}
|
39 |
+
public function getSaveButtonHtml()
|
40 |
+
{
|
41 |
+
return $this->getChildHtml('save_button');
|
42 |
+
}
|
43 |
+
public function getSaveUrl()
|
44 |
+
{
|
45 |
+
return $this->getUrl("*/*/saveDefaultContinent");
|
46 |
+
}
|
47 |
+
public function getHeaderText()
|
48 |
+
{
|
49 |
+
return Mage::helper('iifire_directory')->__('New Default Locale Continent');
|
50 |
+
}
|
51 |
+
}
|
52 |
+
?>
|
app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Default/New/Form.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Continent_Default_New_Form extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
}
|
14 |
+
protected function _prepareForm()
|
15 |
+
{
|
16 |
+
$form = new Varien_Data_Form(array(
|
17 |
+
'id' => 'edit_form',
|
18 |
+
'action' => $this->getData('action'),
|
19 |
+
'method' => 'post'
|
20 |
+
));
|
21 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
22 |
+
'legend' => Mage::helper('iifire_directory')->__('Add Continent'),
|
23 |
+
'class' => 'fieldset-wide'
|
24 |
+
));
|
25 |
+
$fieldset->addField('code', 'text', array(
|
26 |
+
'name' => 'code',
|
27 |
+
'label' => Mage::helper('iifire_directory')->__('Continent Code'),
|
28 |
+
'title' => Mage::helper('iifire_directory')->__('Continent Code'),
|
29 |
+
'required' => true,
|
30 |
+
));
|
31 |
+
$fieldset->addField('name', 'text', array(
|
32 |
+
'name' => 'name',
|
33 |
+
'label' => Mage::helper('iifire_directory')->__('Default Name'),
|
34 |
+
'title' => Mage::helper('iifire_directory')->__('Default Name'),
|
35 |
+
'required' => true,
|
36 |
+
));
|
37 |
+
|
38 |
+
$this->setForm($form);
|
39 |
+
|
40 |
+
return parent::_prepareForm();
|
41 |
+
}
|
42 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Form.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Continent_Form extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
}
|
14 |
+
protected function _prepareForm()
|
15 |
+
{
|
16 |
+
$form = new Varien_Data_Form(array(
|
17 |
+
'id' => 'edit_form',
|
18 |
+
'action' => $this->getData('action'),
|
19 |
+
'method' => 'post'
|
20 |
+
));
|
21 |
+
|
22 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
23 |
+
'legend' => Mage::helper('iifire_directory')->__('Choose Locale'),
|
24 |
+
'class' => 'fieldset-wide'
|
25 |
+
));
|
26 |
+
$localeOptions = Mage::helper('iifire_directory')->getLocaleAsOptionArray();
|
27 |
+
$fieldset->addField('locale', 'select', array(
|
28 |
+
'name' => 'locale',
|
29 |
+
'label' => Mage::helper('iifire_directory')->__('locale'),
|
30 |
+
'title' => Mage::helper('iifire_directory')->__('locale'),
|
31 |
+
'required' => true,
|
32 |
+
'value' => Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE),
|
33 |
+
'options' => $localeOptions,
|
34 |
+
|
35 |
+
));
|
36 |
+
|
37 |
+
$this->setForm($form);
|
38 |
+
|
39 |
+
return parent::_prepareForm();
|
40 |
+
}
|
41 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Continent/Grid.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Continent_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
9 |
+
{
|
10 |
+
protected $_continentTable;
|
11 |
+
protected $_continentNameTable;
|
12 |
+
protected $_locale;
|
13 |
+
|
14 |
+
|
15 |
+
public function __construct()
|
16 |
+
{
|
17 |
+
parent::__construct();
|
18 |
+
$this->setId('continentGrid');
|
19 |
+
$this->setDefaultSort('continent_id', 'desc');
|
20 |
+
$this->_continentTable = Mage::getSingleton('core/resource')->getTableName('iifire_directory_continent');
|
21 |
+
$this->_continentNameTable = Mage::getSingleton('core/resource')->getTableName('iifire_directory_continent_name');
|
22 |
+
$this->_locale = $this->getRequest()->getParam('locale');
|
23 |
+
}
|
24 |
+
protected function _construct()
|
25 |
+
{
|
26 |
+
$this->setEmptyText(Mage::helper('iifire_directory')->__('No Record Found'));
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function _prepareCollection()
|
31 |
+
{
|
32 |
+
$collection = Mage::getResourceSingleton('iifire_directory/continent_collection');
|
33 |
+
$collection->getSelect()->reset();
|
34 |
+
|
35 |
+
$collection->getSelect()
|
36 |
+
->from(array('main_table' => $this->_continentTable))
|
37 |
+
->joinLeft(
|
38 |
+
array('cname' => $this->_continentNameTable),
|
39 |
+
'main_table.continent_id = cname.continent_id',
|
40 |
+
array('name','locale'))
|
41 |
+
->where('cname.locale = ?', $this->_locale);
|
42 |
+
//echo $collection->getSelect();
|
43 |
+
$this->setCollection($collection);
|
44 |
+
|
45 |
+
return parent::_prepareCollection();
|
46 |
+
}
|
47 |
+
|
48 |
+
protected function _prepareColumns()
|
49 |
+
{
|
50 |
+
$this->addColumn('continent_id',array(
|
51 |
+
'header'=>Mage::helper('iifire_directory')->__('Continent ID'),
|
52 |
+
'align'=>'center',
|
53 |
+
'index'=>'continent_id'
|
54 |
+
));
|
55 |
+
$this->addColumn('continent_code',array(
|
56 |
+
'header'=>Mage::helper('iifire_directory')->__('Continent Code'),
|
57 |
+
'align'=>'center',
|
58 |
+
'index'=>'code'
|
59 |
+
));
|
60 |
+
$this->addColumn('continent_name',array(
|
61 |
+
'header'=>Mage::helper('iifire_directory')->__('Continent Name'),
|
62 |
+
'align'=>'center',
|
63 |
+
'index'=>'name'
|
64 |
+
));
|
65 |
+
$this->addColumn('locale',array(
|
66 |
+
'header'=>Mage::helper('iifire_directory')->__('Locale'),
|
67 |
+
'align'=>'center',
|
68 |
+
'index'=>'locale'
|
69 |
+
));
|
70 |
+
return $this;
|
71 |
+
}
|
72 |
+
protected function _prepareMassaction()
|
73 |
+
{
|
74 |
+
$this->setMassactionIdField('region_id');
|
75 |
+
$this->getMassactionBlock()->setFormFieldName('region');
|
76 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
77 |
+
'label' => Mage::helper('iifire_directory')->__('Delete'),
|
78 |
+
'url' => $this->getUrl('*/*/deleteRegion',array('locale'=>$this->_locale,'country'=>$this->_country)),
|
79 |
+
'confirm' => Mage::helper('iifire_directory')->__('Are you sure?')
|
80 |
+
));
|
81 |
+
return $this;
|
82 |
+
}
|
83 |
+
public function getRowUrl($row)
|
84 |
+
{
|
85 |
+
//return $this->getUrl('*/*/edit', array('id'=>$row->getId()));
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
app/code/community/Iifire/Directory/Block/Adminhtml/Continent/New.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Iifire_Directory_Block_Adminhtml_Continent_New extends Mage_Adminhtml_Block_Template
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->setTemplate('iifire/directory/continent/new.phtml');
|
7 |
+
parent::__construct();
|
8 |
+
}
|
9 |
+
|
10 |
+
protected function _prepareLayout()
|
11 |
+
{
|
12 |
+
$locale = $this->getRequest()->getParam('locale');
|
13 |
+
$this->setChild('reset_button',
|
14 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
+
->setData(array(
|
16 |
+
'label' => Mage::helper('iifire_directory')->__('Reset'),
|
17 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/addContinent', array('locale'=>$locale)).'\')'
|
18 |
+
))
|
19 |
+
);
|
20 |
+
$this->setChild('save_button',
|
21 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
22 |
+
->setData(array(
|
23 |
+
'label' => Mage::helper('iifire_directory')->__('New Continent'),
|
24 |
+
'onclick' => 'continentControl.save()'
|
25 |
+
))
|
26 |
+
);
|
27 |
+
return parent::_prepareLayout();
|
28 |
+
}
|
29 |
+
public function getForm()
|
30 |
+
{
|
31 |
+
return $this->getLayout()
|
32 |
+
->createBlock('iifire_directory/adminhtml_continent_new_form')
|
33 |
+
->toHtml();
|
34 |
+
}
|
35 |
+
public function getResetButtonHtml()
|
36 |
+
{
|
37 |
+
return $this->getChildHtml('reset_button');
|
38 |
+
}
|
39 |
+
public function getSaveButtonHtml()
|
40 |
+
{
|
41 |
+
return $this->getChildHtml('save_button');
|
42 |
+
}
|
43 |
+
public function getSaveUrl()
|
44 |
+
{
|
45 |
+
return $this->getUrl("*/*/saveContinent");
|
46 |
+
}
|
47 |
+
public function getHeaderText()
|
48 |
+
{
|
49 |
+
return Mage::helper('iifire_directory')->__('New Continent');
|
50 |
+
}
|
51 |
+
}
|
52 |
+
?>
|
app/code/community/Iifire/Directory/Block/Adminhtml/Continent/New/Form.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Continent_New_Form extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
}
|
14 |
+
protected function _prepareForm()
|
15 |
+
{
|
16 |
+
$form = new Varien_Data_Form(array(
|
17 |
+
'id' => 'edit_form',
|
18 |
+
'action' => $this->getData('action'),
|
19 |
+
'method' => 'post'
|
20 |
+
));
|
21 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
22 |
+
'legend' => Mage::helper('iifire_directory')->__('Add Continent'),
|
23 |
+
'class' => 'fieldset-wide'
|
24 |
+
));
|
25 |
+
$locale = $this->getRequest()->getParam('locale');
|
26 |
+
$fieldset->addField('locale', 'hidden', array(
|
27 |
+
'name' => 'locale',
|
28 |
+
'value' => $locale,
|
29 |
+
'required' => true,
|
30 |
+
));
|
31 |
+
$fieldset->addField('locale_copy', 'text', array(
|
32 |
+
'name' => 'locale_copy',
|
33 |
+
'label' => Mage::helper('iifire_directory')->__('Locale'),
|
34 |
+
'title' => Mage::helper('iifire_directory')->__('Locale'),
|
35 |
+
'value' => $locale,
|
36 |
+
'disabled' => true,
|
37 |
+
'required' => true,
|
38 |
+
));
|
39 |
+
$fieldset->addField('continent', 'select', array(
|
40 |
+
'name' => 'continent',
|
41 |
+
'label' => Mage::helper('iifire_directory')->__('Continent Code'),
|
42 |
+
'title' => Mage::helper('iifire_directory')->__('Continent Code'),
|
43 |
+
'required' => true,
|
44 |
+
'options' => Mage::getSingleton('iifire_directory/continent')->getContinentOptions(),
|
45 |
+
));
|
46 |
+
$fieldset->addField('name', 'text', array(
|
47 |
+
'name' => 'name',
|
48 |
+
'label' => Mage::helper('iifire_directory')->__('Continent Name'),
|
49 |
+
'title' => Mage::helper('iifire_directory')->__('Continent Name'),
|
50 |
+
'required' => true,
|
51 |
+
));
|
52 |
+
|
53 |
+
$this->setForm($form);
|
54 |
+
|
55 |
+
return parent::_prepareForm();
|
56 |
+
}
|
57 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Continents.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Continents extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->setTemplate('iifire/directory/continents.phtml');
|
13 |
+
parent::__construct();
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _prepareLayout()
|
17 |
+
{
|
18 |
+
$locale = $this->getRequest()->getParam('locale');
|
19 |
+
$this->setChild('back_button',
|
20 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
21 |
+
->setData(array(
|
22 |
+
'label' => Mage::helper('iifire_directory')->__('Back'),
|
23 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/continent').'\')',
|
24 |
+
'class' => 'back'
|
25 |
+
))
|
26 |
+
);
|
27 |
+
$this->setChild('new_button',
|
28 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
29 |
+
->setData(array(
|
30 |
+
'label' => Mage::helper('iifire_directory')->__('New Continent'),
|
31 |
+
'onclick' => "setLocation('".$this->getUrl('*/*/addContinent', array('locale'=>$locale))."')",
|
32 |
+
'class' => 'new'
|
33 |
+
))
|
34 |
+
);
|
35 |
+
$this->setChild('grid', $this->getLayout()->createBlock('iifire_directory/adminhtml_continent_grid', 'continent.grid'));
|
36 |
+
return parent::_prepareLayout();
|
37 |
+
}
|
38 |
+
public function getForm()
|
39 |
+
{
|
40 |
+
return $this->getLayout()
|
41 |
+
->createBlock('iifire_directory/adminhtml_continent_form')
|
42 |
+
->toHtml();
|
43 |
+
}
|
44 |
+
public function getBackButtonHtml()
|
45 |
+
{
|
46 |
+
return $this->getChildHtml('back_button');
|
47 |
+
}
|
48 |
+
public function getNewButtonHtml()
|
49 |
+
{
|
50 |
+
return $this->getChildHtml('new_button');
|
51 |
+
}
|
52 |
+
public function getHeaderText()
|
53 |
+
{
|
54 |
+
return Mage::helper('iifire_directory')->__('Manage Continent');
|
55 |
+
}
|
56 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Country.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Country extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->setTemplate('iifire/directory/country.phtml');
|
13 |
+
parent::__construct();
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _prepareLayout()
|
17 |
+
{
|
18 |
+
$this->setChild('reset_button',
|
19 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
20 |
+
->setData(array(
|
21 |
+
'label' => Mage::helper('iifire_directory')->__('Reset'),
|
22 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/*', array('_current'=>true)).'\')'
|
23 |
+
))
|
24 |
+
);
|
25 |
+
$this->setChild('manage_default_button',
|
26 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
27 |
+
->setData(array(
|
28 |
+
'label' => Mage::helper('iifire_directory')->__('Manage Default States/Province'),
|
29 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/countryDefault').'\')'
|
30 |
+
))
|
31 |
+
);
|
32 |
+
$this->setChild('continue_button',
|
33 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
34 |
+
->setData(array(
|
35 |
+
'label' => Mage::helper('iifire_directory')->__('Continue'),
|
36 |
+
'onclick' => "setSettings('".$this->getContinueUrl()."','country','locale')",
|
37 |
+
'class' => 'save'
|
38 |
+
))
|
39 |
+
);
|
40 |
+
|
41 |
+
return parent::_prepareLayout();
|
42 |
+
}
|
43 |
+
public function getForm()
|
44 |
+
{
|
45 |
+
return $this->getLayout()
|
46 |
+
->createBlock('iifire_directory/adminhtml_country_form')
|
47 |
+
->toHtml();
|
48 |
+
}
|
49 |
+
public function getResetButtonHtml()
|
50 |
+
{
|
51 |
+
return $this->getChildHtml('reset_button');
|
52 |
+
}
|
53 |
+
public function getManageDefaultButtonHtml()
|
54 |
+
{
|
55 |
+
return $this->getChildHtml('manage_default_button');
|
56 |
+
}
|
57 |
+
public function getContinueButtonHtml()
|
58 |
+
{
|
59 |
+
return $this->getChildHtml('continue_button');
|
60 |
+
}
|
61 |
+
public function getHeaderText()
|
62 |
+
{
|
63 |
+
return Mage::helper('iifire_directory')->__('Manage State/Province');
|
64 |
+
}
|
65 |
+
public function getContinueUrl()
|
66 |
+
{
|
67 |
+
return $this->getUrl('*/*/listRegion', array(
|
68 |
+
'_current' => true,
|
69 |
+
'country' => '{{country}}',
|
70 |
+
'locale' => '{{locale}}',
|
71 |
+
));
|
72 |
+
}
|
73 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Country/Form.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Country_Form extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
}
|
14 |
+
protected function _prepareForm()
|
15 |
+
{
|
16 |
+
$form = new Varien_Data_Form(array(
|
17 |
+
'id' => 'edit_form',
|
18 |
+
'action' => $this->getData('action'),
|
19 |
+
'method' => 'post'
|
20 |
+
));
|
21 |
+
|
22 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
23 |
+
'legend' => Mage::helper('iifire_directory')->__('Choose Country'),
|
24 |
+
'class' => 'fieldset-wide'
|
25 |
+
));
|
26 |
+
$options = Mage::helper('iifire_directory')->getCountryAsOptions();
|
27 |
+
$fieldset->addField('country', 'select', array(
|
28 |
+
'name' => 'Country',
|
29 |
+
'label' => Mage::helper('iifire_directory')->__('Country'),
|
30 |
+
'title' => Mage::helper('iifire_directory')->__('Country'),
|
31 |
+
'required' => true,
|
32 |
+
'value' => Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_COUNTRY),
|
33 |
+
'options' => $options,
|
34 |
+
|
35 |
+
));
|
36 |
+
$localeOptions = Mage::helper('iifire_directory')->getLocaleAsOptionArray();
|
37 |
+
$fieldset->addField('locale', 'select', array(
|
38 |
+
'name' => 'locale',
|
39 |
+
'label' => Mage::helper('iifire_directory')->__('locale'),
|
40 |
+
'title' => Mage::helper('iifire_directory')->__('locale'),
|
41 |
+
'required' => true,
|
42 |
+
'value' => Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE),
|
43 |
+
'options' => $localeOptions,
|
44 |
+
|
45 |
+
));
|
46 |
+
|
47 |
+
$this->setForm($form);
|
48 |
+
|
49 |
+
return parent::_prepareForm();
|
50 |
+
}
|
51 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Default.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Default extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->setTemplate('iifire/directory/default.phtml');
|
13 |
+
parent::__construct();
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _prepareLayout()
|
17 |
+
{
|
18 |
+
$this->setChild('back_button',
|
19 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
20 |
+
->setData(array(
|
21 |
+
'label' => Mage::helper('iifire_directory')->__('Back'),
|
22 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/countryDefault').'\')',
|
23 |
+
'class' => 'back'
|
24 |
+
))
|
25 |
+
);
|
26 |
+
$this->setChild('grid', $this->getLayout()->createBlock('iifire_directory/adminhtml_default_grid', 'address.default.grid.list'));
|
27 |
+
return parent::_prepareLayout();
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getBackButtonHtml()
|
31 |
+
{
|
32 |
+
return $this->getChildHtml('back_button');
|
33 |
+
}
|
34 |
+
public function getHeaderText()
|
35 |
+
{
|
36 |
+
return Mage::helper('iifire_directory')->__('Manage State/Province');
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Default/Country.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Default_Country extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->setTemplate('iifire/directory/default/country.phtml');
|
13 |
+
parent::__construct();
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _prepareLayout()
|
17 |
+
{
|
18 |
+
$this->setChild('reset_button',
|
19 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
20 |
+
->setData(array(
|
21 |
+
'label' => Mage::helper('iifire_directory')->__('Reset'),
|
22 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/*', array('_current'=>true)).'\')'
|
23 |
+
))
|
24 |
+
);
|
25 |
+
$this->setChild('continue_button',
|
26 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
27 |
+
->setData(array(
|
28 |
+
'label' => Mage::helper('iifire_directory')->__('Continue'),
|
29 |
+
'onclick' => "setSettings('".$this->getContinueUrl()."','country')",
|
30 |
+
'class' => 'save'
|
31 |
+
))
|
32 |
+
);
|
33 |
+
|
34 |
+
return parent::_prepareLayout();
|
35 |
+
}
|
36 |
+
public function getForm()
|
37 |
+
{
|
38 |
+
return $this->getLayout()
|
39 |
+
->createBlock('iifire_directory/adminhtml_default_country_form')
|
40 |
+
->toHtml();
|
41 |
+
}
|
42 |
+
public function getResetButtonHtml()
|
43 |
+
{
|
44 |
+
return $this->getChildHtml('reset_button');
|
45 |
+
}
|
46 |
+
public function getContinueButtonHtml()
|
47 |
+
{
|
48 |
+
return $this->getChildHtml('continue_button');
|
49 |
+
}
|
50 |
+
public function getHeaderText()
|
51 |
+
{
|
52 |
+
return Mage::helper('iifire_directory')->__('Manage Default State/Province');
|
53 |
+
}
|
54 |
+
public function getContinueUrl()
|
55 |
+
{
|
56 |
+
return $this->getUrl('*/*/listDefault', array(
|
57 |
+
'country' => '{{country}}'
|
58 |
+
));
|
59 |
+
}
|
60 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Default/Country/Form.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Default_Country_Form extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
}
|
14 |
+
|
15 |
+
protected function _prepareForm()
|
16 |
+
{
|
17 |
+
$form = new Varien_Data_Form(array(
|
18 |
+
'id' => 'edit_form',
|
19 |
+
'action' => $this->getData('action'),
|
20 |
+
'method' => 'post'
|
21 |
+
));
|
22 |
+
|
23 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
24 |
+
'legend' => Mage::helper('iifire_directory')->__('Choose Country'),
|
25 |
+
'class' => 'fieldset-wide'
|
26 |
+
));
|
27 |
+
$options = Mage::helper('iifire_directory')->getCountryAsOptions();
|
28 |
+
$fieldset->addField('country', 'select', array(
|
29 |
+
'name' => 'Country',
|
30 |
+
'label' => Mage::helper('iifire_directory')->__('Country'),
|
31 |
+
'title' => Mage::helper('iifire_directory')->__('Country'),
|
32 |
+
'required' => true,
|
33 |
+
'value' => Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_COUNTRY),
|
34 |
+
'options' => $options,
|
35 |
+
|
36 |
+
));
|
37 |
+
|
38 |
+
$this->setForm($form);
|
39 |
+
|
40 |
+
return parent::_prepareForm();
|
41 |
+
}
|
42 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Default/Edit.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Default_Edit extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->setTemplate('iifire/directory/default/edit.phtml');
|
13 |
+
parent::__construct();
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _prepareLayout()
|
17 |
+
{
|
18 |
+
$this->setChild('back_button',
|
19 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
20 |
+
->setData(array(
|
21 |
+
'label' => Mage::helper('iifire_directory')->__('Back'),
|
22 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/listDefault').'\')',
|
23 |
+
'class' => 'back'
|
24 |
+
))
|
25 |
+
);
|
26 |
+
$this->setChild('reset_button',
|
27 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
28 |
+
->setData(array(
|
29 |
+
'label' => Mage::helper('iifire_directory')->__('Reset'),
|
30 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/*').'\')',
|
31 |
+
'class' => 'reset'
|
32 |
+
))
|
33 |
+
);
|
34 |
+
$country = Mage::helper('iifire_directory')->getCountryById($this->getRequest()->getParam('country'));
|
35 |
+
$this->setChild('save_button',
|
36 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
37 |
+
->setData(array(
|
38 |
+
'label' => Mage::helper('iifire_directory')->__('Save'),
|
39 |
+
'onclick' => 'regionControl.save(\''.$this->getUrl('*/*/saveDefault').'\');',
|
40 |
+
'class' => 'save'
|
41 |
+
))
|
42 |
+
);
|
43 |
+
return parent::_prepareLayout();
|
44 |
+
}
|
45 |
+
public function getBackButtonHtml()
|
46 |
+
{
|
47 |
+
return $this->getChildHtml('back_button');
|
48 |
+
}
|
49 |
+
public function getForm()
|
50 |
+
{
|
51 |
+
return $this->getLayout()
|
52 |
+
->createBlock('iifire_directory/adminhtml_default_edit_form')
|
53 |
+
->toHtml();
|
54 |
+
}
|
55 |
+
public function getResetButtonHtml()
|
56 |
+
{
|
57 |
+
return $this->getChildHtml('reset_button');
|
58 |
+
}
|
59 |
+
public function getSaveButtonHtml()
|
60 |
+
{
|
61 |
+
return $this->getChildHtml('save_button');
|
62 |
+
}
|
63 |
+
public function getHeaderText()
|
64 |
+
{
|
65 |
+
return Mage::helper('iifire_directory')->__('Edit Default State/Province');
|
66 |
+
}
|
67 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Default/Edit/Form.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Default_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
}
|
14 |
+
protected function _prepareForm()
|
15 |
+
{
|
16 |
+
$form = new Varien_Data_Form(array(
|
17 |
+
'id' => 'edit_form',
|
18 |
+
'action' => $this->getData('action'),
|
19 |
+
'method' => 'post'
|
20 |
+
));
|
21 |
+
|
22 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
23 |
+
'legend' => Mage::helper('iifire_directory')->__('Edit Default State/Province'),
|
24 |
+
'class' => 'fieldset-wide'
|
25 |
+
));
|
26 |
+
$region= Mage::helper('iifire_directory')->getRegionById($this->getRequest()->getParam('region'));
|
27 |
+
if ($region) {
|
28 |
+
$fieldset->addField('region_id', 'hidden', array(
|
29 |
+
'name' => 'region_id',
|
30 |
+
'label' => Mage::helper('iifire_directory')->__('State/Province ID'),
|
31 |
+
'title' => Mage::helper('iifire_directory')->__('State/Province ID'),
|
32 |
+
'value' => $region['region_id'],
|
33 |
+
));
|
34 |
+
$fieldset->addField('region', 'text', array(
|
35 |
+
'name' => 'region',
|
36 |
+
'label' => Mage::helper('iifire_directory')->__('State/Province ID'),
|
37 |
+
'title' => Mage::helper('iifire_directory')->__('State/Province ID'),
|
38 |
+
'value' => $region['region_id'],
|
39 |
+
'required' => true,
|
40 |
+
'disabled' => true
|
41 |
+
));
|
42 |
+
$fieldset->addField('country_id', 'hidden', array(
|
43 |
+
'name' => 'country_id',
|
44 |
+
'label' => Mage::helper('iifire_directory')->__('Country ID'),
|
45 |
+
'title' => Mage::helper('iifire_directory')->__('Country ID'),
|
46 |
+
'value' => $region['country_id'],
|
47 |
+
));
|
48 |
+
$fieldset->addField('country', 'text', array(
|
49 |
+
'name' => 'country',
|
50 |
+
'label' => Mage::helper('iifire_directory')->__('Country ID'),
|
51 |
+
'title' => Mage::helper('iifire_directory')->__('Country ID'),
|
52 |
+
'value' => $region['country_id'],
|
53 |
+
'disabled' => true,
|
54 |
+
'required' => true,
|
55 |
+
));
|
56 |
+
$fieldset->addField('code', 'text', array(
|
57 |
+
'name' => 'code',
|
58 |
+
'label' => Mage::helper('iifire_directory')->__('State/Province Code'),
|
59 |
+
'title' => Mage::helper('iifire_directory')->__('State/Province Code'),
|
60 |
+
'value' => $region['code'],
|
61 |
+
'required' => true,
|
62 |
+
));
|
63 |
+
$fieldset->addField('default_name', 'text', array(
|
64 |
+
'name' => 'default_name',
|
65 |
+
'label' => Mage::helper('iifire_directory')->__('State/Province Default Name'),
|
66 |
+
'title' => Mage::helper('iifire_directory')->__('State/Province Default Name'),
|
67 |
+
'value' => $region['default_name'],
|
68 |
+
'required' => true,
|
69 |
+
));
|
70 |
+
}
|
71 |
+
|
72 |
+
$this->setForm($form);
|
73 |
+
|
74 |
+
return parent::_prepareForm();
|
75 |
+
}
|
76 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Default/Grid.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Default_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
9 |
+
{
|
10 |
+
protected $_regionTable;
|
11 |
+
|
12 |
+
public function __construct()
|
13 |
+
{
|
14 |
+
parent::__construct();
|
15 |
+
$this->setId('regionGrid');
|
16 |
+
$this->setDefaultSort('country_id', 'desc');
|
17 |
+
$this->_regionTable = Mage::getSingleton('core/resource')->getTableName('directory_country_region');
|
18 |
+
}
|
19 |
+
protected function _construct()
|
20 |
+
{
|
21 |
+
$this->setEmptyText(Mage::helper('iifire_directory')->__('No Default States/Province Found'));
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function _prepareCollection()
|
26 |
+
{
|
27 |
+
$countryId = $this->getRequest()->getParam('country');
|
28 |
+
$collection = Mage::getResourceSingleton('directory/region_collection');
|
29 |
+
$collection->getSelect()->reset();
|
30 |
+
$collection->getSelect()
|
31 |
+
->from(array('main_table' => $this->_regionTable))
|
32 |
+
->where('country_id=?',$countryId);
|
33 |
+
$this->setCollection($collection);
|
34 |
+
|
35 |
+
return parent::_prepareCollection();
|
36 |
+
}
|
37 |
+
|
38 |
+
protected function _prepareColumns()
|
39 |
+
{
|
40 |
+
$this->addColumn('region_id',array(
|
41 |
+
'header'=>Mage::helper('iifire_directory')->__('States/Province ID'),
|
42 |
+
'align'=>'center',
|
43 |
+
'index'=>'region_id'
|
44 |
+
));
|
45 |
+
$this->addColumn('country_id',array(
|
46 |
+
'header'=>Mage::helper('iifire_directory')->__('Country ID'),
|
47 |
+
'align'=>'center',
|
48 |
+
'index'=>'country_id'
|
49 |
+
));
|
50 |
+
$this->addColumn('code',array(
|
51 |
+
'header'=>Mage::helper('iifire_directory')->__('Code'),
|
52 |
+
'align'=>'center',
|
53 |
+
'index'=>'code'
|
54 |
+
));
|
55 |
+
$this->addColumn('default_name',array(
|
56 |
+
'header'=>Mage::helper('iifire_directory')->__('Default Name'),
|
57 |
+
'align'=>'center',
|
58 |
+
'index'=>'default_name'
|
59 |
+
));
|
60 |
+
return $this;
|
61 |
+
}
|
62 |
+
protected function _prepareMassaction()
|
63 |
+
{
|
64 |
+
$this->setMassactionIdField('region_id');
|
65 |
+
$this->getMassactionBlock()->setFormFieldName('region');
|
66 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
67 |
+
'label' => Mage::helper('iifire_directory')->__('Delete'),
|
68 |
+
'url' => $this->getUrl('*/*/deleteDefault'),
|
69 |
+
'confirm' => Mage::helper('iifire_directory')->__('Are you sure?')
|
70 |
+
));
|
71 |
+
return $this;
|
72 |
+
}
|
73 |
+
public function getRowUrl($row)
|
74 |
+
{
|
75 |
+
return $this->getUrl('*/*/editDefault', array('region'=>$row->getId()));
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
app/code/community/Iifire/Directory/Block/Adminhtml/Manage.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Manage extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
$this->setTemplate('iifire/directory/index.phtml');
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _prepareLayout()
|
17 |
+
{
|
18 |
+
return parent::_prepareLayout();
|
19 |
+
}
|
20 |
+
public function getHeaderText()
|
21 |
+
{
|
22 |
+
return Mage::helper('iifire_directory')->__('Custom Address');
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Province.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Province extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->setTemplate('iifire/directory/province.phtml');
|
13 |
+
parent::__construct();
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _prepareLayout()
|
17 |
+
{
|
18 |
+
$this->setChild('back_button',
|
19 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
20 |
+
->setData(array(
|
21 |
+
'label' => Mage::helper('iifire_directory')->__('Back'),
|
22 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/listRegion',array('country'=>$this->getRequest()->getParam('country'),'locale'=>$this->getRequest()->getParam('locale'))).'\')',
|
23 |
+
'class' => 'back'
|
24 |
+
))
|
25 |
+
);
|
26 |
+
$this->setChild('reset_button',
|
27 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
28 |
+
->setData(array(
|
29 |
+
'label' => Mage::helper('iifire_directory')->__('Reset'),
|
30 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/*', array('_current'=>true)).'\')',
|
31 |
+
'class' => 'reset'
|
32 |
+
))
|
33 |
+
);
|
34 |
+
$country = Mage::helper('iifire_directory')->getCountryById($this->getRequest()->getParam('country'));
|
35 |
+
$this->setChild('save_button',
|
36 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
37 |
+
->setData(array(
|
38 |
+
'label' => Mage::helper('iifire_directory')->__('Save'),
|
39 |
+
'onclick' => 'provinceControl.saveAndContinue(\''.$this->getUrl('*/*/saveRegion', array('continue'=>false, 'country'=>$country->getCountryId(),'locale'=>$this->getRequest()->getParam('locale'))).'\');',
|
40 |
+
'class' => 'save'
|
41 |
+
))
|
42 |
+
);
|
43 |
+
|
44 |
+
$this->setChild('save_continue_button',
|
45 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
46 |
+
->setData(array(
|
47 |
+
'label' => Mage::helper('iifire_directory')->__('Save and continue add'),
|
48 |
+
'onclick' => 'provinceControl.saveAndContinue(\''.$this->getUrl('*/*/saveRegion', array('continue'=>true, 'country'=>$country->getCountryId())).'\');',
|
49 |
+
'class' => 'save',
|
50 |
+
))
|
51 |
+
);
|
52 |
+
return parent::_prepareLayout();
|
53 |
+
}
|
54 |
+
public function getBackButtonHtml()
|
55 |
+
{
|
56 |
+
return $this->getChildHtml('back_button');
|
57 |
+
}
|
58 |
+
public function getForm()
|
59 |
+
{
|
60 |
+
return $this->getLayout()
|
61 |
+
->createBlock('iifire_directory/adminhtml_province_form')
|
62 |
+
->toHtml();
|
63 |
+
}
|
64 |
+
public function getResetButtonHtml()
|
65 |
+
{
|
66 |
+
return $this->getChildHtml('reset_button');
|
67 |
+
}
|
68 |
+
public function getSaveButtonHtml()
|
69 |
+
{
|
70 |
+
return $this->getChildHtml('save_button');
|
71 |
+
}
|
72 |
+
public function getSaveContinueButtonHtml()
|
73 |
+
{
|
74 |
+
return $this->getChildHtml('save_continue_button');
|
75 |
+
}
|
76 |
+
public function getHeaderText()
|
77 |
+
{
|
78 |
+
return Mage::helper('iifire_directory')->__('Add State/Province');
|
79 |
+
}
|
80 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Province/Form.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Province_Form extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
}
|
14 |
+
protected function _prepareForm()
|
15 |
+
{
|
16 |
+
$form = new Varien_Data_Form(array(
|
17 |
+
'id' => 'edit_form',
|
18 |
+
'action' => $this->getData('action'),
|
19 |
+
'method' => 'post'
|
20 |
+
));
|
21 |
+
|
22 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
23 |
+
'legend' => Mage::helper('iifire_directory')->__('Add State/Province'),
|
24 |
+
'class' => 'fieldset-wide'
|
25 |
+
));
|
26 |
+
$country = Mage::helper('iifire_directory')->getCountryById($this->getRequest()->getParam('country'));
|
27 |
+
if ($country) {
|
28 |
+
$fieldset->addField('country_name', 'text', array(
|
29 |
+
'name' => 'country_name',
|
30 |
+
'label' => Mage::helper('iifire_directory')->__('Country'),
|
31 |
+
'title' => Mage::helper('iifire_directory')->__('Country'),
|
32 |
+
'value' => $country->getName(),
|
33 |
+
'disabled' => true,
|
34 |
+
));
|
35 |
+
$fieldset->addField('country_id', 'hidden', array(
|
36 |
+
'name' => 'country_id',
|
37 |
+
'value' => $country->getCountryId(),
|
38 |
+
'disabled' => true,
|
39 |
+
'required' => true,
|
40 |
+
));
|
41 |
+
$locale = $this->getRequest()->getParam('locale');
|
42 |
+
$fieldset->addField('locale', 'text', array(
|
43 |
+
'name' => 'locale',
|
44 |
+
'label' => Mage::helper('iifire_directory')->__('Locale'),
|
45 |
+
'title' => Mage::helper('iifire_directory')->__('Locale'),
|
46 |
+
'value' => $locale,
|
47 |
+
'disabled' => true,
|
48 |
+
'required' => true,
|
49 |
+
));
|
50 |
+
$fieldset->addField('code', 'text', array(
|
51 |
+
'name' => 'code',
|
52 |
+
'label' => Mage::helper('iifire_directory')->__('State/Province Code'),
|
53 |
+
'title' => Mage::helper('iifire_directory')->__('State/Province Code'),
|
54 |
+
'required' => true,
|
55 |
+
));
|
56 |
+
$fieldset->addField('name', 'text', array(
|
57 |
+
'name' => 'name',
|
58 |
+
'label' => Mage::helper('iifire_directory')->__('State/Province Name'),
|
59 |
+
'title' => Mage::helper('iifire_directory')->__('State/Province Name'),
|
60 |
+
'required' => true,
|
61 |
+
));
|
62 |
+
}
|
63 |
+
|
64 |
+
$this->setForm($form);
|
65 |
+
|
66 |
+
return parent::_prepareForm();
|
67 |
+
}
|
68 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Provinces.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Provinces extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->setTemplate('iifire/directory/provinces.phtml');
|
13 |
+
parent::__construct();
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _prepareLayout()
|
17 |
+
{
|
18 |
+
$country = $this->getRequest()->getParam('country');
|
19 |
+
$locale = $this->getRequest()->getParam('locale');
|
20 |
+
$this->setChild('back_button',
|
21 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
22 |
+
->setData(array(
|
23 |
+
'label' => Mage::helper('iifire_directory')->__('Back'),
|
24 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/*').'\')',
|
25 |
+
'class' => 'back'
|
26 |
+
))
|
27 |
+
);
|
28 |
+
$this->setChild('new_button',
|
29 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
30 |
+
->setData(array(
|
31 |
+
'label' => Mage::helper('iifire_directory')->__('Add States/Province'),
|
32 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/addRegion', array('country'=>$country,'locale'=>$locale)).'\')',
|
33 |
+
'class' => 'new'
|
34 |
+
))
|
35 |
+
);
|
36 |
+
$this->setChild('grid', $this->getLayout()->createBlock('iifire_directory/adminhtml_provinces_grid', 'provinces.grid'));
|
37 |
+
return parent::_prepareLayout();
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getBackButtonHtml()
|
41 |
+
{
|
42 |
+
return $this->getChildHtml('back_button');
|
43 |
+
}
|
44 |
+
public function getNewButtonHtml()
|
45 |
+
{
|
46 |
+
return $this->getChildHtml('new_button');
|
47 |
+
}
|
48 |
+
public function getHeaderText()
|
49 |
+
{
|
50 |
+
return Mage::helper('iifire_directory')->__('Manage State/Province');
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Iifire/Directory/Block/Adminhtml/Provinces/Grid.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Block_Adminhtml_Provinces_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
9 |
+
{
|
10 |
+
protected $_regionTable;
|
11 |
+
protected $_regionNameTable;
|
12 |
+
protected $_country;
|
13 |
+
protected $_locale;
|
14 |
+
|
15 |
+
public function __construct()
|
16 |
+
{
|
17 |
+
parent::__construct();
|
18 |
+
$this->setId('provinceGrid');
|
19 |
+
$this->setDefaultSort('region_id', 'desc');
|
20 |
+
$this->_regionTable = Mage::getSingleton('core/resource')->getTableName('directory_country_region');
|
21 |
+
$this->_regionNameTable = Mage::getSingleton('core/resource')->getTableName('directory_country_region_name');
|
22 |
+
$this->_country = $this->getRequest()->getParam('country');
|
23 |
+
$this->_locale = $this->getRequest()->getParam('locale');
|
24 |
+
}
|
25 |
+
protected function _construct()
|
26 |
+
{
|
27 |
+
$this->setEmptyText(Mage::helper('iifire_directory')->__('No States/Province Found'));
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
protected function _prepareCollection()
|
32 |
+
{
|
33 |
+
$collection = Mage::getResourceSingleton('directory/region_collection');
|
34 |
+
$collection->getSelect()->reset();
|
35 |
+
$collection->getSelect()
|
36 |
+
->from(array('main_table' => $this->_regionTable))
|
37 |
+
->joinLeft(
|
38 |
+
array('rname' => $this->_regionNameTable),
|
39 |
+
'main_table.region_id = rname.region_id',
|
40 |
+
array('name','locale'))
|
41 |
+
->where('main_table.country_id = ?', $this->_country)
|
42 |
+
->where('rname.locale = ?', $this->_locale);
|
43 |
+
//echo $collection->getSelect();die();
|
44 |
+
$this->setCollection($collection);
|
45 |
+
|
46 |
+
return parent::_prepareCollection();
|
47 |
+
}
|
48 |
+
|
49 |
+
protected function _prepareColumns()
|
50 |
+
{
|
51 |
+
$this->addColumn('region_id',array(
|
52 |
+
'header'=>Mage::helper('iifire_directory')->__('States/Province ID'),
|
53 |
+
'align'=>'center',
|
54 |
+
'index'=>'region_id'
|
55 |
+
));
|
56 |
+
$this->addColumn('name',array(
|
57 |
+
'header'=>Mage::helper('iifire_directory')->__('States/Province Name'),
|
58 |
+
'align'=>'center',
|
59 |
+
'index'=>'name'
|
60 |
+
));
|
61 |
+
$this->addColumn('code',array(
|
62 |
+
'header'=>Mage::helper('iifire_directory')->__('Code'),
|
63 |
+
'align'=>'center',
|
64 |
+
'index'=>'code'
|
65 |
+
));
|
66 |
+
$this->addColumn('country_id',array(
|
67 |
+
'header'=>Mage::helper('iifire_directory')->__('Country ID'),
|
68 |
+
'align'=>'center',
|
69 |
+
'index'=>'country_id'
|
70 |
+
));
|
71 |
+
$this->addColumn('locale',array(
|
72 |
+
'header'=>Mage::helper('iifire_directory')->__('Locale'),
|
73 |
+
'align'=>'center',
|
74 |
+
'index'=>'locale'
|
75 |
+
));
|
76 |
+
return $this;
|
77 |
+
}
|
78 |
+
protected function _prepareMassaction()
|
79 |
+
{
|
80 |
+
$this->setMassactionIdField('region_id');
|
81 |
+
$this->getMassactionBlock()->setFormFieldName('region');
|
82 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
83 |
+
'label' => Mage::helper('iifire_directory')->__('Delete'),
|
84 |
+
'url' => $this->getUrl('*/*/deleteRegion',array('locale'=>$this->_locale,'country'=>$this->_country)),
|
85 |
+
'confirm' => Mage::helper('iifire_directory')->__('Are you sure?')
|
86 |
+
));
|
87 |
+
return $this;
|
88 |
+
}
|
89 |
+
public function getRowUrl($row)
|
90 |
+
{
|
91 |
+
//return $this->getUrl('*/*/edit', array('id'=>$row->getId()));
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
app/code/community/Iifire/Directory/Helper/Data.php
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Helper_Data extends Mage_Core_Helper_Abstract
|
9 |
+
{
|
10 |
+
protected function _getWrite()
|
11 |
+
{
|
12 |
+
$resource = Mage::getSingleton('core/resource');
|
13 |
+
$writeConnection = $resource->getConnection('core_write');
|
14 |
+
return $writeConnection;
|
15 |
+
}
|
16 |
+
public function getLocaleAsOptionArray()
|
17 |
+
{
|
18 |
+
$options = Mage::app()->getLocale()->getOptionLocales();
|
19 |
+
$locales = array();
|
20 |
+
foreach ($options as $locale) {
|
21 |
+
$locales[$locale['value']] = $locale['label'];
|
22 |
+
}
|
23 |
+
return $locales;
|
24 |
+
}
|
25 |
+
public function getCountryAsOptions()
|
26 |
+
{
|
27 |
+
$countrys = Mage::helper('directory')->getCountryCollection();
|
28 |
+
$countryIds = array();
|
29 |
+
|
30 |
+
foreach ($countrys as $country) {
|
31 |
+
$countryIds[$country->getCountryId()] = $country->getName();
|
32 |
+
}
|
33 |
+
return $countryIds;
|
34 |
+
}
|
35 |
+
public function getCountryById($countryId)
|
36 |
+
{
|
37 |
+
$country = Mage::helper('directory')->getCountryCollection()->addFieldToFilter('country_id',$countryId);
|
38 |
+
if (count($country)) {
|
39 |
+
return $country->getFirstItem();
|
40 |
+
} else {
|
41 |
+
return false;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
public function getRegionById($regionId)
|
45 |
+
{
|
46 |
+
if($regionId) {
|
47 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('directory_country_region');
|
48 |
+
$query = "SELECT * FROM {$tableName} where region_id={$regionId}";
|
49 |
+
$data = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchRow($query);
|
50 |
+
return $data;
|
51 |
+
}
|
52 |
+
return false;
|
53 |
+
}
|
54 |
+
public function getCountriesByContinent($continentCode)
|
55 |
+
{
|
56 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('iifire_directory_continent_country');
|
57 |
+
$query = "SELECT * FROM {$tableName} where continent_code='{$continentCode}'";
|
58 |
+
$data = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($query);
|
59 |
+
$assigns = array();
|
60 |
+
if(is_array($data)) {
|
61 |
+
foreach ($data as $d) {
|
62 |
+
array_push($assigns, $d['country_id']);
|
63 |
+
}
|
64 |
+
}
|
65 |
+
return $assigns;
|
66 |
+
|
67 |
+
}
|
68 |
+
public function addRegion($countryId, $code, $name, $locale)
|
69 |
+
{
|
70 |
+
$region = Mage::getModel('directory/region')->loadByCode($code, $countryId);
|
71 |
+
//$region = Mage::getModel('directory/region')->loadByCode('CA', 'US');
|
72 |
+
$adapter = $this->_getWrite();
|
73 |
+
$adapter->beginTransaction();
|
74 |
+
if (!$region->getRegionId()) {
|
75 |
+
try {
|
76 |
+
$data = array();
|
77 |
+
$data['country_id'] = $countryId;
|
78 |
+
$data['code'] = $code;
|
79 |
+
$data['default_name'] = $name;
|
80 |
+
$adapter->insert(Mage::getSingleton('core/resource')->getTableName('directory_country_region'), $data);
|
81 |
+
$regionId = Mage::getModel('directory/region')->loadByCode($code, $countryId)->getRegionId();
|
82 |
+
$regionNameData = array();
|
83 |
+
$regionNameData['locale'] = $locale;
|
84 |
+
$regionNameData['region_id'] = $regionId;
|
85 |
+
$regionNameData['name'] = $name;
|
86 |
+
$adapter->insert(Mage::getSingleton('core/resource')->getTableName('directory_country_region_name'), $regionNameData);
|
87 |
+
$adapter->commit();
|
88 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
89 |
+
Mage::helper('iifire_directory')->__('Added Successfully')
|
90 |
+
);
|
91 |
+
} catch (Exception $e) {
|
92 |
+
$adapter->rollBack();
|
93 |
+
}
|
94 |
+
} else {
|
95 |
+
try {
|
96 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('directory_country_region_name');
|
97 |
+
$regionId = $region->getRegionId();
|
98 |
+
$query = "SELECT region_id FROM {$tableName} where locale='{$locale}' and region_id={$regionId}";
|
99 |
+
$data = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchRow($query);
|
100 |
+
if (!$data) {
|
101 |
+
$regionNameData = array();
|
102 |
+
$regionNameData['locale'] = $locale;
|
103 |
+
$regionNameData['region_id'] = $regionId;
|
104 |
+
$regionNameData['name'] = $name;
|
105 |
+
$regionId = $adapter->insert($tableName, $regionNameData);
|
106 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
107 |
+
Mage::helper('iifire_directory')->__('Added Successfully')
|
108 |
+
);
|
109 |
+
} else {
|
110 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
111 |
+
Mage::helper('iifire_directory')->__('Duplicate Record')
|
112 |
+
);
|
113 |
+
}
|
114 |
+
|
115 |
+
$adapter->commit();
|
116 |
+
} catch (Exception $e) {
|
117 |
+
$adapter->rollBack();
|
118 |
+
}
|
119 |
+
}
|
120 |
+
}
|
121 |
+
public function addDefaultContinent($code, $name)
|
122 |
+
{
|
123 |
+
$continent = Mage::getModel('iifire_directory/continent')->loadByCode($code);
|
124 |
+
if (!$continent->getContinentId()) {
|
125 |
+
$continent->setCode($code)
|
126 |
+
->setDefaultName($name);
|
127 |
+
try {
|
128 |
+
$continent->save();
|
129 |
+
} catch (Exception $e) {
|
130 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__("Continent save failed."));
|
131 |
+
}
|
132 |
+
} else {
|
133 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__("Continent already existed."));
|
134 |
+
}
|
135 |
+
}
|
136 |
+
public function addContinent($continentId, $name, $locale)
|
137 |
+
{
|
138 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('iifire_directory_continent_name');
|
139 |
+
$query = "SELECT continent_id FROM {$tableName} where locale='{$locale}' and continent_id={$continentId}";
|
140 |
+
$data = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchRow($query);
|
141 |
+
$flag = false;
|
142 |
+
if (!$data) {
|
143 |
+
$adapter = $this->_getWrite();
|
144 |
+
$continentNameData = array();
|
145 |
+
$continentNameData['locale'] = $locale;
|
146 |
+
$continentNameData['continent_id'] = $continentId;
|
147 |
+
$continentNameData['name'] = $name;
|
148 |
+
try {
|
149 |
+
$flag = $adapter->insert($tableName, $continentNameData);
|
150 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
151 |
+
Mage::helper('iifire_directory')->__('Continet Locale Added Successfully')
|
152 |
+
);
|
153 |
+
} catch (Exception $e) {
|
154 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
155 |
+
Mage::helper('iifire_directory')->__('Continet Locale Added Failed')
|
156 |
+
);
|
157 |
+
}
|
158 |
+
|
159 |
+
} else {
|
160 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
161 |
+
Mage::helper('iifire_directory')->__('Continet Locale Already Existed')
|
162 |
+
);
|
163 |
+
}
|
164 |
+
}
|
165 |
+
public function assignCountry($continentCode, $countryArray)
|
166 |
+
{
|
167 |
+
|
168 |
+
if($continentCode && is_array($countryArray)) {
|
169 |
+
|
170 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('iifire_directory_continent_country');
|
171 |
+
$i = $j = 0;
|
172 |
+
$adapter = $this->_getWrite();
|
173 |
+
$adapter->delete($tableName, array('continent_code=?' => $continentCode));
|
174 |
+
foreach ($countryArray as $c) {
|
175 |
+
|
176 |
+
$continentData = array();
|
177 |
+
$continentData['continent_code'] = $continentCode;
|
178 |
+
$continentData['country_id'] = $c;
|
179 |
+
try {
|
180 |
+
$adapter->insert($tableName, $continentData);
|
181 |
+
$i++;
|
182 |
+
} catch (Exception $e) {
|
183 |
+
$j++;
|
184 |
+
}
|
185 |
+
}
|
186 |
+
if ($i) {
|
187 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
188 |
+
Mage::helper('iifire_directory')->__('%d Country(s) Added Successfully',$i)
|
189 |
+
);
|
190 |
+
}
|
191 |
+
if ($j) {
|
192 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
193 |
+
Mage::helper('iifire_directory')->__('%d Country(s) Added Failed',$j)
|
194 |
+
);
|
195 |
+
}
|
196 |
+
}
|
197 |
+
//die();
|
198 |
+
}
|
199 |
+
public function updateDefaultRegion($regionId, $code, $name)
|
200 |
+
{
|
201 |
+
if($regionId) {
|
202 |
+
$adapter = $this->_getWrite();
|
203 |
+
try {
|
204 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('directory_country_region');
|
205 |
+
$data = array('code'=>$code,'default_name'=>$name);
|
206 |
+
$where = array('region_id=?' => $regionId);
|
207 |
+
$adapter->update($tableName, $data, $where);
|
208 |
+
}catch (Exception $e) {
|
209 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
|
214 |
+
}
|
215 |
+
public function deleteRegion($locale, $regionId)
|
216 |
+
{
|
217 |
+
if ($locale && $regionId) {
|
218 |
+
$adapter = $this->_getWrite();
|
219 |
+
$adapter->beginTransaction();
|
220 |
+
try {
|
221 |
+
$regionTableName = Mage::getSingleton('core/resource')->getTableName('directory_country_region_name');
|
222 |
+
$adapter->delete($regionTableName, array(
|
223 |
+
'locale=?' => $locale,
|
224 |
+
'region_id=?' => $regionId,
|
225 |
+
));
|
226 |
+
|
227 |
+
$adapter->commit();
|
228 |
+
} catch (Exception $e) {
|
229 |
+
$adapter->rollBack();
|
230 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
231 |
+
}
|
232 |
+
}
|
233 |
+
}
|
234 |
+
public function deleteDefaultRegion($regionId)
|
235 |
+
{
|
236 |
+
if ($regionId) {
|
237 |
+
$adapter = $this->_getWrite();
|
238 |
+
$adapter->beginTransaction();
|
239 |
+
try {
|
240 |
+
$regionTable = Mage::getSingleton('core/resource')->getTableName('directory_country_region');
|
241 |
+
$adapter->delete($regionTable, array(
|
242 |
+
'region_id=?' => $regionId,
|
243 |
+
));
|
244 |
+
$adapter->commit();
|
245 |
+
} catch (Exception $e) {
|
246 |
+
$adapter->rollBack();
|
247 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
248 |
+
}
|
249 |
+
}
|
250 |
+
}
|
251 |
+
|
252 |
+
public function getContinentAsOptions()
|
253 |
+
{
|
254 |
+
|
255 |
+
}
|
256 |
+
}
|
app/code/community/Iifire/Directory/Model/Continent.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Iifire_Directory_Model_Continent extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('iifire_directory/continent', 'continent_id');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function loadByCode($code)
|
11 |
+
{
|
12 |
+
if ($code) {
|
13 |
+
$this->_getResource()->loadByCode($this, $code);
|
14 |
+
}
|
15 |
+
return $this;
|
16 |
+
}
|
17 |
+
public function getContinentOptions()
|
18 |
+
{
|
19 |
+
$collection = $this->getCollection();
|
20 |
+
$options = array();
|
21 |
+
if (count($collection)) {
|
22 |
+
foreach ($collection as $_c) {
|
23 |
+
$options[$_c->getContinentId()] = $_c->getCode();
|
24 |
+
}
|
25 |
+
}
|
26 |
+
return $options;
|
27 |
+
}
|
28 |
+
|
29 |
+
}
|
app/code/community/Iifire/Directory/Model/Mysql4/Continent.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Iifire_Directory_Model_Mysql4_Continent extends Mage_Core_Model_Mysql4_Abstract
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('iifire_directory/continent', 'continent_id');
|
7 |
+
}
|
8 |
+
public function loadByCode(Iifire_Directory_Model_Continent $continent, $continentCode)
|
9 |
+
{
|
10 |
+
$adapter = $this->_getReadAdapter();
|
11 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
12 |
+
$select = $adapter->select()
|
13 |
+
->from(array('continent' => $this->getMainTable()))
|
14 |
+
->where('continent.code = ?', $continentCode);
|
15 |
+
$data = $adapter->fetchRow($select);
|
16 |
+
if ($data) {
|
17 |
+
$continent->setData($data);
|
18 |
+
}
|
19 |
+
$this->_afterLoad($continent);
|
20 |
+
return $this;
|
21 |
+
}
|
22 |
+
}
|
app/code/community/Iifire/Directory/Model/Mysql4/Continent/Collection.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Iifire_Directory_Model_Mysql4_Continent_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('iifire_directory/continent');
|
7 |
+
}
|
8 |
+
}
|
app/code/community/Iifire/Directory/controllers/Adminhtml/IDirectoryController.php
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
4 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
5 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
6 |
+
* @version 1.6.0
|
7 |
+
*/
|
8 |
+
class Iifire_Directory_Adminhtml_IDirectoryController extends Mage_Adminhtml_Controller_Action
|
9 |
+
{
|
10 |
+
public function indexAction()
|
11 |
+
{
|
12 |
+
$this->loadLayout();
|
13 |
+
$this->_setActiveMenu('system/iifire_directory');
|
14 |
+
$this->_title($this->__('State/Province Manager'))->_title($this->__('Manage State/Province'));
|
15 |
+
$this->_addContent($this->getLayout()->createBlock('iifire_directory/adminhtml_country', 'country'));
|
16 |
+
$this->renderLayout();
|
17 |
+
}
|
18 |
+
public function countryDefaultAction()
|
19 |
+
{
|
20 |
+
$this->loadLayout();
|
21 |
+
$this->_setActiveMenu('system/iifire_directory');
|
22 |
+
$this->_title($this->__('State/Province Manager'))->_title($this->__('Manage Default State/Province'));
|
23 |
+
$this->_addContent($this->getLayout()->createBlock('iifire_directory/adminhtml_default_country', 'default.country'));
|
24 |
+
$this->renderLayout();
|
25 |
+
}
|
26 |
+
public function listRegionAction()
|
27 |
+
{
|
28 |
+
$country = Mage::helper('iifire_directory')->getCountryById($this->getRequest()->getParam('country'));
|
29 |
+
if (!$country) {
|
30 |
+
$this->_redirect('*/*/region');
|
31 |
+
}
|
32 |
+
$this->loadLayout();
|
33 |
+
$this->_setActiveMenu('system/iifire_directory');
|
34 |
+
$this->_title($this->__('State/Province Manager'))->_title($this->__('Manage State/Province'));
|
35 |
+
$this->_addContent($this->getLayout()->createBlock('iifire_directory/adminhtml_provinces', 'adddress.province.grid'));
|
36 |
+
$this->renderLayout();
|
37 |
+
}
|
38 |
+
public function addRegionAction()
|
39 |
+
{
|
40 |
+
$country = Mage::helper('iifire_directory')->getCountryById($this->getRequest()->getParam('country'));
|
41 |
+
|
42 |
+
if (!$country) {
|
43 |
+
$this->_redirect('*/*/region');
|
44 |
+
}
|
45 |
+
$this->loadLayout();
|
46 |
+
$this->_setActiveMenu('system/iifire_directory');
|
47 |
+
$this->_title($this->__('State/Province Manager'))->_title($this->__('Add State/Province'));
|
48 |
+
$this->_addContent($this->getLayout()->createBlock('iifire_directory/adminhtml_province', 'adddress.province'));
|
49 |
+
$this->renderLayout();
|
50 |
+
}
|
51 |
+
|
52 |
+
public function deleteRegionAction()
|
53 |
+
{
|
54 |
+
$countryId = trim($this->getRequest()->getParam('country'));
|
55 |
+
$locale = trim($this->getRequest()->getParam('locale'));
|
56 |
+
$regions = $this->getRequest()->getParam('region');
|
57 |
+
if (!is_array($regions)) {
|
58 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('iifire_directory')->__('Please select Region(s)'));
|
59 |
+
} else {
|
60 |
+
try {
|
61 |
+
foreach($regions as $region) {
|
62 |
+
Mage::helper('iifire_directory')->deleteRegion($locale, $region);
|
63 |
+
}
|
64 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('iifire_directory')->__('Deleted Successfully'));
|
65 |
+
} catch (Exception $e) {
|
66 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
67 |
+
}
|
68 |
+
}
|
69 |
+
$this->_redirect('*/*/listRegion',array('country'=>$countryId, 'locale'=>$locale));
|
70 |
+
|
71 |
+
}
|
72 |
+
public function saveRegionAction()
|
73 |
+
{
|
74 |
+
$countryId = trim($this->getRequest()->getParam('country'));
|
75 |
+
$code = trim($this->getRequest()->getParam('code'));
|
76 |
+
$name = trim($this->getRequest()->getParam('name'));
|
77 |
+
$locale = trim($this->getRequest()->getParam('locale'));
|
78 |
+
try {
|
79 |
+
Mage::helper('iifire_directory')->addRegion($countryId, $code, $name, $locale);
|
80 |
+
} catch(Exception $e) {
|
81 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
82 |
+
}
|
83 |
+
if ($continue = $this->getRequest()->getParam('continue')) {
|
84 |
+
$this->_redirect('*/*/addRegion', array('country'=>$countryId, 'locale'=>$locale));
|
85 |
+
} else {
|
86 |
+
$this->_redirect('*/*/listRegion',array('country'=>$countryId, 'locale'=>$locale));
|
87 |
+
}
|
88 |
+
|
89 |
+
}
|
90 |
+
public function listDefaultAction()
|
91 |
+
{
|
92 |
+
$countryId = $this->getRequest()->getParam('country');
|
93 |
+
if (!$countryId) {
|
94 |
+
$this->_redirect('*/*/region');
|
95 |
+
}
|
96 |
+
$this->loadLayout();
|
97 |
+
$this->_setActiveMenu('system/iifire_directory');
|
98 |
+
$this->_title($this->__('State/Province Manager'))->_title($this->__('Manage Default Address'));
|
99 |
+
$this->_addContent($this->getLayout()->createBlock('iifire_directory/adminhtml_default', 'province.default.grid'));
|
100 |
+
$this->renderLayout();
|
101 |
+
}
|
102 |
+
public function deleteDefaultAction()
|
103 |
+
{
|
104 |
+
$regions = $this->getRequest()->getParam('region');
|
105 |
+
if (!is_array($regions)) {
|
106 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('iifire_directory')->__('Please select State/Province ID(s)'));
|
107 |
+
} else {
|
108 |
+
try {
|
109 |
+
foreach($regions as $region) {
|
110 |
+
Mage::helper('iifire_directory')->deleteDefaultRegion($region);
|
111 |
+
}
|
112 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('iifire_directory')->__('Deleted Successfully'));
|
113 |
+
} catch (Exception $e) {
|
114 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
115 |
+
}
|
116 |
+
}
|
117 |
+
$this->_redirect('*/*/listDefault');
|
118 |
+
}
|
119 |
+
public function editDefaultAction()
|
120 |
+
{
|
121 |
+
$region = $this->getRequest()->getParam('region');
|
122 |
+
if (!$region) {
|
123 |
+
$this->_redirect('*/*/region');
|
124 |
+
}
|
125 |
+
$this->loadLayout();
|
126 |
+
$this->_setActiveMenu('system/iifire_directory');
|
127 |
+
$this->_title($this->__('State/Province Manager'))->_title($this->__('Edit Default State/Province'));
|
128 |
+
$this->_addContent($this->getLayout()->createBlock('iifire_directory/adminhtml_default_edit', 'adddress.default.edit'));
|
129 |
+
$this->renderLayout();
|
130 |
+
}
|
131 |
+
|
132 |
+
public function saveDefaultAction()
|
133 |
+
{
|
134 |
+
$code = trim($this->getRequest()->getParam('code'));
|
135 |
+
$name = trim($this->getRequest()->getParam('default_name'));
|
136 |
+
$regionId = trim($this->getRequest()->getParam('region_id'));
|
137 |
+
if($regionId && $name && $code) {
|
138 |
+
try {
|
139 |
+
Mage::helper('iifire_directory')->updateDefaultRegion($regionId, $code, $name);
|
140 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
141 |
+
Mage::helper('iifire_directory')->__('Updated Successfully')
|
142 |
+
);
|
143 |
+
} catch(Exception $e) {
|
144 |
+
}
|
145 |
+
}
|
146 |
+
$this->_redirect('*/*/listDefault');
|
147 |
+
|
148 |
+
}
|
149 |
+
public function defaultContinentAction()
|
150 |
+
{
|
151 |
+
$this->loadLayout();
|
152 |
+
$this->_setActiveMenu('system/iifire_directory');
|
153 |
+
$this->_title($this->__('State/Province Manager'))->_title($this->__('Manage Continent'));
|
154 |
+
$this->_addContent($this->getLayout()->createBlock('iifire_directory/adminhtml_continent_default', 'continent'));
|
155 |
+
$this->renderLayout();
|
156 |
+
}
|
157 |
+
public function addDefaultContinentAction()
|
158 |
+
{
|
159 |
+
$this->loadLayout();
|
160 |
+
$this->_setActiveMenu('system/iifire_directory');
|
161 |
+
$this->_title($this->__('State/Province Manager'))->_title($this->__('Add Continent'));
|
162 |
+
$this->_addContent($this->getLayout()->createBlock('iifire_directory/adminhtml_continent_default_new', 'continent'));
|
163 |
+
$this->renderLayout();
|
164 |
+
}
|
165 |
+
public function assignContinentAction()
|
166 |
+
{
|
167 |
+
$this->loadLayout();
|
168 |
+
$this->_setActiveMenu('system/iifire_directory');
|
169 |
+
$this->_title($this->__('State/Province Manager'))->_title($this->__('Assign Country To Continent'));
|
170 |
+
$this->_addContent($this->getLayout()->createBlock('iifire_directory/adminhtml_continent_default_assign', 'continent.assign'));
|
171 |
+
$this->renderLayout();
|
172 |
+
}
|
173 |
+
public function saveDefaultContinentAction()
|
174 |
+
{
|
175 |
+
$code = $this->getRequest()->getParam('code');
|
176 |
+
$name = $this->getRequest()->getParam('name');
|
177 |
+
if ($code && $name) {
|
178 |
+
Mage::helper('iifire_directory')->addDefaultContinent($code, $name);
|
179 |
+
}
|
180 |
+
$this->_redirect('*/*/defaultContinent');
|
181 |
+
}
|
182 |
+
public function continentAction()
|
183 |
+
{
|
184 |
+
$this->loadLayout();
|
185 |
+
$this->_setActiveMenu('system/iifire_directory');
|
186 |
+
$this->_title($this->__('State/Province Manager'))->_title($this->__('Manage Continent Locale'));
|
187 |
+
$this->_addContent($this->getLayout()->createBlock('iifire_directory/adminhtml_continent', 'continent'));
|
188 |
+
$this->renderLayout();
|
189 |
+
}
|
190 |
+
public function listContinentAction()
|
191 |
+
{
|
192 |
+
$this->loadLayout();
|
193 |
+
$this->_setActiveMenu('system/iifire_directory');
|
194 |
+
$this->_title($this->__('Continent Management'))->_title($this->__('State/Province Manager'));
|
195 |
+
$this->_addContent($this->getLayout()->createBlock('iifire_directory/adminhtml_continents', 'directory.continent.grid'));
|
196 |
+
$this->renderLayout();
|
197 |
+
}
|
198 |
+
public function addContinentAction()
|
199 |
+
{
|
200 |
+
$this->loadLayout();
|
201 |
+
$this->_setActiveMenu('system/iifire_directory');
|
202 |
+
$this->_title($this->__('New Continent'))->_title($this->__('State/Province Manager'));
|
203 |
+
$this->_addContent($this->getLayout()->createBlock('iifire_directory/adminhtml_continent_new', 'directory.continent.new'));
|
204 |
+
$this->renderLayout();
|
205 |
+
}
|
206 |
+
public function saveContinentAction()
|
207 |
+
{
|
208 |
+
$locale = $this->getRequest()->getParam('locale');
|
209 |
+
$continent = $this->getRequest()->getParam('continent');
|
210 |
+
$name = $this->getRequest()->getParam('name');
|
211 |
+
//var_dump($this->getRequest()->getParams());die();
|
212 |
+
if ($locale && $continent && $name) {
|
213 |
+
Mage::helper('iifire_directory')->addContinent($continent, $name, $locale);
|
214 |
+
}
|
215 |
+
$this->_redirect('*/*/listContinent', array('locale'=>$locale));
|
216 |
+
}
|
217 |
+
public function saveContinentAssignAction()
|
218 |
+
{
|
219 |
+
$countries = $this->getRequest()->getParam('country');
|
220 |
+
$continent = $this->getRequest()->getParam('continent');
|
221 |
+
|
222 |
+
Mage::helper('iifire_directory')->assignCountry($continent,$countries);
|
223 |
+
if ($this->getRequest()->getParam('continue')) {
|
224 |
+
$this->_redirect("*/*/assignContinent");
|
225 |
+
} else {
|
226 |
+
$this->_redirect("*/*/defaultContinent");
|
227 |
+
}
|
228 |
+
}
|
229 |
+
public function cityAction()
|
230 |
+
{
|
231 |
+
$this->loadLayout();
|
232 |
+
$this->_setActiveMenu('system/iifire_directory');
|
233 |
+
$this->_title($this->__('State/Province Manager'))->_title($this->__('Manage City'));
|
234 |
+
$this->_addContent($this->getLayout()->createBlock('iifire_directory/adminhtml_city', 'city'));
|
235 |
+
$this->renderLayout();
|
236 |
+
}
|
237 |
+
}
|
app/code/community/Iifire/Directory/etc/adminhtml.xml
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
5 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
6 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
7 |
+
* @version 1.6.0
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<menu>
|
12 |
+
<system>
|
13 |
+
<children>
|
14 |
+
<iifire_directory translate="title" module="iifire_directory">
|
15 |
+
<title>State/Province Manager</title>
|
16 |
+
<sort_order>1</sort_order>
|
17 |
+
<!--<action>adminhtml/idirectory/index</action>-->
|
18 |
+
<children>
|
19 |
+
<continent translate="title" module="iifire_directory">
|
20 |
+
<title>Manage Continent</title>
|
21 |
+
<sort_order>1</sort_order>
|
22 |
+
<action>adminhtml/idirectory/defaultContinent</action>
|
23 |
+
</continent>
|
24 |
+
<continent_locale translate="title" module="iifire_directory">
|
25 |
+
<title>Manage Continent Locale</title>
|
26 |
+
<sort_order>5</sort_order>
|
27 |
+
<action>adminhtml/idirectory/continent</action>
|
28 |
+
</continent_locale>
|
29 |
+
<region translate="title" module="iifire_directory">
|
30 |
+
<title>Manage State/Province</title>
|
31 |
+
<sort_order>10</sort_order>
|
32 |
+
<action>adminhtml/idirectory/index</action>
|
33 |
+
</region>
|
34 |
+
<city translate="title" module="iifire_directory">
|
35 |
+
<title>Manage City</title>
|
36 |
+
<sort_order>20</sort_order>
|
37 |
+
<action>adminhtml/idirectory/city</action>
|
38 |
+
</city>
|
39 |
+
</children>
|
40 |
+
</iifire_directory>
|
41 |
+
</children>
|
42 |
+
</system>
|
43 |
+
</menu>
|
44 |
+
<acl>
|
45 |
+
<resources>
|
46 |
+
<admin>
|
47 |
+
<children>
|
48 |
+
<system>
|
49 |
+
<children>
|
50 |
+
<iifire_directory translate="title">
|
51 |
+
<title>State/Province Manager</title>
|
52 |
+
</iifire_directory>
|
53 |
+
</children>
|
54 |
+
</system>
|
55 |
+
</children>
|
56 |
+
</admin>
|
57 |
+
</resources>
|
58 |
+
</acl>
|
59 |
+
</config>
|
app/code/community/Iifire/Directory/etc/config.xml
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
5 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
6 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
7 |
+
* @version 1.6.1
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Iifire_Directory>
|
13 |
+
<version>1.6.1</version>
|
14 |
+
</Iifire_Directory>
|
15 |
+
</modules>
|
16 |
+
<global>
|
17 |
+
<blocks>
|
18 |
+
<iifire_directory>
|
19 |
+
<class>Iifire_Directory_Block</class>
|
20 |
+
</iifire_directory>
|
21 |
+
</blocks>
|
22 |
+
<helpers>
|
23 |
+
<iifire_directory>
|
24 |
+
<class>Iifire_Directory_Helper</class>
|
25 |
+
</iifire_directory>
|
26 |
+
</helpers>
|
27 |
+
<models>
|
28 |
+
<iifire_directory>
|
29 |
+
<class>Iifire_Directory_Model</class>
|
30 |
+
<resourceModel>iifire_directory_mysql4</resourceModel>
|
31 |
+
</iifire_directory>
|
32 |
+
<iifire_directory_mysql4>
|
33 |
+
<class>Iifire_Directory_Model_Mysql4</class>
|
34 |
+
<entities>
|
35 |
+
<continent>
|
36 |
+
<table>iifire_directory_continent</table>
|
37 |
+
</continent>
|
38 |
+
<continent_country>
|
39 |
+
<table>iifire_directory_continent_country</table>
|
40 |
+
</continent_country>
|
41 |
+
<continent_name>
|
42 |
+
<table>iifire_directory_continent_name</table>
|
43 |
+
</continent_name>
|
44 |
+
<city>
|
45 |
+
<table>iifire_directory_city</table>
|
46 |
+
</city>
|
47 |
+
<city_name>
|
48 |
+
<table>iifire_directory_city_name</table>
|
49 |
+
</city_name>
|
50 |
+
|
51 |
+
</entities>
|
52 |
+
</iifire_directory_mysql4>
|
53 |
+
</models>
|
54 |
+
<resources>
|
55 |
+
<iifire_directory_setup>
|
56 |
+
<setup>
|
57 |
+
<module>Iifire_Directory</module>
|
58 |
+
</setup>
|
59 |
+
</iifire_directory_setup>
|
60 |
+
</resources>
|
61 |
+
</global>
|
62 |
+
<admin>
|
63 |
+
<routers>
|
64 |
+
<adminhtml>
|
65 |
+
<args>
|
66 |
+
<modules>
|
67 |
+
<Iifire_Directory before="Mage_Adminhtml">Iifire_Directory_Adminhtml</Iifire_Directory>
|
68 |
+
</modules>
|
69 |
+
</args>
|
70 |
+
</adminhtml>
|
71 |
+
</routers>
|
72 |
+
</admin>
|
73 |
+
<adminhtml>
|
74 |
+
<translate>
|
75 |
+
<modules>
|
76 |
+
<Iifire_Directory>
|
77 |
+
<files>
|
78 |
+
<default>Iifire_Directory.csv</default>
|
79 |
+
</files>
|
80 |
+
</Iifire_Directory>
|
81 |
+
</modules>
|
82 |
+
</translate>
|
83 |
+
</adminhtml>
|
84 |
+
</config>
|
app/code/community/Iifire/Directory/sql/iifire_directory_setup/mysql4-upgrade-1.6.0-1.6.1.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
|
5 |
+
$installer->run("
|
6 |
+
DROP TABLE IF EXISTS {$this->getTable('iifire_directory_continent')};
|
7 |
+
CREATE TABLE {$this->getTable('iifire_directory_continent')} (
|
8 |
+
`continent_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'City Id',
|
9 |
+
`country_id` varchar(4) NOT NULL DEFAULT '0' COMMENT 'country Id',
|
10 |
+
`code` varchar(32) NOT NULL COMMENT 'Continent code',
|
11 |
+
`default_name` varchar(255) DEFAULT NULL COMMENT 'Continent Name',
|
12 |
+
PRIMARY KEY (`continent_id`,`country_id`)
|
13 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iifire Directory Continent';
|
14 |
+
|
15 |
+
DROP TABLE IF EXISTS {$this->getTable('iifire_directory_continent_name')};
|
16 |
+
CREATE TABLE {$this->getTable('iifire_directory_continent_name')} (
|
17 |
+
`locale` varchar(8) NOT NULL COMMENT 'Locale',
|
18 |
+
`continent_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Continent Id',
|
19 |
+
`name` varchar(255) NOT NULL COMMENT 'Continent Name',
|
20 |
+
PRIMARY KEY (`locale`,`continent_id`),
|
21 |
+
KEY `IDX_IIFIRE_DIRECTORY_CONTINENT_NAME_CONTINENT_ID` (`continent_id`),
|
22 |
+
CONSTRAINT `FK_IIFIRE_DIRECTORY_CONTINENT_NAME_CONTINENT_ID` FOREIGN KEY (`continent_id`) REFERENCES {$this->getTable('iifire_directory_continent')} (`continent_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
23 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iifire Directory Continent Name';
|
24 |
+
|
25 |
+
DROP TABLE IF EXISTS {$this->getTable('iifire_directory_city')};
|
26 |
+
CREATE TABLE {$this->getTable('iifire_directory_city')} (
|
27 |
+
`city_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'City Id',
|
28 |
+
`region_id` varchar(4) NOT NULL DEFAULT '0' COMMENT 'Region Id',
|
29 |
+
`code` varchar(32) NOT NULL COMMENT 'City code',
|
30 |
+
`default_name` varchar(255) DEFAULT NULL COMMENT 'City Name',
|
31 |
+
PRIMARY KEY (`city_id`),
|
32 |
+
KEY `IDX_IIFIRE_DIRECTORY_REGION_CITY_REGION_ID` (`region_id`)
|
33 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iifire Directory City';
|
34 |
+
|
35 |
+
DROP TABLE IF EXISTS {$this->getTable('iifire_directory_city_name')};
|
36 |
+
CREATE TABLE {$this->getTable('iifire_directory_city_name')} (
|
37 |
+
`locale` varchar(8) NOT NULL COMMENT 'Locale',
|
38 |
+
`city_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'City Id',
|
39 |
+
`name` varchar(255) NOT NULL COMMENT 'City Name',
|
40 |
+
PRIMARY KEY (`locale`,`city_id`),
|
41 |
+
KEY `IDX_IIFIRE_DIRECTORY_REGION_CITY_NAME_REGION_ID` (`city_id`),
|
42 |
+
CONSTRAINT `FK_IIFIRE_DIRECTORY_CITY_NAME_CITY_ID` FOREIGN KEY (`city_id`) REFERENCES {$this->getTable('iifire_directory_city')} (`city_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
43 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iifire Directory City Name';");
|
44 |
+
$installer->endSetup();
|
45 |
+
|
app/design/adminhtml/default/default/template/iifire/directory/continent.phtml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
?>
|
4 |
+
<div class="content-header">
|
5 |
+
<h3 class="icon-head"><?php echo $this->getHeaderText() ?></h3>
|
6 |
+
<p class="content-buttons form-buttons">
|
7 |
+
<?php echo $this->getResetButtonHtml() ?>
|
8 |
+
<?php echo $this->getManageDefaultButtonHtml() ?>
|
9 |
+
</p>
|
10 |
+
</div>
|
11 |
+
<form action="<?php echo $this->getSaveUrl() ?>" method="post" id="continent_edit_form" enctype="multipart/form-data">
|
12 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
13 |
+
<?php echo $this->getForm(); ?>
|
14 |
+
<?php echo $this->getContinueButtonHtml(); ?>
|
15 |
+
</form>
|
16 |
+
<script type="text/javascript">
|
17 |
+
//<![CDATA[
|
18 |
+
var continentTemplateSyntax = /(^|.|\r|\n)({{(\w+)}})/;
|
19 |
+
function setSettings(urlTemplate, localeElement) {
|
20 |
+
var template = new Template(urlTemplate, continentTemplateSyntax);
|
21 |
+
setLocation(template.evaluate({locale:$F(localeElement)}));
|
22 |
+
}
|
23 |
+
//]]>
|
24 |
+
</script>
|
app/design/adminhtml/default/default/template/iifire/directory/continent/default.phtml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Galey <yanggaojiao@qq.com>
|
4 |
+
* @copyright Copyright © 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
|
5 |
+
* @version 1.0.0
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<div class="content-header">
|
9 |
+
<h3 class="icon-head"><?php echo $this->getHeaderText() ?></h3>
|
10 |
+
<p class="content-buttons form-buttons">
|
11 |
+
<?php echo $this->getBackButtonHtml(); ?>
|
12 |
+
<?php echo $this->getNewButtonHtml(); ?>
|
13 |
+
|
14 |
+
</p>
|
15 |
+
</div>
|
16 |
+
<?php echo $this->getChildHtml('grid') ?>
|
app/design/adminhtml/default/default/template/iifire/directory/continent/new.phtml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="content-header">
|
2 |
+
<h3 class="icon-head"><?php echo $this->getHeaderText() ?></h3>
|
3 |
+
<p class="content-buttons form-buttons">
|
4 |
+
<?php echo $this->getBackButtonHtml(); ?>
|
5 |
+
<?php echo $this->getResetButtonHtml(); ?>
|
6 |
+
<?php echo $this->getSaveButtonHtml(); ?>
|
7 |
+
</p>
|
8 |
+
</div>
|
9 |
+
<form action="<?php echo $this->getSaveUrl() ?>" method="post" name="continent_edit_form" id="continent_edit_form" enctype="multipart/form-data">
|
10 |
+
<?php echo $this->getBlockHtml('formkey'); ?>
|
11 |
+
<?php echo $this->getForm(); ?>
|
12 |
+
</form>
|
13 |
+
|
14 |
+
<script type="text/javascript">
|
15 |
+
//<![CDATA[
|
16 |
+
var continentForm = new varienForm('continent_edit_form');
|
17 |
+
var continentControl = {
|
18 |
+
save: function() {
|
19 |
+
continentForm.submit();
|
20 |
+
}
|
21 |
+
}
|
22 |
+
//]]>
|
23 |
+
</script>
|
app/design/adminhtml/default/default/template/iifire/directory/continents.phtml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Galey <yanggaojiao@qq.com>
|
4 |
+
* @copyright Copyright © 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
|
5 |
+
* @version 1.0.0
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<div class="content-header">
|
9 |
+
<h3 class="icon-head"><?php echo $this->getHeaderText() ?></h3>
|
10 |
+
<p class="content-buttons form-buttons">
|
11 |
+
<?php echo $this->getBackButtonHtml(); ?>
|
12 |
+
<?php echo $this->getNewButtonHtml(); ?>
|
13 |
+
|
14 |
+
</p>
|
15 |
+
</div>
|
16 |
+
<?php echo $this->getChildHtml('grid') ?>
|
app/design/adminhtml/default/default/template/iifire/directory/country.phtml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Galey <yanggaojiao@qq.com>
|
4 |
+
* @copyright Copyright © 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
|
5 |
+
* @version 1.0.0
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<div class="content-header">
|
9 |
+
<h3 class="icon-head head-products"><?php echo $this->getHeaderText() ?></h3>
|
10 |
+
<p class="content-buttons form-buttons">
|
11 |
+
<?php echo $this->getResetButtonHtml() ?>
|
12 |
+
<?php echo $this->getManageDefaultButtonHtml() ?>
|
13 |
+
</p>
|
14 |
+
</div>
|
15 |
+
<form action="<?php echo $this->getSaveUrl() ?>" method="post" id="country_edit_form" enctype="multipart/form-data">
|
16 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
17 |
+
<?php echo $this->getForm(); ?>
|
18 |
+
<?php echo $this->getContinueButtonHtml(); ?>
|
19 |
+
</form>
|
20 |
+
<script type="text/javascript">
|
21 |
+
//<![CDATA[
|
22 |
+
var countryTemplateSyntax = /(^|.|\r|\n)({{(\w+)}})/;
|
23 |
+
function setSettings(urlTemplate, countryElement, localeElement) {
|
24 |
+
var template = new Template(urlTemplate, countryTemplateSyntax);
|
25 |
+
setLocation(template.evaluate({country:$F(countryElement),locale:$F(localeElement)}));
|
26 |
+
}
|
27 |
+
//]]>
|
28 |
+
</script>
|
app/design/adminhtml/default/default/template/iifire/directory/default.phtml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Galey <yanggaojiao@qq.com>
|
4 |
+
* @copyright Copyright © 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
|
5 |
+
* @version 1.0.0
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<div class="content-header">
|
9 |
+
<h3 class="icon-head head-products"><?php echo $this->getHeaderText() ?></h3>
|
10 |
+
<p class="content-buttons form-buttons">
|
11 |
+
<?php echo $this->getBackButtonHtml(); ?>
|
12 |
+
</p>
|
13 |
+
</div>
|
14 |
+
<?php echo $this->getChildHtml('grid') ?>
|
app/design/adminhtml/default/default/template/iifire/directory/default/country.phtml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Galey <yanggaojiao@qq.com>
|
4 |
+
* @copyright Copyright © 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
|
5 |
+
* @version 1.0.0
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<div class="content-header">
|
9 |
+
<h3 class="icon-head head-products"><?php echo $this->getHeaderText() ?></h3>
|
10 |
+
<p class="content-buttons form-buttons">
|
11 |
+
<?php echo $this->getResetButtonHtml() ?>
|
12 |
+
</p>
|
13 |
+
</div>
|
14 |
+
<form action="<?php echo $this->getSaveUrl() ?>" method="post" id="country_edit_form" enctype="multipart/form-data">
|
15 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
16 |
+
<?php echo $this->getForm(); ?>
|
17 |
+
<?php echo $this->getContinueButtonHtml(); ?>
|
18 |
+
</form>
|
19 |
+
<script type="text/javascript">
|
20 |
+
//<![CDATA[
|
21 |
+
var countryTemplateSyntax = /(^|.|\r|\n)({{(\w+)}})/;
|
22 |
+
function setSettings(urlTemplate, countryElement) {
|
23 |
+
var template = new Template(urlTemplate, countryTemplateSyntax);
|
24 |
+
setLocation(template.evaluate({country:$F(countryElement)}));
|
25 |
+
}
|
26 |
+
//]]>
|
27 |
+
</script>
|
app/design/adminhtml/default/default/template/iifire/directory/default/edit.phtml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Galey <yanggaojiao@qq.com>
|
4 |
+
* @copyright Copyright © 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
|
5 |
+
* @version 1.0.0
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<div class="content-header">
|
9 |
+
<h3 class="icon-head head-products"><?php echo $this->getHeaderText() ?></h3>
|
10 |
+
<p class="content-buttons form-buttons">
|
11 |
+
<?php echo $this->getBackButtonHtml(); ?>
|
12 |
+
<?php echo $this->getResetButtonHtml(); ?>
|
13 |
+
<?php echo $this->getSaveButtonHtml(); ?>
|
14 |
+
</p>
|
15 |
+
</div>
|
16 |
+
<form action="<?php echo $this->getSaveUrl() ?>" method="post" name="region_edit_form" id="region_edit_form" enctype="multipart/form-data">
|
17 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
18 |
+
<?php echo $this->getForm(); ?>
|
19 |
+
</form>
|
20 |
+
|
21 |
+
<script type="text/javascript">
|
22 |
+
//<![CDATA[
|
23 |
+
var regionForm = new varienForm('region_edit_form');
|
24 |
+
var regionControl = {
|
25 |
+
save: function(url) {
|
26 |
+
$('region_edit_form').setAttribute('action', url);
|
27 |
+
regionForm.submit();
|
28 |
+
}
|
29 |
+
}
|
30 |
+
//]]>
|
31 |
+
</script>
|
app/design/adminhtml/default/default/template/iifire/directory/province.phtml
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Galey <yanggaojiao@qq.com>
|
4 |
+
* @copyright Copyright © 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
|
5 |
+
* @version 1.0.0
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<div class="content-header">
|
9 |
+
<h3 class="icon-head head-products"><?php echo $this->getHeaderText() ?></h3>
|
10 |
+
<p class="content-buttons form-buttons">
|
11 |
+
<?php echo $this->getBackButtonHtml(); ?>
|
12 |
+
<?php echo $this->getResetButtonHtml(); ?>
|
13 |
+
<?php echo $this->getSaveButtonHtml(); ?>
|
14 |
+
<?php echo $this->getSaveContinueButtonHtml(); ?>
|
15 |
+
</p>
|
16 |
+
</div>
|
17 |
+
<form action="<?php echo $this->getSaveUrl() ?>" method="post" name="province_add_form" id="province_add_form" enctype="multipart/form-data">
|
18 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
19 |
+
<?php echo $this->getForm(); ?>
|
20 |
+
</form>
|
21 |
+
|
22 |
+
<script type="text/javascript">
|
23 |
+
//<![CDATA[
|
24 |
+
var provinceForm = new varienForm('province_add_form');
|
25 |
+
var provinceControl = {
|
26 |
+
saveAndContinue: function(url) {
|
27 |
+
$('province_add_form').setAttribute('action', url);
|
28 |
+
provinceForm.submit();
|
29 |
+
}
|
30 |
+
}
|
31 |
+
//]]>
|
32 |
+
</script>
|
app/design/adminhtml/default/default/template/iifire/directory/provinces.phtml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Galey <yanggaojiao@qq.com>
|
4 |
+
* @copyright Copyright © 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
|
5 |
+
* @version 1.0.0
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<div class="content-header">
|
9 |
+
<h3 class="icon-head head-products"><?php echo $this->getHeaderText() ?></h3>
|
10 |
+
<p class="content-buttons form-buttons">
|
11 |
+
<?php echo $this->getBackButtonHtml(); ?>
|
12 |
+
<?php echo $this->getNewButtonHtml(); ?>
|
13 |
+
</p>
|
14 |
+
</div>
|
15 |
+
<?php echo $this->getChildHtml('grid') ?>
|
app/etc/modules/Iifire_Directory.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Joy <yanggaojiao@qq.com> (http://ecommerce.iifire.com)
|
5 |
+
* @copyright Copyright © 2012, Iifire (http://demo.iifire.com)
|
6 |
+
* @support Hellokeykey (http://www.hellokeykey.com)
|
7 |
+
* @version 1.6.0
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Iifire_Directory>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>community</codePool>
|
15 |
+
<depends>
|
16 |
+
<Mage_Directory />
|
17 |
+
</depends>
|
18 |
+
</Iifire_Directory>
|
19 |
+
</modules>
|
20 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>state_province_manager</name>
|
4 |
+
<version>1.6.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Province Manager</summary>
|
10 |
+
<description>Easy to add a custom State / Province / Region to a Country</description>
|
11 |
+
<notes>Easy to add a custom State / Province / Region to a Country</notes>
|
12 |
+
<authors><author><name>iifire</name><user>iifire</user><email>yanggaojiao@qq.com</email></author></authors>
|
13 |
+
<date>2012-08-21</date>
|
14 |
+
<time>13:22:55</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Iifire"><dir name="Directory"><dir name="Block"><dir name="Adminhtml"><dir name="Continent"><dir name="Default"><dir name="Assign"><file name="Form.php" hash="aaa9b1cf6c4154f10d58d3e9a7078cde"/></dir><file name="Assign.php" hash="09aaaec50396627b6a142a6cb0049464"/><file name="Grid.php" hash="1fbcdd463b23d3271536a682fbc4727b"/><dir name="New"><file name="Form.php" hash="f240a66d8495784d4d0f04b52a1fca36"/></dir><file name="New.php" hash="f99535e4501e3b808c490dfe3e778552"/></dir><file name="Default.php" hash="fca317e24d1d9a6ca1a353af28c73696"/><file name="Form.php" hash="8bda9567db0dccff1f390cb53870d465"/><file name="Grid.php" hash="e3d556c23b4a818afc8621b502ceec95"/><dir name="New"><file name="Form.php" hash="42faf53a204e3e4a47818678a5ec1aea"/></dir><file name="New.php" hash="ff094e28bf03283eda2b701d56247361"/></dir><file name="Continent.php" hash="6eaccdf756bfaef2d05ef7e85ede0eb0"/><file name="Continents.php" hash="da8cc6d41fa8133ce4a59a31afef9ba5"/><dir name="Country"><file name="Form.php" hash="ebc0a6b5d2c537540b2017b82c7c6d3d"/></dir><file name="Country.php" hash="a3482c71a233e945f67d9ee6e25f75b2"/><dir name="Default"><dir name="Country"><file name="Form.php" hash="33c6f44e495fba31d24db272ab9adf1e"/></dir><file name="Country.php" hash="1c63524fe9992e021f4ca7eec4564bcb"/><dir name="Edit"><file name="Form.php" hash="412386c639ba989083f53cc9b16952b5"/></dir><file name="Edit.php" hash="c9cc348f750b0d4cd34523e707ae9f13"/><file name="Grid.php" hash="4fd9323b7d0474156742ff5cc2f0d8fd"/></dir><file name="Default.php" hash="1d9a3f4821fdfe54f0d84dcacf996801"/><file name="Manage.php" hash="717a9a3cd3c0c9422f4c4d2420188adf"/><dir name="Province"><file name="Form.php" hash="1e9f2f41b16dbf3f327e01a186e7db64"/></dir><file name="Province.php" hash="9081ee07f38a7a872cf64cd36780e931"/><dir name="Provinces"><file name="Grid.php" hash="7520579e41eae67021c13eba20053205"/></dir><file name="Provinces.php" hash="4843d250b10bb95ba2d564be7aa05b67"/></dir></dir><dir name="Helper"><file name="Data.php" hash="34c92ae2f40694ca51445eb5cb34b449"/></dir><dir name="Model"><file name="Continent.php" hash="9c80c2785745fa8fb463a25de34a4a6c"/><dir name="Mysql4"><dir name="Continent"><file name="Collection.php" hash="50d088c0be6caba0dbc5c12c90f424db"/></dir><file name="Continent.php" hash="d9f70735380868308b14bf6a772a2053"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IDirectoryController.php" hash="01657f5f1b42973d7de385ac4c9a9fce"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="83607bcef8bde87ca58bc968fda254ae"/><file name="config.xml" hash="74c684be32562e438e08fd150d3c73fb"/></dir><dir name="sql"><dir name="iifire_directory_setup"><file name="mysql4-upgrade-1.6.0-1.6.1.php" hash="dbb5a04eb4dd0f58a25fded534214e22"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="iifire"><dir name="directory"><dir name="continent"><file name="default.phtml" hash="b6b9bec400d80ec7d70c8c0a4d2cc552"/><file name="new.phtml" hash="e35795b40e0622f6bc3af0faa94114dd"/></dir><file name="continent.phtml" hash="56b85180574cceec66d26ea275754fe9"/><file name="continents.phtml" hash="b6b9bec400d80ec7d70c8c0a4d2cc552"/><file name="country.phtml" hash="df8deb69213658f29dc8a2e71990f7df"/><dir name="default"><file name="country.phtml" hash="aa5ca923640b757af0cffbfc44ab7fe8"/><file name="edit.phtml" hash="66273114c6d1f59ae2d4b63e65659df0"/></dir><file name="default.phtml" hash="e034a9faceaaad6842b31f774b407277"/><file name="province.phtml" hash="01f096dd80e35b36b2cb75d245076e77"/><file name="provinces.phtml" hash="131c78ea82f28de375c44ec19dcf8479"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iifire_Directory.xml" hash="14109a74fe5e1372119d18e2c1073c0f"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|