/**
* 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);
}
1 回答
默认情况下,无法重定向到类别或包含在网址中的类别的产品 . 你需要为此编写一个模块 .
让我们看看在代码中完成重定向的位置,因此可以修改行为 . 从购物车控制器开始,产品将添加到
Mage_Checkout_CartController::addAction()
中的购物车中 . 该产品添加仔细查看
Mage_Checkout_Model_Cart::addProduct()
,此处设置了库存量不足的产品的重定向网址:此处的产品在没有类别信息的情况下加载,因此类别不是此URL的一部分 .