Version Notes
- Multilingual support
- French translation of the module
- Zip-code supports alphanumeric characters
- Fix display map in the checkout page
Download this release
Release Info
| Developer | Proxym Group |
| Extension | Proxymit_StoreShipper |
| Version | 1.0.4.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.4 to 1.0.4.1
app/code/community/Proxymit/StoreShipper/Block/Adminhtml/Stores/Edit/Tab/Form.php
CHANGED
|
@@ -2,42 +2,43 @@
|
|
| 2 |
/**
|
| 3 |
*
|
| 4 |
* Proxymit_StoreShipper Module
|
| 5 |
-
* Adminhtml Block
|
| 6 |
* Location : StoreShipper->Manage Stores->Edit Store->General Infromation Tab
|
| 7 |
-
*
|
| 8 |
*/
|
| 9 |
class Proxymit_StoreShipper_Block_Adminhtml_Stores_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
'required' => true
|
| 35 |
-
) );
|
| 36 |
-
$fieldset->addField ( 'status', 'select', array (
|
| 37 |
-
'name' => 'status',
|
| 38 |
-
'label' => $this->__ ( 'Enable' ),
|
| 39 |
-
'values' => Mage::getModel ( 'adminhtml/system_config_source_yesno' )->toOptionArray ()
|
| 40 |
-
) );
|
| 41 |
|
| 42 |
// $fieldset->addField ( 'shipping_price', 'text', array (
|
| 43 |
// 'name' => 'shipping_price',
|
|
@@ -45,69 +46,69 @@ class Proxymit_StoreShipper_Block_Adminhtml_Stores_Edit_Tab_Form extends Mage_Ad
|
|
| 45 |
// 'title' => Mage::helper ( 'storeshipper' )->__ ( 'Shipping Price' ),
|
| 46 |
// 'required' => true
|
| 47 |
// ) );
|
| 48 |
-
|
| 49 |
-
// Get All Storeviews
|
| 50 |
-
$storess=array();
|
| 51 |
-
array_push($storess, array('value' => -1 , 'label' => 'Show in all stores'));
|
| 52 |
-
foreach (Mage::app()->getWebsites() as $website) {
|
| 53 |
-
foreach ($website->getGroups() as $group) {
|
| 54 |
-
$stores = $group->getStores();
|
| 55 |
-
foreach ($stores as $store) {
|
| 56 |
-
array_push($storess, array('value' => $store->getId() , 'label' => $store->getName()));
|
| 57 |
-
}
|
| 58 |
-
}
|
| 59 |
-
}
|
| 60 |
-
// Get All Countries
|
| 61 |
-
$pays=array();
|
| 62 |
-
array_push($pays, array('value' => '' , 'label' => ''));
|
| 63 |
-
|
| 64 |
-
$_countries = Mage::getResourceModel('directory/country_collection')
|
| 65 |
-
->loadData()->toOptionArray(false);
|
| 66 |
-
foreach($_countries as $_country){
|
| 67 |
-
array_push($pays, array('value' => $_country['label'] , 'label' => $_country['label']));
|
| 68 |
-
}
|
| 69 |
-
|
| 70 |
-
$fieldset->addField ( 'available_at_storeview', 'select', array (
|
| 71 |
-
'name' => 'available_at_storeview',
|
| 72 |
-
'label' => $this->__ ( 'Show in Storeview' ),
|
| 73 |
-
'values' => $storess
|
| 74 |
-
) );
|
| 75 |
-
|
| 76 |
-
$fieldset->addField ( 'adress', 'textarea', array (
|
| 77 |
-
'name' => 'adress',
|
| 78 |
-
'label' => Mage::helper ( 'storeshipper' )->__ ( 'Adress' ),
|
| 79 |
-
'title' => Mage::helper ( 'storeshipper' )->__ ( 'Adress' ),
|
| 80 |
-
'required' => true
|
| 81 |
-
) );
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
'label' => Mage::helper ( 'storeshipper' )->__ ( 'Zip code' ),
|
| 105 |
-
'title' => Mage::helper ( 'storeshipper' )->__ ( 'Zip code' ),
|
| 106 |
-
'required' => true
|
| 107 |
-
) );
|
| 108 |
-
|
| 109 |
-
$form->setValues ( $model->getData () );
|
| 110 |
-
|
| 111 |
-
return parent::_prepareForm ();
|
| 112 |
-
}
|
| 113 |
}
|
| 2 |
/**
|
| 3 |
*
|
| 4 |
* Proxymit_StoreShipper Module
|
| 5 |
+
* Adminhtml Block
|
| 6 |
* Location : StoreShipper->Manage Stores->Edit Store->General Infromation Tab
|
| 7 |
+
*
|
| 8 |
*/
|
| 9 |
class Proxymit_StoreShipper_Block_Adminhtml_Stores_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
|
| 10 |
+
protected function _prepareForm() {
|
| 11 |
+
$form = new Varien_Data_Form ();
|
| 12 |
+
$this->setForm ( $form );
|
| 13 |
+
$fieldset = $form->addFieldset ( 'info_form', array (
|
| 14 |
+
'legend' => Mage::helper ( 'storeshipper' )->__ ( 'Store Information' )
|
| 15 |
+
) );
|
| 16 |
+
try{
|
| 17 |
+
if (Mage::registry ( 'storeshipper' )->_data ["id"] != NULL) {
|
| 18 |
+
$model = Mage::getModel ( 'storeshipper/stores' )->load ( Mage::registry ( 'storeshipper' )->getId () );
|
| 19 |
+
} else {
|
| 20 |
+
$model = Mage::getModel ( 'storeshipper/stores' );
|
| 21 |
+
}
|
| 22 |
+
}catch(Exception $e){$model = Mage::getModel ( 'storeshipper/stores' );}
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
if ($model->getId ()) {
|
| 26 |
+
$fieldset->addField ( 'id', 'hidden', array (
|
| 27 |
+
'name' => 'id'
|
| 28 |
+
) );
|
| 29 |
+
}
|
| 30 |
|
| 31 |
+
$fieldset->addField ( 'name', 'text', array (
|
| 32 |
+
'name' => 'name',
|
| 33 |
+
'label' => Mage::helper ( 'storeshipper' )->__ ( 'Name' ),
|
| 34 |
+
'title' => Mage::helper ( 'storeshipper' )->__ ( 'Name' ),
|
| 35 |
+
'required' => true
|
| 36 |
+
) );
|
| 37 |
+
$fieldset->addField ( 'status', 'select', array (
|
| 38 |
+
'name' => 'status',
|
| 39 |
+
'label' => $this->__ ( 'Enable' ),
|
| 40 |
+
'values' => Mage::getModel ( 'adminhtml/system_config_source_yesno' )->toOptionArray ()
|
| 41 |
+
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
// $fieldset->addField ( 'shipping_price', 'text', array (
|
| 44 |
// 'name' => 'shipping_price',
|
| 46 |
// 'title' => Mage::helper ( 'storeshipper' )->__ ( 'Shipping Price' ),
|
| 47 |
// 'required' => true
|
| 48 |
// ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
+
// Get All Storeviews
|
| 51 |
+
$storess=array();
|
| 52 |
+
array_push($storess, array('value' => -1 , 'label' => 'Show in all stores'));
|
| 53 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
| 54 |
+
foreach ($website->getGroups() as $group) {
|
| 55 |
+
$stores = $group->getStores();
|
| 56 |
+
foreach ($stores as $store) {
|
| 57 |
+
array_push($storess, array('value' => $store->getId() , 'label' => $store->getName()));
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
// Get All Countries
|
| 62 |
+
$pays=array();
|
| 63 |
+
array_push($pays, array('value' => '' , 'label' => ''));
|
| 64 |
+
|
| 65 |
+
$_countries = Mage::getResourceModel('directory/country_collection')
|
| 66 |
+
->loadData()->toOptionArray(false);
|
| 67 |
+
foreach($_countries as $_country){
|
| 68 |
+
array_push($pays, array('value' => $_country['label'] , 'label' => $_country['label']));
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
$fieldset->addField ( 'available_at_storeview', 'select', array (
|
| 72 |
+
'name' => 'available_at_storeview',
|
| 73 |
+
'label' => $this->__ ( 'Show in Storeview' ),
|
| 74 |
+
'values' => $storess
|
| 75 |
+
) );
|
| 76 |
+
|
| 77 |
+
$fieldset->addField ( 'adress', 'textarea', array (
|
| 78 |
+
'name' => 'adress',
|
| 79 |
+
'label' => Mage::helper ( 'storeshipper' )->__ ( 'Adress' ),
|
| 80 |
+
'title' => Mage::helper ( 'storeshipper' )->__ ( 'Adress' ),
|
| 81 |
+
'required' => true
|
| 82 |
+
) );
|
| 83 |
+
|
| 84 |
+
$fieldset->addField('country', 'select', array(
|
| 85 |
+
'name' => 'country',
|
| 86 |
+
'label' => 'Country',
|
| 87 |
+
'required' => true,
|
| 88 |
+
'values' => Mage::getModel('adminhtml/system_config_source_country')->toOptionArray(),
|
| 89 |
+
));
|
| 90 |
+
$fieldset->addField ( 'state', 'text', array (
|
| 91 |
+
'name' => 'state',
|
| 92 |
+
'label' => Mage::helper ( 'storeshipper' )->__ ( 'State' ),
|
| 93 |
+
'title' => Mage::helper ( 'storeshipper' )->__ ( 'State' ),
|
| 94 |
+
'required' => true
|
| 95 |
+
) );
|
| 96 |
+
$fieldset->addField ( 'city', 'text', array (
|
| 97 |
+
'name' => 'city',
|
| 98 |
+
'label' => Mage::helper ( 'storeshipper' )->__ ( 'City' ),
|
| 99 |
+
'title' => Mage::helper ( 'storeshipper' )->__ ( 'City' ),
|
| 100 |
+
'required' => true
|
| 101 |
+
) );
|
| 102 |
+
|
| 103 |
+
$fieldset->addField ( 'zipcode', 'text', array (
|
| 104 |
+
'name' => 'zipcode',
|
| 105 |
+
'label' => Mage::helper ( 'storeshipper' )->__ ( 'Zip code' ),
|
| 106 |
+
'title' => Mage::helper ( 'storeshipper' )->__ ( 'Zip code' ),
|
| 107 |
+
'required' => true
|
| 108 |
+
) );
|
| 109 |
+
|
| 110 |
+
$form->setValues ( $model->getData () );
|
| 111 |
|
| 112 |
+
return parent::_prepareForm ();
|
| 113 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
}
|
app/code/community/Proxymit/StoreShipper/controllers/Adminhtml/IndexController.php
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
<?php
|
| 2 |
/**
|
| 3 |
*
|
| 4 |
* Proxymit_StoreShipper Module
|
|
@@ -7,516 +7,520 @@
|
|
| 7 |
*/
|
| 8 |
class Proxymit_StoreShipper_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
|
| 9 |
{
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
// $fileName = 'stores.csv';
|
| 289 |
// $content = $this->getLayout()->createBlock('storeshipper/adminhtml_stores_grid')
|
| 290 |
// ->getCsv();
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
}
|
| 522 |
?>
|
| 1 |
+
<?php
|
| 2 |
/**
|
| 3 |
*
|
| 4 |
* Proxymit_StoreShipper Module
|
| 7 |
*/
|
| 8 |
class Proxymit_StoreShipper_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
|
| 9 |
{
|
| 10 |
+
/**
|
| 11 |
+
* Init Action
|
| 12 |
+
*/
|
| 13 |
+
protected function _initAction()
|
| 14 |
+
{
|
| 15 |
+
$this->loadLayout()->_setActiveMenu('storeshipper/stores')
|
| 16 |
+
->_addBreadcrumb('Store Manager','test Manager');
|
| 17 |
+
|
| 18 |
+
return $this;
|
| 19 |
+
}
|
| 20 |
+
/**
|
| 21 |
+
* Index Action
|
| 22 |
+
*/
|
| 23 |
+
public function indexAction()
|
| 24 |
+
{
|
| 25 |
+
$this->_initAction();
|
| 26 |
+
$this->renderLayout();
|
| 27 |
+
|
| 28 |
+
}
|
| 29 |
+
/**
|
| 30 |
+
* Add New Store Action
|
| 31 |
+
*/
|
| 32 |
+
public function newAction()
|
| 33 |
+
{
|
| 34 |
+
$this->loadLayout();
|
| 35 |
+
$this->_addContent($this->getLayout()->createBlock('storeshipper/adminhtml_stores_edit'))
|
| 36 |
+
->_addLeft($this->getLayout()->createBlock('storeshipper/adminhtml_stores_edit_tabs'));
|
| 37 |
+
$this->renderLayout();
|
| 38 |
+
|
| 39 |
+
//$this->_forward('edit');
|
| 40 |
+
}
|
| 41 |
+
/**
|
| 42 |
+
* Edit Store Action
|
| 43 |
+
*/
|
| 44 |
+
public function editAction()
|
| 45 |
+
{
|
| 46 |
+
$this->_initAction();
|
| 47 |
+
|
| 48 |
+
// Get id if available
|
| 49 |
+
$id = $this->getRequest()->getParam('id');
|
| 50 |
+
$model = Mage::getModel('storeshipper/stores');
|
| 51 |
+
|
| 52 |
+
if ($id) {
|
| 53 |
+
// Load record
|
| 54 |
+
$model->load($id);
|
| 55 |
+
|
| 56 |
+
// Check if record is loaded
|
| 57 |
+
if (!$model->getId()) {
|
| 58 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('This store no longer exists.'));
|
| 59 |
+
$this->_redirect('*/*/');
|
| 60 |
+
|
| 61 |
+
return;
|
| 62 |
+
}else{
|
| 63 |
+
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
$this->_title($model->getId() ? $model->getName() : $this->__('New Store'));
|
| 68 |
+
|
| 69 |
+
$data = Mage::getSingleton('adminhtml/session')->getBazData(true);
|
| 70 |
+
if (!empty($data)) {
|
| 71 |
+
$model->setData($data);
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
Mage::register('storeshipper', $model);
|
| 75 |
+
|
| 76 |
+
$this->_initAction()
|
| 77 |
+
->_addContent($this->getLayout()->createBlock('storeshipper/adminhtml_stores_edit')->setData('action', $this->getUrl('*/*/save')))
|
| 78 |
+
->_addLeft($this->getLayout()->createBlock('storeshipper/adminhtml_stores_edit_tabs'))
|
| 79 |
+
->renderLayout();
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
/**
|
| 83 |
+
* Delete Store Action
|
| 84 |
+
*/
|
| 85 |
+
public function deleteAction() {
|
| 86 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
| 87 |
+
try {
|
| 88 |
+
$model = Mage::getModel('storeshipper/stores');
|
| 89 |
+
|
| 90 |
+
$model->setId($this->getRequest()->getParam('id'))
|
| 91 |
+
->delete();
|
| 92 |
+
|
| 93 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
| 94 |
+
$this->_redirect('*/*/');
|
| 95 |
+
} catch (Exception $e) {
|
| 96 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 97 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
$this->_redirect('*/*/');
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
/**
|
| 104 |
+
* Save Store Action
|
| 105 |
+
*/
|
| 106 |
+
public function saveAction()
|
| 107 |
+
{
|
| 108 |
+
if ($postData = $this->getRequest()->getPost()) {
|
| 109 |
+
$model = Mage::getSingleton('storeshipper/stores');
|
| 110 |
+
// Load Store From ID
|
| 111 |
+
if($this->getRequest()->getParam('id')){
|
| 112 |
+
$model=Mage::getModel("storeshipper/stores")->load($this->getRequest()->getParam('id'));
|
| 113 |
+
}else{
|
| 114 |
+
$model=Mage::getModel("storeshipper/stores");
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
// Unset ID Store if there is on
|
| 119 |
+
if($this->getRequest()->getParam('id') == null){
|
| 120 |
+
unset($postData["id"]);
|
| 121 |
+
}else{
|
| 122 |
+
$model->setId($this->getRequest()->getParam('id'));
|
| 123 |
+
}
|
| 124 |
+
$model->setData($postData);
|
| 125 |
+
if($this->getRequest()->getParam('id')){
|
| 126 |
+
$model->setId($this->getRequest()->getParam('id'));
|
| 127 |
+
}
|
| 128 |
+
try {
|
| 129 |
+
|
| 130 |
+
$model->save();
|
| 131 |
+
|
| 132 |
+
// Upload Images while Saving Store
|
| 133 |
+
if(isset($_FILES['store_image']['name']) and (file_exists($_FILES['store_image']['tmp_name']))) {
|
| 134 |
+
try {
|
| 135 |
+
$uploader = new Varien_File_Uploader('store_image');
|
| 136 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
| 137 |
+
$uploader->setAllowRenameFiles(true);
|
| 138 |
+
$uploader->setFilesDispersion(false);
|
| 139 |
+
// Build Path Under media/storeshipper/id_store
|
| 140 |
+
$path = Mage::getBaseDir('media') . DS. 'storeshipper'.DS.$this->getRequest()->getParam('id').DS ;
|
| 141 |
+
$uploader->save($path, $_FILES['store_image']['name']);
|
| 142 |
+
$data['store_image'] = $_FILES['store_image']['name'];
|
| 143 |
+
}catch(Exception $e) {
|
| 144 |
+
|
| 145 |
+
}
|
| 146 |
+
}
|
| 147 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The store has been saved.'));
|
| 148 |
+
$this->_redirect('*/*/');
|
| 149 |
+
|
| 150 |
+
return;
|
| 151 |
+
}
|
| 152 |
+
catch (Mage_Core_Exception $e) {
|
| 153 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 154 |
+
}
|
| 155 |
+
catch (Exception $e) {
|
| 156 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while saving this store.'));
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
Mage::getSingleton('adminhtml/session')->setBazData($postData);
|
| 160 |
+
$this->_redirectReferer();
|
| 161 |
+
}
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
/**
|
| 165 |
+
* Delete image of a store by store ID - Action
|
| 166 |
+
*/
|
| 167 |
+
public function deleteImageAction()
|
| 168 |
+
{
|
| 169 |
+
$path = Mage::getBaseDir ( 'media' ) . DS . 'storeshipper' . DS .$this->getRequest()->getParam('id').DS;
|
| 170 |
+
$nm = $this->getRequest()->getParam('imagename');
|
| 171 |
+
unlink($path.$nm);
|
| 172 |
+
$this->_redirect('*/*/edit/id/'.$this->getRequest()->getParam('id').'/');
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
/**
|
| 176 |
+
* Add Image for a store Action
|
| 177 |
+
*/
|
| 178 |
+
public function addImageAction()
|
| 179 |
+
{
|
| 180 |
+
$this->_redirect('*/*/edit/id/'.$this->getRequest()->getParam('id').'/');
|
| 181 |
+
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
/**
|
| 185 |
+
* Message content Action
|
| 186 |
+
*/
|
| 187 |
+
public function messageAction()
|
| 188 |
+
{
|
| 189 |
+
$data = Mage::getModel('storeshipper/stores')->load($this->getRequest()->getParam('id'));
|
| 190 |
+
echo $data->getContent();
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
protected function _isAllowed()
|
| 195 |
+
{
|
| 196 |
+
return Mage::getSingleton('admin/session')->isAllowed('storeshipper/stores');
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
/**
|
| 200 |
+
* Import list of stores CSV Action
|
| 201 |
+
*/
|
| 202 |
+
public function importCsvAction() {
|
| 203 |
+
|
| 204 |
+
// Import file path
|
| 205 |
+
$fileName = Mage::getBaseDir().DS."stores.csv";
|
| 206 |
+
// delimeter
|
| 207 |
+
$delimiter = ',';
|
| 208 |
+
// enclosure
|
| 209 |
+
$enclosure = '"';
|
| 210 |
+
// init store model
|
| 211 |
+
$model = Mage::getModel('storeshipper/stores');
|
| 212 |
+
// open file on read access
|
| 213 |
+
try{
|
| 214 |
+
$file = fopen ( $fileName, "r" );
|
| 215 |
+
}catch (Exception $e){
|
| 216 |
+
$file = null;
|
| 217 |
+
}
|
| 218 |
+
if(!$file){
|
| 219 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('File not found under : '.$fileName));
|
| 220 |
+
$this->_redirect("*/*/", array());
|
| 221 |
+
return;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
$csvArr=array();
|
| 225 |
+
$i=0;
|
| 226 |
+
while ( ! feof ( $file ) ) {
|
| 227 |
+
$csvArr = fgetcsv ( $file, 0, $delimiter, $enclosure );
|
| 228 |
+
if($i>0){
|
| 229 |
+
$data=array();
|
| 230 |
+
$data["name"]=$csvArr[1];
|
| 231 |
+
$data["status"]=$csvArr[2];
|
| 232 |
+
$data["shipping_price"]=$csvArr[3];
|
| 233 |
+
$data["adress"]=$csvArr[4];
|
| 234 |
+
$data["city"]=$csvArr[5];
|
| 235 |
+
$data["zipcode"]=$csvArr[6];
|
| 236 |
+
$data["country"]=$csvArr[7];
|
| 237 |
+
$data["state"]=$csvArr[8];
|
| 238 |
+
$data["latitude"]=$csvArr[9];
|
| 239 |
+
$data["longitude"]=$csvArr[10];
|
| 240 |
+
$data["description"]=$csvArr[11];
|
| 241 |
+
$data["website"]=$csvArr[12];
|
| 242 |
+
$data["email"]=$csvArr[13];
|
| 243 |
+
$data["phone"]=$csvArr[14];
|
| 244 |
+
$data["fax"]=$csvArr[15];
|
| 245 |
+
$data["manager_name"]=$csvArr[16];
|
| 246 |
+
$data["manager_email"]=$csvArr[17];
|
| 247 |
+
$data["manager_show_frontend"]=$csvArr[18];
|
| 248 |
+
$data["manager_fax"]=$csvArr[19];
|
| 249 |
+
$data["manager_phone"]=$csvArr[20];
|
| 250 |
+
$data["id_schedule"]=NULL;
|
| 251 |
+
$data["available_at_storeview"]=$csvArr[22];
|
| 252 |
+
$data["available_after"]=$csvArr[23];
|
| 253 |
+
$data["monday_open"]=$csvArr[24];
|
| 254 |
+
$data["monday_close"]=$csvArr[25];
|
| 255 |
+
$data["tuesday_open"]=$csvArr[26];
|
| 256 |
+
$data["tuesday_close"]=$csvArr[27];
|
| 257 |
+
$data["wednesday_open"]=$csvArr[28];
|
| 258 |
+
$data["wednesday_close"]=$csvArr[29];
|
| 259 |
+
$data["thursday_open"]=$csvArr[30];
|
| 260 |
+
$data["thursday_close"]=$csvArr[31];
|
| 261 |
+
$data["friday_open"]=$csvArr[32];
|
| 262 |
+
$data["friday_close"]=$csvArr[33];
|
| 263 |
+
$data["saturday_open"]=$csvArr[34];
|
| 264 |
+
$data["saturday_close"]=$csvArr[35];
|
| 265 |
+
$data["sunday_open"]=$csvArr[36];
|
| 266 |
+
$data["sunday_close"]=$csvArr[37];
|
| 267 |
+
|
| 268 |
+
// set model data
|
| 269 |
+
if($data["name"] != NULL){
|
| 270 |
+
$model->setData($data);
|
| 271 |
+
// save line
|
| 272 |
+
$model->save();
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
}
|
| 276 |
+
$i++;
|
| 277 |
+
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
fclose ( $file );
|
| 281 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Stores imported successfully '));
|
| 282 |
+
$this->_redirect("*/*/", array());
|
| 283 |
+
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
/**
|
| 288 |
+
* Export list of stores CSV Action
|
| 289 |
+
*/
|
| 290 |
+
public function exportCsvAction()
|
| 291 |
+
{
|
| 292 |
// $fileName = 'stores.csv';
|
| 293 |
// $content = $this->getLayout()->createBlock('storeshipper/adminhtml_stores_grid')
|
| 294 |
// ->getCsv();
|
| 295 |
+
$fileName = 'stores.csv'; //file path of the CSV file in which the data to be saved
|
| 296 |
+
|
| 297 |
+
//$mage_csv = new Varien_File_Csv(); //mage CSV
|
| 298 |
+
$content = Mage::helper('storeshipper')->generateMlnList();
|
| 299 |
+
|
| 300 |
+
$this->_prepareDownloadResponse($fileName, $content);
|
| 301 |
+
}
|
| 302 |
+
/**
|
| 303 |
+
* Export list of stores XML Action
|
| 304 |
+
*/
|
| 305 |
+
public function exportXmlAction()
|
| 306 |
+
{
|
| 307 |
+
$fileName = 'stores.xml';
|
| 308 |
+
$content = $this->getLayout()->createBlock('storeshipper/adminhtml_stores_grid')
|
| 309 |
+
->getXml();
|
| 310 |
+
$this->_prepareDownloadResponse($fileName, $content);
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
|
| 314 |
+
/**
|
| 315 |
+
* Store Manager Email Notification
|
| 316 |
+
*/
|
| 317 |
+
public function notifyStoreManagerAction()
|
| 318 |
+
{
|
| 319 |
+
if($this->getRequest()->getParam('order_id')){
|
| 320 |
+
// Retrieve Order ID From redirection
|
| 321 |
+
$order=Mage::getModel('sales/order')->load($this->getRequest()->getParam('order_id'));
|
| 322 |
+
|
| 323 |
+
// Get Store ID
|
| 324 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
| 325 |
+
|
| 326 |
+
// Get Store Manager Email Adress
|
| 327 |
+
$store_order=Mage::getModel('storeshipper/orders')->getCollection()->addFieldToFilter('id_order',$order->getId() );
|
| 328 |
+
$data=$store_order->getData();
|
| 329 |
+
$store= Mage::getModel('storeshipper/stores')->load($data[0]["id_store"]);
|
| 330 |
+
$email= $store->getManagerEmail();
|
| 331 |
+
|
| 332 |
+
// Retrieve store manager email template id
|
| 333 |
+
$templateId = Mage::getStoreConfig('carriers/pickup/email_manager_template');
|
| 334 |
+
//Zend_Debug::dump($templateId);
|
| 335 |
+
//die();
|
| 336 |
+
|
| 337 |
+
// If default template send email with default template
|
| 338 |
+
if($templateId == "carriers_pickup_email_manager_template"){
|
| 339 |
+
|
| 340 |
+
/**
|
| 341 |
+
* $templateId can be set to numeric or string type value.
|
| 342 |
+
* You can use Id of transactional emails (found in
|
| 343 |
+
* "System->Trasactional Emails"). But better practice is
|
| 344 |
+
* to create a config for this and use xml path to fetch
|
| 345 |
+
* email template info (whatever from file/db).
|
| 346 |
+
*/
|
| 347 |
+
//const EMAIL_TEMPLATE_XML_PATH = 'customer/testemail/email_template';
|
| 348 |
+
//$templateId = Mage::getStoreConfig('store');
|
| 349 |
+
|
| 350 |
+
$mailSubject = 'StoreShipper Notification';
|
| 351 |
+
|
| 352 |
+
/**
|
| 353 |
+
* $sender can be of type string or array. You can set identity of
|
| 354 |
+
* diffrent Store emails (like 'support', 'sales', etc.) found
|
| 355 |
+
* in "System->Configuration->General->Store Email Addresses"
|
| 356 |
+
*/
|
| 357 |
+
$sender = Array('name' => Mage::getStoreConfig('trans_email/ident_general/name', $storeId),
|
| 358 |
+
'email' => Mage::getStoreConfig('trans_email/ident_general/email', $storeId));
|
| 359 |
+
|
| 360 |
+
/**
|
| 361 |
+
* If $name = null, then magento will parse the email id
|
| 362 |
+
* and use the base part as name.
|
| 363 |
+
*/
|
| 364 |
+
$name = Mage::getStoreConfig('trans_email/ident_general/name', $storeId);
|
| 365 |
+
|
| 366 |
+
$vars = Array();
|
| 367 |
+
/* An example how you can pass magento objects and normal variables*/
|
| 368 |
+
|
| 369 |
+
$vars = Array('order'=>$order);
|
| 370 |
+
|
| 371 |
+
/*This is optional*/
|
| 372 |
+
$storeId = Mage::app()->getStore()->getId();
|
| 373 |
+
|
| 374 |
+
$translate = Mage::getSingleton('core/translate');
|
| 375 |
+
try{
|
| 376 |
+
Mage::getModel('core/email_template')->loadDefault('storeshipper_manager')
|
| 377 |
+
->setTemplateSubject($mailSubject)
|
| 378 |
+
->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
| 379 |
+
$translate->setTranslateInline(true);
|
| 380 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The Store Manager has been notified to '.$email));
|
| 381 |
+
$this->_redirect("adminhtml/sales_order/view", array('order_id'=>$order->getId()));
|
| 382 |
+
|
| 383 |
+
}catch(Exception $e){
|
| 384 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Error : Email was not sent !'));
|
| 385 |
+
$this->_redirect("adminhtml/sales_order/view", array('order_id'=>$order->getId()));
|
| 386 |
+
}
|
| 387 |
+
return;
|
| 388 |
+
}
|
| 389 |
+
if($templateId){
|
| 390 |
+
$mailer = Mage::getModel('core/email_template_mailer');
|
| 391 |
+
$emailInfo = Mage::getModel('core/email_info');
|
| 392 |
+
$emailInfo->addTo($email, "Customer Notification");
|
| 393 |
+
|
| 394 |
+
$mailer->addEmailInfo($emailInfo);
|
| 395 |
+
// Set all required params and send emails
|
| 396 |
+
$mailer->setSender(Mage::getStoreConfig('sales_email/shipment/identity', $storeId));
|
| 397 |
+
$mailer->setStoreId($storeId);
|
| 398 |
+
$mailer->setTemplateId($templateId);
|
| 399 |
+
|
| 400 |
+
$mailer->setTemplateParams(array(
|
| 401 |
+
'order' => $order,
|
| 402 |
+
)
|
| 403 |
+
);
|
| 404 |
+
try {
|
| 405 |
+
// SEND EMAIL
|
| 406 |
+
$mailer->send();
|
| 407 |
+
// Mage::log($mailer);
|
| 408 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The Store Manager has been notified to '.$email));
|
| 409 |
+
$this->_redirect("adminhtml/sales_order/view", array('order_id'=>$order->getId()));
|
| 410 |
+
}
|
| 411 |
+
catch (Exception $e) {
|
| 412 |
+
Mage::logException($e);
|
| 413 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Invalide Email Template ! Please select a new email template in the Global StoreShipper Config'));
|
| 414 |
+
$this->_redirect("adminhtml/sales_order/view", array('order_id'=>$order->getId()));
|
| 415 |
+
}
|
| 416 |
+
}else{
|
| 417 |
+
Mage::log("Invalide Template");
|
| 418 |
+
}
|
| 419 |
+
}
|
| 420 |
+
}
|
| 421 |
+
/**
|
| 422 |
+
* Client Email Notification
|
| 423 |
+
*/
|
| 424 |
+
public function notifyCustomerAction()
|
| 425 |
+
{
|
| 426 |
+
if($this->getRequest()->getParam('order_id')){
|
| 427 |
+
// Retrieve Order ID From redirection
|
| 428 |
+
$order=Mage::getModel('sales/order')->load($this->getRequest()->getParam('order_id'));
|
| 429 |
+
// Get Store ID
|
| 430 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
| 431 |
+
|
| 432 |
+
// Get Customer Email Adress
|
| 433 |
+
$email = $order->getCustomerEmail();
|
| 434 |
+
|
| 435 |
+
// Retrieve store manager email template id
|
| 436 |
+
$templateId = Mage::getStoreConfig('carriers/pickup/email_customer_template');
|
| 437 |
+
//Zend_Debug::dump($templateId);
|
| 438 |
+
//die();
|
| 439 |
+
|
| 440 |
+
// If default template send email with default template
|
| 441 |
+
if($templateId == "carriers_pickup_email_customer_template"){
|
| 442 |
+
|
| 443 |
+
/**
|
| 444 |
+
* $templateId can be set to numeric or string type value.
|
| 445 |
+
* You can use Id of transactional emails (found in
|
| 446 |
+
* "System->Trasactional Emails"). But better practice is
|
| 447 |
+
* to create a config for this and use xml path to fetch
|
| 448 |
+
* email template info (whatever from file/db).
|
| 449 |
+
*/
|
| 450 |
+
//const EMAIL_TEMPLATE_XML_PATH = 'customer/testemail/email_template';
|
| 451 |
+
//$templateId = Mage::getStoreConfig('store');
|
| 452 |
+
|
| 453 |
+
$mailSubject = 'Customer StoreShipper Notification';
|
| 454 |
+
|
| 455 |
+
/**
|
| 456 |
+
* $sender can be of type string or array. You can set identity of
|
| 457 |
+
* diffrent Store emails (like 'support', 'sales', etc.) found
|
| 458 |
+
* in "System->Configuration->General->Store Email Addresses"
|
| 459 |
+
*/
|
| 460 |
+
$sender = Array('name' => Mage::getStoreConfig('trans_email/ident_general/name', $storeId),
|
| 461 |
+
'email' => Mage::getStoreConfig('trans_email/ident_general/email', $storeId));
|
| 462 |
+
|
| 463 |
+
/**
|
| 464 |
+
* If $name = null, then magento will parse the email id
|
| 465 |
+
* and use the base part as name.
|
| 466 |
+
*/
|
| 467 |
+
$name = Mage::getStoreConfig('trans_email/ident_general/name', $storeId);
|
| 468 |
+
|
| 469 |
+
$vars = Array();
|
| 470 |
+
/* An example how you can pass magento objects and normal variables*/
|
| 471 |
+
|
| 472 |
+
$vars = Array('order'=>$order);
|
| 473 |
+
|
| 474 |
+
/*This is optional*/
|
| 475 |
+
$storeId = Mage::app()->getStore()->getId();
|
| 476 |
+
|
| 477 |
+
$translate = Mage::getSingleton('core/translate');
|
| 478 |
+
try{
|
| 479 |
+
Mage::getModel('core/email_template')->loadDefault('storeshipper_customer')
|
| 480 |
+
->setTemplateSubject($mailSubject)
|
| 481 |
+
->sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
| 482 |
+
$translate->setTranslateInline(true);
|
| 483 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The Customer has been notified to '.$email));
|
| 484 |
+
$this->_redirect("adminhtml/sales_order/view", array('order_id'=>$order->getId()));
|
| 485 |
+
|
| 486 |
+
}catch(Exception $e){
|
| 487 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Error : Email was not sent !'));
|
| 488 |
+
$this->_redirect("adminhtml/sales_order/view", array('order_id'=>$order->getId()));
|
| 489 |
+
}
|
| 490 |
+
return;
|
| 491 |
+
}
|
| 492 |
+
if($templateId){
|
| 493 |
+
$mailer = Mage::getModel('core/email_template_mailer');
|
| 494 |
+
$emailInfo = Mage::getModel('core/email_info');
|
| 495 |
+
$emailInfo->addTo($email, "Customer Notification");
|
| 496 |
+
|
| 497 |
+
$mailer->addEmailInfo($emailInfo);
|
| 498 |
+
// Set all required params and send emails
|
| 499 |
+
$mailer->setSender(Mage::getStoreConfig('sales_email/shipment/identity', $storeId));
|
| 500 |
+
$mailer->setStoreId($storeId);
|
| 501 |
+
$mailer->setTemplateId($templateId);
|
| 502 |
+
|
| 503 |
+
$mailer->setTemplateParams(array(
|
| 504 |
+
'order' => $order,
|
| 505 |
+
)
|
| 506 |
+
);
|
| 507 |
+
try {
|
| 508 |
+
// SEND EMAIL
|
| 509 |
+
$mailer->send();
|
| 510 |
+
// Mage::log($mailer);
|
| 511 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The Customer has been notified at '.$email));
|
| 512 |
+
$this->_redirect("adminhtml/sales_order/view", array('order_id'=>$order->getId()));
|
| 513 |
+
}
|
| 514 |
+
catch (Exception $e) {
|
| 515 |
+
Mage::logException($e);
|
| 516 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Invalide Email Template ! Please select a new email template in the Global StoreShipper Config'));
|
| 517 |
+
$this->_redirect("adminhtml/sales_order/view", array('order_id'=>$order->getId()));
|
| 518 |
+
}
|
| 519 |
+
}else{
|
| 520 |
+
Mage::log("Invalide Template");
|
| 521 |
+
}
|
| 522 |
+
}
|
| 523 |
+
}
|
| 524 |
+
|
| 525 |
}
|
| 526 |
?>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Proxymit_StoreShipper</name>
|
| 4 |
-
<version>1.0.4</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>GNU General Public License (GPL)</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -16,8 +16,8 @@ It has a back-office interface to manage the details of your stores (ex. Locatio
|
|
| 16 |
- Fix display map in the checkout page</notes>
|
| 17 |
<authors><author><name>Proxym Group</name><user>Proxym_IT</user><email>magento@proxym-group.com</email></author><author><name>Kais Elouragini</name><user>kaisinter</user><email>kais.elouragini@gmail.com</email></author></authors>
|
| 18 |
<date>2015-06-24</date>
|
| 19 |
-
<time>
|
| 20 |
-
<contents><target name="magecommunity"><dir name="Proxymit"><dir name="Pickup"><dir name="Block"><file name="Pickup.php" hash="3c7707d7afb5fd8c324f272b6a06be39"/></dir><dir name="Helper"><file name="Data.php" hash="ecf62e258e7c12aa86de4bac15c25a32"/></dir><dir name="Model"><dir name="Carrier"><file name="Pickup.php" hash="a0956839e99a2f606d80dcf7d5e336af"/></dir><dir name="Mysql4"><dir name="Pickup"><file name="Collection.php" hash="79e0f31beff5db9cf37beb6c94ee832b"/></dir><file name="Pickup.php" hash="216c7325f405761b14cbedde449d2cb6"/></dir><file name="Observer.php" hash="5f83ef6b65f99e439a9385ec02e13853"/><file name="Pickup.php" hash="9ed2ad2889e017c1fab32cca4c8355f8"/><dir name="Sales"><file name="Order.php" hash="eb3734981bf8afd3d451cf820392241b"/></dir></dir><dir name="etc"><file name="config.xml" hash="ac40b8cdda80bf97ba47177e78b9af93"/><file name="system.xml" hash="64f86253ba611f0fcafd8a9dc055a757"/></dir><dir name="sql"><dir name="pickup_setup"><file name="mysql4-install-0.1.0.php" hash="52c6c1b853ca325914901d86e7d30597"/></dir></dir></dir><dir name="StoreShipper"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="View.php" hash="54f6de1fed7c9023b484ae767f3834fd"/></dir></dir><dir name="Stores"><dir name="Edit"><file name="Button.php" hash="0a1ca8110d14131fef663274cddfb9a4"/><file name="Country.php" hash="b51205ca2ae9bf753ba6759698aba3d5"/><file name="Form.php" hash="b00e363afd28df06dffec013e1037c4d"/><file name="Html.php" hash="c1092b7b84e7e0aeacf525505b9fb622"/><file name="Images.php" hash="d7ae2b4dc3e32b4b55f5b69e8e2edb95"/><file name="Map.php" hash="5e697f39d1e75b46d0282516d3288c94"/><file name="StoreViewColumn.php" hash="2c36ba4bba1e4ca3c73951c9a64bc933"/><dir name="Tab"><file name="Contact.php" hash="ed80b6a8e0a71c10109ddd8d9d24506c"/><file name="Form.php" hash="
|
| 21 |
<compatible/>
|
| 22 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 23 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Proxymit_StoreShipper</name>
|
| 4 |
+
<version>1.0.4.1</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>GNU General Public License (GPL)</license>
|
| 7 |
<channel>community</channel>
|
| 16 |
- Fix display map in the checkout page</notes>
|
| 17 |
<authors><author><name>Proxym Group</name><user>Proxym_IT</user><email>magento@proxym-group.com</email></author><author><name>Kais Elouragini</name><user>kaisinter</user><email>kais.elouragini@gmail.com</email></author></authors>
|
| 18 |
<date>2015-06-24</date>
|
| 19 |
+
<time>12:19:02</time>
|
| 20 |
+
<contents><target name="magecommunity"><dir name="Proxymit"><dir name="Pickup"><dir name="Block"><file name="Pickup.php" hash="3c7707d7afb5fd8c324f272b6a06be39"/></dir><dir name="Helper"><file name="Data.php" hash="ecf62e258e7c12aa86de4bac15c25a32"/></dir><dir name="Model"><dir name="Carrier"><file name="Pickup.php" hash="a0956839e99a2f606d80dcf7d5e336af"/></dir><dir name="Mysql4"><dir name="Pickup"><file name="Collection.php" hash="79e0f31beff5db9cf37beb6c94ee832b"/></dir><file name="Pickup.php" hash="216c7325f405761b14cbedde449d2cb6"/></dir><file name="Observer.php" hash="5f83ef6b65f99e439a9385ec02e13853"/><file name="Pickup.php" hash="9ed2ad2889e017c1fab32cca4c8355f8"/><dir name="Sales"><file name="Order.php" hash="eb3734981bf8afd3d451cf820392241b"/></dir></dir><dir name="etc"><file name="config.xml" hash="ac40b8cdda80bf97ba47177e78b9af93"/><file name="system.xml" hash="64f86253ba611f0fcafd8a9dc055a757"/></dir><dir name="sql"><dir name="pickup_setup"><file name="mysql4-install-0.1.0.php" hash="52c6c1b853ca325914901d86e7d30597"/></dir></dir></dir><dir name="StoreShipper"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="View.php" hash="54f6de1fed7c9023b484ae767f3834fd"/></dir></dir><dir name="Stores"><dir name="Edit"><file name="Button.php" hash="0a1ca8110d14131fef663274cddfb9a4"/><file name="Country.php" hash="b51205ca2ae9bf753ba6759698aba3d5"/><file name="Form.php" hash="b00e363afd28df06dffec013e1037c4d"/><file name="Html.php" hash="c1092b7b84e7e0aeacf525505b9fb622"/><file name="Images.php" hash="d7ae2b4dc3e32b4b55f5b69e8e2edb95"/><file name="Map.php" hash="5e697f39d1e75b46d0282516d3288c94"/><file name="StoreViewColumn.php" hash="2c36ba4bba1e4ca3c73951c9a64bc933"/><dir name="Tab"><file name="Contact.php" hash="ed80b6a8e0a71c10109ddd8d9d24506c"/><file name="Form.php" hash="5b4bbc0f1992bfdec8df7b5e9ae609c1"/><file name="Geo.php" hash="c48c1df95b3e8d98930d8d63300116b5"/><file name="Grid.php" hash="89a9105c4208e8f01920b3b6a4957744"/><file name="Orders.php" hash="291f387975d9157c67a7705d5840443d"/><file name="Schedule.php" hash="32e1d2c6bb6fb48cfd5a527252a04075"/></dir><file name="Tabs.php" hash="5edef8c10c42c7ba17c974a2c762f933"/></dir><file name="Edit.php" hash="143a89809c04d9a0d7f0a88a27b46552"/><file name="Grid.php" hash="478a9bd09cc964831e95226676901b9e"/></dir><file name="Stores.php" hash="6d1b31b17463dc95836ff622cf1ebc74"/></dir><file name="OurStores.php" hash="9748faf9ae758c86dcd873e0f11da6d8"/><dir name="Sales"><dir name="Order"><file name="Details.php" hash="d8c40cf76dfe2b0ed60e20664efba413"/><file name="Info.php" hash="d5a334a930990147176db75a1414fd73"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="4db730c74e14cd4efc282a400d914dca"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Grid"><file name="Collection.php" hash="0a0cf92a30d0a5975bad8a7a5182600b"/></dir><file name="Grid.php" hash="ae16af89aecc74bcf52a61a9b4ec5187"/><dir name="Orders"><file name="Collection.php" hash="d029e22562052a3016780de47dd1a776"/></dir><file name="Orders.php" hash="d19868310aee510808f8ed977fae066b"/><dir name="Pickup"><file name="Collection.php" hash="826510bf7d5e3a9c2f85d2f02e0510b7"/></dir><dir name="Schedule"><file name="Collection.php" hash="0a9f8bd84b026e04fc537342948c27ce"/></dir><file name="Schedule.php" hash="d4d53ff739fb2f39b9b667f9b413a9f1"/><dir name="Stores"><file name="Collection.php" hash="a7332f6deb916116e9eb258f0a1d7db4"/></dir><file name="Stores.php" hash="2b485a9a369e71dd411dabcef992b1f4"/></dir><file name="Orders.php" hash="bfd510d47f89e711dfc25194617adac3"/><file name="Schedule.php" hash="7dc8e5d93a90298d4d259c3dc5381a2d"/><file name="Stores.php" hash="3573385d27ce0686f037bc173bcc8274"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="5412b12deee4b5e183bdfad73a598d56"/></dir><file name="IndexController.php" hash="595f43e54eb3c9371136baff6ff538e2"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1b6752942dc3b158c510197e828b7114"/><file name="config.xml" hash="1c4165c229f2553707c6b0d7a04c1acc"/></dir><dir name="sql"><dir name="storeshipper_setup"><file name="mysql4-install-0.0.1.php" hash="4fbea88419fb71a4ea9132e3bb56fea2"/><file name="mysql4-upgrade-1.0.1-1.0.4.php" hash="dee8aa002b38af43b561db7dc93b8d9e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="storeshipper.xml" hash="b761b39334537ddd20f9816903fb28c5"/></dir><dir name="template"><dir name="storeshipper"><dir name="sales"><file name="info.phtml" hash="3cb149a18b801d0a79394fc07125a6eb"/><dir name="order"><dir name="creditmemo"><dir name="create"><file name="form.phtml" hash="1c5f908d7f210a5020a72ce12dec215b"/></dir><dir name="view"><file name="form.phtml" hash="cbb0b183c4d7891c94a291e81705db39"/></dir></dir><dir name="invoice"><dir name="create"><file name="form.phtml" hash="e6455ad14f099971af1298cf9fa85537"/></dir><dir name="view"><file name="form.phtml" hash="541d7cfd141f40d990b5174f922590ef"/></dir></dir><dir name="shipment"><dir name="create"><file name="form.phtml" hash="6088357bbc6c1809b3c9dd8fa421dd12"/></dir><dir name="view"><file name="form.phtml" hash="fa14a8a546db34b412071a132c00a8c0"/></dir></dir></dir></dir><file name="stores.phtml" hash="f84214fc43f665c79b92dc7a092b364f"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="pickup.xml" hash="939372e4fccfda4858fb9897ba058aa5"/><file name="storeshipper.xml" hash="b2f71fd4d9e54923b980e06ac15f0bf1"/></dir><dir name="template"><dir name="pickup"><dir name="checkout"><dir name="onepage"><dir name="shipping_method"><file name="available.phtml" hash="85b1878b9f08c7782f2adae765478b07"/></dir></dir></dir><file name="pickup.phtml" hash="d4d4071c92a9fae0b6a9be96f266242b"/></dir><dir name="storeshipper"><file name="ourstores.phtml" hash="7c7fa77576fb5a9e098e18faf9b09fa6"/><dir name="sales"><dir name="order"><file name="details.phtml" hash="1d55d81837b49180f936d336e6affff7"/><file name="info.phtml" hash="4c8852b5dcfbbc5c5091a29e1930289e"/><dir name="print"><file name="creditmemo.phtml" hash="9de481f4fec7e3358a659b749cb3016d"/><file name="invoice.phtml" hash="a199ce301ab6bdbeedfd4752c2c85b9b"/></dir><file name="print.phtml" hash="35d1b5ffaf9cf17199b021b66494f868"/></dir></dir></dir></dir></dir></dir><dir name="proxymit"><dir name="default"><dir name="template"><dir name="sales"><dir name="order"><file name="info.phtml" hash="38482e9412c9d69349070a4b349784c3"/><dir name="print"><file name="creditmemo.phtml" hash="873d74a7e67723a69afc259e9068e95e"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="sales"><file name="storeshipper_customer.html" hash="bc7196d3d1c2d248eb8e8949c266211f"/><file name="storeshipper_manager.html" hash="bddaf245c893560c2f0d5f9a1c85c527"/></dir></dir></dir><file name="Proxymit_StoreShipper.csv" hash="2f5639f1f7e871b17d663aabdc2c07e7"/></dir><dir name="fr_FR"><file name="Proxymit_StoreShipper.csv" hash="e68a17f7dac105e1e146f78c98b7102a"/></dir></target><target name="mageetc"><dir name="modules"><file name="Proxymit_Pickup.xml" hash="3927e43fd741918c4097099eda5d9d5d"/><file name="Proxymit_StoreShipper.xml" hash="c2449245e0564b56b5dc48d512b0f722"/></dir></target><target name="mage"><dir name="js"><dir name="jquery"><file name="jquery-1.8.3.js" hash="2073df88a429ccbe5dca5e2c40e742b4"/></dir><dir name="pickup"><file name="jquery-1.6.4.min.js" hash="9118381924c51c89d9414a311ec9c97f"/><file name="noconflict.js" hash="3179f2255b046d5f2e9a71e365287bef"/><file name="onepage.js" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="stores"><dir name="canvasloader"><file name="canvasloader.js" hash="1b8c74a958c3b19863796426b37651c4"/></dir></dir></dir></target></contents>
|
| 21 |
<compatible/>
|
| 22 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 23 |
</package>
|
