2012-03-08 2 views
3

Responsive OpenCart (1.5.2.1) 테마에서 작업 중이며 응답 가능한 FancyBox로 ColorBox 스크립트를 대체했습니다.이 부분을 제외하고는 모두 작동하도록했습니다. OpenCart 스크립트.ColorBox를 호출하는 OpenCart 스크립트를 Responsive FancyBox 호출로 바꿔야합니다.

저는 ColorBox 부분을 바꾸고 싶지만 작동 시키려고합니다.

당신은 반응 FancyBox here

<script type="text/javascript"><!-- 
$('#button-quote').live('click', function() { 
$.ajax({ 
    url: 'index.php?route=checkout/cart/quote', 
    type: 'post', 
    data: 'country_id=' + $('select[name=\'country_id\']').val() + '&zone_id=' + $('select[name=\'zone_id\']').val() + '&postcode=' + encodeURIComponent($('input[name=\'postcode\']').val()), 
    dataType: 'json',  
    beforeSend: function() { 
     $('#button-quote').attr('disabled', true); 
     $('#button-quote').after('<span class="wait">&nbsp;<img src="catalog/view/theme/sellegance/image/loading.gif" alt="" /></span>'); 
    }, 
    complete: function() { 
     $('#button-quote').attr('disabled', false); 
     $('.wait').remove(); 
    },  
    success: function(json) { 
     $('.success, .warning, .attention, .error').remove();   

     if (json['error']) { 
      if (json['error']['warning']) { 
       $('#notification').html('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/sellegance/image/close.png" alt="" class="close" /></div>'); 

       $('.warning').fadeIn('slow'); 

       $('html, body').animate({ scrollTop: 0 }, 'slow'); 
      } 

      if (json['error']['country']) { 
       $('select[name=\'country_id\']').after('<span class="error">' + json['error']['country'] + '</span>'); 
      } 

      if (json['error']['zone']) { 
       $('select[name=\'zone_id\']').after('<span class="error">' + json['error']['zone'] + '</span>'); 
      } 

      if (json['error']['postcode']) { 
       $('input[name=\'postcode\']').after('<span class="error">' + json['error']['postcode'] + '</span>'); 
      }     
     } 

     if (json['shipping_method']) { 
      html = '<h2><?php echo $text_shipping_method; ?></h2>'; 
      html += '<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">'; 
      html += ' <table class="radio">'; 

      for (i in json['shipping_method']) { 
       html += '<tr>'; 
       html += ' <td colspan="3"><b>' + json['shipping_method'][i]['title'] + '</b></td>'; 
       html += '</tr>'; 

       if (!json['shipping_method'][i]['error']) { 
        for (j in json['shipping_method'][i]['quote']) { 
         html += '<tr class="highlight">'; 

         if (json['shipping_method'][i]['quote'][j]['code'] == '<?php echo $shipping_method; ?>') { 
          html += '<td><input type="radio" name="shipping_method" value="' + json['shipping_method'][i]['quote'][j]['code'] + '" id="' + json['shipping_method'][i]['quote'][j]['code'] + '" checked="checked" /></td>'; 
         } else { 
          html += '<td><input type="radio" name="shipping_method" value="' + json['shipping_method'][i]['quote'][j]['code'] + '" id="' + json['shipping_method'][i]['quote'][j]['code'] + '" /></td>'; 
         } 

         html += ' <td><label for="' + json['shipping_method'][i]['quote'][j]['code'] + '">' + json['shipping_method'][i]['quote'][j]['title'] + '</label></td>'; 
         html += ' <td style="text-align: right;"><label for="' + json['shipping_method'][i]['quote'][j]['code'] + '">' + json['shipping_method'][i]['quote'][j]['text'] + '</label></td>'; 
         html += '</tr>'; 
        }  
       } else { 
        html += '<tr>'; 
        html += ' <td colspan="3"><div class="error">' + json['shipping_method'][i]['error'] + '</div></td>'; 
        html += '</tr>';       
       } 
      } 

      html += ' </table>'; 
      html += ' <br />'; 
      html += ' <input type="hidden" name="next" value="shipping" />'; 
      html += ' <input type="submit" value="<?php echo $button_shipping; ?>" class="button" />';    
      html += '</form>'; 

      $.colorbox({ 
     overlayClose: true, 
     opacity: 0.5, 
     width: '600px', 
     height: '400px', 
     href: false, 
     html: html 
    }); 
     } 
    } 
}); 
을 찾을 수 있습니다

}); // - 당신이하지 않은 경우>

내가

$(".fancybox").fancybox({ 
     maxWidth : 800, 
     maxHeight : 600, 
     fitToView : false, 
     width  : '70%', 
     height  : '70%', 
     autoSize : false, 
     closeClick : false, 
     openEffect : 'none', 
     closeEffect : 'none', 
     href: false, 
     html: html 
    }); 

으로하지만 운

$.colorbox({ 
     overlayClose: true, 
     opacity: 0.5, 
     width: '600px', 
     height: '400px', 
     href: false, 
     html: html 
    }); 

을 대체하려고

+1

fancybox가 OC 1.5.X에서 제거 된 이유는 무엇입니까? 그것은 IE에서 대단히 느린 로딩 문제로 인한 것입니다. –

+1

이것은 OpenCart에서 이전에 사용했던 것과 다른 fancyBox 스크립트입니다. – Edwin

+0

@JayGilford 나는 그들이 그것을 제거한다는 것을 깨닫지 못하고 이것을 해결하기 위해 오래 동안 노력해 왔습니다. – AlphaApp

답변

1

$.fancybox({ 
     maxWidth : 800, 
     maxHeight : 600, 
     fitToView : false, 
     width  : '70%', 
     height  : '70%', 
     autoSize : false, 
     closeClick : false, 
     openEffect : 'none', 
     closeEffect : 'none', 
     content  : html 
    }); 

시도 할당 자 g href이면 그 옵션은 필요하지 않습니다. 또한 contenthref을 무시합니다.

+0

JFK가 완벽하게 작동합니다. – Edwin

+0

정확한 answer.thanks로 확인하는 것을 잊지 마십시오. – JFK

관련 문제