Magento 我如何在管理端将jQuery与模块一起使用,而不破坏其他所有功能?

Magento 我如何在管理端将jQuery与模块一起使用,而不破坏其他所有功能?,magento,Magento,在justin.xml中: <layout>          <updates handle="index_settings">          <embeds>                 <file>justin.xml</file>            </embeds>         </updates>     </layout>              

在justin.xml中:

 <layout>
         <updates handle="index_settings">
            <embeds>
                 <file>justin.xml</file>
            </embeds>
         </updates>
     </layout>

        
       
           
js_css
justin/style.css
       
   

您的XML应该如下所示:

<justin_index_settings>
         
        <reference name="head">
            <action method="addItem">
           <type>js_css</type>
           <name>justin/style.css</name>
        </action>
        </reference>
    </justin_index_settings>
这样,您的Javascript现在只为
catalog\u product\u视图
句柄生成的页面加载,因此只有产品详细信息页面而不是列表页面等。
在您的情况下,您只需要将此句柄调整为模块句柄,可能是
justin\u index\u设置

您的XML应该如下所示:

<justin_index_settings>
         
        <reference name="head">
            <action method="addItem">
           <type>js_css</type>
           <name>justin/style.css</name>
        </action>
        </reference>
    </justin_index_settings>
这样,您的Javascript现在只为
catalog\u product\u视图
句柄生成的页面加载,因此只有产品详细信息页面而不是列表页面等。
在您的情况下,您只需要将此句柄调整为模块句柄,可能是
justin\u index\u设置

您在某处添加了
jQuery.noConflict()
?如果没有,请添加它。Magento完全基于prototype,prototype已经在使用
$
,因此与jQuery版本的
$
冲突。这可能是你的问题。我只是将它添加到我有自己的jquery的文件中,这对于
$
问题就足够了。所以你可以把它从方程中取出来。您可以将
移动到自定义
手柄中,然后执行
@TimHofman操作。我刚刚尝试过,但无法使其工作。我做错什么了吗?我将更新帖子。我已经添加了一个关于XML应该是什么样子的答案。您是否在某处添加了
jQuery.noConflict()
?如果没有,请添加它。Magento完全基于prototype,prototype已经在使用
$
,因此与jQuery版本的
$
冲突。这可能是你的问题。我只是将它添加到我有自己的jquery的文件中,这对于
$
问题就足够了。所以你可以把它从方程中取出来。您可以将
移动到自定义
手柄中,然后执行
@TimHofman操作。我刚刚尝试过,但无法使其工作。我做错什么了吗?我将更新这篇文章。我已经添加了一个关于XML应该是什么样子的答案。
<my_own_custom_handle>
    <reference name="head">
        <action method="addJs"><js>splurgyjs/jquery-1.7.2.min.js</js></action>
    </reference>
</my_own_custom_handle>
<catalog_product_view>
    <update handle="my_own_custom_handle" />
</catalog_product_view>