2011-12-06 31 views
10

Tôi đang phát triển mô-đun SMS tùy chỉnh trong Magento 1.6.Lỗi 404 trong cấu hình Tùy chỉnh Magento trong quản trị

Tôi đã thiết lập tệp system.xml để quản lý các trường cấu hình tùy chỉnh có liên quan.

Mục menu hiển thị, nhưng khi tôi nhấp vào, trang lỗi 404 được hiển thị thay vì danh sách trường cấu hình dự kiến.

Bạn có thấy bất kỳ lỗi nào trong mã của mình không?

<config> 
<tabs> 
    <mynew_tab translate="label"> 
     <label>SMS Gateway Integration</label> 
     <sort_order>100</sort_order> 
    </mynew_tab> 
</tabs> 
<sections> 
    <smsconfig translate="label"> 
     <label>SMS Gateway Integration</label> 
     <sort_order>200</sort_order> 
     <show_in_default>1</show_in_default> 
     <show_in_website>1</show_in_website> 
     <show_in_store>1</show_in_store> 
     <tab>mynew_tab</tab> 
     <groups> 
      <sms_group translate="label"> 
       <label>My Custom Configurations</label> 
       <comment>This is example of custom configuration.</comment> 
       <sort_order>10</sort_order> 
       <show_in_default>1</show_in_default> 
       <show_in_website>1</show_in_website> 
       <show_in_store>1</show_in_store> 
       <fields> 
        <sms_enabled translate="label tooltip comment"> 
         <label>Is Enabled</label> 
         <frontend_type>select</frontend_type> 
         <source_model>adminhtml/system_config_source_yesno</source_model> 
         <sort_order>0</sort_order> 
         <show_in_default>1</show_in_default> 
         <show_in_website>1</show_in_website> 
         <show_in_store>1</show_in_store> 
         <comment>Enable this module.</comment> 
        </sms_enabled> 
        <sms_username translate="label tooltip comment"> 
         <label>Sender Email</label> 
         <frontend_type>text</frontend_type> 
         <sort_order>1</sort_order> 
         <show_in_default>1</show_in_default> 
         <show_in_website>1</show_in_website> 
         <show_in_store>1</show_in_store> 
         <comment>Username of the SMS gateway.</comment> 
        </sms_username> 
        <sms_password translate="label tooltip comment"> 
         <label>Sender Email</label> 
         <frontend_type>text</frontend_type> 
         <sort_order>1</sort_order> 
         <show_in_default>1</show_in_default> 
         <show_in_website>1</show_in_website> 
         <show_in_store>1</show_in_store> 
         <comment>Password of the SMS gateway.</comment> 
        </sms_password> 
       </fields> 
      </sms_group> 
     </groups> 
    </smsconfig> 
</sections> 

Sau khi yêu cầu ben, chúng tôi đặt các tập tin adminhtml.xml. Tôi đã đặt nội dung của tệp XML.

<config> 
<acl> 
    <resources> 
     <admin> 
      <children> 
       <system> 
        <children> 
         <config> 
          <children> 
           <sms translate="title" module="sms"> 
            <title>SMS Gateway Section</title> 
           </sms> 
          </children> 
         </config> 
        </children> 
       </system> 
      </children> 
     </admin> 
    </resources> 
</acl> 

Nhưng đến lỗi 404 đến ...

+0

Để f Lỗi chính xác: Làm việc này cho tôi http://pradhab.blogspot.com/2013/03/magento-404-error.html Hãy thử điều này –

+1

Vui lòng không cung cấp câu trả lời "chỉ liên kết" (điều gì sẽ xảy ra nếu trang đó trên trang từ xa bị gỡ xuống?). Nếu nội dung bên ngoài có liên quan, hãy thêm các bước/mã vào câu trả lời của bạn và bạn có thể trích dẫn nguồn dưới dạng ghi chú bổ sung. – newfurniturey

Trả lời

36

Một lỗi 404 trong cấu hình hệ thống thường có nghĩa là có một vấn đề với ACL. Bạn có khả năng thiếu nút acl thích hợp trong adminhtml.xml tập tin của mô-đun của bạn:

<acl> 
    <resources> 
     <admin> 
      <children> 
       <system> 
        <children> 
         <config> 
          <children> 
           <smsconfig> <!-- translate="title" module="sms_config" if appropriate and depending on config --> 
            <title>Your Section</title> 
</...> 

Sau khi thêm trên, bạn sẽ cần phải đăng xuất và đăng nhập trở lại cho người sử dụng vai trò quản trị đầy đủ và rõ ràng thêm vai trò này cho vai trò người dùng tùy chỉnh quản trị .

+0

Tôi đã đặt tệp adminhtml.xml và làm theo hướng dẫn của bạn. Nhưng cho đến khi nó mặc dù lỗi 404. –

+0

bạn có thể ghi đè mã của mình ở đâu đó không? – benmarks

+1

Bạn đúng Ben, tôi có một số lỗi trong mã của tôi. Bây giờ nó đã được làm việc. Cảm ơn bạn đã giúp đỡ. –

2

Đừng đánh giá thấp nhu cầu đăng xuất và sau đó đăng nhập lại sau khi thực hiện thay đổi ACL. Thậm chí nếu bạn xóa bộ nhớ cache của bạn, bạn sẽ vẫn 404 cho đến khi bạn đăng xuất và đăng nhập lại.

3

Hãy làm những gì @benmarks nói cộng hãy chắc chắn để thêm những đứa trẻ phải (trong trường hợp của bạn) smsconfig

(@benmarks sử dụng sms_config thay vì smsconfig)

<!-- namespace/modulename/etc/adminhtml.xml --> 
<acl> 
    <resources> 
     <admin> 
      <children> 
       <system> 
        <children> 
         <config> 
          <children> 
           <smsconfig> <!-- translate="title" module="sms_config" if appropriate and depending on config --> 
            <title>Your Section</title> 
</...> 

bộ nhớ cache rõ ràng, quản trị logout, quản trị viên đăng nhập == làm việc

Gợi ý: Nếu bạn nhận được 404 nhìn vào t ông url (khi bạn nhấp vào tab của bạn):

/index.php/admin/system_config/edit/section/mymodulename_something/...

này url dường như-điểm để mymodulename_something:

<!-- namespace/modulename/etc/system.xml --> 
<?xml version="1.0"?> 
<config> 
    <tabs> 
     <mymodulename translate="label" module="mymodulename"> 
      <label>MyModuleName Awesome Label</label> 
      <sort_order>1</sort_order> 
     </mymodulename> 
    </tabs> 
    <sections> 
     <mymodulename_something translate="label" module="mymodulename"> 
<!-- ... --> 

nên bạn adminhtml.xml sẽ trông như thế:

<!-- namespace/modulename/etc/adminhtml.xml --> 
<?xml version="1.0"?> 
<config> 
    <acl> 
     <resources> 
      <admin> 
       <children> 
        <system> 
         <children> 
          <config> 
           <children> 
            <mymodulename_something translate="title" module="mymodulename"> 
             <title>have no idea where this is showing up btw</title> 
            </mymodulename_something> 
           </children> 
          </config> 
         </children> 
        </system> 
       </children> 
      </admin> 
     </resources> 
    </acl> 
</config> 
Các vấn đề liên quan