addwish - Version 0.16.0

Version Notes

New multisite module

Download this release

Release Info

Developer addwish
Extension addwish
Version 0.16.0
Comparing to
See all releases


Code changes from version 0.15.0 to 0.16.0

app/code/local/Addwish/Awext/.DS_Store ADDED
Binary file
app/code/local/Addwish/Awext/Helper/Data.php CHANGED
@@ -3,4 +3,122 @@
3
  class Addwish_Awext_Helper_Data extends Mage_Core_Helper_Abstract
4
  {
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  }
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();
10
+ $data['title'] = $product->getName();
11
+ $data['imgurl'] = $this->getProductImageUrl($product);
12
+
13
+ $specialPrice = $this->getProductPrice($product, true);
14
+ $regularPrice = $this->getProductPrice($product, false);
15
+ if($specialPrice < $regularPrice) {
16
+ $data['price'] = $specialPrice;
17
+ $data['previousprice'] = $regularPrice;
18
+ } else {
19
+ $data['price'] = $regularPrice;
20
+ }
21
+
22
+ $data['keywords'] = $product->getMetaKeyword();
23
+ $data['description'] = $product->getDescription();
24
+ $data['id'] = $product->getId();
25
+ $data['productnumber'] = $product->getSku();
26
+ $data['currency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
27
+ $data['hierarchies'] = $this->getProductHierarchies($product);
28
+ $data['brand'] = $product->getData('brand');
29
+ $data['inStock'] = $this->getProductInStock($product);
30
+
31
+ if($product->getData('gender')) {
32
+ $attr = $product->getResource()->getAttribute("gender");
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
+
41
+ // Helpers
42
+ public function getProductImageUrl($product) {
43
+ $imageUrl = Mage::helper('catalog/image')->init($product , 'thumbnail')->resize(256);
44
+ return $imageUrl->__toString();
45
+ }
46
+
47
+ public function getProductPrice($product, $discountPrice = false) {
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
+ }
55
+ }
56
+
57
+ $pricesIncludeTax = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX);
58
+
59
+ if (!$pricesIncludeTax) {
60
+ $taxClassId = $product->getTaxClassId();
61
+ $taxCalculation = Mage::getModel('tax/calculation');
62
+ $request = $taxCalculation->getRateRequest();
63
+ $taxRate = $taxCalculation->getRate($request->setProductClassId($taxClassId));
64
+ $price = ($price / 100 * $taxRate) + $price;
65
+ }
66
+
67
+ return floatval($price);
68
+
69
+ }
70
+
71
+ public function getProductHierarchies($product) {
72
+ $cats = $product->getCategoryIds();
73
+
74
+ // Remove category id's that are parent of others
75
+ foreach ($cats as $categoryId) {
76
+ $category = Mage::getModel('catalog/category')->load($categoryId);
77
+ $parentCategories = $category->getParentCategories();
78
+ foreach ($parentCategories as $parent) {
79
+ if($categoryId == $parent->getId()) {
80
+ continue;
81
+ }
82
+ $key = array_search($parent->getId(),$cats);
83
+ if($key !== false) {
84
+ unset($cats[$key]);
85
+ }
86
+ }
87
+ }
88
+
89
+ $hierarchies = array();
90
+ foreach ($cats as $categoryId) {
91
+ $category = Mage::getModel('catalog/category')->load($categoryId);
92
+ $parentCategories = $category->getParentCategories();
93
+ $hierarchy = array();
94
+ foreach ($parentCategories as $parent) {
95
+ $name = trim($parent->getName());
96
+ if($name != "") {
97
+ $hierarchy[] = $name;
98
+ }
99
+ }
100
+ if(count($hierarchy) > 0) {
101
+ $hierarchies[] = $hierarchy;
102
+ }
103
+ }
104
+ return $hierarchies;
105
+ }
106
+
107
+ public function getProductInStock($product) {
108
+ $inStock = false;
109
+ if($product->isConfigurable()) {
110
+ $allProducts = $product->getTypeInstance(true)->getUsedProducts(null, $product);
111
+ foreach ($allProducts as $productD) {
112
+ if (!$productD->isSaleable() || $productD->getIsInStock() == 0) {
113
+ //out of stock for check child simple product
114
+ } else {
115
+ $inStock = true;
116
+ }
117
+ }
118
+ } else {
119
+ $inStock = $product->isInStock();
120
+ }
121
+ return $inStock;
122
+ }
123
+
124
  }
app/code/local/Addwish/Awext/controllers/Adminhtml/AwextController.php CHANGED
@@ -2,42 +2,18 @@
2
 
3
  class Addwish_Awext_Adminhtml_AwextController extends Mage_Adminhtml_Controller_action
4
  {
5
-
6
- protected function _initAction() {
7
- $this->loadLayout()
8
- ->_setActiveMenu('awext/awext')
9
- ->_addBreadcrumb(Mage::helper('adminhtml')->__('AddWish Settings'), Mage::helper('adminhtml')->__('AddWish Settings'));
10
- return $this;
11
- }
12
- public function indexAction() {
13
- $this->_initAction()
14
- ->renderLayout();
15
- }
16
- protected function _awextModule($moduleName) {
17
- // Disable the module itself
18
- $nodePath = "modules/$moduleName/active";
19
- if (Mage::helper('core/data')->isModuleEnabled($moduleName)) {
20
- Mage::getConfig()->setNode($nodePath, 'false', true);
21
- }
22
-
23
- // Disable its output as well (which was already loaded)
24
- $outputPath = "advanced/modules_disable_output/$moduleName";
25
- if (!Mage::getStoreConfig($outputPath)) {
26
- Mage::app()->getStore()->setConfig($outputPath, true);
27
- }
28
- }
29
  public function viewAction(){
30
-
31
  $this->loadLayout();
32
  $this->_initLayoutMessages('core/session');
33
  $this->_setActiveMenu('awext/awext');
34
  $this->_addBreadcrumb(Mage::helper('adminhtml')->__('AddWish'), Mage::helper('adminhtml')->__('AddWish'));
35
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('AddWish'), Mage::helper('adminhtml')->__('AddWish'));
36
  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
 
37
  $currentStore= Mage::app()->getDefaultStoreView()->getStoreId();
38
  if(Mage::app()->getRequest()->getParam('storeconfig')!=""){
39
  $currentStore=Mage::app()->getRequest()->getParam('storeconfig');
40
  }
 
41
  $loadValues= Mage::getModel('awext/awext')->load($currentStore);
42
  if(count($loadValues->getData())<=0){
43
 
@@ -49,7 +25,6 @@ class Addwish_Awext_Adminhtml_AwextController extends Mage_Adminhtml_Controller_
49
  switch($data['action']){
50
  case "dataexport":
51
  $k['ipaddress']=$data['ipaddress'];
52
- $k['cron_time']=$data['cron_hour'];
53
  if(isset($data['enable_order_feed'])){
54
  $k['enable_order_export']=$data['enable_order_feed'];
55
  }else{
@@ -62,7 +37,7 @@ class Addwish_Awext_Adminhtml_AwextController extends Mage_Adminhtml_Controller_
62
  }
63
  break;
64
  case "scriptsetup":
65
- $k['userId']=$data['addwishID'];
66
  break;
67
  case "recomendations":
68
  if(isset($data['addwishUpsells'])){
@@ -72,96 +47,20 @@ class Addwish_Awext_Adminhtml_AwextController extends Mage_Adminhtml_Controller_
72
  }
73
  break;
74
  }
 
75
  $model = Mage::getModel('awext/awext');
76
- $model->setData($k)
77
- ->setId($currentStore);
78
 
79
  try {
80
  $model->save();
81
  Mage::getSingleton('core/session')->addSuccess('Configuration was successfully saved.');
 
82
  } catch (Exception $e) {
83
- Mage::getSingleton('customer/session')->addSuccess('Some error occured.');
84
- exit;
85
  }
86
  }
87
  $this->_addContent($this->getLayout()->createBlock('awext/adminhtml_awext_view'))
88
- ->_addLeft($this->getLayout()->createBlock('awext/adminhtml_awext_view_tabs'));
89
  $this->renderLayout();
90
  }
