0

I have created a custom product grid in my custom module form successfully Like below.

enter image description here

Existing products are showing fine which i saved. When i want to try search for another product i am redirecting to a 404 page. This is only happens in the server. Local host 2 instances working fine. Can anyone help me any suggestion to check this and fix this issue.

Magento version 2.4.3-p1

1 Answer 1

0

I would like to update the fix. It was a spelling mistake on the module name in the grid controller. My module name was HomeTry, but i have updated the block class as Hometry. My local environment was based MAC and server is Linux, Its case sensitive. Care fully handle when naming and using it in the code.

Existing code

public function execute(){
    $resultRaw = $this->resultRawFactory->create();
    return $resultRaw->setContents(
        $this->layoutFactory->create()->createBlock(
            \Ayakil\Hometry\Block\Adminhtml\HTO\Tab\Products::class,
            'hto.assignproducts'
        )->toHtml()
    );
}

Fixed code

public function execute(){
    $resultRaw = $this->resultRawFactory->create();
    return $resultRaw->setContents(
        $this->layoutFactory->create()->createBlock(
            \Ayakil\HomeTry\Block\Adminhtml\HTO\Tab\Products::class,
            'hto.assignproducts'
        )->toHtml()
    );
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.