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

Move saving logic outside the View part #38

Closed
stalniy opened this issue Jul 6, 2012 · 3 comments
Closed

Move saving logic outside the View part #38

stalniy opened this issue Jul 6, 2012 · 3 comments

Comments

@stalniy
Copy link

stalniy commented Jul 6, 2012

It's necessary that saving logic should be in model or controller, not in block like this

class Mage_Checkout_Block_Onepage_Shipping_Method_Available extends Mage_Checkout_Block_Onepage_Abstract
{
................................................
    public function getShippingRates()
    {

        if (empty($this->_rates)) {
            $this->getAddress()->collectShippingRates()->save();
..........................................................

Because it's not clear (hidden) logic. Blocks should be used only for View part of MVC.

@colinmollenhour
Copy link

Definitely agree here. I and another person I know have both been bothered with tracking down this mysterious save occurring unexpectedly.

@magento-team
Copy link
Contributor

@stalniy
Thank you for raising the issue.
Brief investigation revealed, that there are quite a few places in the checkout implementation, which contain business logic in blocks. So, it does not make much sense to fix this particular place and leave similar occurrences intact. At the same time, moving out all checkout business logic from blocks seems to be a pretty complex task.

The issue has been converted into the ticket in the internal tracking system. However, the improvement seems to be completely developer-oriented without clear business value, which significantly lowers its priority. Providing a pull request with appropriate changes along with corresponding tests may help to expedite the changes.

Leaving the ticket open, upon any activity in the internal ticket, corresponding update will be posted to the GitHub.

@magento-team
Copy link
Contributor

Closing the ticket for now, it will be reopened upon an activity on the corresponding internal ticket.

magento-team pushed a commit that referenced this issue Jan 16, 2015
[Github] Fix for the missed trailing end of line in indexer.php usage help text
@stevieyu stevieyu mentioned this issue Apr 3, 2015
magento-team pushed a commit that referenced this issue Oct 24, 2015
[Mavericks] Functional test maintenance
magento-engcom-team pushed a commit that referenced this issue Nov 13, 2020
magento-engcom-team pushed a commit that referenced this issue May 30, 2021
MC-42290: Check bind changes are covered by test
@FabXav FabXav mentioned this issue Oct 11, 2024
5 tasks
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

No branches or pull requests

3 participants