【发布时间】:2011-06-28 15:48:35
【问题描述】:
我们有一个报价模块,它将提交报价请求然后重定向到某个页面。我们想返回产品页面,但尝试了一些方法后仍然无法正常工作。
下面的代码显示了报价的处理器,最后显示:$this->_redirect('Quotation/Quote/List/');
我在尝试获取 URL 方面尝试了几个想法,但目前还没有任何效果。
在处理产品 URL 并重定向到该页面而不是报价单/报价单/列表页面时,我需要添加什么内容?
/**
* Create a quote inquiry with cart's products
*
*/
public function CreateRequestAction()
{
$this->loadLayout();
$this->renderLayout();
}
/**
* Create a quote inquiry with cart's products
*
*/
public function CreateIndividualRequestAction()
{
$this->loadLayout();
$this->renderLayout();
}
/**
* Post a new quote request Individual
*
*/
public function SendIndividualRequestAction()
{
$CustomerId = mage::Helper('customer')->getCustomer()->getId();
$storeId = mage::getModel('customer/customer')->load($CustomerId)->getStoreId();
$defaultValidityDuration = Mage::getStoreConfig('quotation/general/default_validity_duration', $storeId);
$defaultExpirationDate = time() + $defaultValidityDuration * 24 * 3600;
//Create new quotation
$NewQuotation = mage::getModel('Quotation/Quotation')
->setcustomer_id($CustomerId)
->setcaption($this->__('New request'))
->setcreated_time(date("Y/m/d"))
->setcustomer_msg($this->getRequest()->getPost('description'))
->setcustomer_request(1)
->setstatus(MDN_Quotation_Model_Quotation::STATUS_CUSTOMER_REQUEST)
->setvalid_end_time(date('Y/m/d', $defaultExpirationDate))
->save();
$NewQuotation->setincrement_id($NewQuotation->GenerateIncrementId())->save();
//Add selected product
$product = mage::getModel('catalog/product')->load($this->getRequest()->getPost('product_id'));
if ($product->getId())
{
//add product to quotation
$quotationItem = mage::getModel('Quotation/Quotationitem')
->setquotation_id($NewQuotation->getId())
->setorder(1)
->setproduct_id($product->getId())
->setqty(1)
->setprice_ht($product->getPrice())
->setcaption($product->getName())
->setsku($product->getSku())
->setcost($product->getCost())
->setweight($product->getWeight())
->save();
//compute quotation price & weight
$NewQuotation->CalculateWeight();
$NewQuotation->CalculateQuotationPriceHt();
}
//Notify admin
$NewQuotation->NotifyCreationToAdmin();
//confirm
$this->_redirect('Quotation/Quote/List/');
}
【问题讨论】: