سؤال

أحتاج اثنين مختلفة 404 صفحة للعملاء و فيندر.

أحتاج إلى صفحة مختلفة للعملاء وصفحة مختلفة لبندر.

كيف يمكنني أن أفعل صفحة مختلفة للعملاء و فيندر

هل كانت مفيدة؟

المحلول

أود أن أقترح عليك استخدام الحدث controller_action_layout_load_before.من خلال إعداد الأحداث الخاصة بك للاستماع إلى هذا يجب أن تكون قادرا على استخدام action و layout التي تعلق على هذا الحدث.

<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>

ثم يمكنك التحقق من نوع الإجراء في المراقب الخاص بك للتأكد من أنك تعمل مع صفحة 404 ثم إضافة مقبض بناء على نوع العميل.بالنسبة لك شيء مثل ما يلي يجب أن يكون بداية جيدة:

$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');
    }
}

ثم تحتاج ببساطة إلى إضافة تحديث تخطيط للمقبض المناسب وتغيير القالب / التصميم حسب الرغبة.

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
    (
    )

)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top