5

i need two different 404 page for customer and vender.

i need different page for customer and different page for vender.

how can i do different page for customer and vender

  • 3
    I think you need add new router and that will identify that if page is 404 and that will coming for which page then redirect to ur custom page – Keyul Shah Apr 22 '15 at 6:18
  • 1
    No need for a custom router. Within the 404 simply identify customer or vendor and show different template. So the question becomes, how do you identify if it is a customer or vendor? Customer group? Another customer attribute? – Melvyn Apr 22 '15 at 7:36
1

I would suggest that you use the event controller_action_layout_load_before. By setting up your events to listen to this you should be able to use the action and layout that are attached to this event.

<events>
    <controller_action_layout_load_before>
        <observers>
            <layout_test>
                <class>layout_test/observer</class>
                <method>changeLayoutEvent</method>
            </layout_test>
        </observers>
    </controller_action_layout_load_before>
</events>

Then you can check the action type in your observer to make sure you are working with the 404 page and then add a handle based on customer type. For you something like the following should be a good start:

$action = $observer->getEvent()->getAction();
if ($action instanceof Mage_Cms_IndexController && $action->getRequest()->getRequestedActionName() == 'noRoute') {
    if (// Add check for customer or vendor here) {
    $observer->getEvent()->getLayout()->getUpdate()
        ->addHandle('new_layout_handles');
    }
}

Then you simply need to add a layout update for the appropriate handle and change the template/design as desired.

Varien_Event Object
(
[_observers:protected] => Varien_Event_Observer_Collection Object
    (
        [_observers:protected] => Array
            (
            )

    )

[_data:protected] => Array
    (
        [action] => Mage_Cms_IndexController Object
            (
                [_currentArea:protected] => frontend
                [_sessionNamespace:protected] => frontend
                [_request:protected] => Mage_Core_Controller_Request_Http Object
                    (
                        [_originalPathInfo:protected] => /sales/order/hdsa/
                        [_storeCode:protected] => 
                        [_requestString:protected] => /sales/order/hdsa/
                        [_rewritedPathInfo:protected] => 
                        [_requestedRouteName:protected] => 
                        [_routingInfo:protected] => Array
                            (
                            )

                        [_route:protected] => cms
                        [_directFrontNames:protected] => 
                        [_controllerModule:protected] => Mage_Cms
                        [_isStraight:protected] => 
                        [_beforeForwardInfo:protected] => Array
                            (
                            )

                        [_paramSources:protected] => Array
                            (
                                [0] => _GET
                                [1] => _POST
                            )

                        [_requestUri:protected] => /amazoneclone/Web/index.php/sales/order/hdsa/
                        [_baseUrl:protected] => /amazoneclone/Web/index.php
                        [_basePath:protected] => /amazoneclone/Web
                        [_pathInfo:protected] => /sales/order/hdsa/
                        [_params:protected] => Array
                            (
                            )

                        [_rawBody:protected] => 
                        [_aliases:protected] => Array
                            (
                            )

                        [_dispatched:protected] => 1
                        [_module:protected] => cms
                        [_moduleKey:protected] => module
                        [_controller:protected] => index
                        [_controllerKey:protected] => controller
                        [_action:protected] => noRoute
                        [_actionKey:protected] => action
                    )

                [_response:protected] => Mage_Core_Controller_Response_Http Object
                    (
                        [_body:protected] => Array
                            (
                            )

                        [_exceptions:protected] => Array
                            (
                            )

                        [_headers:protected] => Array
                            (
                                [0] => Array
                                    (
                                        [name] => Content-Type
                                        [value] => text/html; charset=UTF-8
                                        [replace] => 
                                    )

                                [1] => Array
                                    (
                                        [name] => X-Frame-Options
                                        [value] => SAMEORIGIN
                                        [replace] => 1
                                    )

                                [2] => Array
                                    (
                                        [name] => P3p
                                        [value] => CP="CAO PSA OUR"
                                        [replace] => 1
                                    )

                                [3] => Array
                                    (
                                        [name] => Http/1.1
                                        [value] => 404 Not Found
                                        [replace] => 
                                    )

                                [4] => Array
                                    (
                                        [name] => Status
                                        [value] => 404 File not found
                                        [replace] => 
                                    )

                            )

                        [_headersRaw:protected] => Array
                            (
                            )

                        [_httpResponseCode:protected] => 200
                        [_isRedirect:protected] => 
                        [_renderExceptions:protected] => 
                        [headersSentThrowsException] => 1
                    )

                [_realModuleName:protected] => 
                [_flags:protected] => Array
                    (
                    )

                [_cookieCheckActions:protected] => Array
                    (
                    )

                [_isLayoutLoaded:protected] => 
                [_titles:protected] => Array
                    (
                    )

                [_removeDefaultTitle:protected] => 
            )

        [layout] => Mage_Core_Model_Layout Object
            (
                [_update:protected] => EM_Themeframework_Model_Layout_Update Object
                    (
                        [_elementClass:protected] => 
                        [_packageLayout:protected] => 
                        [_cacheId:protected] => 
                        [_cachePrefix:protected] => 
                        [_updates:protected] => Array
                            (
                            )

                        [_handles:protected] => Array
                            (
                                [default] => 1
                                [cms_page] => 1
                                [STORE_default] => 1
                                [THEME_frontend_default_em0117] => 1
                                [cms_index_noroute] => 1
                                [page_two_columns_right] => 1
                            )

                        [_subst:protected] => Array
                            (
                                [from] => Array
                                    (
                                        [0] => {{baseUrl}}
                                        [1] => {{baseSecureUrl}}
                                    )

                                [to] => Array
                                    (
                                        [0] =>     http://192.168.10.223/amazoneclone/Web/index.php/
                                        [1] => http://192.168.10.223/amazoneclone/Web/index.php/
                                    )

                            )

                    )

                [_blocks:protected] => Array
                    (
                    )

                [_output:protected] => Array
                    (
                    )

                [_area:protected] => frontend
                [_helpers:protected] => Array
                    (
                    )

                [_directOutput:protected] => 
                [_xml:protected] => Mage_Core_Model_Layout_Element     Object
                    (
                    )

                [_cacheId:protected] => 
                [_cacheTags:protected] => Array
                    (
                    )

                [_cacheLifetime:protected] => 
                [_cacheChecksum:protected] => 
                [_cacheSaved:protected] => 
                [_cache:protected] => 
                [_elementClass:protected] =>     Mage_Core_Model_Layout_Element
                [_xpathExtends:protected] => //*[@extends]
            )

        [name] => controller_action_layout_load_before
    )

[_hasDataChanges:protected] => 
[_origData:protected] => 
[_idFieldName:protected] => 
[_isDeleted:protected] => 
[_oldFieldsMap:protected] => Array
    (
    )

[_syncFieldsMap:protected] => Array
    (
    )

)
  • Thanks David i will try it and let u know – Vaibhav Ahalpara Apr 22 '15 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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