2014-02-10 65 views
0

概述:加入购物车错误,产品重定向问题 - Magento的

在我的产品叫测试产品有量。

enter image description here

所以,当我把数量,并按添加到购物车。 (记住,产品的数量是10,所以它应该提示错误)

enter image description here

输出是正确的,用户得到了通过,他们不是比数量放时,该系统通知产品的实际数量。

enter image description here

如果在URL仔细一看,用户之前单击添加到购物车,网址是

enter image description here

当已经显示的错误,网址是

enter image description here

含义,magento删除类别链接并重定向到t他实际的产品链接。

问题 有没有什么办法了Magento的重定向到当前的类别,而不是产品的链接?

回答

0

默认情况下,重定向到类别或包含在URL中的类别的产品都是不可能的。你需要为此编写一个模块。

让我们看看重定向在代码中完成的位置,因此可以修改行为。 从购物车控制器产品开始添加到购物车Mage_Checkout_CartController::addAction()。该产品加入

$cart = $this->_getCart(); 
... 
$cart->addProduct($product, $params); 

具有Mage_Checkout_Model_Cart::addProduct()仔细看看产品与库存量不足的重定向URL设置的位置:

/** 
* String we can get if prepare process has error 
*/ 
if (is_string($result)) { 
$redirectUrl = ($product->hasOptionsValidationFail()) 
    ? $product->getUrlModel()->getUrl(
     $product, 
     array('_query' => array('startcustomization' => 1)) 
    ) 
    : $product->getProductUrl(); 
$this->getCheckoutSession()->setRedirectUrl($redirectUrl); 
if ($this->getCheckoutSession()->getUseNotice() === null) { 
    $this->getCheckoutSession()->setUseNotice(true); 
} 
Mage::throwException($result); 
} 

这里的产品被下载,而分类信息这样的类别不是这个网址的一部分。

相关问题