-
-
Notifications
You must be signed in to change notification settings - Fork 436
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
In catalog/product model the clearInstance function doesn't clear typeInstanceSingleton #3392
Comments
The method Now, let's look at the code: magento-lts/app/code/core/Mage/Core/Model/Abstract.php Lines 606 to 637 in 8572935
It has only 4 statements. The first and third statements you can scroll down the above code snippet and see that it does nothing. Whereas the event magento-lts/app/code/core/Mage/CatalogInventory/etc/config.xml Lines 86 to 93 in 8572935
which is: magento-lts/app/code/core/Mage/CatalogInventory/Model/Observer.php Lines 76 to 92 in 8572935
I would think that this issue is invalid. For your use case: // Get the first available configurable product
$configurableProductId = Mage::getModel('catalog/product')->getCollection()
->addAttributeToFilter('type_id', 'configurable')
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
->getFirstItem()->getId(); The // Get the first available configurable product
$configurableProduct = Mage::getModel('catalog/product')->getCollection()
->addAttributeToFilter('type_id', 'configurable')
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
->getFirstItem(); And if you need the id, you can get it like so: If you agree, I am closing this. |
My bad. The methods |
@kiatng Hi, don't forget this is a sample code only just to replicate the issue. The real code is fetching all ids based on many rules and to speed things up the collection is limited to only some fields. Later on for the filtered product list the product needs to be loaded fully. So I know I can just get the first item without loading later but it wouldn't showcase the issue then :) Even if clear instance didn't exist in the product model, as long as it causes a bug and not clearing fully the model as expected, it would still need to be overriden in the product model to perform the task correctly in my opinion |
Basically no matter the circumstances or how a product is loaded when invoking the type instance for a configurable product, if it returns the simple product type instance instead of the configurable one then it's a bug and not the expected behavior don't you agree? |
…t. (#3395) * Fixed issue #3392 clearInstance() method in Mage_Catalog_Model_Product. * PHPStan * whitespace * PHPStan --------- Co-authored-by: Fabrizio Balliano <[email protected]>
Fixed in PR #3395 |
Preconditions (*)
Steps to reproduce (*)
Sample script
Where the output is
Expected result (*)
The correct TypeInstance is loaded for Configurable Product
Actual result (*)
The text was updated successfully, but these errors were encountered: