创建名为no.tpl
的网页。此处显示firstname
中的客户lastname
和select dropdown
。
此处我的代码 no.tpl
<select name="customer_id" id="customer" style="width: 325px;margin-bottom:10px" class="form-control">
<?php foreach($customerData as $customer){ ?>
<option value=<?php echo $customer['customer_id']?>><?php echo $customer['customer_name']?></option>
<?php }?>
</select>
这是我的控制器代码
<?php
class ControllerSaleno extends Controller {
private $error = array();
public function index() {
$data=$this->request->post;
$customerId=$data['customer_id'];
//$this->sendMail($customerId);
$data['column_left'] = $this->load->controller('common/column_left');
$data['column_right'] = $this->load->controller('common/column_right');
$data['content_top'] = $this->load->controller('common/content_top');
$data['content_bottom'] = $this->load->controller('common/content_bottom');
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');
//$this->response->setOutput($this->load->view('default/template/product/no.tpl', $data));
$this->response->setOutput($this->load->view('sale/no.tpl', $data));
//$data['productsData']=$this->getProductData();
$customers=$this->getCustomerData();
$data['customerData']=array();
foreach($customers as $customer)
{
$data['customerData'][]=array(
'customer_id'=>$customer['customer_id'],
'customer_name'=>$customer['firstname'].' '.$customer['lastname']
);
//var_dump($data['customerData']);
//var_dump($customer['firstname']);
}
}
public function getCustomerData()
{
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer order by firstname asc");
return $query->rows;
}
public function sendMail($customerId)
{
$tempArray=array();
$selectedCustomerId=$customerId;
$query=$this->db->query("SELECT state FROM " . DB_PREFIX . "customer where customer_id=".$selectedCustomerId);
$state=$query->row;
$querySalesEmail=$this->db->query("SELECT email FROM " . DB_PREFIX . "customer where customer_id=".$selectedCustomerId);
$salesPersonEmail1=$querySalesEmail->row;
$salesPersonEmail= $salesPersonEmail1['email'];
$queryCustomerName=$this->db->query("SELECT concat(firstname,' ',lastname) as name FROM " . DB_PREFIX . "customer where customer_id=".$selectedCustomerId);
$customerName=$queryCustomerName->row['name'];
$To = "radhamani123@gmail.com";
$Subject = "New Order From " . "'" . $customerName . "'" . date('m/d/Y h:i:s');
$Headers = "MIME-Version: 1.0\r\n";
$Headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$Headers .= "From: No ORder<orders@milkymist.in>\r\n";
$Message = '';
$Message .= 'No Order Today';
if(mail($To, $Subject, $Message, $Headers)){
echo "success";
}else{
echo "failure";
}
$data['column_left'] = $this->load->controller('common/column_left');
$data['column_right'] = $this->load->controller('common/column_right');
$data['content_top'] = $this->load->controller('common/content_top');
$data['content_bottom'] = $this->load->controller('common/content_bottom');
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');
$this->response->setOutput($this->load->view('default/template/product/no.tpl', $data));
}
}
答案 0 :(得分:0)
在控制器页面中我做了一些更改
There are some known install problems for JRE packages due to dependencies reported by RPM package manager.
Switching to DEB or IPK packaging temporarily fixes this.
ie:
PACKAGE_CLASSES = "package_deb"
or
PACKAGE_CLASSES = "package_ipk"
in your 'local.conf' file