OpenCart触发模板页面的控制器功能

时间:2014-07-17 19:46:33

标签: php opencart

以下功能在控制器admin/controller/sale/customer.php内调用时有效,但有人可以告诉我如何从模板admin/view/template/sale/customer_form.tpl中的表单中调用它吗?

    public function process_cart() {
        $this->load->model('sale/order');
        $this->load->model('sale/customer');
        $cust = $this->model_sale_customer->getCustomer($this->request->get['customer_id']);
          function add_tax(&$data) {
                foreach($data as &$details)
                    $details['tax'] = 0;
                return $data;
            }

          $order_product = add_tax($this->data['products']);

          $order_details = array(
                'store_id' => 1,
                'customer_id' => $cust['customer_id'],
                'customer_group_id' => 1,
                'firstname' => $cust['firstname'],
                'lastname' => $cust['lastname'],
                'email' => $cust['email'],
                'telephone' => $cust['telephone'],
                'fax' => $cust['fax'],
                'payment_firstname' => $cust['firstname'],
                'payment_lastname' => $cust['lastname'],
                'more_keys' =>  'and_values_etc',
                'order_product' => $order_product
                );

        $this->model_sale_order->addOrder($order_details);

    }

顺便说一下,该功能的作用是获取用户保存的购物车的内容(使用Admin View Customers Saved Cart扩展程序呈现),然后从管理员端将其转换为订单。我们在食品购买俱乐部使用它,价格和供货情况是近似的,直到货物到货。

到目前为止,这就是我在模板中所拥有的一切:

        <form action="<?php echo $action; ?>" method="post">
        <input type="hidden" name="process" value="process">
        <input type="submit" value="Process Order">
        </form>

0 个答案:

没有答案