Orba_Ceneopl - Version 0.2.1

Version Notes

- small bugfix

Download this release

Release Info

Developer ORBA
Extension Orba_Ceneopl
Version 0.2.1
Comparing to
See all releases


Code changes from version 0.2.0 to 0.2.1

app/code/community/Orba/Ceneopl/Model/Attribute.php CHANGED
@@ -10,19 +10,29 @@ class Orba_Ceneopl_Model_Attribute extends Mage_Core_Model_Abstract {
10
  }
11
 
12
  public function toOptionArray() {
13
- $attributes_collection = Mage::getModel('catalog/entity_attribute')->getCollection()
14
- ->addFieldToFilter('entity_type_id', 4);
15
- $res = array(array('label' => '', 'value' => ''));
16
- foreach ($attributes_collection as $attribute) {
17
- $res[$attribute->getAttributeCode()] = array(
18
- 'label' => $attribute->getAttributeCode(),
19
- 'value' => $attribute->getAttributeCode()
20
- );
 
 
 
 
21
  }
22
- ksort($res);
23
  return $res;
24
  }
25
 
 
 
 
 
 
 
 
26
  public function addCeneoAttributeToProduct() {
27
  $this->createAttribute('ceneo_category_id', 'Ceneo Category', 'select', null, array(
28
  'backend_type' => 'int',
10
  }
11
 
12
  public function toOptionArray() {
13
+ $entity_type_id = $this->getEntityTypeId();
14
+ if ($entity_type_id) {
15
+ $attributes_collection = Mage::getModel('catalog/entity_attribute')->getCollection()
16
+ ->addFieldToFilter('entity_type_id', $entity_type_id);
17
+ $res = array(array('label' => '', 'value' => ''));
18
+ foreach ($attributes_collection as $attribute) {
19
+ $res[$attribute->getAttributeCode()] = array(
20
+ 'label' => $attribute->getAttributeCode(),
21
+ 'value' => $attribute->getAttributeCode()
22
+ );
23
+ }
24
+ ksort($res);
25
  }
 
26
  return $res;
27
  }
28
 
29
+ protected function getEntityTypeId() {
30
+ $collection = Mage::getModel('eav/entity_type')->getCollection()
31
+ ->addFieldToFilter('entity_type_code', 'catalog_product');
32
+ $item = $collection->getFirstItem();
33
+ return $item->getId();
34
+ }
35
+
36
  public function addCeneoAttributeToProduct() {
37
  $this->createAttribute('ceneo_category_id', 'Ceneo Category', 'select', null, array(
38
  'backend_type' => 'int',
app/code/community/Orba/Ceneopl/Model/Product.php CHANGED
@@ -53,7 +53,7 @@ class Orba_Ceneopl_Model_Product extends Mage_Catalog_Model_Product {
53
  $core_attrs['stock'] = (int)$_stock->getQty();
54
  }
55
  foreach ($conditions as $attr => $data) {
56
- if (isset($data['code'])) {
57
  if (!empty($data['code']) && $product->getData($data['code']) !== null) {
58
  $options = $additional_attributes[$data['code']];
59
  if (empty($options)) {
@@ -63,8 +63,8 @@ class Orba_Ceneopl_Model_Product extends Mage_Catalog_Model_Product {
63
  $core_attrs[$attr] = (int)($option == $data['value']);
64
  }
65
  }
66
- } else {
67
- if (isset($data['values']) && is_array($data['values'])) {
68
  foreach ($data['values'] as $value => $value_data) {
69
  if (!empty($value_data['code'])) {
70
  $options = $additional_attributes[$value_data['code']];
53
  $core_attrs['stock'] = (int)$_stock->getQty();
54
  }
55
  foreach ($conditions as $attr => $data) {
56
+ if (array_key_exists('code', $data)) {
57
  if (!empty($data['code']) && $product->getData($data['code']) !== null) {
58
  $options = $additional_attributes[$data['code']];
59
  if (empty($options)) {
63
  $core_attrs[$attr] = (int)($option == $data['value']);
64
  }
65
  }
66
+ } else if (array_key_exists('values', $data)) {
67
+ if (is_array($data['values'])) {
68
  foreach ($data['values'] as $value => $value_data) {
69
  if (!empty($value_data['code'])) {
70
  $options = $additional_attributes[$value_data['code']];
app/code/community/Orba/Ceneopl/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Orba_Ceneopl>
5
- <version>0.2.0</version>
6
  </Orba_Ceneopl>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <Orba_Ceneopl>
5
+ <version>0.2.1</version>
6
  </Orba_Ceneopl>
7
  </modules>
8
  <frontend>
app/code/community/Orba/Ceneopl/sql/ceneopl_setup/mysql4-install-0.2.1.php ADDED
@@ -0,0 +1,2569 @@