-
-
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
Obsolete code in block for configurable products #2246
Comments
From the first glance it does seem useless as it doesn't cause any side-effects, just returning stuff. Have you tried removing that code and reloading the page? What was the loading time? |
If I see correctly Its not an no-brainer. and getFinalPrice sets 'final_price' field on product which is calculated in Mage_Catalog_Model_Product_Type_Price::getFinalPrice (which also triggers a So more digging/profiling is needed to optimize the code without breaking. |
|
What about custom code that sets |
This makes no sense. magento-lts/app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php Lines 231 to 235 in 412bee0
depends on magento-lts/app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php Lines 196 to 198 in 412bee0
So is percent is considered in lines 196-198 and the result will never be in percent. |
Overwrites the current call of the loop magento-lts/app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php Lines 231 to 235 in 412bee0
not all preceding ones? Thus it would be sufficient to call _preparePrice only once? However, this would also be pointless, since then only
would remain? |
I was only talking about the execution path mentioned in OP, I don't know about the usage in other places. |
We commented out that code block and the request completed in under a second. We have not noticed any side effects but we only tested our special test case and no other ones. |
@theroch Hey, are you still using your workaround in production? Any issues noticed? |
We still use this code without any issues. |
@theroch Thank you! Feel free to open a PR to be reviewed if you wish, otherwise I'll do it later. |
We have inherited a development that implements a booking function via a calendar with time selection. This is realized via configurable products. Depending on the available time slots, there can be as many as 800 options.
We know that this is not the best solution to this problem. But that should not be the topic here.
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
Cause of the problem
The Problem is located in app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php starting at line 227:
Because
_preparePrice
and all sub calls to all other methods operate with return values and not with objects or session data, the result of this method is never considered.We think the loops and the call to to
_preparePrice
starting at line 227 is not needed for correct functionality. This function is a performance brake and only burns time.Can this part of code safely be removed?
Can someone please verify our assessment?
The text was updated successfully, but these errors were encountered: