function getcustomer() { if (!class_exists('BookProModelCustomer')) { AImporter::model('customer'); } $user = JFactory::getUser(); $model = new BookProModelCustomer(); $customer = $model->getItem($model->getIdByUserId()); echo json_encode($customer); die; }
function display($tpl = null) { $user = JFactory::getUser(); $this->customer = new JObject(); if (!$user->get('guest') && !$is_agent) { $model = new BookProModelCustomer(); $customer = $model->getItemByUser(); $this->customer = $customer; } $this->config = JComponentHelper::getParams('com_bookpro'); $this->plugins = $this->getPlugins(); parent::display($tpl); }
public function display($tpl = null) { $this->item = $this->get('Item'); $this->form = $this->get('Form'); $this->order = $this->item; if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $cModel = new BookProModelCustomer(); //$cModel->setId($this->order->user_id); $this->customer = $cModel->getItem($this->order->user_id); //getObject(); if ($this->getLayout() != 'default') { $this->addToolbar(); } parent::display($tpl); }
function getObjectByID($id) { AImporter::model('orderinfos', 'customer'); $query = 'SELECT `obj`.*, c.mobile,c.firstname,c.email FROM `' . $this->_table->getTableName() . '` AS `obj` '; $query .= 'LEFT JOIN `#__bookpro_customer` AS `c` ON `c`.`id` = `obj`.`user_id` '; $query .= 'WHERE `obj`.`id` = ' . (int) $id; $this->_db->setQuery($query); $obj =& $this->_db->loadObject(); //load orderinfo $infosmode = new BookProModelOrderinfos(); $infolists = array('order_id' => $id); $infosmode->init($infolists); $infos = $infosmode->getData(); $obj->infos = $infos; //load customer $customerModel = new BookProModelCustomer(); //$customerModel->setId($obj->user_id); $customer = $customerModel->getItem($obj->user_id); //getObject(); $obj->customer = $customer; return $obj; }
/** * Save subject. * * @param boolean $apply true state on edit page, false return to browse list */ function sendemail() { AImporter::model('customer', 'order', 'application'); $body_customer = JFile::read(JPATH_COMPONENT_ADMINISTRATOR . DS . 'templates' . DS . 'emailconfirm.html'); $amount = JRequest::getVar('amount'); $order_id = JRequest::getVar('order_id'); $orderModel = new BookProModelOrder(); $applicationModel = new BookProModelApplication(); $customerModel = new BookProModelCustomer(); //$orderModel->setId($order_id); $order = $orderModel->getItem($order_id); //getObject(); $customerModel->setId($order->user_id); $customer = $customerModel->getObject(); $app = $applicationModel->getObjectByCode($order->type); AImporter::helper('email'); $body_customer = EmailHelper::fillCustomer($body_customer, $customer); $body_customer = EmailHelper::fillOrder($body_customer, $order); $payment_link = JURI::root() . 'index.php?option=com_bookpro&task=paymentredirect&controller=payment&order_id=' . $order->id; $body_customer = str_replace('{payment_link}', $payment_link, $body_customer); $order->order_status = "CONFIRMED"; $order->store(); BookProHelper::sendMail($this->app->email_send_from, $app->email_send_from_name, $customer->email, $app->email_customer_subject, $body_customer, true); $this->setRedirect(JURI::root() . '/administrator/index.php?option=com_bookpro&view=orders'); return; }
function exportmonthpdf() { $datefrom = JFactory::$application->input->get('datefrom'); $dateto = JFactory::$application->input->get('dateto'); AImporter::helper('pdf', 'order'); AImporter::model('customer'); $customerModel = new BookProModelCustomer(); $customer = $customerModel->getItemByUser(); $user_id = $customer->id; AImporter::model('orders'); $model = new BookProModelOrders(); $state = $model->getState(); $state->set('list.start', 0); $state->set('list.limit', 0); $state->set('filter.datefrom', $datefrom); $state->set('filter.dateto', $dateto); $state->set('filter.user_id', $user_id); $orders = $model->getItems(); $object = new JObject(); $object->orders = $orders; $object->customer = $customer; $object->order_number = time(); $object->date = JText::sprintf('COM_BOOKPRO_BILL_FROM_TO', $datefrom, $dateto); $ticket_view = $this->getView('ordersagent', 'html', 'BookProView'); if ($user_id) { $ticket_view->ordersComplex = $object; ob_start(); $ticket_view->display(); $pdf = ob_get_contents(); ob_clean(); PrintPdfHelper::printTicket($pdf, $object); } else { JFactory::getApplication()->enqueueMessage(JText::_('COM_BOOKPRO_CAN_NO_FIND_ORDERS_FOR_PRINTING')); $this->setRedirect(JURI::base() . 'controller=order&task=ordersdetailmonth'); } }
function exportmonthpdf() { $datefrom = JFactory::$application->input->get('datefrom'); $dateto = JFactory::$application->input->get('dateto'); $id = JFactory::$application->input->get('id'); AImporter::helper('pdf', 'order'); AImporter::model('customer'); $customerModel = new BookProModelCustomer(); $customer = $customerModel->getItem($id); $user_id = $customer->id; AImporter::model('orders'); $model = new BookProModelOrders(); $state = $model->getState(); $state->set('list.start', 0); $state->set('list.limit', 0); $state->set('filter.datefrom', $datefrom); $state->set('filter.dateto', $dateto); $state->set('filter.user_id', $user_id); $orders = $model->getItems(); $object = new JObject(); $object->orders = $orders; $object->customer = $customer; $object->order_number = time(); $object->date = JText::sprintf('COM_BOOKPRO_BILL_FROM_TO', $datefrom, $dateto); $ticket_view = $this->getView('ordersagent', 'html', 'BookProView'); $ticket_view->ordersComplex = $object; ob_start(); $ticket_view->display(); $pdf = ob_get_contents(); ob_clean(); PrintPdfHelper::printTicket($pdf, $object); }
public function registerNotify($custtomer_id) { $customerModel = new BookProModelCustomer(); $this->customer = $customerModel->getComplexItem($custtomer_id); $body_admin = $this->config->sendRegistrationsBodyAdmin; $body_customer = $this->config->sendRegistrationsBodyCustomer; $body_customer = $this->fillCustomer($body_customer); $body_admin = $this->fillCustomer($body_admin); if ($this->config->sendRegistrationsEmails = 1 || ($this->config->sendRegistrationsEmails = 3)) { BookProHelper::sendMail($this->config->sendRegistrationsEmailsFrom, $this->config->sendRegistrationsEmailsFromname, $customer->email, $this->config->sendRegistrationsEmailsSubjectCustomer, $body_customer, true); } if ($this->config->sendRegistrationsEmails = 1 || ($this->config->sendRegistrationsEmails = 2)) { BookProHelper::sendMail($config->sendRegistrationsEmailsFrom, $config->sendRegistrationsEmailsFromname, $config->sendRegistrationsEmailsFrom, $config->sendRegistrationsEmailsSubjectAdmin, $body_admin, $htmlMode); } }
function getFullObject() { AImporter::model('orderinfos', 'customer'); $orders = $this->getData(); //load orderinfo foreach ($orders as $order) { $infomodel = new BookProModelOrderinfos(); $lists = array('order_id' => $order->id); $infomodel->init($lists); $infos = $infomodel->getData(); $order->infos = $infos; $customerModel = new BookProModelCustomer(); //$customerModel->setId($order->user_id); $customer = $customerModel->getItem($order->user_id); //getObject(); $order->customer = $customer; } //load customer/ return $orders; }