91
- public function editAction() {
92
-
93
- }
94
- public function generatefeedAction(){
95
- $products_out='<?xml version="1.0" encoding="UTF-8"?><products>';
96
- $currentStore=Mage::app()->getStore()->getStoreId();
97
- $products = Mage::getModel('catalog/product')->getCollection()->setStoreId($currentStore)->addAttributeToFilter('visibility', 4);
98
- $products->addAttributeToSelect('*');
99
- foreach($products as $product) {
100
- $imageUrl = Mage::helper('catalog/image')->init($product , 'thumbnail')->resize(256);
101
- $specialPrice = number_format($product->getSpecialPrice(), 2, '.', '');
102
- $regularPrice = number_format($product->getPrice(), 2, '.', '');
103
- $products_out.="<product><url>".$product->getProductUrl()."</url><title>".htmlspecialchars(htmlentities($product->getName(),ENT_QUOTES,'UTF-8'))."</title><imgurl>".$imageUrl."</imgurl>";
104
- if(isset($specialPrice) && $specialPrice>0){
105
- $products_out.= "<price>".$specialPrice."</price>";
106
- $products_out.= "<previousprice>".$regularPrice."</previousprice>";
107
- }else{
108
- $products_out.= "<price>".$regularPrice."</price>";
109
- }
110
- if($product->getMetaKeyword()!=''){
111
- $products_out.= "<keywords>".htmlspecialchars(htmlentities($product->getMetaKeyword(),ENT_QUOTES,'UTF-8'))."</keywords>";
112
- }
113
- if($product->getDescription()!=''){
114
- $products_out.= "<description>".htmlspecialchars(htmlentities($product->getDescription(),ENT_QUOTES,'UTF-8'))."</description>";
115
- }
116
- $products_out.= "<productnumber>".$product->getId()."</productnumber>";
117
- $products_out.= "<currency>".Mage::app()->getStore()->getCurrentCurrencyCode()."</currency>";
118
- $cats = $product->getCategoryIds();
119
- $products_out.= "<hierarchies>";
120
- foreach ($cats as $category_id) {
121
- $products_out.= "<hierarchy> ";
122
- $category = Mage::getModel('catalog/category')->load($category_id) ;
123
- $catnames = array();
124
- foreach ($category->getParentCategories() as $parent) {
125
- if(trim($parent->getName())!=""){
126
- $catnames[] = $parent->getName();
127
-
128
- $products_out.= "<category>".htmlspecialchars(htmlentities($parent->getName(),ENT_QUOTES,'UTF-8'))."</category>";
129
- }
130
- }
131
-
132
- $products_out.= "</hierarchy> ";
133
- }
134
- $products_out.= "</hierarchies>";
135
- if($product->getData('brand')){
136
- $products_out.= "<brand>".$product->getData('brand')."</brand>";
137
- }
138
-
139
- if($product->isInStock()){
140
- $products_out.= "<instock>true</instock>";
141
- }else{
142
- $products_out.= "<instock>false</instock>";
143
- }
144
-
145
- if($product->getData('gender')){
146
- $products_out.= "<gender>".$product->getData('gender')."</gender>";
147
- }
148
- if($product->getData('pricedetail')){
149
- $products_out.= "<pricedetail>".$product->getData('pricedetail')."</pricedetail>";
150
- }
151
- //
152
- $products_out.= "</product>";
153
- }
154
- $products_out.= "</products>";
155
- $file_path=Mage::getBaseDir()."/addwishProductExport.xml";
156
- $addwishProductExport = fopen($file_path, "w");
157
- fwrite($addwishProductExport, $products_out);
158
- fclose($addwishProductExport);
159
- Mage::getSingleton('core/session')->addSuccess('Feed Generated successfully.');
160
- $this->_redirect('*/*/view');
161
-
162
- }
163
- public function newAction()
164
- {
165
- $this->_forward('edit');
166
- }
167
  }
2
 
3
  class Addwish_Awext_Adminhtml_AwextController extends Mage_Adminhtml_Controller_action
4
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  public function viewAction(){
 
6
  $this->loadLayout();
7
  $this->_initLayoutMessages('core/session');
8
  $this->_setActiveMenu('awext/awext');
9
  $this->_addBreadcrumb(Mage::helper('adminhtml')->__('AddWish'), Mage::helper('adminhtml')->__('AddWish'));
 
10
  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
11
+
12
  $currentStore= Mage::app()->getDefaultStoreView()->getStoreId();
13
  if(Mage::app()->getRequest()->getParam('storeconfig')!=""){
14
  $currentStore=Mage::app()->getRequest()->getParam('storeconfig');
15
  }
16
+
17
  $loadValues= Mage::getModel('awext/awext')->load($currentStore);
18
  if(count($loadValues->getData())<=0){
19
 
25
  switch($data['action']){
26
  case "dataexport":
27
  $k['ipaddress']=$data['ipaddress'];
 
28
  if(isset($data['enable_order_feed'])){
29
  $k['enable_order_export']=$data['enable_order_feed'];
30
  }else{
37
  }
38
  break;
39
  case "scriptsetup":
40
+ $k['userId']=$data['addwishID'];
41
  break;
42
  case "recomendations":
43
  if(isset($data['addwishUpsells'])){
47
  }
48
  break;
49
  }
50
+
51
  $model = Mage::getModel('awext/awext');
52
+ $model->setData($k)->setId($currentStore);
 
53
 
54
  try {
55
  $model->save();
56
  Mage::getSingleton('core/session')->addSuccess('Configuration was successfully saved.');
57
+ $this->_redirectReferer();
58
  } catch (Exception $e) {
59
+ Mage::getSingleton('core/session')->addError('Some error occured.');
 
60
  }
61
  }
62
  $this->_addContent($this->getLayout()->createBlock('awext/adminhtml_awext_view'))
63
+ ->_addLeft($this->getLayout()->createBlock('awext/adminhtml_awext_view_tabs'));
64
  $this->renderLayout();
65
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  }
app/code/local/Addwish/Awext/controllers/IndexController.php CHANGED
@@ -1,202 +1,188 @@
1
  <?php
 
2
  class Addwish_Awext_IndexController extends Mage_Core_Controller_Front_Action
3
  {
 
 
 
 
 
 
 
 
 
4
  public function searchAction(){
5
  $this->loadLayout();
6
  $this->renderLayout();
7
  }
 
8
  public function upsellsAction(){
9
  $this->loadLayout();
10
  $this->renderLayout();
11
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  public function orderListAction(){
13
- $model = Mage::getModel('awext/awext')->load(1);
14
- if($model->getData('ipaddress')!=''){
15
- $allowedIps=explode(",",$model->getData('ipaddress'));
16
- $ipaddress = '';
17
- if ($_SERVER['HTTP_CLIENT_IP'])
18
- $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
19
- else if($_SERVER['HTTP_X_FORWARDED_FOR'])
20
- $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
21
- else if($_SERVER['HTTP_X_FORWARDED'])
22
- $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
23
- else if($_SERVER['HTTP_FORWARDED_FOR'])
24
- $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
25
- else if($_SERVER['HTTP_FORWARDED'])
26
- $ipaddress = $_SERVER['HTTP_FORWARDED'];
27
- else if($_SERVER['REMOTE_ADDR'])
28
- $ipaddress = $_SERVER['REMOTE_ADDR'];
29
- else
30
- $ipaddress = 'UNKNOWN';
31
- if(!in_array($ipaddress,$allowedIps)){
32
- echo "Access Denied";
33
- exit;
34
- }
35
-
36
  }
37
- if($model->getData('enable_order_export')==0){
38
- echo "Access Denied";
39
- exit;
40
- }
41
 
42
  $exportFromDate=$this->getRequest()->getParam('exportFromDate');
43
  $exportToDate=$this->getRequest()->getParam('exportToDate');
44
  $fromDate = date('Y-m-d H:i:s', strtotime($exportFromDate));
45
  $toDate = date('Y-m-d H:i:s', strtotime($exportToDate));
46
- header("Content-type: text/xml");
47
- echo '<?xml version="1.0" encoding="UTF-8"?><orders><exportFromDate>'.$exportFromDate.'</exportFromDate><exportToDate>'.$exportToDate.'</exportToDate>';
48
  $orders = Mage::getModel('sales/order')->getCollection()
49
- ->addAttributeToFilter('created_at', array('from'=>$fromDate, 'to'=>$toDate))
50
- ->addAttributeToFilter('status', array('eq' => Mage_Sales_Model_Order::STATE_COMPLETE));
51
- foreach($orders as $order){
52
- $order_total=number_format($order->getData('base_grand_total'), 2, '.', '');
53
- echo '<order><orderDate>'.$order->getData('created_at').'</orderDate><orderNumber>'.$order->getData('increment_id').'</orderNumber><orderTotal>'.$order_total.'</orderTotal><orderLines>';
54
- $items = $order->getAllItems();
55
- foreach($items as $orderItem):
56
- $_product = Mage::getModel('catalog/product')
57
- ->load($orderItem->getProductId());
58
- echo '<orderLine><productnumber>'.$_product->getId().'</productnumber><productURL>'.$_product->getProductUrl().'</productURL><quantity>'.(int)$orderItem->getData('qty_ordered').'</quantity></orderLine>';
59
- endforeach;
 
 
 
 
 
 
 
 
 
60
  echo '</orderLines></order>';
61
- }
62
- echo '</orders>';
63
- //echo "</pre>";
64
-
65
-
66
  exit;
67
  }
 
68
  public function indexAction()
69
  {
70
- $model = Mage::getModel('awext/awext')->load(1);
71
- if($model->getData('enable_product_feed')==0){
72
- echo "Access Denied";
73
- exit;
74
- }
75
- if($model->getData('ipaddress')!=''){
76
- $allowedIps=explode(",",$model->getData('ipaddress'));
77
- $ipaddress = '';
78
- if ($_SERVER['HTTP_CLIENT_IP'])
79
- $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
80
- else if($_SERVER['HTTP_X_FORWARDED_FOR'])
81
- $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
82
- else if($_SERVER['HTTP_X_FORWARDED'])
83
- $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
84
- else if($_SERVER['HTTP_FORWARDED_FOR'])
85
- $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
86
- else if($_SERVER['HTTP_FORWARDED'])
87
- $ipaddress = $_SERVER['HTTP_FORWARDED'];
88
- else if($_SERVER['REMOTE_ADDR'])
89
- $ipaddress = $_SERVER['REMOTE_ADDR'];
90
- else
91
- $ipaddress = 'UNKNOWN';
92
- if(!in_array($ipaddress,$allowedIps)){
93
- echo "Access Denied";
94
- exit;
95
- }
96
- }
97
  header("Content-type: text/xml");
98
- $products_out='<?xml version="1.0" encoding="UTF-8"?><products>';
99
- $products = Mage::getModel('catalog/product')->getCollection()->addStoreFilter(Mage::app()->getStore()->getStoreId())->addAttributeToFilter('visibility', 4);
100
- $products->addAttributeToSelect('*')->addAttributeToFilter(
101
- 'status',
102
- array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
103
- );
 
 
 
104
  foreach($products as $product) {
105
- $imageUrl = Mage::helper('catalog/image')->init($product , 'thumbnail')->resize(256);
106
- $specialPrice = number_format($product->getSpecialPrice(), 2, '.', '');
107
- $regularPrice = number_format($product->getPrice(), 2, '.', '');
108
- $products_out.="<product><url>".$product->getProductUrl()."</url><title>".htmlspecialchars(htmlentities($product->getName(),ENT_QUOTES,'UTF-8'))."</title><imgurl>".$imageUrl."</imgurl>";
109
- if(isset($specialPrice) && $specialPrice>0 && $specialPrice<$regularPrice ){
110
- $today = date('Y-m-d');
111
- $today=date('Y-m-d', strtotime($today));;
112
- $spcialPriceDateBegin = date('Y-m-d', strtotime($product->getSpecialFromDate()));
113
- $spcialPriceDateEnd = date('Y-m-d', strtotime($product->getSpecialToDate()));
114
-
115
- if (($today > $spcialPriceDateBegin) && ($today < $spcialPriceDateEnd))
116
- {
117
- $products_out.= "<price>".number_format(Mage::getModel('directory/currency')->formatTxt($specialPrice, array('display' => Zend_Currency::NO_SYMBOL)), 2, '.', '')."</price>";
118
- $products_out.= "<previousprice>".number_format(Mage::getModel('directory/currency')->formatTxt($regularPrice, array('display' => Zend_Currency::NO_SYMBOL)), 2, '.', '')."</previousprice>";
119
- }
120
- else
121
- {
122
- $products_out.= "<price>".number_format(Mage::getModel('directory/currency')->formatTxt($regularPrice, array('display' => Zend_Currency::NO_SYMBOL)), 2, '.', '')."</price>";
123
- }
124
-
125
-
126
-
127
-
128
-
129
- }else{
130
- $products_out.= "<price>".number_format(Mage::getModel('directory/currency')->formatTxt($regularPrice, array('display' => Zend_Currency::NO_SYMBOL)), 2, '.', '')."</price>";
131
- }
132
-
133
-
134
-
135
- if($product->getMetaKeyword()!=''){
136
- $products_out.= "<keywords>".htmlspecialchars(htmlentities($product->getMetaKeyword(),ENT_QUOTES,'UTF-8'))."</keywords>";
137
- }
138
- if($product->getDescription()!=''){
139
- $products_out.= "<description>".htmlspecialchars(htmlentities($product->getDescription(),ENT_QUOTES,'UTF-8'))."</description>";
140
- }
141
- $products_out.= "<productnumber>".$product->getId()."</productnumber>";
142
- $products_out.= "<currency>".Mage::app()->getStore()->getCurrentCurrencyCode()."</currency>";
143
- $cats = $product->getCategoryIds();
144
- $products_out.= "<hierarchies>";
145
- foreach ($cats as $category_id) {
146
- $products_out.= "<hierarchy> ";
147
- $category = Mage::getModel('catalog/category')->load($category_id) ;
148
- $catnames = array();
149
- foreach ($category->getParentCategories() as $parent) {
150
- if(trim($parent->getName())!=""){
151
- $catnames[] = $parent->getName();
152
-
153
- $products_out.= "<category>".htmlspecialchars(htmlentities($parent->getName(),ENT_QUOTES,'UTF-8'))."</category>";
154
- }
155
- }
156
-
157
- $products_out.= "</hierarchy> ";
158
- }
159
- $products_out.= "</hierarchies>";
160
- if($product->getData('brand')){
161
- $products_out.= "<brand>".$product->getData('brand')."</brand>";
162
- }
163
- $product_inStock=0;
164
- if($product->isConfigurable()){
165
- $allProducts = $product->getTypeInstance(true)->getUsedProducts(null, $product);
166
- foreach ($allProducts as $productD) {
167
- if (!$productD->isSaleable()|| $productD->getIsInStock()==0) {
168
- //out of stock for check child simple product
169
- }else{
170
- $product_inStock=1;
171
  }
172
- }
173
- if($product_inStock==1){
174
- $products_out.= "<instock>true</instock>";
175
- }else{
176
- $products_out.= "<instock>false</instock>";
177
- }
178
- }else{
179
- if($product->isInStock()){
180
- $products_out.= "<instock>true</instock>";
181
- }else{
182
- $products_out.= "<instock>false</instock>";
183
  }
184
  }
185
-
186
- if($product->getData('gender')){
187
- $attr = $product->getResource()->getAttribute("gender");
188
- $genderLabel = $attr->getSource()->getOptionText($product->getData('gender'));
189
- $products_out.= "<gender>".$genderLabel."</gender>";
190
- }
191
- if($product->getData('pricedetail')){
192
- $products_out.= "<pricedetail>".$product->getData('pricedetail')."</pricedetail>";
193
- }
194
- //
195
- $products_out.= "</product>";
196
  }
197
- $products_out.= "</products>";
198
- echo $products_out;
199
  exit;
200
  }
 
 
 
 
 
 
 
 
 
 
201
  }
202
- ?>
1
  <?php
2
+
3
  class Addwish_Awext_IndexController extends Mage_Core_Controller_Front_Action
4
  {
5
+ protected $model = null;
6
+
7
+ public function preDispatch() {
8
+ parent::preDispatch();
9
+ $this->model = Mage::getModel('awext/awext')->load(1);
10
+ return $this;
11
+ }
12
+
13
+
14
  public function searchAction(){
15
  $this->loadLayout();
16
  $this->renderLayout();
17
  }
18
+
19
  public function upsellsAction(){
20
  $this->loadLayout();
21
  $this->renderLayout();
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;
45
+ }
46
+ }
47
+
48
+ $storeId = $this->getRequest()->getParam('store');
49
+ if (isset($storeId) && is_numeric($storeId)) {
50
+ try {
51
+ Mage::app()->getStore((int)$storeId);
52
+ Mage::app()->setCurrentStore((int)$storeId);
53
+ return;
54
+ } catch (Exception $e) {
55
+ echo "Store not found";
56
+ exit;
57
+ }
58
+ }
59
+
60
+ }
61
+
62
+ public function storesAction() {
63
+ $this->verifyAccess();
64
+
65
+ header("Content-type: text/xml");
66
+ echo '<?xml version="1.0" encoding="UTF-8"?><stores>';
67
+ foreach (Mage::app()->getWebsites() as $website) {
68
+ foreach ($website->getGroups() as $group) {
69
+ $stores = $group->getStores();
70
+ foreach ($stores as $store) {
71
+ echo '<store>';
72
+ echo self::toXmlTag('id', $store->getId());
73
+ echo self::toXmlTag('name', $store->getName());
74
+ echo '</store>';
75
+ }
76
+ }
77
+ }
78
+ echo '</stores>';
79
+
80
+ }
81
+
82
+
83
  public function orderListAction(){
84
+ $this->verifyAccess();
85
+ if($this->model->getData('enable_order_export')==0) {
86
+ echo "Access Denied";
87
+ exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  }
89
+
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) {
105
+ $orders->setCurPage($page + 1);
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
+ }
121
+ echo '</orders>';
 
 
 
