vpietri / adm_warehouse

Multi stock extension for Magento
9 stars 12 forks source link

Bugs #2

Closed ontic closed 9 years ago

ontic commented 9 years ago

I'm currently evaluating your extension, the idea seems great but the extension seems rushed and slapped together. When I first installed the extension, I tried adding a new Warehouse to test multiple inventory/stock, but got redirected to a 404 page. See below for the fixes.

Is this extension still in development? Are you using it on any Magento installation or testing it locally?


https://github.com/vpietri/ADM_Warehouse/blob/master/app/code/community/ADM/Warehouse/controllers/Adminhtml/WarehouseController.php

Add this controller action which redirects to the edit action.

public function newAction()
{
    $this->_forward('edit');
}

When you register the model in the registry, it needs to be outside the if statement. Reason being the form references this object whether it has data or not.

if ($id) {
    // Load record
    $model->load($id);

    // Check if record is loaded
    if (!$model->getId()) {
        Mage::getSingleton('adminhtml/session')->addError($this->__('This stock no longer exists.'));
        $this->_redirect('*/*/');
        return;
    }
}

Mage::register('current_stock', $model);
vpietri commented 9 years ago

The fix is applied

vpietri commented 9 years ago

This module is a kind of proof of concept, It's a quick development for a beta version.

If you discover others bugs or "rushed and slapped together" code do not hesitate to open new issue.