Magmodules_Channable - Version 1.4.6

Version Notes

Channable Connect

Download this release

Release Info

Developer Magmodules
Extension Magmodules_Channable
Version 1.4.6
Comparing to
See all releases


Code changes from version 1.4.5 to 1.4.6

app/code/community/Magmodules/Channable/Helper/Data.php CHANGED
@@ -12,7 +12,7 @@
12
  * @author Magmodules <info@magmodules.eu>
13
  * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
  * @license http://www.magmodules.eu/license-agreement/
15
- * @version 07-06-2016
16
  * =============================================================
17
  */
18
 
@@ -184,26 +184,32 @@ class Magmodules_Channable_Helper_Data extends Mage_Core_Helper_Abstract {
184
 
185
  public function getProductUrl($product, $config, $parent)
186
  {
 
187
  if(!empty($parent)) {
188
- if($parent->getUrlKey()) {
189
- $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $parent->getUrlKey() . $config['product_url_suffix']));
190
- }
191
  if(empty($url)) {
192
- if($product->getRequestPath()) {
193
- $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $parent->getRequestPath() . $config['product_url_suffix']));
194
- }
195
  }
196
  } else {
197
- if($product->getUrlKey()) {
198
- $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $product->getUrlKey() . $config['product_url_suffix']));
199
- }
200
  if(empty($url)) {
201
- if($product->getRequestPath()) {
202
- $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $product->getRequestPath() . $config['product_url_suffix']));
203
- }
 
 
 
 
 
204
  }
205
  }
206
- if(!empty($parent) && !empty($config['conf_switch_urls'])) {
207
  if($parent->getTypeId() == 'configurable') {
208
  $productAttributeOptions = $parent->getTypeInstance(true)->getConfigurableAttributesAsArray($parent);
209
  $url_extra = '';
@@ -530,8 +536,20 @@ class Magmodules_Channable_Helper_Data extends Mage_Core_Helper_Abstract {
530
  if(!empty($config['category_replace'])) {
531
  $attributes[] = $config['category_replace'];
532
  }
533
-
534
- $categories = Mage::getModel('catalog/category')->setStoreId($storeId)->getCollection()->addAttributeToSelect($attributes)->addFieldToFilter('is_active', array('eq' => 1));
 
 
 
 
 
 
 
 
 
 
 
 
535
  $_categories = array();
536
 
537
  foreach($categories as $cat) {
@@ -675,6 +693,11 @@ class Magmodules_Channable_Helper_Data extends Mage_Core_Helper_Abstract {
675
  {
676
  $type_prices = array();
677
  if(!empty($config['conf_enabled'])) {
 
 
 
 
 
678
  foreach($products as $product) {
679
  if($product->getTypeId() == 'configurable') {
680
  $attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
@@ -684,9 +707,9 @@ class Magmodules_Channable_Helper_Data extends Mage_Core_Helper_Abstract {
684
  $prices = $attribute->getPrices();
685
  foreach ($prices as $price){
686
  if ($price['is_percent']) {
687
- $att_prices[$price['value_index']] = (float)$price['pricing_value'] * $base_price / 100;
688
  } else {
689
- $att_prices[$price['value_index']] = (float)$price['pricing_value'];
690
  }
691
  }
692
  }
@@ -700,7 +723,7 @@ class Magmodules_Channable_Helper_Data extends Mage_Core_Helper_Abstract {
700
  $total_price += $att_prices[$value];
701
  }
702
  }
703
- $type_prices[$sProduct->getEntityId()] = number_format($total_price, 2, '.', '') . ' ' . $config['currency'];
704
  }
705
  }
706
  }
@@ -708,7 +731,6 @@ class Magmodules_Channable_Helper_Data extends Mage_Core_Helper_Abstract {
708
  return $type_prices;
709
  }
710
 
711
-
712
  public function checkOldVersion($dir)
713
  {
714
  if($dir) {
12
  * @author Magmodules <info@magmodules.eu>
13
  * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
  * @license http://www.magmodules.eu/license-agreement/
15
+ * @version 16-09-2016
16
  * =============================================================
17
  */
18
 
184
 
185
  public function getProductUrl($product, $config, $parent)
186
  {
187
+ $url = '';
188
  if(!empty($parent)) {
189
+ if($parent->getRequestPath()) {
190
+ $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $parent->getRequestPath()));
191
+ }
192
  if(empty($url)) {
193
+ if($parent->getUrlKey()) {
194
+ $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $parent->getUrlKey()));
195
+ }
196
  }
197
  } else {
198
+ if($product->getRequestPath()) {
199
+ $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $product->getRequestPath()));
200
+ }
201
  if(empty($url)) {
202
+ if($product->getUrlKey()) {
203
+ $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $product->getUrlKey()));
204
+ }
205
+ }
206
+ }
207
+ if(!empty($config['product_url_suffix'])) {
208
+ if(strpos($url, $config['product_url_suffix']) === false) {
209
+ $url = $url . $config['product_url_suffix'];
210
  }
211
  }