122
  exit;
123
  }
124
+
125
  public function indexAction()
126
  {
127
+ $this->verifyAccess();
128
+ if($this->model->getData('enable_product_feed') == 0){
129
+ echo "Access Denied";
130
+ exit;
131
+ }
132
+
133
+ $page = (int)$this->getRequest()->getParam('page');
134
+ $pageSize = (int)$this->getRequest()->getParam('pageSize');
135
+
136
+ $products = Mage::getModel('catalog/product')
137
+ ->getCollection()
138
+ ->addStoreFilter(Mage::app()->getStore()->getStoreId())
139
+ ->addAttributeToFilter('visibility', 4)
140
+ ->addAttributeToSelect('*')->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED));
141
+
 
 
 
 
 
 
 
 
 
 
 
 
142
  header("Content-type: text/xml");
143
+
144
+ echo '<?xml version="1.0" encoding="UTF-8"?><products';
145
+ if($pageSize > 0) {
146
+ $products->setCurPage($page + 1);
147
+ $products->setPageSize($pageSize);
148
+ echo ' last-page-number="' . ($products->getLastPageNumber() - 1) . '"';
149
+ }
150
+ echo '>';
151
+
152
  foreach($products as $product) {
153
+
154
+ $data = Mage::helper('awext')->getProductData($product);
155
+ $productOut = '<product>';
156
+ foreach($data as $key => $value) {
157
+ if($key == 'hierarchies') {
158
+ $productOut.= "<hierarchies>";
159
+ foreach($value as $hierarchy) {
160
+ $productOut.= "<hierarchy>";
161
+ foreach($hierarchy as $category) {
162
+ $productOut .= self::toXmlTag('category', $category);
163
+ }
164
+ $productOut.= "</hierarchy>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  }
166
+ $productOut.= "</hierarchies>";
167
+ } else {
168
+ $productOut .= self::toXmlTag($key, $value);
 
 
 
 
 
 
 
 
169
  }
170
  }
171
+
172
+ $productOut.= "</product>";
173
+ echo $productOut;
 
 
 
 
 
 
 
 
174
  }
175
+ echo "</products>";
 
176
  exit;
177
  }
178
+
179
+ private static function toXmlTag($tag, $value) {
180
+ if(is_bool($value)) {
181
+ $value = $value ? 'true' : 'false';
182
+ } else {
183
+ $value = htmlspecialchars($value);
184
+ }
185
+ return "<$tag>".$value."</$tag>";
186
+ }
187
+
188
  }
 
app/code/local/Addwish/Awext/etc/.DS_Store ADDED
Binary file
app/code/local/Addwish/Awext/etc/config.xml CHANGED
@@ -2,24 +2,20 @@
2
  <config>
3
  <modules>
4
  <Addwish_Awext>
5
- <version>0.2.0</version>
6
  </Addwish_Awext>
7
  </modules>
8
-
9
  <frontend>
10
-
11
-
12
  <events>
13
-
14
- <sales_quote_address_save_after>
15
  <observers>
16
  <getbillingData>
17
  <class>Addwish_Awext_Model_Observer</class>
18
  <method>getbillingData</method>
19
  </getbillingData>
20
  </observers>
