コード例 #1
0
ファイル: default_adsummary.php プロジェクト: politik86/test2
				<td class=""><?php 
    echo $adDetail['ad_original_amt'];
    ?>
</td>
			</tr>
			<?php 
    $makecal = 'makepayment();';
}
?>

		<?php 
$cop_dis = 0;
if (!empty($adDetail['ad_coupon'])) {
    // get payment HTML
    JLoader::import('showad', JPATH_SITE . DS . 'components' . DS . 'com_socialads' . DS . 'models');
    $showadmodel = new socialadsModelShowad();
    $adcop = $showadmodel->getcoupon($adDetail['ad_coupon']);
    if ($adcop) {
        if ($adcop[0]->val_type == 1) {
            $cop_dis = $adcop[0]->value / 100 * $adDetail['ad_original_amt'];
        } else {
            $cop_dis = $adcop[0]->value;
        }
    } else {
        $cop_dis = 0;
    }
}
$discountedPrice = $adDetail['ad_original_amt'] - $cop_dis;
?>

コード例 #2
0
<?php

// no direct access
defined('_JEXEC') or die(';)');
JHtml::_('behavior.formvalidation');
$document = JFactory::getDocument();
// get ad preview
// get payment HTML
//JLoader::import('showad',JPATH_SITE.DS.'components'.DS.'com_socialads'.DS.'models');
JLoader::import('showad', JPATH_SITE . DS . 'components' . DS . 'com_socialads' . DS . 'models');
$showadmodel = new socialadsModelShowad();
$preview = $showadmodel->getAds($ad_id);
$this->preview = $preview;
?>

<div class="techjoomla-bootstarp ad_reviewAdmainContainer">
<?php 
$user = JFactory::getUser();
if (!$user->id) {
    ?>
	<div class="alert alert-success">
		<?php 
    echo JText::_('BUILD_LOGIN');
    ?>
	</div>

</div><!--techjoomla bootstrap ends if not logged in-->
	<?php 
    return false;
}
require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php";
コード例 #3
0
ファイル: showad.php プロジェクト: politik86/test2
 function saveOrder($data, $orderid, $pg_nm)
 {
     $db = JFactory::getDBO();
     $paymentdata = new stdClass();
     $paymentdata->id = $orderid;
     $paymentdata->transaction_id = $data['transaction_id'];
     if ($data['status'] == 'C') {
         $paymentdata->status = 'C';
         if (!empty($data['payment_type'])) {
             if ($data['payment_type'] == 'recurring') {
                 $paymentdata->subscription_id = $data['subscription_id'];
                 if (empty($data['payment_number'])) {
                     $paymentdata->status = 'P';
                 }
             }
         }
         $query = "SELECT subscription_id,ad_credits_qty,ad_id FROM #__ad_payment_info WHERE id =" . $orderid;
         $db->setQuery($query);
         $result = $db->loadObject();
         if (!$result->ad_credits_qty) {
             $result->ad_credits_qty = 0;
         }
         //added  for date type ads
         $adid = $result->ad_id;
         $query = "SELECT ad_payment_type FROM #__ad_data WHERE ad_id =" . $adid;
         $db->setQuery($query);
         $ad_payment_type = $db->loadResult();
         if ($ad_payment_type == 2) {
             socialadshelper::adddays($adid, $result->ad_credits_qty);
         } else {
             $query = "UPDATE #__ad_data SET ad_credits = ad_credits + {$result->ad_credits_qty}, ad_credits_balance = ad_credits_balance + {$result->ad_credits_qty} WHERE ad_id=" . $result->ad_id;
             $db->setQuery($query);
             $db->execute();
         }
     }
     $paymentdata->extras = $data['raw_data'];
     if (!$db->updateObject('#__ad_payment_info', $paymentdata, 'id')) {
         echo $db->stderr();
         return false;
     }
     if ($paymentdata->status == 'C') {
         // added by VM:
         $socialadsModelShowad = new socialadsModelShowad();
         $sendmail = $socialadsModelShowad->SendOrderMAil($orderid, $pg_nm, 1);
         // end Vm
         return true;
     } else {
         return false;
     }
 }
コード例 #4
0
ファイル: buildad.php プロジェクト: politik86/test2
 function savePricingData($post)
 {
     $response = array();
     $db = JFactory::getDBO();
     $session = JFactory::getSession();
     require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php";
     $app = JFactory::getApplication();
     //.. do Back End Stuff
     if ($app->isAdmin()) {
         $ad_creator_id = $post->get('ad_creator_id');
         $user = JFactory::getUser($ad_creator_id);
         $userid = $user->id;
     } else {
         $user = JFactory::getUser();
         $userid = $user->id;
     }
     if (!$userid) {
         $userid = 0;
         return false;
     }
     $ad_id = $session->get('ad_id');
     $ad_data = new stdClass();
     $ad_data->ad_id = $ad_id;
     $ad_data->ad_startdate = $post->get('datefrom', '', 'STRING');
     $ad_data->ad_payment_type = $post->get('chargeoption');
     $ad_data->ad_noexpiry = $post->get('unlimited_ad', '', 'INT');
     if ($ad_data->ad_noexpiry == 1) {
         $ad_data->ad_approved = 1;
     }
     $camp_id = '';
     if ($socialads_config['select_campaign'] == 1) {
         $db = JFactory::getDBO();
         $camp_id = $post->get('camp', '0', 'STRING');
         $camp_name = $post->get('camp_name', '', 'STRING');
         $camp_amount = $post->get('camp_amount', '0', 'FLOAT');
         if (!$camp_id && !empty($camp_name) && !empty($camp_amount)) {
             $db = JFactory::getDBO();
             $obj = new stdclass();
             $obj->camp_id = '';
             $obj->user_id = $userid;
             $obj->campaign = $post->get('camp_name', '', 'STRING');
             $obj->daily_budget = $post->get('camp_amount', '0', 'FLOAT');
             $obj->camp_published = 1;
             if ($obj->camp_id) {
                 if (!$db->updateObject('#__ad_campaign', $obj, 'camp_id')) {
                     echo $db->stderr();
                     return false;
                 }
             } else {
                 if (!$db->insertObject('#__ad_campaign', $obj, 'camp_id')) {
                     echo $db->stderr();
                     return false;
                 }
                 $response['camp_id'] = $camp_id = $db->insertid();
             }
         }
         $ad_data->camp_id = $camp_id;
         $ad_data->ad_payment_type = $post->get('pricing_opt', '', 'STRING');
         if ($socialads_config['bidding'] == 1) {
             $ad_data->bid_value = $post->get('bid_value', '', 'STRING');
         }
     }
     if (!$db->updateObject('#__ad_data', $ad_data, 'ad_id')) {
         echo $db->stderr();
         return false;
     }
     //If campaign is selected then there is no need to place order So need to skip oreder code
     //If unlimited ad then there is no need to save payment info so return from here itself
     if ($ad_data->ad_noexpiry == 1) {
         //Delete Price data if already exist
         $db = JFactory::getDBO();
         $query = " DELETE FROM `#__ad_payment_info`\n\t\t\t\t\t WHERE ad_id = " . $ad_id . " AND  status ='P' ";
         $db->setQuery($query);
         $db->execute();
         return true;
     }
     //NO campaign option is not selected then only place order
     if ($socialads_config['select_campaign'] == 0) {
         $paymentdata = new stdClass();
         $paymentdata->id = '';
         //Get ad id
         if ($ad_id) {
             $paymentdata->ad_id = $ad_id;
             //Get order id
             // @params $value,$field_name,$tableName
             //$orderid = $this->getIdFromAnyFieldValue($paymentdata->ad_id, 'ad_id', '#__ad_payment_info');
             $db = JFactory::getDBO();
             $query = " SELECT id FROM `#__ad_payment_info`\n\t\t\t\t\t\t WHERE ad_id = " . $paymentdata->ad_id . " AND  status ='P' ";
             $db->setQuery($query);
             $orderid = $db->loadResult();
             if ($orderid) {
                 $paymentdata->id = $orderid;
             }
         } else {
             $app = JFactory::getApplication();
             $app->enqueueMessage('Session Expire', 'error');
             return false;
         }
         $paymentdata->cdate = date('Y-m-d H:i:s');
         $paymentdata->processor = '';
         $ad_chargeoption = $post->get('chargeoption', '', 'INT');
         if ($ad_chargeoption >= 2) {
             $credits = $post->get('totaldays', '', 'INT');
         } else {
             $credits = $post->get('totaldisplay', '', 'INT');
         }
         $paymentdata->ad_credits_qty = $credits;
         //Need
         $paymentdata->ad_amount = $post->get('totalamount', '', 'FLOAT');
         $paymentdata->ad_original_amt = $post->get('totalamount', '', 'FLOAT');
         $paymentdata->status = 'P';
         //Need
         $paymentdata->ad_coupon = '';
         $paymentdata->payee_id = $userid;
         $paymentdata->ip_address = $_SERVER["REMOTE_ADDR"];
         jimport('joomla.application.component.model');
         JLoader::import('showad', JPATH_ROOT . DS . 'components' . DS . 'com_socialads' . DS . 'models');
         //@ VM CHECK FOR COUPON
         $coupon = $post->get('sa_cop', '', 'RAW');
         //JLoader::import('controller', JPATH_SITE.DS.'components'.DS.'com_socialads');
         $socialadsModelShowad = new socialadsModelShowad();
         $adcop = $socialadsModelShowad->getcoupon($coupon);
         if (!empty($adcop)) {
             if ($adcop[0]->val_type == 1) {
                 $val = $adcop[0]->value / 100 * $paymentdata->ad_original_amt;
             } else {
                 $val = $adcop[0]->value;
             }
             if (!empty($val)) {
                 $paymentdata->ad_coupon = $coupon;
             }
         } else {
             $val = 0;
         }
         $discountedPrice = $paymentdata->ad_original_amt - $val;
         if ($discountedPrice <= 0) {
             $discountedPrice = 0;
         }
         //<!-- TAX CALCULATION-->
         $dispatcher = JDispatcher::getInstance();
         JPluginHelper::importPlugin('adstax');
         //@TODO:need to check plugim type..
         $taxresults = $dispatcher->trigger('addTax', array($discountedPrice));
         //Call the plugin and get the result
         $appliedTax = 0;
         if (!empty($taxresults)) {
             foreach ($taxresults as $tax) {
                 if (!empty($tax)) {
                     $appliedTax += $tax[1];
                 }
             }
         }
         $amountAfterTax = $discountedPrice + $appliedTax;
         $paymentdata->ad_amount = $amountAfterTax;
         // if order amount is 0 due to coupon
         if ($paymentdata->ad_amount == 0 && !empty($paymentdata->ad_coupon)) {
             //$paymentdata->status = 'C';
         }
         //@ VM CHECK FOR COUPON
         if (!$paymentdata->id) {
             if (!$db->insertObject('#__ad_payment_info', $paymentdata, 'id')) {
                 echo $db->stderr();
                 return false;
             }
         } else {
             if (!$db->updateObject('#__ad_payment_info', $paymentdata, 'id')) {
                 echo $db->stderr();
                 return false;
             }
         }
     }
     return $response;
 }
