我试图获取
上每个订单的order_idcatalog/controller/checkout/success.php
if (isset($this->session->data['order_id'])) {
$this->cart->clear();
//JACK - ADD ORDER ID TO NEW VARIABLE
$order_id = $this->session->data['order_id'];
//END MODIFICATION
unset($this->session->data['shipping_method']);
unset($this->session->data['shipping_methods']);
unset($this->session->data['payment_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['guest']);
unset($this->session->data['comment']);
unset($this->session->data['order_id']);
unset($this->session->data['coupon']);
unset($this->session->data['reward']);
unset($this->session->data['voucher']);
unset($this->session->data['vouchers']);
}
但是我收到了错误:
Undefined variable: order_id in /Applications/XAMPP/xamppfiles/htdocs/opencart/catalog/controller/checkout/success.php on line 121
foreach($get_order_products as $prod){
$order_products[] = array(
'order_id' => $order_id
);
}
答案 0 :(得分:1)
你的代码应该是这样的,试试这个。
目录/控制器/结帐/ success.php
if (isset($this->session->data['order_id'])) {
$this->cart->clear();
//JACK - ADD ORDER ID TO NEW VARIABLE
$order_id = $this->session->data['order_id'];
//END MODIFICATION
unset($this->session->data['shipping_method']);
unset($this->session->data['shipping_methods']);
unset($this->session->data['payment_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['guest']);
unset($this->session->data['comment']);
unset($this->session->data['coupon']);
unset($this->session->data['reward']);
unset($this->session->data['voucher']);
unset($this->session->data['vouchers']);
}
foreach($get_order_products as $prod){
$order_products[] = array(
'order_id' => $order_id
);
}
unset($this->session->data['order_id']);