2016-08-16 6 views
0

問題があり、私のmagentoサイトで既定のテーマを使用していて、このスクリプトを使用しています。 RWDテーマでのみ動作します。私はそれについていくつかの情報を見つけようとしていて、何も見つけられません。あなたがデフォルトのテーマでこのスクリプトを手助けする何かを知っていれば助けてください。スクリプトはRWDテーマでのみ動作し、既定のテーマでは機能しません

<div class="block block-subscribe"> 
<div class="block-title"> 
    <strong><span><?php echo $this->__('Newsletter') ?></span></strong> 
</div> 
<div id="feedback" style="display:none" class="mini-newsletter"> 
    Thank you for subscribing to our newsletter! 
</div> 
<form action="<?php echo $this->getFormActionUrl() ?>" name="newsletter-form" id="newsletter-form" method="post"> 
    <div class="block-content"> 
     <div class="form-subscribe-header"> 
      <label for="newsletter"><?php echo $this->__('Sign Up for Our Newsletter:') ?></label> 
     </div> 
     <div class="input-box"> 
      <input type="text" placeholder="Email address" name="email" id="newsletter" title="<?php echo $this->__('Subscribe to Our Newsletter') ?>" class="required-entry input-subscribe" style="width:178px;" /> 
      <div class="error-news-msg" id="error-news-msg" style="display:none;">Please enter a valid email address.</div> 
     </div> 
     <div class="actions"> 
      <button type="button" title="<?php echo $this->__('Subscribe') ?>" onclick="myfunc();" class="button"> 
       <span><span>Subscribe</span></span> 
      </button> 
     </div> 
    </div> 
</form> 

<script type="text/javascript"> 
    function myfunc() 
    { 
     var newsletterSubscriberFormDetail = new VarienForm('newsletter-form'); 
     var form_email = $('newsletter').getValue(); 
     var params_form = $('newsletter-validate-detail'); 
     //alert(params_form); 
     if(echeck(form_email)) 
     { 
      //alert(form_email); 
      //alert(Form.serialize($('newsletter-validate-detail'))); 
      new Ajax.Updater({ success: 'newsletter-form' }, '<?php echo $this->getUrl('newsletter/subscriber/new') ?>', { 
       asynchronous:true, evalScripts:false, 
       parameters: { email: form_email }, 
       onComplete:function(request, json){Element.hide('newsletter-form');Element.show('feedback');}, 
       onLoading:function(request, json){Element.hide('news-loader');} 

      }); 
     } 
     else 
     { 
      //alert(form_email); 
      return false; 
     }  
    } 

    function echeck(str) {  
     var at="@"; 
     var dot="."; 
     var lat=str.indexOf(at); 
     var lstr=str.length; 
     var ldot=str.indexOf(dot); 
     if (str.indexOf(at)==-1){ 
      //alert("Invalid E-mail ID") 
      goProcedural(); 
      return false 
     } 

     if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ 
      //alert("Invalid E-mail ID") 
      goProcedural(); 
      return false 
     } 

     if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ 
      //alert("Invalid E-mail ID") 
      goProcedural(); 
      return false 
     } 

     if (str.indexOf(at,(lat+1))!=-1){ 
      //alert("Invalid E-mail ID") 
      goProcedural(); 
      return false 
     } 

     if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ 
      //alert("Invalid E-mail ID") 
      goProcedural(); 
      return false 
     } 

     if (str.indexOf(dot,(lat+2))==-1){ 
      //alert("Invalid E-mail ID") 
      goProcedural(); 
      return false 
     } 

     if (str.indexOf(" ")!=-1){ 
      //alert("Invalid E-mail ID") 
      goProcedural(); 
      return false 
     }  
     return true 
    } 

    function goProcedural() 
    { 
     Element.show('error-news-msg'); 
     Element.hide.delay(5, 'error-news-msg'); 
    } 

</script> 
+3

「動作しない」と定義してください。あなたが使用しているコードのファイルパスを共有し、あなたのウェブサイトのテーマ設定を表示してください(システム - >設定 - >デザイン) –

+0

あなたのコンソールを見てくださいあなたのコンソールに何かエラーがあるかもしれません –

+0

これはMagento [Magento SEサイト](http://magento.stackexchange.com/)にも投稿してください。 –

答えて

-1

カスタムフォルダ名にRWDから、管理構成の変更をテーマパッケージフォルダパスを行ってください。これを行うには、管理者パネル>システム>設定>デザインからパッケージ名とテーマフォルダ名を設定します。

+0

ありがとうございます。しかし、私は私のカスタムテーマでこのコードが動作する必要があります –

関連する問題