2012-12-12 154 views
2

我使用的是Magento購物主題(http://shopper.queldorei.com/)。Magento購物主題多「購物車」的車頭標題

當我將產品添加到我的商店購物車,它增加的

<div class="cart-top-title"> 
<a href="https://droppinstudio.dk/horsepony/index.php/checkout/cart/" class="clearfix"> 
<span class="icon"></span>Cart</a></div> 

多個elemtns我已經想通了,這是jQuery的,使得這裏的錯誤:

function setLocationAjax(url, id) 
{ 
    ... 
     if (data.status != 'ERROR' && $('.cart-top-container').length) { 
      $('.cart-top-container').replaceWith(data.cart_top); 
     } 
    ... 
} 

不任何人都有一個好主意來解決這個問題?

回答

1

謝謝歐文,that helped me figure out what is wrong。 CartController位於app/code/local/Excellence/Ajax/controllers /中,實際上名爲IndexController.php。

線52-54設置data.cart_top響應:

$sidebar_header = $this->getLayout()->getBlock('cart_top')->toHtml(); 
Mage::register('referrer_url', $this->_getRefererUrl()); 
$response['cart_top'] = $sidebar_header; 

一個修復可能是改變cart_top塊被設計的方式,以及從cart_top刪除「購物車頂部標題」 .phtml並將其放在自己的文件中,並將其包含在header.phtml中。

原來在ajaxcart.js(函數setLocationAjax)的第85行發生了acutal替換。

速戰速決對我來說是與jQuery刪除DIV像這樣:

if (data.status != 'ERROR' && $('.cart-top-container').length) { 
    $('.cart-top-title').remove(); 
    $('.cart-top-container').replaceWith(data.cart_top); 
} 

js文件的位置:皮膚/前端/默認/購物/ JS/ajaxcart/ajaxcart.js

cart_top .phtml here:app/design/frontend/default/shopper/template/checkout/cart/cart-top.phtml

header.phtml here:app/design/frontend/default/shopper/template/page/html/header.phtml

+1

很高興我可以幫助:) –

2

您應該看看CartController並更改響應變量(data.cart_top)。

CartController的位置取決於主題使用的模塊。核心CartController位於app/code/core/Mage/Checkout/controllers/CartController.php中。

希望這會有所幫助。