21
- </sales_quote_address_save_after>
22
- <controller_action_layout_load_before>
23
  <observers>
24
  <addwishHeader>
25
  <class>Addwish_Awext_Model_Observer</class>
@@ -29,19 +25,19 @@
29
  </controller_action_layout_load_before>
30
  <customer_register_success>
31
  <observers>
32
- <inspectCartAddData>
33
- <class>Addwish_Awext_Model_Observer</class>
34
- <method>customerRegisterData</method>
35
- </inspectCartAddData>
36
- </observers>
37
  </customer_register_success>
38
  <checkout_cart_add_product_complete>
39
  <observers>
40
- <inspectCartAddData>
41
- <class>Addwish_Awext_Model_Observer</class>
42
- <method>inspectCartAddData</method>
43
- </inspectCartAddData>
44
- </observers>
45
  </checkout_cart_add_product_complete>
46
  </events>
47
  <routers>
@@ -62,23 +58,21 @@
62
  </layout>
63
  </frontend>
64
  <admin>
65
- <routers>
66
- <adminhtml>
67
- <args>
68
- <modules>
69
- <addwish_awext after="Mage_Adminhtml">Addwish_Awext_Adminhtml</addwish_awext>
70
- </modules>
71
- </args>
72
- </adminhtml>
73
- </routers>
74
- </admin>
75
  <adminhtml>
76
-
77
  <menu>
78
-
79
  <awext module="awext">
80
  <title>addwish</title>
81
- <sort_order>1</sort_order>
82
  <children>
83
  <items module="awext">
84
  <title>addwish Configuration</title>
@@ -111,7 +105,6 @@
111
  </updates>
112
  </layout>
113
  </adminhtml>
114
-
115
  <global>
116
  <models>
117
  <awext>
2
  <config>
3
  <modules>
4
  <Addwish_Awext>
5
+ <version>0.16.0</version>
6
  </Addwish_Awext>
7
  </modules>
 
8
  <frontend>
 
 
9
  <events>
10
+ <sales_quote_address_save_after>
 
11
  <observers>
12
  <getbillingData>
13
  <class>Addwish_Awext_Model_Observer</class>
14
  <method>getbillingData</method>
15
  </getbillingData>
16
  </observers>
17
+ </sales_quote_address_save_after>
18
+ <controller_action_layout_load_before>
19
  <observers>
20
  <addwishHeader>
21
  <class>Addwish_Awext_Model_Observer</class>
25
  </controller_action_layout_load_before>
26
  <customer_register_success>
27
  <observers>
28
+ <inspectCartAddData>
29
+ <class>Addwish_Awext_Model_Observer</class>
30
+ <method>customerRegisterData</method>
31
+ </inspectCartAddData>
32
+ </observers>
33
  </customer_register_success>
34
  <checkout_cart_add_product_complete>
35
  <observers>
36
+ <inspectCartAddData>
37
+ <class>Addwish_Awext_Model_Observer</class>
38
+ <method>inspectCartAddData</method>
39
+ </inspectCartAddData>
40
+ </observers>
41
  </checkout_cart_add_product_complete>
42
  </events>
43
  <routers>
58
  </layout>
59
  </frontend>
60
  <admin>
61
+ <routers>
62
+ <adminhtml>
63
+ <args>
64
+ <modules>
65
+ <addwish_awext after="Mage_Adminhtml">Addwish_Awext_Adminhtml</addwish_awext>
66
+ </modules>
67
+ </args>
68
+ </adminhtml>
69
+ </routers>
70
+ </admin>
71
  <adminhtml>
 
72
  <menu>
 
73
  <awext module="awext">
74
  <title>addwish</title>
75
+ <sort_order>80</sort_order>
76
  <children>
77
  <items module="awext">
78
  <title>addwish Configuration</title>
105
  </updates>
106
  </layout>
107
  </adminhtml>
 
108
  <global>
109
  <models>
110
  <awext>
app/design/adminhtml/default/default/template/awext/list.phtml CHANGED
@@ -1,13 +1,7 @@
1
- <link rel="stylesheet" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>adminhtml/default/default/css/addwish.css" />
2
- <link rel="stylesheet" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>adminhtml/default/default/boxes.css" />
3
- <div style="float: left; margin-top: 0;">
4
- <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>adminhtml/default/default/images/addwish/addwish.png" alt="addwish logo" />
5
- </div>
6
- <div class='clear'></div>
7
- <div class="introtext">Great! You’ve successfully installed the addwish for business extension. This will allow you to quickly implement changes to how addwish functions on your webshop. We’ve made the extension as easy to use as possible but if you do have any questions don’t hesitate to contact us on <a href="mailto:support@addwish.com">support@addwish.com</a>. Alternatively, check out our FAQs on <a href="http://addwish.com/company/faq.html" target="_blank">http://addwish.com/company/faq.html</a>. We hope you enjoy growing your business with addwish!</div>
8
  <div class="entry-edit">
9
- <div class="entry-edit-head collapseable">
10
- <a onclick="Fieldset.toggleCollapse('general_region', ''); return false;" href="#" id="general_region-head" class="">Script Setup</a>
11
  </div>
12
  <form action='' method='post'>
13
  <?php
@@ -18,7 +12,7 @@ $currentStore=Mage::app()->getRequest()->getParam('storeconfig');
18
  ?>
19
  <input type='hidden' name='action' value='scriptsetup'/>
20
  <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
21
- <fieldset id="general_region" class="config collapseable">
22
  <legend>Script Setup</legend>
23
  <?php
24
  $model = Mage::getModel('awext/awext')->load($currentStore);
@@ -47,16 +41,14 @@ Once you have an addwish business ID enter it in the box below and press save.</
47
 
48
  <div class='clear'></div>
49
  <div class="entry-edit">
50
- <div class="entry-edit-head collapseable">
51
- <a
52
- onclick="Fieldset.toggleCollapse('general_Dataregion', ''); return false;"
53
- href="#" id="general_Dataregion-head" class="">Data Export Setup</a>
54
  </div>
55
  <form action='' method='post'>
56
  <input type='hidden' name='action' value='dataexport'/>
57
  <input name="form_key" type="hidden"
58
  value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
59
- <fieldset id="general_Dataregion" class="config collapseable">
60
  <legend>Data Export Setup</legend>
61
  <div style="margin-bottom: 10px" class="introtext">
62
  This extension will automatically create a product feed and an order history feed, which will allow addwish to correctly identify and display all the products on your webshop <br>and create relations between them, based on your historical orders. <br>
1
+ <div class="headertext">Great! You’ve successfully installed the addwish for business extension. This will allow you to quickly implement changes to how addwish functions on your webshop. We’ve made the extension as easy to use as possible but if you do have any questions don’t hesitate to contact us on <a href="mailto:support@addwish.com">support@addwish.com</a>. Alternatively, check out our FAQs on <a href="http://addwish.com/company/faq.html" target="_blank">http://addwish.com/company/faq.html</a>. We hope you enjoy growing your business with addwish!</div>
 
 
 
 
 
 
2
  <div class="entry-edit">
3
+ <div class="entry-edit-head">
4
+ <h4>Script Setup</h4>
5
  </div>
6
  <form action='' method='post'>
7
  <?php
12
  ?>
13
  <input type='hidden' name='action' value='scriptsetup'/>
14
  <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
15
+ <fieldset id="general_region" class="config">
16
  <legend>Script Setup</legend>
17
  <?php
