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

Do not overwrite previously generated value #234

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

VincentBean
Copy link

This PR fixes an issue where a value that was generated previously will always be overwritten by the getCondition method because it retrieves the data directly from the product.

For example, when the manage_stock attribute is selected it will use getAttributeValue and getManageStockValue to retrieve the correct value. But when use_config_manage_stock is enabled on a product it should not listen to the product's value, which is what getManageStockValue does.
But because Helper/Source.php:632 defines conditions for manage_stock the getCondition will run which retrieves the value directly from the product and not the default configuration.

This can be reproduced by setting manage_stock to false and use_config_manage_stock to true on a product and true in the global configuration.

As I am not completely familiar with this module I am unsure what the impact is of this change and if this is the best solution.

@Marvin-Magmodules
Copy link
Member

Hi @VincentBean,

Thank you for raising this detailed issue. Everything is clear, but I’m having difficulty reproducing the behavior. When setting the global configuration to “use stock,” it doesn’t allow me to configure the product’s “manage stock” and “use config” settings as described through the Magento admin panel.

That said, this PR does make sense in different scenarios, so we’ll include it in the upcoming release scheduled for early January.

Thank you for your contribution!

@VincentBean
Copy link
Author

Thanks for the reply!

The Magento interface does not let you set it when the checkbox is checked. When you have manage stock enabled globally you can:

  1. Uncheck the use default checkbox on the product
  2. Disable manage stock on the product
  3. Check the use default checkbox on the product

After that you should be able to reproduce. In the database it should have set manage_stock to 0 and the use_config_manage_stock value to 1 at the product row.

@Marvin-Magmodules
Copy link
Member

@VincentBean, thank you for the clarification—it’s very helpful! I’ll test this flow as part of the upcoming release scheduled for early January.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants