addwish - Version 0.19.0

Version Notes

New multisite module

Download this release

Release Info

Developer addwish
Extension addwish
Version 0.19.0
Comparing to
See all releases


Code changes from version 0.18.0 to 0.19.0

app/code/local/Addwish/Awext/Helper/Data.php CHANGED
@@ -3,7 +3,7 @@
3
  class Addwish_Awext_Helper_Data extends Mage_Core_Helper_Abstract
4
  {
5
 
6
- public function getProductData($product) {
7
  $data = array();
8
 
9
  $data['url'] = $product->getProductUrl();
@@ -33,8 +33,14 @@ class Addwish_Awext_Helper_Data extends Mage_Core_Helper_Abstract
33
  $genderLabel = $attr->getSource()->getOptionText($product->getData('gender'));
34
  $data['gender'] = $genderLabel;
35
  }
36
- $data['pricedetail'] = $product->getData('pricedetail');
 
 
 
 
 
37
 
 
38
  return $data;
39
  }
40
 
@@ -48,7 +54,7 @@ class Addwish_Awext_Helper_Data extends Mage_Core_Helper_Abstract
48
 
49
  $price = $product->getPrice();
50
  if ($discountPrice) {
51
- $price = Mage::getModel('catalogrule/rule')->calcProductPriceRule($product, $product->getFinalPrice());
52
  if (!isset($price)) {
53
  $price = $product->getFinalPrice();
54
  }
3
  class Addwish_Awext_Helper_Data extends Mage_Core_Helper_Abstract
4
  {
5
 
6
+ public function getProductData($product, $extraAttributes = array()) {
7
  $data = array();
8
 
9
  $data['url'] = $product->getProductUrl();
33
  $genderLabel = $attr->getSource()->getOptionText($product->getData('gender'));
34
  $data['gender'] = $genderLabel;
35
  }
36
+ foreach($extraAttributes as $attribute) {
37
+ try {
38
+ $data[$attribute] = $product->getAttributeText($attribute);
39
+ } catch(Exception $e) {
40
+ // Ignore attribute errors
41
+ }
42
 
43
+ }
44
  return $data;
45
  }
46
 
54
 
55
  $price = $product->getPrice();
56
  if ($discountPrice) {
57
+ $price = Mage::getModel('catalogrule/rule')->calcProductPriceRule($product, $price);
58
  if (!isset($price)) {
59
  $price = $product->getFinalPrice();
60
  }
app/code/local/Addwish/Awext/controllers/IndexController.php CHANGED
@@ -21,11 +21,14 @@ class Addwish_Awext_IndexController extends Mage_Core_Controller_Front_Action
21
  $this->renderLayout();
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;
31
  }
@@ -42,13 +45,32 @@ class Addwish_Awext_IndexController extends Mage_Core_Controller_Front_Action
42
  exit;
43
  }
44
  }
45
-
 
 
46
  }
47
 
48
  // No access control on this method
49
  public function infoAction() {
50
  header("Content-type: text/xml");
51
- echo '<?xml version="1.0" encoding="UTF-8"?><info><version>'.$this->getExtensionVersion().'</version></info>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  exit;
53
  }
54
 
@@ -160,10 +182,14 @@ class Addwish_Awext_IndexController extends Mage_Core_Controller_Front_Action
160
  echo ' last-page-number="' . ($products->getLastPageNumber() - 1) . '"';
161
  }
162
  echo '>';
163
-
 
 
 
 
 
164
  foreach($products as $product) {
165
-
166
- $data = Mage::helper('awext')->getProductData($product);
167
  $productOut = '<product>';
168
  foreach($data as $key => $value) {
169
  if($key == 'hierarchies') {
@@ -177,7 +203,15 @@ class Addwish_Awext_IndexController extends Mage_Core_Controller_Front_Action
177
  }
178
  $productOut.= "</hierarchies>";
179
  } else {
180
- $productOut .= self::toXmlTag($key, $value);
 
 
 
 
 
 
 
 
181
  }
182
  }
183
 
21
  $this->renderLayout();
22
  }
23
 
24
+ protected function verifyAccess($return = false) {
25
  if($this->model->getData('ipaddress') != '') {
26
  $allowedIps=explode(",",$this->model->getData('ipaddress'));
27
  $ipaddress = self::getClientIp();
28
  if(!in_array($ipaddress,$allowedIps)) {
29
+ if($return) {
30
+ return false;
31
+ }
32
  echo "Access Denied";
33
  exit;
34
  }
45
  exit;
46
  }
47
  }
48
+ if($return) {
49
+ return true;
50
+ }
51
  }
52
 
53
  // No access control on this method
54
  public function infoAction() {
55
  header("Content-type: text/xml");
56
+ echo '<?xml version="1.0" encoding="UTF-8"?><info>';
57
+ echo self::toXmlTag('version', $this->getExtensionVersion());
58
+ $access = $this->verifyAccess(true);
59
+ echo self::toXmlTag('access', $access ? 'true' : 'false');
60
+ echo self::toXmlTag('clientIp', self::getClientIp());
61
+ if($access) {
62
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')->getItems();
63
+ echo '<product_attributes>';
64
+ foreach ($attributes as $attribute){
65
+ echo '<attribute>';
66
+ echo self::toXmlTag('attribute_code', $attribute->getAttributeCode());
67
+ echo self::toXmlTag('attribute_name', $attribute->getFrontendLabel());
68
+ echo '</attribute>';
69
+ }
70
+ echo '</product_attributes>';
71
+ }
72
+
73
+ echo '</info>';
74
  exit;
75
  }
76
 
182
  echo ' last-page-number="' . ($products->getLastPageNumber() - 1) . '"';
183
  }
184
  echo '>';
185
+ $extraAttributes = $this->getRequest()->getParam('extraAttributes', '');
186
+ if(trim($extraAttributes)) {
187
+ $extraAttributes = explode(',', $extraAttributes);
188
+ } else {
189
+ $extraAttributes = array();
190
+ }
191
  foreach($products as $product) {
192
+ $data = Mage::helper('awext')->getProductData($product, $extraAttributes);
 
193
  $productOut = '<product>';
194
  foreach($data as $key => $value) {
195
  if($key == 'hierarchies') {
203
  }
204
  $productOut.= "</hierarchies>";
205
  } else {
206
+ if(is_array($value)) {
207
+ $productOut .= "<$key>";
208
+ foreach($value as $v) {
209
+ $productOut .= self::toXmlTag('value', $v);
210
+ }
211
+ $productOut .= "</$key>";
212
+ } else {
213
+ $productOut .= self::toXmlTag($key, $value);
214
+ }
215
  }
216
  }
217
 
app/code/local/Addwish/Awext/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Addwish_Awext>
5
- <version>0.18.0</version>
6
  </Addwish_Awext>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <Addwish_Awext>
5
+ <version>0.19.0</version>
6
  </Addwish_Awext>
7
  </modules>
8
  <frontend>
app/design/frontend/base/default/template/addwish/integrator.phtml CHANGED
@@ -8,6 +8,7 @@ if($model->getData('userId')!=''){
8
  }
9
  ?><script type="text/javascript">
10
  (function() {
 
11
  var aws = document.createElement('script');
12
  aws.type = 'text/javascript';
13
  if (typeof(aws.async) != "undefined") { aws.async = true; }
8
  }
9
  ?><script type="text/javascript">
10
  (function() {
11
+ /* Addwish <?php echo Mage::getConfig()->getNode()->modules->Addwish_Awext->version ?> */
12
  var aws = document.createElement('script');
13
  aws.type = 'text/javascript';
14
  if (typeof(aws.async) != "undefined") { aws.async = true; }
package.xml CHANGED
@@ -1,2 +1,2 @@
1
  <?xml version="1.0"?>
2
- <package><name>addwish</name><version>0.18.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-10-19</date><time>1:12:07</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"><dir name="Adminhtml"><dir name="Awext"><file name="View.php" hash="a5a5aa835bdbaf1102b50e90dec526a8"/><dir name="View"><file name="Tabs.php" hash="b68e152475528d168d92ca6e8ad6eafc"/><dir name="Tab"><file name="Details.php" hash="eff51a28eacafbe07577af60237ad9c4"/><file name="Recommend.php" hash="02d71705312a1de1da6445027bb0926d"/><file name="Search.php" hash="c94f0146c7529f0542100a871446c4f0"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="450fdfeaa9e8fad57d4ac13940000092"/><dir name="Adminhtml"><file name="AwextController.php" hash="1cb7469bcc2761763c27756a691b8a32"/></dir></dir><dir name="etc"><file name="config.xml" hash="b30f64f9e5e531ba77f6a86242d602d4"/></dir><dir name="Helper"><file name="Data.php" hash="ef9c6ec9dfd7700b41c6f5ea71fd0569"/></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="b632bf4a38cfb992303f97cd7a449a15"/></dir><dir name="template"><dir name="awext"><file name="list.phtml" hash="36b662e22b3586bc1cb601c6e1fb9392"/><file name="recommendations.phtml" hash="f8e63393c235903babd5a27a68b4a054"/><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="da61ba45715f12b7153e518bbaa2e15a"/><file name="product-span.phtml" hash="4d2e243368b2ece3f8126400bdce6413"/><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.19.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-10-28</date><time>5:13:26</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"><dir name="Adminhtml"><dir name="Awext"><file name="View.php" hash="a5a5aa835bdbaf1102b50e90dec526a8"/><dir name="View"><file name="Tabs.php" hash="b68e152475528d168d92ca6e8ad6eafc"/><dir name="Tab"><file name="Details.php" hash="eff51a28eacafbe07577af60237ad9c4"/><file name="Recommend.php" hash="02d71705312a1de1da6445027bb0926d"/><file name="Search.php" hash="c94f0146c7529f0542100a871446c4f0"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="4c172a128775dc959eb6f0cd2b260588"/><dir name="Adminhtml"><file name="AwextController.php" hash="1cb7469bcc2761763c27756a691b8a32"/></dir></dir><dir name="etc"><file name="config.xml" hash="0c34204307e1291921f08b75218f4174"/></dir><dir name="Helper"><file name="Data.php" hash="ee078ec1dc3016e53c011da705aca897"/></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="b632bf4a38cfb992303f97cd7a449a15"/></dir><dir name="template"><dir name="awext"><file name="list.phtml" hash="36b662e22b3586bc1cb601c6e1fb9392"/><file name="recommendations.phtml" hash="f8e63393c235903babd5a27a68b4a054"/><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="62143696cb9df89a457f6ac024ff6035"/><file name="product-span.phtml" hash="4d2e243368b2ece3f8126400bdce6413"/><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>