18
  $model = Mage::getModel('awext/awext')->load($currentStore);
41
 
42
  <div class='clear'></div>
43
  <div class="entry-edit">
44
+ <div class="entry-edit-head">
45
+ <h4>Data Export Setup</h4>
 
 
46
  </div>
47
  <form action='' method='post'>
48
  <input type='hidden' name='action' value='dataexport'/>
49
  <input name="form_key" type="hidden"
50
  value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
51
+ <fieldset id="general_Dataregion" class="config">
52
  <legend>Data Export Setup</legend>
53
  <div style="margin-bottom: 10px" class="introtext">
54
  This extension will automatically create a product feed and an order history feed, which will allow addwish to correctly identify and display all the products on your webshop <br>and create relations between them, based on your historical orders. <br>
app/design/adminhtml/default/default/template/awext/recommendations.phtml CHANGED
@@ -1,19 +1,7 @@
1
- <link
2
- rel="stylesheet"
3
- href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>adminhtml/default/default/css/addwish.css" />
4
- <link
5
- rel="stylesheet"
6
- href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>adminhtml/default/default/boxes.css" />
7
- <div style="float: left; margin-top: 0;">
8
- <img
9
- src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>adminhtml/default/default/images/addwish/addwish.png"
10
- alt="addwish logo" />
11
-
12
- </div>
13
- <div class='clear'></div>
14
- <div class="entry-edit">
15
- <div class="entry-edit-head collapseable">
16
- <a class="" id="general_recommend-head" href="#" onclick="Fieldset.toggleCollapse('general_recommend', ''); return false;">Recommendations</a>
17
  </div>
18
  <form action="" method="post">
19
  <?php
@@ -25,7 +13,7 @@ $currentStore=Mage::app()->getRequest()->getParam('storeconfig');
25
  <input type="hidden" name="action" value="recomendations">
26
  <input name="form_key" type="hidden"
27
  value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
28
- <fieldset class="config collapseable" id="general_recommend">
29
  <legend>Recomendations</legend>
30
  <?php
31
  $model = Mage::getModel('awext/awext')->load($currentStore);
1
+ <div class="headertext">&nbsp;</div>
2
+ <div class="entry-edit" style="top:-200px">
3
+ <div class="entry-edit-head">
4
+ <h4>Recommendations</h4>
 
 
 
 
 
 
 
 
 
 
 
 
5
  </div>
6
  <form action="" method="post">
7
  <?php
13
  <input type="hidden" name="action" value="recomendations">
14
  <input name="form_key" type="hidden"
15
  value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
16
+ <fieldset class="config" id="general_recommend">
17
  <legend>Recomendations</legend>
18
  <?php
19
  $model = Mage::getModel('awext/awext')->load($currentStore);
app/design/adminhtml/default/default/template/awext/search.phtml CHANGED
@@ -1,6 +1,15 @@
1
- Our live search feature simplifies and speeds up your customers’ searches, and gives them live results while typing.<br>
2
- It automatically corrects and understands spelling errors and gives them quick previews as they type.
3
- <br><br>Included in the Search feature is also a full featured result page.<br>This plug-in automatically generated this result page, and the addwish javascript present on you shop pages, makes sure that the searched products is shown.
4
- <br>You can visit the page here <a href="<?php echo Mage::getBaseUrl();?>addwish-search-result.html" target="_blank">/addwish-search-result.html</a> and make sure that design seperate from the space where the results will be shown, is fitting into you requirements.
5
- <br><b>Please contact <a href="mailto:support@addwish.com">support@addwish.com</a> to get the search implemented and setup for you webshop.
6
- </b>
 
 
 
 
 
 
 
 
 
1
+ <div class="headertext">&nbsp;</div>
2
+ <div class="entry-edit">
3
+ <div class="entry-edit-head">
4
+ <h4>Search</h4>
5
+ </div>
6
+ <div class="fieldset">
7
+ Our live search feature simplifies and speeds up your customers’ searches, and gives them live results while typing.<br>
8
+ It automatically corrects and understands spelling errors and gives them quick previews as they type.<br>
9
+ <br>
10
+ Included in the Search feature is also a full featured result page.<br>
11
+ This plug-in automatically generated this result page, and the addwish javascript present on you shop pages, makes sure that the searched products is shown.<br>
12
+ You can visit the page here <a href="<?php echo Mage::getBaseUrl();?>addwish-search-result.html" target="_blank">/addwish-search-result.html</a> and make sure that design seperate from the space where the results will be shown, is fitting into you requirements.<br><b>Please contact <a href="mailto:support@addwish.com">support@addwish.com</a> to get the search implemented and setup for you webshop.</b>
13
+ </div>
14
+ </div>
15
+
app/design/adminhtml/default/default/template/awext/store-selector.phtml CHANGED
@@ -1,29 +1,33 @@
 
1
  <?php
2
  $currentStore= Mage::app()->getDefaultStoreView()->getStoreId();
3
  if(Mage::app()->getRequest()->getParam('storeconfig')){
4
- $currentStore=Mage::app()->getRequest()->getParam('storeconfig');
5
  }
6
  ?>
7
  <form action="" name="addwish_store_selector" id="addwish_store_selector">
8
- <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
9
- <div class="switcher">
10
- <label for="store_switcher">Current Configuration Scope:</label>
11
- <a class="link-store-scope" title="What is this?" onclick="this.target='_blank'" href="http://www.magentocommerce.com/knowledge-base/entry/understanding-store-scopes">What is this?</a> <select onchange="addwish_store_selector.submit()" class="system-config-store-switcher" id="storeconfig" name="storeconfig"">
12
- <?php
13
- foreach (Mage::app()->getWebsites() as $website) {
14
- foreach ($website->getGroups() as $group) {
15
- $stores = $group->getStores();
16
- foreach ($stores as $store) {
17
- $selected='';
18
- if($store->getStoreId()==$currentStore){
19
- $selected="selected='selected'";
20
- }
21
- echo "<option value='".$store->getStoreId()."' ".$selected.">".$store->getName()."</option>";
22
- }
23
- }
24
- }
25
- ?>
26
- </select>
27
-
28
  </div>
29
- </form>
 
 
 
 
1
+ <link rel="stylesheet" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>adminhtml/default/default/css/addwish.css" />
2
  <?php
3
  $currentStore= Mage::app()->getDefaultStoreView()->getStoreId();
4
  if(Mage::app()->getRequest()->getParam('storeconfig')){
5
+ $currentStore=Mage::app()->getRequest()->getParam('storeconfig');
6
  }
7
  ?>
8
  <form action="" name="addwish_store_selector" id="addwish_store_selector">
9
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
10
+ <div class="switcher">
11
+ <label for="store_switcher">Current Configuration Scope:</label>
12
+ <a class="link-store-scope" title="What is this?" onclick="this.target='_blank'" href="http://www.magentocommerce.com/knowledge-base/entry/understanding-store-scopes">What is this?</a>
13
+ <select onchange="addwish_store_selector.submit()" class="system-config-store-switcher" id="storeconfig" name="storeconfig"">
14
+ <?php
15
+ foreach (Mage::app()->getWebsites() as $website) {
16
+ foreach ($website->getGroups() as $group) {
17
+ $stores = $group->getStores();
18
+ foreach ($stores as $store) {
19
+ $selected='';
20
+ if($store->getStoreId()==$currentStore){
21
+ $selected="selected='selected'";
22
+ }
23
+ echo "<option value='".$store->getStoreId()."' ".$selected.">".$store->getName()."</option>";
24
+ }
25
+ }
26
+ }?>
27
+ </select>
 
