Skip to content

Commit b036e11

Browse files
committed
Fixed: When an associated simple product transforms into a pure simple product, reset its visibility.
1 parent 06e7d53 commit b036e11

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

app/code/local/Gec/Customimport/Block/Adminhtml/Customimport.php

+16-6
Original file line numberDiff line numberDiff line change
@@ -522,27 +522,28 @@ public function associatePdtPdt($association)
522522
);
523523
} elseif ((string) $association->assocType == 3) {
524524
$preAssociatedArray[] = $prid;
525-
$this->_changeVisibility($prid);
525+
$this->_hideVisibility($prid);
526526
} elseif ((string) $association->assocType == 4) {
527527
$bundleArray[] = $prid;
528528
$bundleQuantityArray[] = (int) $association->quantity;
529529
$bundlePositionArray[] = (int) $position;
530530
}
531531
} elseif($prid && strtolower((string) $association->isActive) == 'n') {
532-
if ((string) $association->assocType == 0) {
532+
if ((string) $association->assocType == 0) {
533533
$crossArray[$prid] = array(
534534
'position' => $position
535535
);
536536
} elseif ((string) $association->assocType == 1) {
537-
$upsellArray[$prid] = array(
537+
$upsellArray[$prid] = array(
538538
'position' => $position
539539
);
540540
} elseif ((string) $association->assocType == 2) {
541-
$relatedArray[$prid] = array(
541+
$relatedArray[$prid] = array(
542542
'position' => $position
543543
);
544544
} elseif ((string) $association->assocType == 3) {
545-
$disAssociateArray[] = $prid;
545+
$disAssociateArray[] = $prid;
546+
$this->_bothVisibility($prid);
546547
}
547548
}
548549
}
@@ -2229,12 +2230,21 @@ private function _getMageId($attriextid)
22292230
return $rowArray['magento_id'];
22302231
}
22312232

2232-
private function _changeVisibility($proid)
2233+
private function _hideVisibility($proid)
22332234
{
22342235
$product = Mage::getModel('catalog/product');
22352236
$product->load($proid);
22362237
$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE);
22372238
$product->save();
22382239
}
2240+
2241+
private function _bothVisibility($proid)
2242+
{
2243+
$product = Mage::getModel('catalog/product');
2244+
$product->load($proid);
2245+
$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
2246+
$product->save();
2247+
}
2248+
22392249
}
22402250
?>

0 commit comments

Comments
 (0)