212
+ if(!empty($parent) && !empty($config['conf_switch_urls']) && !empty($url)) {
213
  if($parent->getTypeId() == 'configurable') {
214
  $productAttributeOptions = $parent->getTypeInstance(true)->getConfigurableAttributesAsArray($parent);
215
  $url_extra = '';
536
  if(!empty($config['category_replace'])) {
537
  $attributes[] = $config['category_replace'];
538
  }
539
+
540
+ if(!empty($config['filter_enabled'])) {
541
+ $type = $config['filter_type'];
542
+ $f_categories = explode(',', $config['filter_cat']);
543
+ if($type && $f_categories) {
544
+ if($type == 'include') {
545
+ $categories = Mage::getModel('catalog/category')->setStoreId($storeId)->getCollection()->addAttributeToSelect($attributes)->addFieldToFilter('is_active', array('eq' => 1))->addAttributeToFilter('entity_id', array('in' => $f_categories));
546
+ } else {
547
+ $categories = Mage::getModel('catalog/category')->setStoreId($storeId)->getCollection()->addAttributeToSelect($attributes)->addFieldToFilter('is_active', array('eq' => 1))->addAttributeToFilter('entity_id', array('nin' => $f_categories));
548
+ }
549
+ }
550
+ } else {
551
+ $categories = Mage::getModel('catalog/category')->setStoreId($storeId)->getCollection()->addAttributeToSelect($attributes)->addFieldToFilter('is_active', array('eq' => 1));
552
+ }
553
  $_categories = array();
554
 
555
  foreach($categories as $cat) {
693
  {
694
  $type_prices = array();
695
  if(!empty($config['conf_enabled'])) {
696
+ if(!empty($config['hide_currency'])) {
697
+ $currency = '';
698
+ } else {
699
+ $currency = ' ' . $config['currency'];
700
+ }
701
  foreach($products as $product) {
702
  if($product->getTypeId() == 'configurable') {
703
  $attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
707
  $prices = $attribute->getPrices();
708
  foreach ($prices as $price){
709
  if ($price['is_percent']) {
710
+ $att_prices[$price['value_index']] = (float)(($price['pricing_value'] * $base_price / 100) * $config['markup']);
711
  } else {
712
+ $att_prices[$price['value_index']] = (float)($price['pricing_value'] * $config['markup']);
713
  }
714
  }
715
  }
723
  $total_price += $att_prices[$value];
724
  }
725
  }
726
+ $type_prices[$sProduct->getEntityId()] = number_format(($total_price * $config['markup']), 2, '.', '') . $currency;
727
  }
728
  }
729
  }
731
  return $type_prices;
732
  }
733
 
 
734
  public function checkOldVersion($dir)
