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

Fixed issue #3392 clearInstance() method in Mage_Catalog_Model_Product. #3395

Merged
merged 4 commits into from
Jul 21, 2023

Conversation

kiatng
Copy link
Contributor

@kiatng kiatng commented Jul 20, 2023

Description (*)

As explained in issue #3392, clearInstance() kept the previous product type. The reason is because the properties $_typeInstance and $_typeInstanceSingleton were not reset. I reviewed all other properties in Mage_Catalog_Model_Product and its parent Mage_Catalog_Model_Abstract and reset them.

Fixed Issues (if relevant)

  1. Issue In catalog/product model the clearInstance function doesn't clear typeInstanceSingleton #3392

Manual testing scenarios (*)

Test script:
In my test, product 1 is type downloadable, product 2 is type virtual.

    $p = Mage::getModel('catalog/product')->load(1);
    $r['downloadable'] = get_class($p->getTypeInstance(true));
    $p->clearInstance()->load(2);
    $r['virtual'] = get_class($p->getTypeInstance(true));

Expected result (with this PR):

 array(2) {
  ["downloadable"] => string(36) "Mage_Downloadable_Model_Product_Type"
  ["virtual"] => string(39) "Mage_Catalog_Model_Product_Type_Virtual"
}

But actual result (without this PR):

 array(2) {
  ["downloadable"] => string(36) "Mage_Downloadable_Model_Product_Type"
  ["virtual"] => string(36) "Mage_Downloadable_Model_Product_Type"
}

@github-actions github-actions bot added the Component: Catalog Relates to Mage_Catalog label Jul 20, 2023
@addison74
Copy link
Contributor

3 issues with PHPStan.

Copy link
Contributor

@fballiano fballiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked the defaults and they look ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Catalog Relates to Mage_Catalog phpstan
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants