Esempio n. 1
0
 /**
  * vendorEmail
  *
  * @param   string  $order    order
  * @param   string  $orderid  orderid
  *
  * @return  Void
  */
 public function vendorEmail($order, $orderid)
 {
     $fullorder_id = $order['order_info'][0]->prefix . $orderid;
     // Getting orderitem infomation
     $comquick2cartHelper = new comquick2cartHelper();
     $order_details = $comquick2cartHelper->getOrderitems($orderid);
     // GETTTING STORE INFORMATION
     $store_array = array();
     $storeinfo = array();
     foreach ($order_details as $cart) {
         if (!in_array($cart['store_id'], $store_array)) {
             $store_array[] = $cart['store_id'];
             $qtc_store_id = $cart['store_id'];
             $storeinfo[$qtc_store_id] = $comquick2cartHelper->getSoreInfo($cart['store_id']);
         }
     }
     $original_order_data = $order;
     foreach ($storeinfo as $key => $sinfo) {
         // Check for view override
         $view = $comquick2cartHelper->getViewpath('orders', 'order');
         $this->orders_site = 1;
         $this->orders_email = 1;
         $this->vendor_email = 1;
         $this->order_authorized = 1;
         // STORE RELEATED VIEW
         $this->storeReleatedView = 1;
         $html = '';
         $temp = $original_order_data['items'];
         // 3. REMOVE other verder store item  information
         foreach ($temp as $k => $order_item) {
             if ($order_item->store_id != $key) {
                 unset($temp[$k]);
             }
         }
         $this->orderinfo = $original_order_data['order_info'];
         $this->vendor_email = 1;
         $this->vendor_store_id = $key;
         $this->orderitems = $temp;
         $mainframe = JFactory::getApplication();
         $site = $mainframe->getCfg('sitename');
         $html = '<div>' . JText::sprintf('QTC_ORDER_VENDER_MAIL_MSG', $sinfo['title']) . '</div>';
         $subject = JText::sprintf('QTC_ORDER_MAIL_SUB', $site, $fullorder_id);
         ob_start();
         include $view;
         $html = ob_get_contents();
         ob_end_clean();
         $body = $html;
         $comquick2cartHelper->sendmail($sinfo['store_email'], $subject, $body, '');
     }
 }