addwish - Version 0.17.0

Version Notes

New multisite module

Download this release

Release Info

Developer addwish
Extension addwish
Version 0.17.0
Comparing to
See all releases


Code changes from version 0.16.0 to 0.17.0

app/code/local/Addwish/Awext/controllers/IndexController.php CHANGED
@@ -22,23 +22,9 @@ class Addwish_Awext_IndexController extends Mage_Core_Controller_Front_Action
22
  }
23
 
24
  protected function verifyAccess() {
25
- if($this->model->getData('ipaddress')!='') {
26
  $allowedIps=explode(",",$this->model->getData('ipaddress'));
27
- $ipaddress = '';
28
- if ($_SERVER['HTTP_CLIENT_IP'])
29
- $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
30
- else if($_SERVER['HTTP_X_FORWARDED_FOR'])
31
- $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
32
- else if($_SERVER['HTTP_X_FORWARDED'])
33
- $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
34
- else if($_SERVER['HTTP_FORWARDED_FOR'])
35
- $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
36
- else if($_SERVER['HTTP_FORWARDED'])
37
- $ipaddress = $_SERVER['HTTP_FORWARDED'];
38
- else if($_SERVER['REMOTE_ADDR'])
39
- $ipaddress = $_SERVER['REMOTE_ADDR'];
40
- else
41
- $ipaddress = 'UNKNOWN';
42
  if(!in_array($ipaddress,$allowedIps)) {
43
  echo "Access Denied";
44
  exit;
@@ -78,8 +64,7 @@ class Addwish_Awext_IndexController extends Mage_Core_Controller_Front_Action
78
  echo '</stores>';
79
 
80
  }
81
-
82
-
83
  public function orderListAction(){
84
  $this->verifyAccess();
85
  if($this->model->getData('enable_order_export')==0) {
@@ -90,15 +75,23 @@ class Addwish_Awext_IndexController extends Mage_Core_Controller_Front_Action
90
  $page = (int)$this->getRequest()->getParam('page');
91
  $pageSize = (int)$this->getRequest()->getParam('pageSize');
92
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
- $exportFromDate=$this->getRequest()->getParam('exportFromDate');
95
- $exportToDate=$this->getRequest()->getParam('exportToDate');
96
- $fromDate = date('Y-m-d H:i:s', strtotime($exportFromDate));
97
- $toDate = date('Y-m-d H:i:s', strtotime($exportToDate));
98
  $orders = Mage::getModel('sales/order')->getCollection()
99
  ->addFieldToFilter('store_id', Mage::app()->getStore()->getStoreId())
100
- ->addAttributeToFilter('created_at', array('from'=>$fromDate, 'to'=>$toDate))
101
  ->addAttributeToFilter('status', array('eq' => Mage_Sales_Model_Order::STATE_COMPLETE));
 
102
  header("Content-type: text/xml");
103
  echo '<?xml version="1.0" encoding="UTF-8"?><orders';
104
  if($pageSize > 0) {
@@ -106,15 +99,27 @@ class Addwish_Awext_IndexController extends Mage_Core_Controller_Front_Action
106
  $orders->setPageSize($pageSize);
107
  echo ' last-page-number="' . ($orders->getLastPageNumber() - 1) . '"';
108
  }
109
- echo '><exportFromDate>'.$exportFromDate.'</exportFromDate><exportToDate>'.$exportToDate.'</exportToDate>';
 
 
 
 
110
  foreach($orders as $order){
111
- $order_total=number_format($order->getData('base_grand_total'), 2, '.', '');
112
- echo '<order><orderDate>'.$order->getData('created_at').'</orderDate><orderNumber>'.$order->getData('increment_id').'</orderNumber><orderTotal>'.$order_total.'</orderTotal><orderLines>';
 
 
 
 
113
  $items = $order->getAllItems();
114
  foreach($items as $orderItem) {
115
- $_product = Mage::getModel('catalog/product')
116
- ->load($orderItem->getProductId());
117
- echo '<orderLine><productnumber>'.$_product->getId().'</productnumber><productURL>'.$_product->getProductUrl().'</productURL><quantity>'.(int)$orderItem->getData('qty_ordered').'</quantity></orderLine>';
 
 
 
 
118
  }
119
  echo '</orderLines></order>';
120
  }
@@ -185,4 +190,20 @@ class Addwish_Awext_IndexController extends Mage_Core_Controller_Front_Action
185
  return "<$tag>".$value."</$tag>";
186
  }
187
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  }
22
  }
23
 
24
  protected function verifyAccess() {
25
+ if($this->model->getData('ipaddress') != '') {
26
  $allowedIps=explode(",",$this->model->getData('ipaddress'));
27
+ $ipaddress = self::getClientIp();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  if(!in_array($ipaddress,$allowedIps)) {
29
  echo "Access Denied";
30
  exit;
64
  echo '</stores>';
65
 
66
  }
67
+
 
68
  public function orderListAction(){
69
  $this->verifyAccess();
70
  if($this->model->getData('enable_order_export')==0) {
75
  $page = (int)$this->getRequest()->getParam('page');
76
  $pageSize = (int)$this->getRequest()->getParam('pageSize');
77
 
78
+ $exportToDate = new DateTime($this->getRequest()->getParam('exportToDate'));
79
+ if($this->getRequest()->getParam('exportFromDate')) {
80
+ $exportFromDate = new DateTime($this->getRequest()->getParam('exportFromDate'));
81
+ } else {
82
+ $days = (int)$this->getRequest()->getParam('days', 7);
83
+ $exportFromDate = clone $exportToDate;
84
+ $exportFromDate->modify('-'.$days.' day');
85
+ }
86
+
87
+ $exportFromDate = $exportFromDate->format('Y-m-d H:i:s');
88
+ $exportToDate = $exportToDate->format('Y-m-d H:i:s');
89
 
 
 
 
 
90
  $orders = Mage::getModel('sales/order')->getCollection()
91
  ->addFieldToFilter('store_id', Mage::app()->getStore()->getStoreId())
92
+ ->addAttributeToFilter('created_at', array('from'=>$exportFromDate, 'to'=>$exportToDate))
93
  ->addAttributeToFilter('status', array('eq' => Mage_Sales_Model_Order::STATE_COMPLETE));
94
+
95
  header("Content-type: text/xml");
96
  echo '<?xml version="1.0" encoding="UTF-8"?><orders';
97
  if($pageSize > 0) {
99
  $orders->setPageSize($pageSize);
100
  echo ' last-page-number="' . ($orders->getLastPageNumber() - 1) . '"';
101
  }
102
+ echo '>';
103
+
104
+ echo self::toXmlTag('exportFromDate', $exportFromDate);
105
+ echo self::toXmlTag('exportToDate', $exportToDate);
106
+
107
  foreach($orders as $order){
108
+ $order_total = number_format($order->getData('base_grand_total'), 2, '.', '');
109
+ echo '<order>';
110
+ echo self::toXmlTag('orderDate', $order->getData('created_at'));
111
+ echo self::toXmlTag('orderNumber', $order->getData('increment_id'));
112
+ echo self::toXmlTag('orderTotal', $order_total);
113
+ echo '<orderLines>';
114
  $items = $order->getAllItems();
115
  foreach($items as $orderItem) {
116
+ $_product = Mage::getModel('catalog/product')->load($orderItem->getProductId());
117
+ echo '<orderLine>';
118
+ echo self::toXmlTag('productnumber', $_product->getSku());
119
+ echo self::toXmlTag('id', $_product->getId());
120
+ echo self::toXmlTag('productURL', $_product->getProductUrl());
121
+ echo self::toXmlTag('quantity', (int)$orderItem->getData('qty_ordered'));
122
+ echo '</orderLine>';
123
  }
124
  echo '</orderLines></order>';
125
  }
190
  return "<$tag>".$value."</$tag>";
191
  }
192
 
193
+ private static function getClientIp() {
194
+ foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key){
195
+ if (array_key_exists($key, $_SERVER) === true){
196
+ foreach (explode(',', $_SERVER[$key]) as $ip){
197
+ $ip = trim($ip);
198
+
199
+ if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false){
200
+ return $ip;
201
+ }
202
+ }
203
+ }
204
+ }
205
+ return 'UNKNOWN';
206
+ }
207
+
208
+
209
  }
app/code/local/Addwish/Awext/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Addwish_Awext>
5
- <version>0.16.0</version>
6
  </Addwish_Awext>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <Addwish_Awext>
5
+ <version>0.17.0</version>
6
  </Addwish_Awext>
7
  </modules>
8
  <frontend>
package.xml CHANGED
@@ -1,2 +1,2 @@
1
  <?xml version="1.0"?>
2
- <package><name>addwish</name><version>0.16.0</version><stability>stable</stability><license>GNU General Public License (GPL)</license><channel>community</channel><extends></extends><summary>New multisite module</summary><description>New multisite module</description><notes>New multisite module</notes><authors><author><name>addwish</name><user>addwish</user><email>krj@addwish.com</email></author></authors><date>2016-09-26</date><time>0:20:06</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>8.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="code"><dir name="local"><dir name="Addwish"><dir name="Awext"><dir name="Block"><file name="Awext.php" hash="5d627b94fe5a46ab3c5a77debbabcff6"/><dir name="Adminhtml"><file name="Awext.php" hash="2e46d78792ff55c3285d77780ba3e784"/><dir name="Awext"><file name="Grid.php" hash="0a9e0cc01157a49a58cddf0ef4eddbad"/><file name="Renderer.php" hash="f5f132bb8089270358be38f9e1fb342d"/><file name="View.php" hash="a5a5aa835bdbaf1102b50e90dec526a8"/><dir name="View"><file name="Tabs.php" hash="51d7b9c59068451c28bf614d42fe303d"/><dir name="Tab"><file name="Details.php" hash="9431059a450be7a0bb9d69867c2b2b10"/><file name="Form.php" hash="14b1192bea84fbee58e47ff749a004f4"/><file name="Recommend.php" hash="5d4fe965a062adcb51567c93e5adec2f"/><file name="Search.php" hash="f194d4fa52fa3e106baa49ffd981de06"/><file name="Searchconfig.php" hash="ce2a937906c8f2d13552d06b8c7b4f69"/><dir name="Details"><file name="List.php" hash="629a98942f2354a0a10d14e8564fc542"/></dir><dir name="Recommend"><file name="List.php" hash="a8f994f1e5a29abf1f4bbf48e826e1d2"/></dir><dir name="Search"><file name="List.php" hash="c556a6030e13ae9933bdf16e2ff1ff33"/></dir><dir name="Searchconfig"><file name="List.php" hash="6ef64a77cfc24144aa3a85515f6ce22b"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="0d3925b917a44c8fabbecb9774cc0a1b"/><dir name="Adminhtml"><file name="AwextController.php" hash="1cb7469bcc2761763c27756a691b8a32"/></dir></dir><dir name="etc"><file name="config.xml" hash="f75a11a053861e243edf8c6504ecc259"/></dir><dir name="Helper"><file name="Data.php" hash="24b9ffe936508548090958084d658cf7"/></dir><dir name="Model"><file name="Awext.php" hash="1925cb6fd94cc7cd6baecda71964a424"/><file name="Observer.php" hash="e85fea849acf03c9353e557588e3f21d"/><dir name="Mysql4"><file name="Awext.php" hash="acd112233e367ebe80caf114f5dfe653"/><dir name="Awext"><file name="Collection.php" hash="12afe62372c67a5bd9154695c8d095f3"/></dir></dir></dir><dir name="sql"><dir name="addwish_setup"><file name="mysql4-install-0.0.4.php" hash="77a5d3d50380396c9bd2a9dfdfea8905"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="awext.xml" hash="0d94beddc26ad6e8a080ca4f0c8288f8"/></dir><dir name="template"><dir name="awext"><file name="list.phtml" hash="36b662e22b3586bc1cb601c6e1fb9392"/><file name="recommendations.phtml" hash="f8e63393c235903babd5a27a68b4a054"/><file name="search-config.phtml" hash="35e42872b25a359386b1ea239d571947"/><file name="search.phtml" hash="82d7130e256b0689d3b1682bf097fa55"/><file name="store-selector.phtml" hash="275b91522d136265f22de6550c7ca6dc"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="awext.xml" hash="55de3edcbfdd85884f58b322f88cfc27"/></dir><dir name="template"><dir name="addwish"><file name="addwish-head.phtml" hash="c5b6fa2cae55ad1ddd4a5c64f8d532f6"/><file name="basket-span.phtml" hash="e94f8c7f460ab66e3906fcc0e3fdf76b"/><file name="conversion-span.phtml" hash="a112dbaef738171454b0192bbc3722f9"/><file name="integrator.phtml" hash="43fb7dd7c6a56cbbaf25784aa393c110"/><file name="product-span.phtml" hash="3cfb25327ffed490dee813a8568e54ba"/><file name="search-result-page.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="upsells-page.phtml" hash="ac41002da8c7bb57233599a00053ef77"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Addwish_Awext.xml" hash="fea2883f86536f249670eea31980f72c"/></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><file name="addwish.css" hash="df6e33a58cf2381ceaba72253a29796d"/></dir><dir name="images"><dir name="addwish"><file name="addwish.png" hash="a588d24d1919d9206eff40a886b88ef1"/></dir></dir></dir></dir></dir></dir></target></contents></package>
1
  <?xml version="1.0"?>
2
+ <package><name>addwish</name><version>0.17.0</version><stability>stable</stability><license>GNU General Public License (GPL)</license><channel>community</channel><extends></extends><summary>New multisite module</summary><description>New multisite module</description><notes>New multisite module</notes><authors><author><name>addwish</name><user>addwish</user><email>krj@addwish.com</email></author></authors><date>2016-09-28</date><time>6:47:23</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>8.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="code"><dir name="local"><dir name="Addwish"><dir name="Awext"><dir name="Block"><file name="Awext.php" hash="5d627b94fe5a46ab3c5a77debbabcff6"/><dir name="Adminhtml"><file name="Awext.php" hash="2e46d78792ff55c3285d77780ba3e784"/><dir name="Awext"><file name="Grid.php" hash="0a9e0cc01157a49a58cddf0ef4eddbad"/><file name="Renderer.php" hash="f5f132bb8089270358be38f9e1fb342d"/><file name="View.php" hash="a5a5aa835bdbaf1102b50e90dec526a8"/><dir name="View"><file name="Tabs.php" hash="51d7b9c59068451c28bf614d42fe303d"/><dir name="Tab"><file name="Details.php" hash="9431059a450be7a0bb9d69867c2b2b10"/><file name="Form.php" hash="14b1192bea84fbee58e47ff749a004f4"/><file name="Recommend.php" hash="5d4fe965a062adcb51567c93e5adec2f"/><file name="Search.php" hash="f194d4fa52fa3e106baa49ffd981de06"/><file name="Searchconfig.php" hash="ce2a937906c8f2d13552d06b8c7b4f69"/><dir name="Details"><file name="List.php" hash="629a98942f2354a0a10d14e8564fc542"/></dir><dir name="Recommend"><file name="List.php" hash="a8f994f1e5a29abf1f4bbf48e826e1d2"/></dir><dir name="Search"><file name="List.php" hash="c556a6030e13ae9933bdf16e2ff1ff33"/></dir><dir name="Searchconfig"><file name="List.php" hash="6ef64a77cfc24144aa3a85515f6ce22b"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="80fb0d051853dade850c9234797dde06"/><dir name="Adminhtml"><file name="AwextController.php" hash="1cb7469bcc2761763c27756a691b8a32"/></dir></dir><dir name="etc"><file name="config.xml" hash="ba72e74e6de000f510cd61bba56694ff"/></dir><dir name="Helper"><file name="Data.php" hash="24b9ffe936508548090958084d658cf7"/></dir><dir name="Model"><file name="Awext.php" hash="1925cb6fd94cc7cd6baecda71964a424"/><file name="Observer.php" hash="e85fea849acf03c9353e557588e3f21d"/><dir name="Mysql4"><file name="Awext.php" hash="acd112233e367ebe80caf114f5dfe653"/><dir name="Awext"><file name="Collection.php" hash="12afe62372c67a5bd9154695c8d095f3"/></dir></dir></dir><dir name="sql"><dir name="addwish_setup"><file name="mysql4-install-0.0.4.php" hash="77a5d3d50380396c9bd2a9dfdfea8905"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="awext.xml" hash="0d94beddc26ad6e8a080ca4f0c8288f8"/></dir><dir name="template"><dir name="awext"><file name="list.phtml" hash="36b662e22b3586bc1cb601c6e1fb9392"/><file name="recommendations.phtml" hash="f8e63393c235903babd5a27a68b4a054"/><file name="search-config.phtml" hash="35e42872b25a359386b1ea239d571947"/><file name="search.phtml" hash="82d7130e256b0689d3b1682bf097fa55"/><file name="store-selector.phtml" hash="275b91522d136265f22de6550c7ca6dc"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="awext.xml" hash="55de3edcbfdd85884f58b322f88cfc27"/></dir><dir name="template"><dir name="addwish"><file name="addwish-head.phtml" hash="c5b6fa2cae55ad1ddd4a5c64f8d532f6"/><file name="basket-span.phtml" hash="e94f8c7f460ab66e3906fcc0e3fdf76b"/><file name="conversion-span.phtml" hash="a112dbaef738171454b0192bbc3722f9"/><file name="integrator.phtml" hash="43fb7dd7c6a56cbbaf25784aa393c110"/><file name="product-span.phtml" hash="3cfb25327ffed490dee813a8568e54ba"/><file name="search-result-page.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="upsells-page.phtml" hash="ac41002da8c7bb57233599a00053ef77"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Addwish_Awext.xml" hash="fea2883f86536f249670eea31980f72c"/></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><file name="addwish.css" hash="df6e33a58cf2381ceaba72253a29796d"/></dir><dir name="images"><dir name="addwish"><file name="addwish.png" hash="a588d24d1919d9206eff40a886b88ef1"/></dir></dir></dir></dir></dir></dir></target></contents></package>