735
  {
736
  if($dir) {
app/code/community/Magmodules/Channable/Model/Channable.php CHANGED
@@ -107,7 +107,7 @@ class Magmodules_Channable_Model_Channable extends Magmodules_Channable_Model_Co
107
  $config['delivery_out_be'] = Mage::getStoreConfig('channable/data/delivery_out_be', $storeId);
108
  $config['images'] = Mage::getStoreConfig('channable/data/images', $storeId);
109
  $config['default_image'] = Mage::getStoreConfig('channable/data/default_image', $storeId);
110
- $config['skip_validation'] = true;
111
 
112
  // WEIGHT
113
  $config['weight'] = Mage::getStoreConfig('channable/data/weight', $storeId);
107
  $config['delivery_out_be'] = Mage::getStoreConfig('channable/data/delivery_out_be', $storeId);
108
  $config['images'] = Mage::getStoreConfig('channable/data/images', $storeId);
109
  $config['default_image'] = Mage::getStoreConfig('channable/data/default_image', $storeId);
110
+ $config['skip_validation'] = false;
111
 
112
  // WEIGHT
113
  $config['weight'] = Mage::getStoreConfig('channable/data/weight', $storeId);
app/code/community/Magmodules/Channable/Model/Common.php CHANGED
@@ -27,11 +27,11 @@ class Magmodules_Channable_Model_Common extends Mage_Core_Helper_Abstract {
27
  $collection->addUrlRewrite();
28
 
29
  if(!empty($config['filter_enabled'])) {
30
- $type = $config['filter_type'];
31
  $categories = $config['filter_cat'];
32
- if($type && $categories) {
33
  $table = Mage::getSingleton('core/resource')->getTableName('catalog_category_product');
34
- if($type == 'include') {
35
  $collection->getSelect()->join(array('cats' => $table), 'cats.product_id = e.entity_id');
36
  $collection->getSelect()->where('cats.category_id in (' . $categories . ')');
37
  } else {
@@ -50,7 +50,7 @@ class Magmodules_Channable_Model_Common extends Mage_Core_Helper_Abstract {
50
  if(empty($config['conf_enabled'])) {
51
  $collection->addAttributeToFilter('visibility', array('in' => array(2,3,4)));
52
  }
53
-
54
  if($type != 'count') {
55
 
56
  // All attributes
@@ -156,7 +156,9 @@ class Magmodules_Channable_Model_Common extends Mage_Core_Helper_Abstract {
156
  Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($collection);
157
  }
158
  $products = $collection->load();
 
159
  } else {
 
160
  if(!empty($config['filters'])) {
161
  foreach($config['filters'] as $filter) {
162
  $attribute = $filter['attribute'];
@@ -192,6 +194,7 @@ class Magmodules_Channable_Model_Common extends Mage_Core_Helper_Abstract {
192
  if(!empty($config['hide_no_stock'])) {
193
  Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($collection);
194
  }
 
195
  $products = $collection->getSize();
196
  }
197
  return $products;
27
  $collection->addUrlRewrite();
28
 
29
  if(!empty($config['filter_enabled'])) {
30
+ $f_type = $config['filter_type'];
31
  $categories = $config['filter_cat'];
32
+ if($f_type && $categories) {
33
  $table = Mage::getSingleton('core/resource')->getTableName('catalog_category_product');
34
+ if($f_type == 'include') {
35
  $collection->getSelect()->join(array('cats' => $table), 'cats.product_id = e.entity_id');
36
  $collection->getSelect()->where('cats.category_id in (' . $categories . ')');
37
  } else {
50
  if(empty($config['conf_enabled'])) {
51
  $collection->addAttributeToFilter('visibility', array('in' => array(2,3,4)));
52
  }
53
+
54
  if($type != 'count') {
55
 
56
  // All attributes
156
  Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($collection);
157
  }
158
  $products = $collection->load();
159
+
160
  } else {
161
+
162
  if(!empty($config['filters'])) {
163
  foreach($config['filters'] as $filter) {
164
  $attribute = $filter['attribute'];
194
  if(!empty($config['hide_no_stock'])) {
195
  Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($collection);
196
  }
197
+
198
  $products = $collection->getSize();
199
  }
200
  return $products;
app/code/community/Magmodules/Channable/etc/config.xml CHANGED
@@ -19,7 +19,7 @@
19
  <config>
20
  <modules>
21
  <Magmodules_Channable>
22
- <version>1.4.5</version>
23
  </Magmodules_Channable>
24
  </modules>
25
  <global>
19
  <config>
20
  <modules>
21
  <Magmodules_Channable>
22
+ <version>1.4.6</version>
23
  </Magmodules_Channable>
24
  </modules>
25
  <global>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Magmodules_Channable</name>
4
- <version>1.4.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.magmodules.eu/license-agreement/">Single Server License</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Magmodules_Channable</description>
11
  <notes>Channable Connect</notes>
12
  <authors><author><name>Magmodules</name><user>magmodules</user><email>info@magmodules.nl</email></author></authors>
13
- <date>2016-08-25</date>
14
- <time>11:50:31</time>
15
- <contents><target name="magecommunity"><dir name="Magmodules"><dir name="Channable"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Extra.php" hash="73e9ccaafacba4153962b37a8038c1ad"/><file name="Filter.php" hash="b64842b1a7bbe5b879468c034ade22bd"/><file name="Shipping.php" hash="7f15ea3b4fed5dcb20b37a78dd84cf5d"/></dir><dir name="Renderer"><file name="Select.php" hash="90a71e109a5f96bca26209c922a74961"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Feeds.php" hash="e1127c67a55f163e0c17ae54111b4538"/><file name="Heading.php" hash="cf8597dec6375bbf35014e1a491605d6"/><file name="Note.php" hash="6d7c8056bf0418ab6008dd86ed1d93ca"/><file name="Token.php" hash="d6f89e494288e7d90525d8067a7bb1de"/><file name="Version.php" hash="7be709c731b412258539184c3c4e01dd"/></dir></dir></dir></dir><dir name="Widget"><dir name="Info"><file name="Info.php" hash="1e9f175e9be64df06e971f2307b5fd5e"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="2b769d911d15a5009b8bd5b46eb4c8fa"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Design"><file name="Extra.php" hash="6f888d0db7ed195c93a84748dd0a0c94"/><file name="Filter.php" hash="6609193f2296111f82276f09dc548be2"/><file name="Shipping.php" hash="6bea82000c4341ff2c5a9b05c992406c"/></dir></dir><dir name="Source"><file name="Action.php" hash="d655c22564992e02daccd9aac650358a"/><file name="Attribute.php" hash="714c0aafbe76d361fe883483bb7036d0"/><file name="Category.php" hash="bad1adc7e7890cfa5b83de0cd7a16835"/><file name="Categorytype.php" hash="7284943e01d7fe3346da7233ea827086"/><file name="Conditions.php" hash="aeb42d43282065fda73860f6a6d9da46"/><file name="Configurable.php" hash="08f157df27a2424e1a91d81bc1a572a7"/><file name="Countries.php" hash="ca6b39297950c9800059c34f7307d627"/><file name="Images.php" hash="d1c8294e6434fa3b0c03635b45964cc0"/><file name="Mainimage.php" hash="c85a8c05df234c188a0aff45a93a6b5c"/><file name="Name.php" hash="86af909704dc4f9320f2154d7c38ff4b"/><file name="Pricemodel.php" hash="359aeff8e7dc6099f55c493abed92a75"/><file name="Selectattribute.php" hash="5579305934bb5b51a443cc9525215975"/><file name="Shipping.php" hash="da2a147c1b6cf21a9f6f47e0456524dd"/><file name="Tax.php" hash="1b50c014c9e204e60cbbfcb883c76a9b"/><file name="Textattribute.php" hash="ea0a682c8a1aa0b51ee3e529c60fcbe8"/><file name="Type.php" hash="ffe6276231f501ac35943d3a83c77447"/><file name="Visibility.php" hash="c2e80831d9d8b5fc6cd642a590812a56"/><file name="Weight.php" hash="ba1e3c862ea2779c275d3d267b819435"/></dir></dir></dir></dir><file name="Channable.php" hash="db3dd2c0338f417b7a0572d055f5c258"/><file name="Common.php" hash="fdf8ac826f418c3dc842118e4a0f021f"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ChannableController.php" hash="e6110aeea10eca08da781c70206f6ed9"/></dir><file name="FeedController.php" hash="e2b205016ebdc274835165111b1ed7f9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f6d3e3176f08cd111e0655837c3365dd"/><file name="config.xml" hash="1b07e1a4f855f9af2281c33e5eb93663"/><file name="system.xml" hash="a899289abe17ad825fcac279374743c1"/></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Magmodules_Channable.csv" hash="b7f6f15de57f502ccf1c98e71006a823"/></dir><dir name="nl_NL"><file name="Magmodules_Channable.csv" hash="2eaec8847182a0005c575e0acf6e1c1d"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magmodules_Channable.xml" hash="061032d718f1ddd64de211fc7133685c"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Magmodules_Channable</name>
4
+ <version>1.4.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.magmodules.eu/license-agreement/">Single Server License</license>
7
  <channel>community</channel>
10
  <description>Magmodules_Channable</description>
11
  <notes>Channable Connect</notes>
12
  <authors><author><name>Magmodules</name><user>magmodules</user><email>info@magmodules.nl</email></author></authors>
13
+ <date>2016-09-16</date>
14
+ <time>10:31:49</time>
15
+ <contents><target name="magecommunity"><dir name="Magmodules"><dir name="Channable"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Extra.php" hash="73e9ccaafacba4153962b37a8038c1ad"/><file name="Filter.php" hash="b64842b1a7bbe5b879468c034ade22bd"/><file name="Shipping.php" hash="7f15ea3b4fed5dcb20b37a78dd84cf5d"/></dir><dir name="Renderer"><file name="Select.php" hash="90a71e109a5f96bca26209c922a74961"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Feeds.php" hash="e1127c67a55f163e0c17ae54111b4538"/><file name="Heading.php" hash="cf8597dec6375bbf35014e1a491605d6"/><file name="Note.php" hash="6d7c8056bf0418ab6008dd86ed1d93ca"/><file name="Token.php" hash="d6f89e494288e7d90525d8067a7bb1de"/><file name="Version.php" hash="7be709c731b412258539184c3c4e01dd"/></dir></dir></dir></dir><dir name="Widget"><dir name="Info"><file name="Info.php" hash="1e9f175e9be64df06e971f2307b5fd5e"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="a7f519fec4d3e373f42878040d7469dc"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Design"><file name="Extra.php" hash="6f888d0db7ed195c93a84748dd0a0c94"/><file name="Filter.php" hash="6609193f2296111f82276f09dc548be2"/><file name="Shipping.php" hash="6bea82000c4341ff2c5a9b05c992406c"/></dir></dir><dir name="Source"><file name="Action.php" hash="d655c22564992e02daccd9aac650358a"/><file name="Attribute.php" hash="714c0aafbe76d361fe883483bb7036d0"/><file name="Category.php" hash="bad1adc7e7890cfa5b83de0cd7a16835"/><file name="Categorytype.php" hash="7284943e01d7fe3346da7233ea827086"/><file name="Conditions.php" hash="aeb42d43282065fda73860f6a6d9da46"/><file name="Configurable.php" hash="08f157df27a2424e1a91d81bc1a572a7"/><file name="Countries.php" hash="ca6b39297950c9800059c34f7307d627"/><file name="Images.php" hash="d1c8294e6434fa3b0c03635b45964cc0"/><file name="Mainimage.php" hash="c85a8c05df234c188a0aff45a93a6b5c"/><file name="Name.php" hash="86af909704dc4f9320f2154d7c38ff4b"/><file name="Pricemodel.php" hash="359aeff8e7dc6099f55c493abed92a75"/><file name="Selectattribute.php" hash="5579305934bb5b51a443cc9525215975"/><file name="Shipping.php" hash="da2a147c1b6cf21a9f6f47e0456524dd"/><file name="Tax.php" hash="1b50c014c9e204e60cbbfcb883c76a9b"/><file name="Textattribute.php" hash="ea0a682c8a1aa0b51ee3e529c60fcbe8"/><file name="Type.php" hash="ffe6276231f501ac35943d3a83c77447"/><file name="Visibility.php" hash="c2e80831d9d8b5fc6cd642a590812a56"/><file name="Weight.php" hash="ba1e3c862ea2779c275d3d267b819435"/></dir></dir></dir></dir><file name="Channable.php" hash="355952b740d0f84b5ec479e774f30598"/><file name="Common.php" hash="7e910793305c571fc948e08e1be000c0"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ChannableController.php" hash="e6110aeea10eca08da781c70206f6ed9"/></dir><file name="FeedController.php" hash="e2b205016ebdc274835165111b1ed7f9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f6d3e3176f08cd111e0655837c3365dd"/><file name="config.xml" hash="d6af6549d06d9e0c4ef563fbd0d4e1ee"/><file name="system.xml" hash="a899289abe17ad825fcac279374743c1"/></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Magmodules_Channable.csv" hash="b7f6f15de57f502ccf1c98e71006a823"/></dir><dir name="nl_NL"><file name="Magmodules_Channable.csv" hash="2eaec8847182a0005c575e0acf6e1c1d"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magmodules_Channable.xml" hash="061032d718f1ddd64de211fc7133685c"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>