默认情况下,重定向到类别或包含在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);
}
这里的产品被下载,而分类信息这样的类别不是这个网址的一部分。