Ejemplo n.º 1
0
 function processFreeOrder($adminCall = 0)
 {
     $jinput = JFactory::getApplication()->input;
     $order_id = $jinput->get('order_id', '', 'STRING');
     $socialadshelper = new socialadshelper();
     $adDetail = $socialadshelper->syncOrderDetail($order_id);
     // if order amount is 0 due to coupon
     if ($adDetail->ad_amount == 0 && !empty($adDetail->ad_coupon)) {
         $db = JFactory::getDBO();
         $row = new stdClass();
         $row->status = 'C';
         $row->id = $order_id;
         if (!$db->updateObject('#__ad_payment_info', $row, 'id')) {
             echo $this->_db->stderr();
         }
         $modelPath = JPATH_SITE . DS . 'components' . DS . 'com_socialads' . DS . 'models' . DS . 'showad.php';
         if (!class_exists('socialadsModelShowad')) {
             //require_once $path;
             JLoader::register('socialadsModelShowad', $modelPath);
             JLoader::load('socialadsModelShowad');
         }
         $data = array();
         $data['status'] = 'C';
         $data['payment_type'] = '';
         $data['raw_data'] = '';
         $pg_nm = '';
         $socialadsModelShowad = new socialadsModelShowad();
         $socialadsModelShowad->saveOrder($data, $order_id, $pg_nm);
     }
     $mainframe = JFactory::getApplication();
     $response['msg'] = JText::_('DETAILS_SAVE');
     if ($adminCall == 1) {
         $link = 'index.php?option=com_socialads&view=approveads';
     } else {
         $Itemid = $socialadshelper->getSocialadsItemid('managead');
         $link = JUri::base() . substr(JRoute::_('index.php?option=com_socialads&view=managead&layout=list&Itemid=' . $Itemid, false), strlen(JUri::base(true)) + 1);
     }
     $mainframe->redirect($link, $response['msg']);
 }