我们正在使用 Aheadworks 帮助台模块,并正在尝试创建第二个表单来捕获特定信息并使用该表单创建一个工单,其中所有表单内容都会发布到帮助台的“内容”部分。
问题是,如果我使用名称 =“内容”,则发布到“内容”部分的内容只是“数组”
表单代码很简单:
<form id="helpdesk-ticket-form" action="../helpdeskultimate/customer/new/" method="post" enctype="multipart/form-data"><input name="title" value="WHOLESALE SETUP REQUEST" type="hidden">
<div><label for="title_field">Name<span class="required">*</span></label><br> <input id="title" class="input-text required-entry" style="width: 250px;" name="" value="" type="text"></div>
<div> </div>
<div><label for="title_field">Company Name<span class="required">*</span></label> <br><input id="content_field" class="input-text " title="Company" name="content" value="" type="text"></div>
<input name="department_id" value="2" type="hidden">
<div> </div>
<div><label for="content_field">Message<span class="required">*</span></label><br> <textarea id="content_field" class="required-entry" style="width: 450px;" name="content" rows="10" cols="53"></textarea></div>
<div> </div>
<div> </div>
<div><label for="filename">Attach Reseller Permit (2Mb limit)</label><br> <input id="filename" class="input-file" style="width: 450px;" name="filename" type="file"></div>
<div class="button-set"> </div>
<div class="button-set"><span><span><br></span></span></div>
<div class="button-set"><button class="button right form-button" type="submit"><span> <span>Submit ticket</span></span> </button></div>
</form>
我试过使用 name="content[]" 但它也返回了 "Array"
该模块看起来正在使用这个 post 方法:
public function newAction()
{
if (!$this->_getCustomerSession()->getCustomerId()) {
$this->_getCustomerSession()->authenticate($this);
return;
}
$session = Mage::getSingleton('core/session');
$customer = $this->_getCustomerSession()->getCustomer();
$Proto = Mage::getModel('helpdeskultimate/proto');
$postData = $this->getRequest()->getPost();
if (isset($postData['department_id'])) {
$Proto->setDepartmentId($postData['department_id']);
}
try {
$Proto
->setSubject(@$postData['title'])
->setContent(@$postData['content'])
->setPriority(@$postData['priority'])
->setStoreId(Mage::app()->getStore()->getId())
->setFrom(Mage::getSingleton('customer/customer')->getId())
->setSource('web');
插入到消息字段中似乎来自这里:
/* Insert */
try {
$message->setContent(trim($data['content']));
$validateResult = $message->validate();
完整的控制器文件可以从http://www.gingabox.com/CustomerController.zip下载
我不确定如何实际使用带有@$postData['content'] 的 foreach 语句,或者是否有更好的解决方案。
我很乐意询问 AheadWorks,但被他们告知他们目前不接受定制查询(太忙了)...
任何帮助将不胜感激!