2014-05-01 2 views
2

Magento 버전을 사용하여 상점을 만들려고합니다. 1.8.1.0. 내 프로그래밍 기능은 훌륭하지 않습니다. 저는 전자 엔지니어이며 임베디드 C를 제대로 알고 있습니다. 그러니 제발 잘 대하십시오.getPriceHtml 함수가 undefined를 포함한 무언가를 반환했습니다.

테마 신발 가게를 here에서 설치했습니다. 테마는 현재 정상적으로 작동하지만 아래의 스크린 샷 클립에서 볼 수 있듯이 가격 근처에서 "정의되지 않은"텍스트가 있습니다.

enter image description here

나는이 블록의 코드를 확인하는 브라우저를 사용하고는 다음과 같이이다 :

<div class="price-box"> 
    <span class="regular-price" id="product-price-1"> 
    <span class="price"> 
     <span class="cur_sym">1</span> 
     <span class="price_int">9,99&nbsp;TL.</span> 
     <span class="price_deci">undefined</span></span> 
    </span> 
</div> 
<div class="actions"> 
    <a class="details" href="http://www.myurl.com/store/denek-urun.html" title="Details">Details</a> 
</div> 

그리고이 HTML 코드의 일부입니다 new_products.phtml 페이지에 의해 생성되는 위의 HTML 코드를 인쇄하려면 다음을 사용합니다.

<?php echo $this->getPriceHtml($_product, true) ?> 

내가 이해하는 한, "정의되지 않은"것은 가격의 소수 부분에서 비롯된다. 나는 app/design/frontend/base/default/template/catalog/product/price.phtml를 점검했지만 아무것도 이해할 수 없었다.

"정의되지 않은"텍스트를 제거하려면 어떻게해야합니까?

+0

이 그들을 관련 거의 확실하다. 데모 테마로 전환하여 문제가 지속되는지 확인하십시오. 주제를 팔았던 사람들과 함께 문제를 생각해 보면 그들이 말하지 않은 모듈 의존성이있을 수 있습니다. –

답변

0

Marius 덕분에 문제가 해결되었습니다.

다음은 제 솔루션입니다. 다음과 같이 내가 파일 /app/design/frontend/default/shoe_store/template/page/html/head.phtml에 스크립트 부분을 변경 :

var price, sepstr, firstpart, secondpart, currency; 

jQuery(document).ready(function() 
{ 

    jQuery(
     '.newproducts .price-box .regular-price .price, .newproducts .old-price .price, .newproducts .special-price .price, .category-products .price-box .regular-price .price, .category-products .old-price .price, .category-products .special-price .price, .product-shop .price-box .regular-price .price, .product-shop .old-price .price, .product-shop .special-price .price' 
    ).each(function() 
    { 

     price = jQuery.trim(jQuery(this).text()); 

     if(price.indexOf("TL") > -1) // The currency is TL 
     { 
      sepstr = price.split(','); 

      firstpart = sepstr[0]; 

      secondpart = sepstr[1]; 

      currency = secondpart[3] + secondpart[4]; 

      secondpart = secondpart.replace(currency, ''); 

      jQuery(this).html('<span class="price_int">' + firstpart + 
       ',</span><span class="price_deci">' + secondpart + '</span>' + '<span class="price_int">' + currency + '</span>'); 
     } 


     else 
     { 
      sepstr = price.split('.'); 

      firstpart = sepstr[0]; 

      secondpart = sepstr[1]; 

      currency = firstpart[0]; 

      firstpart = firstpart.replace(currency, ''); 

      jQuery(this).html('<span class="cur_sym">' + currency + '</span><span class="price_int">' + firstpart + 
       '.</span><span class="price_deci">' + secondpart + '</span>'); 
     } 
    }); 

}); 

결과는 다음과 같습니다

enter image description here

관련 문제