Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.

My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
diff -urpN magento_original/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php
--- magento_original/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php	2009-09-23 21:52:01.000000000 +0300
+++ app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php	2009-09-22 13:16:30.000000000 +0300
@@ -613,6 +613,11 @@ class Mage_Catalog_Model_Convert_Adapter
             unset($websiteIds);
         }

+		if(!isset($_SESSION['product_import_attribute_codes']))
+		{
+			$_SESSION['product_import_attribute_codes'] = array();
+		}
+
         foreach ($importData as $field => $value) {
             if (in_array($field, $this->_inventoryFields)) {
                 continue;
@@ -626,6 +631,11 @@ class Mage_Catalog_Model_Convert_Adapter
                 continue;
             }

+			if(!in_array($attribute->getAttributeId(), $_SESSION['product_import_attribute_codes']))
+			{
+				$_SESSION['product_import_attribute_codes'][] = $attribute->getAttributeId();
+			}
+
             $isArray = false;
             $setValue = $value;

@@ -703,6 +713,12 @@ class Mage_Catalog_Model_Convert_Adapter
         $product->setExcludeUrlRewrite(true);

         $product->save();
+        if(!isset($_SESSION['product_import_ids']))
+		{
+			$_SESSION['product_import_ids'] = array();
+		}
+        $productId = $product->getIdBySku($importData['sku']);
+		$_SESSION['product_import_ids'][] = $productId;

         return true;
     }
@@ -731,5 +747,7 @@ class Mage_Catalog_Model_Convert_Adapter
     public function finish()
     {
         Mage::dispatchEvent('catalog_product_import_after', array());
+		unset($_SESSION['product_import_ids']);
+		unset($_SESSION['product_import_attribute_codes']);
     }
 }
diff -urpN magento_original/app/code/core/Mage/Catalog/Model/Observer.php app/code/core/Mage/Catalog/Model/Observer.php
--- magento_original/app/code/core/Mage/Catalog/Model/Observer.php	2009-09-23 21:52:06.000000000 +0300
+++ app/code/core/Mage/Catalog/Model/Observer.php	2009-09-21 10:56:50.000000000 +0300
@@ -162,7 +162,7 @@ class Mage_Catalog_Model_Observer
     public function catalogProductImportAfter(Varien_Event_Observer $observer)
     {
         Mage::getModel('catalog/url')->refreshRewrites();
-        Mage::getResourceSingleton('catalog/category')->refreshProductIndex();
+        Mage::getResourceSingleton('catalog/category')->refreshProductIndex(array(), $_SESSION['product_import_ids']);
         return $this;
     }

diff -urpN magento_original/app/code/core/Mage/CatalogIndex/Model/Indexer.php app/code/core/Mage/CatalogIndex/Model/Indexer.php
--- magento_original/app/code/core/Mage/CatalogIndex/Model/Indexer.php	2009-09-23 21:51:41.000000000 +0300
+++ app/code/core/Mage/CatalogIndex/Model/Indexer.php	2009-09-21 14:43:44.000000000 +0300
@@ -228,9 +228,37 @@ class Mage_CatalogIndex_Model_Indexer ex
             /**
              * Prepare attributes data
              */
-            if (is_null($attributes)) {
+            if (is_null($attributes) || is_array($attributes)) {
                 $priceAttributeCodes = $this->_indexers['price']->getIndexableAttributeCodes();
                 $attributeCodes = $this->_indexers['eav']->getIndexableAttributeCodes();
+				if(is_array($attributes))
+				{
+					$new_priceAttributeCodes = array();
+					for($i = 0; $i < count($priceAttributeCodes); $i++)
+					{
+						if(in_array($priceAttributeCodes[$i], $attributes))
+						{
+							$new_priceAttributeCodes[] = $priceAttributeCodes[$i];
+						}
+					}
+					if(!count($new_priceAttributeCodes))
+					{
+						$priceAttributeCodes = array($priceAttributeCodes[0]);
+					}
+					else
+					{
+						$priceAttributeCodes = $new_priceAttributeCodes;
+					}
+					$new_attributeCodes = array();
+					for($i = 0; $i < count($attributeCodes); $i++)
+					{
+						if(in_array($attributeCodes[$i], $attributes))
+						{
+							$new_attributeCodes[] = $attributeCodes[$i];
+						}
+					}
+					$attributeCodes = $new_attributeCodes;
+				}
             }
             elseif ($attributes instanceof Mage_Eav_Model_Entity_Attribute_Abstract) {
                 if ($this->_indexers['eav']->isAttributeIndexable($attributes)) {
@@ -802,4 +830,4 @@ class Mage_CatalogIndex_Model_Indexer ex

         return $this;
     }
-}
\ No newline at end of file
+}
diff -urpN magento_original/app/code/core/Mage/CatalogIndex/Model/Observer.php app/code/core/Mage/CatalogIndex/Model/Observer.php
--- magento_original/app/code/core/Mage/CatalogIndex/Model/Observer.php	2009-09-23 21:51:41.000000000 +0300
+++ app/code/core/Mage/CatalogIndex/Model/Observer.php	2009-09-22 13:21:07.000000000 +0300
@@ -223,7 +223,7 @@ class Mage_CatalogIndex_Model_Observer e
      */
     public function catalogProductImportAfter(Varien_Event_Observer $observer)
     {
-        $this->_getIndexer()->plainReindex();
+        $this->_getIndexer()->plainReindex($_SESSION['product_import_ids'], $_SESSION['product_import_attribute_codes']);
         $this->_getAggregator()->clearCacheData();
         return $this;
     }
@@ -397,4 +397,4 @@ class Mage_CatalogIndex_Model_Observer e


         return $this;

     }
-}
\ No newline at end of file
+}
diff -urpN magento_original/app/code/core/Mage/CatalogSearch/Model/Fulltext/Observer.php app/code/core/Mage/CatalogSearch/Model/Fulltext/Observer.php
--- magento_original/app/code/core/Mage/CatalogSearch/Model/Fulltext/Observer.php	2009-09-23 21:51:31.000000000 +0300
+++ app/code/core/Mage/CatalogSearch/Model/Fulltext/Observer.php	2009-09-21 10:45:11.000000000 +0300
@@ -127,7 +127,7 @@ class Mage_CatalogSearch_Model_Fulltext_
     public function refreshIndexAfterImport()
     {
         $this->_getFulltextModel()
-            ->rebuildIndex();
+            ->rebuildIndex(null, $_SESSION['product_import_ids']);
         return $this;
     }