28
  </div>
29
+ </form>
30
+ <div style="float: left; margin-top: 0;">
31
+ <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>adminhtml/default/default/images/addwish/addwish.png" alt="addwish logo" />
32
+ </div>
33
+ <div class="clear"></div>
app/design/frontend/base/default/template/addwish/basket-span.phtml CHANGED
@@ -14,8 +14,8 @@ if($product->isVisibleInSiteVisibility()){
14
  <span class="addwish-product"
15
  data-unit-price="<?php echo number_format(Mage::getModel('directory/currency')->formatTxt($cartProduct['price'], array('display' => Zend_Currency::NO_SYMBOL)), 2, '.', '');?>"
16
  data-url="<?php echo $product->getProductUrl();?>"
17
- data-productnumber="<?php echo $product->getId();?>"
18
- data-sku="<?php echo $product->getSku();?>"
19
  data-quantity="<?php echo (int)$cartProduct['qty'];?>"
20
  data-unit-tax="<?php echo number_format($cartProduct['tax_amount'], 2, '.', '');?>">
21
  </span>
14
  <span class="addwish-product"
15
  data-unit-price="<?php echo number_format(Mage::getModel('directory/currency')->formatTxt($cartProduct['price'], array('display' => Zend_Currency::NO_SYMBOL)), 2, '.', '');?>"
16
  data-url="<?php echo $product->getProductUrl();?>"
17
+ data-id="<?php echo $product->getId();?>"
18
+ data-productnumber="<?php echo $product->getSku();?>"
19
  data-quantity="<?php echo (int)$cartProduct['qty'];?>"
20
  data-unit-tax="<?php echo number_format($cartProduct['tax_amount'], 2, '.', '');?>">
21
  </span>
app/design/frontend/base/default/template/addwish/conversion-span.phtml CHANGED
@@ -17,8 +17,8 @@ if($product->isVisibleInSiteVisibility()){
17
  <span class="addwish-product"
18
  data-unit-price="<?php echo number_format(Mage::getModel('directory/currency')->formatTxt($cartProduct->getData('price'), array('display' => Zend_Currency::NO_SYMBOL)), 2, '.', '');?>"
19
  data-url="<?php echo $product->getProductUrl();?>"
20
- data-productnumber="<?php echo $product->getId();?>"
21
- data-sku="<?php echo $product->getSku();?>"
22
  data-quantity="<?php echo (int)$cartProduct->getData('qty_ordered');?>"
23
  data-unit-tax="<?php echo number_format($cartProduct->getData('tax_amount'), 2, '.', '');?>">
24
  </span>
17
  <span class="addwish-product"
18
  data-unit-price="<?php echo number_format(Mage::getModel('directory/currency')->formatTxt($cartProduct->getData('price'), array('display' => Zend_Currency::NO_SYMBOL)), 2, '.', '');?>"
19
  data-url="<?php echo $product->getProductUrl();?>"
20
+ data-id="<?php echo $product->getId();?>"
21
+ data-productnumber="<?php echo $product->getSku();?>"
22
  data-quantity="<?php echo (int)$cartProduct->getData('qty_ordered');?>"
23
  data-unit-tax="<?php echo number_format($cartProduct->getData('tax_amount'), 2, '.', '');?>">
24
  </span>
app/design/frontend/base/default/template/addwish/product-span.phtml CHANGED
@@ -1,108 +1,20 @@
1
  <?php
2
  $product = Mage::registry('current_product');
3
- $specialPrice = number_format($product->getSpecialPrice(), 2, '.', '');
4
- $regularPrice = number_format($product->getPrice(), 2, '.', '');
5
- $product_image=Mage::helper('catalog/image')->init($product , 'thumbnail')->resize(256);
6
- $imageUrl = Mage::helper('catalog/image')->init($product , 'thumbnail')->resize(256);
7
- ?>
8
- <span class="addwish-product-info" style="display:none"
9
- data-title="<?php echo htmlentities($product->getName());?>"
10
- data-imgurl="<?php echo $imageUrl ;?>"
11
-
12
- <?php
13
-
14
-
15
- $product_inStock=0;
16
- if($product->isConfigurable()){
17
- $allProducts = $product->getTypeInstance(true)->getUsedProducts(null, $product);
18
- foreach ($allProducts as $productD) {
19
- if (!$productD->isSaleable()|| $productD->getIsInStock()==0) {
20
- //out of stock for check child simple product
21
- }else{
22
- $product_inStock=1;
23
- }
24
- }
25
- if($product_inStock==1){
26
- echo " data-instock='true'";
27
- }else{
28
- echo " data-instock='false'";
29
- }
30
- }else{
31
- if($product->isInStock()){
32
- echo " data-instock='true'";
33
- }else{
34
- echo " data-instock='false'";
35
- }
36
- }
37
-
38
- if(isset($specialPrice) && $specialPrice>0 && $specialPrice<$regularPrice ){
39
- $today = date('Y-m-d');
40
- $today=date('Y-m-d', strtotime($today));;
41
- $spcialPriceDateBegin = date('Y-m-d', strtotime($product->getSpecialFromDate()));
42
- $spcialPriceDateEnd = date('Y-m-d', strtotime($product->getSpecialToDate()));
43
 
44
- if (($today > $spcialPriceDateBegin) && ($today < $spcialPriceDateEnd))
45
- {
46
- echo ' data-price="'.number_format(Mage::getModel('directory/currency')->formatTxt($specialPrice, array('display' => Zend_Currency::NO_SYMBOL)), 2, '.', '').'"';
47
- echo ' data-previousprice="'.number_format(Mage::getModel('directory/currency')->formatTxt($regularPrice, array('display' => Zend_Currency::NO_SYMBOL)), 2, '.', '').'"';
48
- }
49
- else
50
- {
51
- echo ' data-price="'.number_format(Mage::getModel('directory/currency')->formatTxt($regularPrice, array('display' => Zend_Currency::NO_SYMBOL)), 2, '.', '').'" ';
52
- }
53
-
54
-
55
-
56
-
57
-
58
- }else{
59
- echo ' data-price="'.number_format(Mage::getModel('directory/currency')->formatTxt($regularPrice, array('display' => Zend_Currency::NO_SYMBOL)), 2, '.', '').'" ';
60
- }
61
  ?>
62
- data-productnumber="<?php echo $product->getId();?>"
63
- data-sku="<?php echo $product->getSku();?>"
64
- data-url="<?php echo $product->getProductUrl();?>"
65
- data-currency="<?php echo Mage::app()->getStore()->getCurrentCurrencyCode();?>"
66
- <?php
67
- if($product->getData('brand')){
68
- echo " data-brand='".$product->getData('brand')."'";
69
- }
70
-
71
- $cats = $product->getCategoryIds();
72
- $catJsonArray=array();
73
- foreach ($cats as $category_id) {
74
- $category = Mage::getModel('catalog/category')->load($category_id) ;
75
- foreach ($category->getParentCategories() as $parent) {
76
- $catJsonArray[] = htmlentities($parent->getName());
77
  }
78
- }
79
- ?>
80
- data-category='<?php echo addslashes(json_encode($catJsonArray));?>'
81
- <?php
82
- if($product->getData('gender')){
83
- $attr = $product->getResource()->getAttribute("gender");
84
- $genderLabel = $attr->getSource()->getOptionText($product->getData('gender'));
85
- echo " data-gender='".$genderLabel."'";
86
- }
87
- if($product->getData('pricedetail')){
88
- echo " data-pricedetail='".$product->getData('pricedetail')."'";
89
- }
90
- if($product->getData('score')){
91
- echo " data-score='".$product->getData('score')."'";
92
- }
93
- if($product->getData('newsletter-promotion')){
94
- echo " data-newsletter-promotion='".$product->getData('newsletter-promotion')."'";
95
- }
96
- if($product->getData('recurrent')){
97
- echo " data-recurrent='".$product->getData('recurrent')."'";
98
- }
99
- if($product->getData('sold-related')){
100
- echo " data-sold-related='".$product->getData('sold-related')."'";
101
- }
102
- $uencURL=Mage::helper('checkout/cart')->getAddUrl($product);
103
- $elem1=explode("uenc/",$uencURL);
104
- $elem2=explode("/product",$elem1[1]);
105
  ?>
106
- data-formkey='<?php echo Mage::getSingleton('core/session')->getFormKey();?>'
107
- data-uenc='<?php echo $elem2[0];?>'
108
  ></span>
1
  <?php
2
  $product = Mage::registry('current_product');
3
+ $productData = Mage::helper('awext')->getProductData($product);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
+ $parts=explode("uenc/", Mage::helper('checkout/cart')->getAddUrl($product));
6
+ $parts=explode("/product",$parts[1]);
7
+ $productData['uenc'] = $parts[0];
8
+ $productData['formkey'] = Mage::getSingleton('core/session')->getFormKey();
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  ?>
10
+ <span class="addwish-product-info" style="display:none"
11
+ <?php foreach($productData as $key => $value):
12
+ if(is_bool($value)) {
13
+ $value = $value ? "true" : "false";
14
+ } else if(is_array($value)) {
15
+ $value = json_encode($value);
 
 
 
 
 
 
 
 
 
16
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  ?>
18
+ data-<?php echo strtolower($key)?>="<?php echo htmlspecialchars($value)?>"
19
+ <?php endforeach ?>
20
  ></span>
package.xml CHANGED
@@ -1,18 +1,2 @@
1
  <?xml version="1.0"?>
2
- <package>
3
- <name>addwish</name>
4
- <version>0.15.0</version>
5
- <stability>stable</stability>
6
- <license>GNU General Public License (GPL)</license>
7
- <channel>community</channel>
8
- <extends/>
9
- <summary>New multisite module</summary>
10
- <description>New multisite module</description>
11
- <notes>New multisite module</notes>
12
- <authors><author><name>addwish</name><user>addwish</user><email>krj@addwish.com</email></author></authors>
13
- <date>2016-07-08</date>
14
- <time>03:50:43</time>
15
- <contents><target name="magelocal"><dir name="Addwish"><dir name="Awext"><dir name="Block"><dir name="Adminhtml"><dir name="Awext"><file name="Grid.php" hash="0a9e0cc01157a49a58cddf0ef4eddbad"/><file name="Renderer.php" hash="f5f132bb8089270358be38f9e1fb342d"/><dir name="View"><dir name="Tab"><dir name="Details"><file name="List.php" hash="629a98942f2354a0a10d14e8564fc542"/></dir><file name="Details.php" hash="9431059a450be7a0bb9d69867c2b2b10"/><file name="Form.php" hash="14b1192bea84fbee58e47ff749a004f4"/><dir name="Recommend"><file name="List.php" hash="a8f994f1e5a29abf1f4bbf48e826e1d2"/></dir><file name="Recommend.php" hash="5d4fe965a062adcb51567c93e5adec2f"/><dir name="Search"><file name="List.php" hash="c556a6030e13ae9933bdf16e2ff1ff33"/></dir><file name="Search.php" hash="f194d4fa52fa3e106baa49ffd981de06"/><dir name="Searchconfig"><file name="List.php" hash="6ef64a77cfc24144aa3a85515f6ce22b"/></dir><file name="Searchconfig.php" hash="ce2a937906c8f2d13552d06b8c7b4f69"/></dir><file name="Tabs.php" hash="51d7b9c59068451c28bf614d42fe303d"/></dir><file name="View.php" hash="a5a5aa835bdbaf1102b50e90dec526a8"/></dir><file name="Awext.php" hash="2e46d78792ff55c3285d77780ba3e784"/></dir><file name="Awext.php" hash="5d627b94fe5a46ab3c5a77debbabcff6"/></dir><dir name="Helper"><file name="Data.php" hash="cb01c88cb51f7576e38209e495593b0f"/></dir><dir name="Model"><file name="Awext.php" hash="1925cb6fd94cc7cd6baecda71964a424"/><dir name="Mysql4"><dir name="Awext"><file name="Collection.php" hash="12afe62372c67a5bd9154695c8d095f3"/></dir><file name="Awext.php" hash="acd112233e367ebe80caf114f5dfe653"/></dir><file name="Observer.php" hash="e85fea849acf03c9353e557588e3f21d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AwextController.php" hash="791cdc06945d68170a621ef672769d60"/></dir><file name="IndexController.php" hash="ece60b3c518a01bbd71fd7f3a6747095"/></dir><dir name="etc"><file name="config.xml" hash="a1a8d58b8191ad97bff73e32d0db4e45"/></dir><dir name="sql"><dir name="addwish_setup"><file name="mysql4-install-0.0.4.php" hash="77a5d3d50380396c9bd2a9dfdfea8905"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><file name="addwish.css" hash="19749f3be796449de42232fae0d77d2f"/></dir><dir name="images"><dir name="addwish"><file name="addwish.png" hash="a588d24d1919d9206eff40a886b88ef1"/></dir></dir></dir></dir></dir></target><target name="magedesign"><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="1590b47b152d27472a56731ec48240cb"/><file name="recommendations.phtml" hash="ec0a4cdb4909fed98b08f150d05fde5e"/><file name="search-config.phtml" hash="35e42872b25a359386b1ea239d571947"/><file name="search.phtml" hash="bcf56fe0d8728a45ca5421a0d6273385"/><file name="store-selector.phtml" hash="0807c0434f92c17688b4c4c24dadc7ad"/></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="376f40e9b45308397be1fc407416e9b4"/><file name="conversion-span.phtml" hash="d138217056dfe6e07ec106d8f2c42103"/><file name="integrator.phtml" hash="43fb7dd7c6a56cbbaf25784aa393c110"/><file name="product-span.phtml" hash="b01acc572de58e1cc45182a59eef1362"/><file name="search-result-page.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="upsells-page.phtml" hash="ac41002da8c7bb57233599a00053ef77"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Addwish_Awext.xml" hash="fea2883f86536f249670eea31980f72c"/></dir></target></contents>
16
- <compatible/>
17
- <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
- </package>
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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
skin/adminhtml/default/default/css/addwish.css CHANGED
@@ -1,8 +1,9 @@
1
- .introtext {
2
- margin-bottom: 43px;
 
3
  }
4
- #informative {
5
- list-style: outside none circle;
6
  }
7
  #addwish_store_selector {
8
  float: right;
1
+ .headertext {
2
+ padding-top: 60px;
3
+ padding-bottom: 30px;
4
  }
5
+ .introtext {
6
+ margin-bottom: 30px;
7
  }
8
  #addwish_store_selector {
9
  float: right;