Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Issue #278 (Import -> Stores with large amount of Configurable Products) #284

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,28 @@ protected function _isParticularAttributesValid(array $rowData, $rowNum)
*
* @return Mage_ImportExport_Model_Import_Entity_Product_Type_Configurable
*/
protected function _loadSkuSuperAttributeValues()
protected function _loadSkuSuperAttributeValues($bunch, $newSku, $oldSku)
{
if ($this->_superAttributes) {
$attrSetIdToName = $this->_entityModel->getAttrSetIdToName();
$allowProductTypes = array();


foreach ($bunch as $rowData){
if (!empty($rowData['_super_products_sku'])) {
if (isset($newSku[$rowData['_super_products_sku']])) {
$productIdArray[] = $newSku[$rowData['_super_products_sku']];
} elseif (isset($oldSku[$rowData['_super_products_sku']])) {
$productIdArray[] = $oldSku[$rowData['_super_products_sku']];
}
}
}
foreach (Mage::getConfig()
->getNode('global/catalog/product/type/configurable/allow_product_types')->children() as $type) {
$allowProductTypes[] = $type->getName();
}
foreach (Mage::getResourceModel('Mage_Catalog_Model_Resource_Product_Collection')
->addFieldToFilter('type_id', $allowProductTypes)
->addFieldToFilter ('entity_id', array('in' => $productIdArray))
->addAttributeToSelect(array_keys($this->_superAttributes)) as $product) {
$attrSetName = $attrSetIdToName[$product->getAttributeSetId()];

Expand Down Expand Up @@ -362,7 +372,6 @@ public function saveData()
if ($this->_entityModel->getBehavior() == Mage_ImportExport_Model_Import::BEHAVIOR_APPEND) {
$this->_loadSkuSuperData();
}
$this->_loadSkuSuperAttributeValues();

while ($bunch = $this->_entityModel->getNextBunch()) {
$superAttributes = array(
Expand All @@ -372,6 +381,7 @@ public function saveData()
'super_link' => array(),
'relation' => array()
);
$this->_loadSkuSuperAttributeValues($bunch, $newSku, $oldSku);
foreach ($bunch as $rowNum => $rowData) {
if (!$this->_entityModel->isRowAllowedToImport($rowData, $rowNum)) {
continue;
Expand Down