0

我试图在cs购物车皮肤中插入一个javascript,但是在common_templates的scripts.tpl中插入代码后没有任何反应。我已经尝试将它插入 {literal} {/literal} 标签,但仍然没有任何变化。请帮助。

-------------------这是我现在在scripts.tpl中的代码:--------------------

{* $Id: scripts.tpl 10199 2010-07-26 09:11:31Z klerik $ *}

{script src="lib/jquery/jquery.js"}
{script src="js/core.js"}
{script src="js/ajax.js"}

{literal}<script type='text/javascript'>
var _vwo_code=(function(){
var account_id=45350,
settings_tolerance=2000,
library_tolerance=2500,
use_existing_jquery=false,
// DO NOT EDIT BELOW THIS LINE
f=false,d=document;return{use_existing_jquery:function(){return use_existing_jquery;},library_tolerance:function(){return library_tolerance;},finish:function(){if(!f){f=true;var a=d.getElementById('_vis_opt_path_hides');if(a)a.parentNode.removeChild(a);}},finished:function(){return f;},load:function(a){var b=d.createElement('script');b.src=a;b.type='text/javascript';b.innerText;b.onerror=function(){_vwo_code.finish();};d.getElementsByTagName('head')[0].appendChild(b);},init:function(){settings_timer=setTimeout('_vwo_code.finish()',settings_tolerance);this.load('//dev.visualwebsiteoptimizer.com/j.php?a='+account_id+'&u='+encodeURIComponent(d.URL)+'&r='+Math.random());var a=d.createElement('style'),b='body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}',h=d.getElementsByTagName('head')[0];a.setAttribute('id','_vis_opt_path_hides');a.setAttribute('type','text/css');if(a.styleSheet)a.styleSheet.cssText=b;else a.appendChild(d.createTextNode(b));h.appendChild(a);return settings_timer;}};}());_vwo_settings_timer=_vwo_code.init();
</script>{/literal}


<script type="text/javascript">
//<![CDATA[
var index_script = '{$index_script|escape:"javascript"}';
var current_path = '{$config.current_path|escape:"javascript"}';
var changes_warning = '{$settings.Appearance.changes_warning|escape:"javascript"}';

var lang = {$ldelim}
    cannot_buy: '{$lang.cannot_buy|escape:"javascript"}',
    no_products_selected: '{$lang.no_products_selected|escape:"javascript"}',
    error_no_items_selected: '{$lang.error_no_items_selected|escape:"javascript"}',
    delete_confirmation: '{$lang.delete_confirmation|escape:"javascript"}',
    text_out_of_stock: '{$lang.text_out_of_stock|escape:javascript}',
    in_stock: '{$lang.in_stock|escape:javascript}',
    items: '{$lang.items|escape:javascript}',
    text_required_group_product: '{$lang.text_required_group_product|escape:javascript}',
    notice: '{$lang.notice|escape:"javascript"}',
    warning: '{$lang.warning|escape:"javascript"}',
    loading: '{$lang.loading|escape:"javascript"}',
    none: '{$lang.none|escape:"javascript"}',
    text_are_you_sure_to_proceed: '{$lang.text_are_you_sure_to_proceed|escape:"javascript"}',
    text_invalid_url: '{$lang.text_invalid_url|escape:"javascript"}',
    text_cart_changed: '{$lang.text_cart_changed|escape:"javascript"}',
    error_validator_email: '{$lang.error_validator_email|escape:"javascript"}',
    error_validator_confirm_email: '{$lang.error_validator_confirm_email|escape:"javascript"}',
    error_validator_phone: '{$lang.error_validator_phone|escape:"javascript"}',
    error_validator_integer: '{$lang.error_validator_integer|escape:"javascript"}',
    error_validator_multiple: '{$lang.error_validator_multiple|escape:"javascript"}',
    error_validator_password: '{$lang.error_validator_password|escape:"javascript"}',
    error_validator_required: '{$lang.error_validator_required|escape:"javascript"}',
    error_validator_zipcode: '{$lang.error_validator_zipcode|escape:"javascript"}',
    error_validator_message: '{$lang.error_validator_message|escape:"javascript"}',
    text_page_loading: '{$lang.text_page_loading|escape:"javascript"}',
    view_cart: '{$lang.view_cart|escape:javascript}',
    checkout: '{$lang.checkout|escape:javascript}',
    product_added_to_cart: '{$lang.product_added_to_cart|escape:javascript}',
    products_added_to_cart: '{$lang.products_added_to_cart|escape:javascript}',
    product_added_to_wl: '{$lang.product_added_to_wl|escape:javascript}',
    product_added_to_cl: '{$lang.product_added_to_cl|escape:javascript}',
    close: '{$lang.close|escape:javascript}',
    error: '{$lang.error|escape:"javascript"}',
    error_ajax: '{$lang.error_ajax|escape:"javascript"}',
    text_changes_not_saved: '{$lang.text_changes_not_saved|escape:"javascript"}',
    text_data_changed: '{$lang.text_data_changed|escape:"javascript"}'
{$rdelim}

var warning_mark = "&lt;&lt;";