コード例 #5
0
ファイル: helper.php プロジェクト: politik86/test2
 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']);
 }
コード例 #6
0
ファイル: default.php プロジェクト: politik86/test2
	</div><!--techjoomla bootstrap ends if not logged in-->
	<?php 
    return false;
}
$buildadsession = JFactory::getSession();
$plugin = JPluginHelper::getPlugin('payment', $buildadsession->get('ad_gateway'));
if (!isset($plugin)) {
    $pluginParams = json_decode($plugin->params);
    $arb_support = $pluginParams->arb_support;
}
$ad_image = $buildadsession->get('ad_image');
/////Values are taken when zone pricing Enabled
//$payhtml = $model->getpayHTML($order['order_info'][0]->processor,$order_id);
// added by VM
JLoader::import('showad', JPATH_SITE . DS . 'components' . DS . 'com_socialads' . DS . 'models');
$model = new socialadsModelShowad();
// VM : end
if ($socialads_config['zone_pricing'] == '1') {
    $buildadsession = JFactory::getSession();
    $zoneid = $buildadsession->get('adzone');
    //print_r($zoneid); die('sdf');
    $zonedata = $model->getzonedata($zoneid);
    $socialads_config['clicks_price'] = $zonedata['0']->per_click;
    $socialads_config['date_price'] = $zonedata['0']->per_day;
    $socialads_config['impr_price'] = $zonedata['0']->per_imp;
}
//Added by sagar hardcoded for now
if ($socialads_config['select_campaign'] == 0) {
    /////Values are taken when zone pricing Enabled
    if ($this->chargeoption == 1) {
        $cal = $this->ad_totaldisplay * $socialads_config['clicks_price'];