var currencies = {$ldelim}
    'primary': {$ldelim}
        'decimals_separator': '{$currencies.$primary_currency.decimals_separator|escape:javascript}',
        'thousands_separator': '{$currencies.$primary_currency.thousands_separator|escape:javascript}',
        'decimals': '{$currencies.$primary_currency.decimals|escape:javascript}',
        'coefficient': '{$currencies.$primary_currency.coefficient|escape:javascript}'
    {$rdelim},
    'secondary': {$ldelim}
        'decimals_separator': '{$currencies.$secondary_currency.decimals_separator|escape:javascript}',
        'thousands_separator': '{$currencies.$secondary_currency.thousands_separator|escape:javascript}',
        'decimals': '{$currencies.$secondary_currency.decimals|escape:javascript}',
        'coefficient': '{$currencies.$secondary_currency.coefficient}'
    {$rdelim}
{$rdelim};

var cart_language = '{$smarty.const.CART_LANGUAGE}';
var images_dir = '{$images_dir}';
var notice_displaying_time = {if $settings.Appearance.notice_displaying_time}{$settings.Appearance.notice_displaying_time}{else}0{/if};
var cart_prices_w_taxes = {if ($settings.Appearance.cart_prices_w_taxes == 'Y' && 'CHECKOUT'|defined) || ($settings.Appearance.show_prices_taxed_clean == 'Y' && !'CHECKOUT'|defined)}true{else}false{/if};
var translate_mode = {if "TRANSLATION_MODE"|defined}true{else}false{/if};
var iframe_urls = new Array();
var iframe_extra = new Array();
var regexp = new Array();
$(document).ready(function(){$ldelim}
    jQuery.runCart('C');
{$rdelim});

document.write('<style>.cm-noscript {$ldelim} display:none {$rdelim}</style>'); // hide noscript tags
//]]>
</script>
{literal}
<!--[if lt IE 8]>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
    $('ul.dropdown li').hover(function(){
        $(this).addClass('hover');
        $('> .dir',this).addClass('open');
        $('ul:first',this).css('display', 'block');
    },function(){
        $(this).removeClass('hover');
        $('.open',this).removeClass('open');
        $('ul:first',this).css('display', 'none');
    });
});
//]]>
</script>
<![endif]-->
{/literal}
{hook name="index:scripts"}
{/hook}

------------------- 不会插入的代码部分: -------------------

{literal}<script type='text/javascript'>
    var _vwo_code=(function(){
    var account_id=45350,
    settings_tolerance=2000,
    library_tolerance=2500,
    use_existing_jquery=false,
    // DO NOT EDIT BELOW THIS LINE
    f=false,d=document;return{use_existing_jquery:function(){return use_existing_jquery;},library_tolerance:function(){return library_tolerance;},finish:function(){if(!f){f=true;var a=d.getElementById('_vis_opt_path_hides');if(a)a.parentNode.removeChild(a);}},finished:function(){return f;},load:function(a){var b=d.createElement('script');b.src=a;b.type='text/javascript';b.innerText;b.onerror=function(){_vwo_code.finish();};d.getElementsByTagName('head')[0].appendChild(b);},init:function(){settings_timer=setTimeout('_vwo_code.finish()',settings_tolerance);this.load('//dev.visualwebsiteoptimizer.com/j.php?a='+account_id+'&u='+encodeURIComponent(d.URL)+'&r='+Math.random());var a=d.createElement('style'),b='body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}',h=d.getElementsByTagName('head')[0];a.setAttribute('id','_vis_opt_path_hides');a.setAttribute('type','text/css');if(a.styleSheet)a.styleSheet.cssText=b;else a.appendChild(d.createTextNode(b));h.appendChild(a);return settings_timer;}};}());_vwo_settings_timer=_vwo_code.init();
    </script>{/literal}
4

1 回答 1

0

您可以使用 my_changes 附加组件并挂钩到脚本,
我看到您正在使用 v3

  • 归档

    PRO: skins/[SKIN_NAME]/customer/addons/my_changes/hooks/index/scripts.post.tpl
    ULT: stores/[STORE_ID]/skins/[SKIN_NAME]/customer/addons/my_changes/hooks/index/scripts.post.tpl
    
  • 添加内容

    {literal}<script type='text/javascript'>
    var _vwo_code=(function(){
    var account_id=45350,
    settings_tolerance=2000,
    library_tolerance=2500,
    use_existing_jquery=false,
    // DO NOT EDIT BELOW THIS LINE
    f=false,d=document;return{use_existing_jquery:function(){return use_existing_jquery;},library_tolerance:function(){return library_tolerance;},finish:function(){if(!f){f=true;var a=d.getElementById('_vis_opt_path_hides');if(a)a.parentNode.removeChild(a);}},finished:function(){return f;},load:function(a){var b=d.createElement('script');b.src=a;b.type='text/javascript';b.innerText;b.onerror=function(){_vwo_code.finish();};d.getElementsByTagName('head')[0].appendChild(b);},init:function(){settings_timer=setTimeout('_vwo_code.finish()',settings_tolerance);this.load('//dev.visualwebsiteoptimizer.com/j.php?a='+account_id+'&u='+encodeURIComponent(d.URL)+'&r='+Math.random());var a=d.createElement('style'),b='body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}',h=d.getElementsByTagName('head')[0];a.setAttribute('id','_vis_opt_path_hides');a.setAttribute('type','text/css');if(a.styleSheet)a.styleSheet.cssText=b;else a.appendChild(d.createTextNode(b));h.appendChild(a);return settings_timer;}};}());_vwo_settings_timer=_vwo_code.init();
    </script>{/literal}
    
  • 清除缓存(非常重要) http://www.example.com/admin.php?cc

现在应该列在标题中

还请检查您是否有任何覆盖脚本的钩子;)

于 2014-03-04T14:00:48.990 回答