function getAllOptions() { $list = oseMscPublic::getList(); $options = array(); $msc = oseRegistry::call('msc'); foreach ($list as $key => $entry) { $msc_id = oseObject::getValue($entry, 'id'); $node = $msc->getInfo($msc_id, 'obj'); $paymentInfos = $msc->getExtInfo($msc_id, 'payment'); $cart = oseMscPublic::getCart(); $osePaymentCurrency = $cart->get('currency'); $option = oseMscPublic::generatePriceOption($node, $paymentInfos, $osePaymentCurrency); $options = array_merge($options, $option); } return $options; }
protected function generateMscIdOption() { $list = oseMscPublic::getList(); $result = array(); if (!empty($list)) { $cart = oseMscPublic::getCart(); $options = array(); $msc = oseRegistry::call('msc'); foreach ($list as $key => $entry) { $msc_id = oseObject::getValue($entry, 'id'); $node = $msc->getInfo($msc_id, 'obj'); $paymentInfos = $msc->getExtInfo($msc_id, 'payment'); $osePaymentCurrency = $cart->get('currency'); $option = oseMscPublic::generatePriceOption($node, $paymentInfos, $osePaymentCurrency); $options = array_merge($options, $option); } $mscList = array('total' => count($list), 'results' => $list); $mscOptions = array('total' => count($options), 'results' => $options); $result = array(); $result['mscList'] = $mscList; $result['mscOptions'] = $mscOptions; } else { $result['mscList'] = array(); $result['mscOptions'] = array(); } return $result; }
public static function save($params) { if(!class_exists('oseMscPublic')) { require_once(OSEMSC_F_HELPER.DS.'oseMscPublic.php'); } $result = array(); $result['success'] = true; //oseExit($params); if(empty($params['allow_work'])) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('Error Join.PAP'); return $result; } unset($params['allow_work']); /* Offline payments should be counted as well; removed from v 6.0.5 if( $params['join_from'] != 'payment') { $result['success'] = true; $result['title'] = JText::_('Done'); $result['content'] = JText::_('Done Join.Order'); return $result; } */ $oseMscConfig = oseRegistry::call('msc')->getConfig('thirdparty','obj'); if(empty($oseMscConfig->pap_enable)) { return $result; } if(empty($oseMscConfig->pap_url)) { return $result; } $db = oseDB::instance(); //$post = JRequest::get('post'); $msc_id = $params['msc_id']; $member_id = $params['member_id']; $order_id = $params['order_id']; $order_item_id = $params['order_item_id']; $where = array(); $where[] = "order_id = {$order_id}"; $payment = oseRegistry::call('payment'); $curOrder = $payment->getOrder($where,'obj'); $curOrderParams = oseJson::decode($curOrder->params); $recurrence_times = ($curOrderParams->has_trial)?$curOrderParams->recurrence_times+1:$curOrderParams->recurrence_times; $member = oseRegistry::call('member'); $member->instance($member_id); $userInfo = $member->getUserInfo('obj'); $memParams = $member->getMemberInfo($msc_id,'obj')->memParams; $memParams = oseJSON::decode($memParams); $memParams->first_ip = oseObject::getValue($curOrderParams,'first_ip');; if(empty($curOrderParams->pap_visitorid)) { return $result; //$memParams->pap_visitorid = 'paypal'; } else { $memParams->pap_visitorid = $curOrderParams->pap_visitorid; //$memParams->pap_visitorid = $_COOKIE['PAPVisitorId']; } $memParams_encode = oseJSON::encode($memParams); $query = " UPDATE `#__osemsc_member`" ." SET params = ".$db->Quote($memParams_encode) ." WHERE msc_id = {$msc_id} AND member_id = {$member_id}" ; $db->setQuery($query); //oseExit($db->_sql); if(!oseDB::query()) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('Error Join.Order.2'); return $result; } try { require_once(OSEMSC_B_LIB.DS.'PapApi.class.php'); $saleTracker = new Pap_Api_SaleTracker($oseMscConfig->pap_url.'/scripts/sale.php'); $saleTracker->setAccountId(oseObject::getValue($oseMscConfig,'pap_account_id','default1')); $saleTracker->setVisitorId($memParams->pap_visitorid); $sale1 = $saleTracker->createSale(); $msc = oseRegistry::call('msc'); $where = array(); $where[] = "`order_item_id` = '{$order_item_id}'"; $curOrderItem = $payment->getInstance('Order')->getOrderItem($where,'obj'); $curOrderItemParams = oseJson::decode($curOrderItem->params); $node = $msc->getInfo($msc_id,'obj'); $paymentInfos = $msc->getExtInfo($msc_id,'payment'); foreach($paymentInfos as $key => $paymentInfo) { if($key != $curOrderItemParams->msc_option) { unset($paymentInfos[$key]); } } $cart = oseMscPublic::getCart(); $osePaymentCurrency = $cart->get('currency'); $items = $cart->get('items'); $options = oseMscPublic::generatePriceOption($node,$paymentInfos,$osePaymentCurrency); $sale1->setTotalCost($curOrder->payment_price); $sale1->setOrderID($order_id); $sale1->setProductID("{$node->title}-{$options[0]['title']}"); $sale1->setData1($userInfo->email); $sale1->setData2($userInfo->jname); $sale1->setData3($memParams->first_ip); $sale1->setData4($curOrder->payment_serial_number); $sale1->setData5("{$curOrder->order_id}-{$node->title}-{$options[0]['title']}-#recurrence:{$recurrence_times}"); $saleTracker->register(); //$memParams->pap_affiliate_id = $sale1->getAffiliateId(); //$memParams->pap_campaign_id = $sale1->getCampaignId(); //$memParams->pap_banner_id = $sale1->getBannerId(); // Order problem for system add return $result; } catch (Exception $e) { return $result; } }
public static function renew($params) { if(!class_exists('oseMscPublic')) { require_once(OSEMSC_F_HELPER.DS.'oseMscPublic.php'); } $result = array(); $result['success'] = true; if(empty($params['allow_work'])) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('Error Renew.Order'); return $result; } //unset($params['allow_work']); $oseMscConfig = oseRegistry::call('msc')->getConfig('thirdparty','obj'); $db = oseDB::instance(); //$post = JRequest::get('post'); $msc_id = $params['msc_id']; $member_id = $params['member_id']; $order_id = $params['order_id']; $order_item_id = $params['order_item_id']; $where = array(); $where[] = "order_id = {$order_id}"; $payment = oseRegistry::call('payment'); $curOrder = $payment->getOrder($where,'obj'); $curOrderParams = oseJson::decode($curOrder->params); $recurrence_times = ($curOrderParams->has_trial)?oseObject::getValue($curOrderParams,'recurrence_times',0)+1:oseObject::getValue($curOrderParams,'recurrence_times',0); if(oseObject::GetValue($config, 'oseaffiliate_enabled',true)) { if(empty($curOrderParams->oseaffiliateID) || empty($curOrderParams->osebannerID)) { return true; } else { //$memParams->oseaffiliateID = $curOrderParams->oseaffiliateID; //$memParams->osebannerID = $curOrderParams->osebannerID; } $file = JPATH_ADMINISTRATOR.DS.'com_ose_affiliates'.DS.'helpers'.DS.'oseaffiliates_helper.php'; if ( JFile::exists($file) ) { require_once($file); } else { return false; } $msc = oseRegistry::call('msc'); $where = array(); $where[] = "`order_item_id` = '{$order_item_id}'"; $curOrderItem = $payment->getInstance('Order')->getOrderItem($where,'obj'); $curOrderItemParams = oseJson::decode($curOrderItem->params); $node = $msc->getInfo($msc_id,'obj'); $paymentInfos = $msc->getExtInfo($msc_id,'payment'); foreach($paymentInfos as $key => $paymentInfo) { if($key != $curOrderItemParams->msc_option) { unset($paymentInfos[$key]); } } $osePaymentCurrency = $curOrder->payment_currency; $options = oseMscPublic::generatePriceOption($node,$paymentInfos,$osePaymentCurrency); $product = "{$node->title}-{$options[0]['title']}"; $helper = new oseAffiliatesHelper(); $helper->setTotalCost($curOrder->payment_price); $helper->setOrderId($order_id); $helper->setProduct($product); $helper->setCurrency($osePaymentCurrency); $helper->setAffiliateId($curOrderParams->oseaffiliateID); $helper->setBannerId($curOrderParams->osebannerID); if(!$helper->createSale()) { return false; } } return $result; }
public static function getOptions() { $msc_id = JRequest::getInt('msc_id', 0); $msc = oseRegistry::call('msc'); $node = $msc->getInfo($msc_id, 'obj'); $paymentInfos = $msc->getExtInfo($msc_id, 'payment'); $cart = oseMscPublic::getCart(); $osePaymentCurrency = $cart->get('currency'); $option = oseMscPublic::generatePriceOption($node, $paymentInfos, $osePaymentCurrency); $options = array(); $options = array_merge($options, $option); /* $session =& JFactory::getSession(); $osePaymentCurrency = $session->get('osePaymentCurrency',oseRegistry::call('msc')->getConfig('currency','obj')->primary_currency); $oseMscPayment = $session->get('oseMscPayment',array('msc_id'=>0,'msc_option'=>0)); $option = array(); if(!empty($oseMscPayment['msc_option'])) { $paymentInfo = oseObject::getValue($paymentInfos,$oseMscPayment['msc_option']); $node = oseRegistry::call('payment')->getInstance('View')->getPriceStandard($node,$paymentInfo,$osePaymentCurrency); $optionPrice = oseObject::getValue($node,'standard_price').' for every '.oseObject::getValue($node,'standard_recurrence') ; if(oseObject::getValue($paymentInfo,'has_trial')) { $node = oseRegistry::call('payment')->getInstance('View')->getPriceTrial($node,$paymentInfo,$osePaymentCurrency); $optionPrice .= ' ('.oseObject::getValue($node,'trial_price').' in first '.oseObject::getValue($node,'trial_recurrence').')'; } $option[] = array('id'=>oseObject::getValue($paymentInfo,'id'),'text'=>$optionPrice); } else { foreach($paymentInfos as $paymentInfo) { $node = oseRegistry::call('payment')->getInstance('View')->getPriceStandard($node,$paymentInfo,$osePaymentCurrency); $optionPrice = oseObject::getValue($node,'standard_price').' for every '.oseObject::getValue($node,'standard_recurrence') ; if(oseObject::getValue($paymentInfo,'has_trial')) { $node = oseRegistry::call('payment')->getInstance('View')->getPriceTrial($node,$paymentInfo,$osePaymentCurrency); $optionPrice .= ' ('.oseObject::getValue($node,'trial_price').' in first '.oseObject::getValue($node,'trial_recurrence').')'; } $option[] = array('id'=>oseObject::getValue($paymentInfo,'id'),'text'=>$optionPrice); } } */ $combo = array(); $combo['total'] = count($options); $combo['results'] = $options; $combo = oseJson::encode($combo); oseExit($combo); }
function ajaxOrderTrack($account, $order_id) { $db = JFactory::getDBO(); $where = array('`order_id`=' . $db->Quote($order_id)); $code = array(); if (!JFile::exists(JPATH_SITE . DS . 'components' . DS . 'com_osemsc' . DS . 'init.php')) { return false; } else { require_once(JPATH_SITE . DS . 'components' . DS . 'com_osemsc' . DS . 'init.php'); } $db = oseDB::instance(); $pOrder = oseRegistry::call('payment')->getInstance('Order'); $orderInfo = $pOrder->getOrder($where, 'obj'); $orderInfoParams = oseJson::decode($orderInfo->params); // transaction $code[] = 'var pageTracker = _gat._getTracker("' . $account . '");'; $code[] = "pageTracker._addTrans("; $code[] = "'{$orderInfo->order_id}',"; $code[] = "'{$orderInfo->order_number}',"; $code[] = "'{$orderInfo->payment_price}',"; $code[] = "'{$orderInfoParams->gross_tax}',"; $code[] = "'0',"; $code[] = "'',"; $code[] = "'', "; $code[] = "'' "; $code[] = ");"; // product $msc = oseRegistry::call('msc'); $orderItems = $pOrder->getOrderItems($orderInfo->order_id, 'obj'); foreach ($orderItems as $orderItem) { $curOrderItemParams = oseJson::decode($orderItem->params); $msc_id = $orderItem->entry_id; $node = $msc->getInfo($msc_id, 'obj'); $paymentInfos = $msc->getExtInfo($msc_id, 'payment'); foreach ($paymentInfos as $key => $paymentInfo) { if ($key != $curOrderItemParams->msc_option) { unset($paymentInfos[$key]); } } $cart = oseMscPublic::getCart(); $osePaymentCurrency = $cart->get('currency'); $items = $cart->get('items'); $options = oseMscPublic::generatePriceOption($node, $paymentInfos, $osePaymentCurrency); $option = $options[0]; $code[] = "pageTracker._addItem("; $code[] = "'{$orderItem->order_id}',"; $code[] = "'{$orderItem->entry_type}_{$orderItem->entry_id}',"; $code[] = "'{$node->title}-{$option['title']}',"; $code[] = "'{$orderItem->entry_type}',"; $code[] = "'{$orderItem->payment_price}',"; $code[] = "'1'"; $code[] = ");"; } $code[] = "pageTracker._trackTrans();"; return $code; }
private static function getAllOptions() { $list = oseMscPublic::getList(); $options = array(); $msc = oseRegistry::call('msc'); foreach($list as $key => $entry) { $msc_id = oseObject::getValue($entry,'id',0); $node = $msc->getInfo($msc_id,'obj'); $paymentInfos = $msc->getExtInfo($msc_id,'payment'); $cart = oseMscPublic::getCart(); $osePaymentCurrency = $cart->get('currency'); $items = $cart->get('items'); $option = oseMscPublic::generatePriceOption($node,$paymentInfos,$osePaymentCurrency); $paymentAdvInfos = $msc->getExtInfo($msc_id,'paymentAdv'); foreach ( $option as $key => $obj ) { $visible = self::checkVisibility($msc_id, $obj['id'], $paymentAdvInfos); if ($visible != true) { unset($option[$key]); } } $options = array_merge($options,$option); } $combo = array(); $combo['total'] = count($options); $combo['results'] = $options; $combo = oseJson::encode($combo); oseExit($combo); }
protected function generateMscIdOptionJS() { $list = oseMscPublic::getList(); $cart = oseMscPublic::getCart(); $selectedMsc = oseMscAddon::runAction('register.msc.getSelectedMsc', array()); $options = array(); $msc = oseRegistry::call('msc'); foreach ($list as $key => $entry) { $msc_id = oseObject::getValue($entry, 'id'); $node = $msc->getInfo($msc_id, 'obj'); $paymentInfos = $msc->getExtInfo($msc_id, 'payment'); $osePaymentCurrency = $cart->get('currency'); $option = oseMscPublic::generatePriceOption($node, $paymentInfos, $osePaymentCurrency); $options = array_merge($options, $option); } $currency = oseMscPublic::getCurrency(); $mscList = array('total' => count($list), 'results' => $list); $mscOptions = array('total' => count($options), 'results' => $options); $currency = array('total' => count($currency), 'results' => $currency); $output = "var getMscList = function() {return " . oseJson::encode($mscList) . "};"; $output .= "\r\n"; $output .= "var getMscOption = function() {return " . oseJson::encode($mscOptions) . "};"; return $output; }
public static function getMscInfo($params = array()) { $my = JFactory::getUser(); $msc_id = JRequest::getInt('msc_id', 0); $member_id = $my->id; $db = oseDB::instance(); $query = " SELECT * FROM `#__osemsc_member`" . " WHERE member_id = {$member_id} AND msc_id = {$msc_id}"; $db->setQuery($query); $item = oseDB::loadItem('obj'); $memParams = oseJson::decode($item->params); //order $orderId = oseObject::getValue($memParams, 'order_id'); $orderInfo = oseRegistry::call('payment')->getInstance('Order')->getOrder(array('order_id = ' . $orderId), 'obj'); //order item $orderItemId = oseObject::getValue($memParams, 'order_item_id', 'm'); $orderItemInfo = oseRegistry::call('payment')->getInstance('Order')->getOrderItem(array('0' => 'order_item_id = ' . $orderItemId), 'obj'); $orderItemInfoParams = oseJson::decode($orderItemInfo->params); $msc = oseRegistry::call('msc'); $node = $msc->getInfo($msc_id, 'obj'); $paymentInfos = $msc->getExtInfo($msc_id, 'payment'); $paymentInfo = $paymentInfos[oseObject::getValue($orderItemInfoParams, 'msc_option')]; $option = oseMscPublic::generatePriceOption($node, array($paymentInfo), 'USD'); if (oseObject::getValue($memParams, 'payment_mode', 'm') == 'm') { $titlePaymentMode = JText::_('MANUAL_BILLING'); $query = " SELECT acl.*,mem.*, (SELECT DATEDIFF(mem.expired_date,NOW())) AS days_left " . " ,mem.`expired_date` AS `real_expired_date`" . " FROM `#__osemsc_member` AS mem " . " INNER JOIN `#__osemsc_acl` AS acl ON acl.id = mem.msc_id" . " WHERE mem.member_id = {$member_id} AND mem.msc_id = {$msc_id}"; } else { $titlePaymentMode = JText::_('AUTOMATIC_BILLING'); $query = " SELECT acl.*,mem.*, (SELECT DATEDIFF(mem.expired_date,NOW()) - 1) AS days_left " . " ,DATE_SUB(mem.`expired_date`,INTERVAL 1 DAY) AS `real_expired_date`" . " FROM `#__osemsc_member` AS mem " . " INNER JOIN `#__osemsc_acl` AS acl ON acl.id = mem.msc_id" . " WHERE mem.member_id = {$member_id} AND mem.msc_id = {$msc_id}"; } $db->setQuery($query); $item = oseDB::loadItem(); $globalConfig = oseRegistry::call('msc')->getConfig('global', 'obj'); if ($item['start_date'] != '0000-00-00 00:00:00' && !empty($globalConfig->DateFormat)) { $item = oseObject::setValue($item, 'start_date', date($globalConfig->DateFormat, strtotime($item['start_date']))); } if ($item['real_expired_date'] != '0000-00-00 00:00:00' && !empty($globalConfig->DateFormat)) { $item = oseObject::setValue($item, 'real_expired_date', date($globalConfig->DateFormat, strtotime($item['real_expired_date']))); } if (oseObject::getValue($item, 'eternal', false)) { $item = oseObject::setValue($item, 'real_expired_date', JText::_('LIFE_TIME')); $item = oseObject::setValue($item, 'days_left', JText::_('INFINITED')); } $result = array(); if (empty($item)) { $result['total'] = 0; $result['result'] = array(); } else { $item['title'] = oseObject::getValue($option[0], 'title') . "({$titlePaymentMode})"; $item['msc_option'] = oseObject::getValue($orderItemInfoParams, 'msc_option'); $item['expired_date'] = $item['real_expired_date']; $item['params'] = oseJson::decode($item['params']); if ($item['status'] == 1) { $exp_text = ''; if (oseObject::getValue($memParams, 'payment_mode', 'm') == 'a') { if (in_array($orderInfo->order_status, array('cancelled'))) { $exp_text = ' until ' . $item['expired_date']; } } $item['status'] = JText::_('ACTIVE') . ' ' . $exp_text; } else { $item['status'] = JText::_('INACTIVE'); } $item['payment_mode_text'] = ($item['params']->payment_mode == 'm') ? JText::_('MANUAL_RENEWING') : JText::_('AUTOMATIC_RENEWING'); if (empty($paymentInfo)) { $item['interval'] = '--'; } else { $item['interval'] = oseObject::getValue($paymentInfo, 'p3') . ' ' . JText::_(strtoupper(oseObject::getValue($paymentInfo, 't3'))) . '(s)'; } $result['total'] = 1; $result['result'] = $item; } return $result; }
public static function renew($params) { if(!class_exists('oseMscPublic')) { require_once(OSEMSC_F_HELPER.DS.'oseMscPublic.php'); } $result = array(); $result['success'] = true; if(empty($params['allow_work'])) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('Error Renew.Order'); return $result; } //unset($params['allow_work']); $oseMscConfig = oseRegistry::call('msc')->getConfig('thirdparty','obj'); if(empty($oseMscConfig->pap_enable)) { return $result; } if(empty($oseMscConfig->pap_url)) { return $result; } $db = oseDB::instance(); //$post = JRequest::get('post'); $msc_id = $params['msc_id']; $member_id = $params['member_id']; $order_id = $params['order_id']; $order_item_id = $params['order_item_id']; $where = array(); $where[] = "order_id = {$order_id}"; $payment = oseRegistry::call('payment'); $curOrder = $payment->getOrder($where,'obj'); $curOrderParams = oseJson::decode($curOrder->params); $recurrence_times = ($curOrderParams->has_trial)?oseObject::getValue($curOrderParams,'recurrence_times',0)+1:oseObject::getValue($curOrderParams,'recurrence_times',0); $member = oseRegistry::call('member'); $member->instance($member_id); $userInfo = $member->getUserInfo('obj'); $memParams = $member->getMemberInfo($msc_id,'obj')->memParams; $memParams = oseJSON::decode($memParams); $usePAPUserId = false; require_once(OSEMSC_B_LIB.DS.'PapApi.class.php'); if(!oseObject::GetValue($memParams,'pap_visitorid',oseObject::getValue($curOrderParams,'pap_visitorid',false))) { if(oseObject::GetValue($memParams,'pap_userid',false)) { $usePAPUserId = true; } else { // check whether has table in old version 4.4 $tableList = $db->getTableList(); if(in_array($db->replacePrefix('#__osemsc_affiliate_tracking'),$tableList)) { $session = new Gpf_Api_Session($oseMscConfig->pap_url.'/scripts/server.php'); if(!$session->login(oseObject::getValue($oseMscConfig,'pap_username'), oseObject::getValue($oseMscConfig,'pap_password'))) { $result['success'] = false; $result['title'] = JText::_('Error'); $result['content'] = $session->getMessage(); return $result; } $request = new Pap_Api_TransactionsGrid($session); // set filter //$request->addFilter('dateinserted', Gpf_Data_Filter::DATERANGE_IS, Gpf_Data_Filter::RANGE_THIS_YEAR); $request->addFilter('orderid', Gpf_Data_Filter::EQUALS, $order_id); $request->setLimit(0, 30); $request->setSorting('orderid', false); $request->sendNow(); $grid = $request->getGrid(); $recordset = $grid->getRecordset(); if($grid->getTotalCount() > 0) { $usePAPUserId = true; foreach($recordset as $rec) { $memParams->pap_userid = $rec->get('userid'); break; } } else { return $result; } } else { return $result; } } } else { $memParams->pap_visitorid = oseObject::GetValue($memParams,'pap_visitorid',oseObject::getValue($curOrderParams,'pap_visitorid')); } //oseObject::GetValue($memParams,'pap_visitorid',oseObject::getValue($curOrderParams,'pap_visitorid',false)); $memParams->first_ip = oseObject::getValue($memParams,'first_ip',oseObject::getValue($curOrderParams,'first_ip',oseMscPublic::getIP())); $memParams->pap_url = OSEMSC_B_LIB; $memParams_encode = oseJSON::encode($memParams); $query = " UPDATE `#__osemsc_member`" ." SET `params` = ".$db->Quote($memParams_encode) ." WHERE `msc_id` = '{$msc_id}' AND `member_id` = '{$member_id}'" ; $db->setQuery($query); if(!oseDB::query()) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('Error Join.Order.2'); return $result; } try { $msc = oseRegistry::call('msc'); $where = array(); $where[] = "`order_item_id` = '{$order_item_id}'"; $curOrderItem = $payment->getInstance('Order')->getOrderItem($where,'obj'); $curOrderItemParams = oseJson::decode($curOrderItem->params); $node = $msc->getInfo($msc_id,'obj'); $paymentInfos = $msc->getExtInfo($msc_id,'payment'); foreach($paymentInfos as $key => $paymentInfo) { if($key != $curOrderItemParams->msc_option) { unset($paymentInfos[$key]); } } $cart = oseMscPublic::getCart(); $osePaymentCurrency = $cart->get('currency'); $options = oseMscPublic::generatePriceOption($node,$paymentInfos,$osePaymentCurrency); $saleTracker = new Pap_Api_SaleTracker($oseMscConfig->pap_url.'/scripts/sale.php'); $saleTracker->setAccountId(oseObject::getValue($oseMscConfig,'pap_account_id','default1')); $sale1 = $saleTracker->createSale(); if($usePAPUserId) { $sale1->setAffiliateID($memParams->pap_userid); } else { $saleTracker->setVisitorId($memParams->pap_visitorid); } $sale1->setTotalCost($curOrder->payment_price); $sale1->setOrderID($order_id); $sale1->setProductID("{$node->title}-{$options[0]['title']}"); $sale1->setData1($userInfo->email); $sale1->setData2($userInfo->jname); $sale1->setData3($memParams->first_ip); $sale1->setData4($curOrder->payment_serial_number); $sale1->setData5("{$curOrder->order_id}-{$node->title}-{$options[0]['title']}-#recurrence:{$recurrence_times}"); $saleTracker->register(); return $result; } catch (Exception $e) { return $result; } }
private function drawMscListCart($msc_id, $osePaymentCurrency) { $buildList = oseRegistry::call('payment')->getInstance('MscList'); $buildList->set('currency', $osePaymentCurrency); $tree = oseMscTree::retrieveTree($msc_id, 'obj'); $first = $tree[0]; unset($tree[0]); if (count($tree) > 0) { $firstNode = $buildList->drawParent($first); $firstNode = $buildList->drawFirst($firstNode); $subTree = $buildList->drawTree($first->id); $subTree = $buildList->drawSecond($subTree); $row = $this->drawRow(array($firstNode, $subTree)); } else { $firstNode = $buildList->drawLeaf($first); $msc = oseRegistry::call('msc'); $paymentInfos = $msc->getExtInfo($msc_id, 'payment'); $options = oseMscPublic::generatePriceOption($first, $paymentInfos, $osePaymentCurrency); if (!empty($options)) { $option = array(); foreach ($options as $obj) { $oAttr = array(); $oAttr['option.value'] = 'value'; $oAttr['option.attr'] = 'attr'; $attrStr = 'title="%s" trial_price="%s" trial_recurrence="%s" standard_price="%s" standard_recurrence="%s" has_trial="%s"'; $oAttr['attr'] = sprintf($attrStr, $obj['title'], oseObject::getValue($obj, 'trial_price', 0), oseObject::getValue($obj, 'trial_recurrence', 0), $obj['standard_price'], $obj['standard_recurrence'], oseObject::getValue($obj, 'has_trial', 0)); $o = oseHTML::getInstance('Select')->option(oseObject::getValue($obj, 'id'), oseObject::getValue($obj, 'title'), $oAttr); $option[] = $o; } $basic = $options[0]; $listAttr = array(); $listAttr['list.attr'] = ' class="msc_options" size="1" style="width:200px"'; $listAttr['list.translate'] = false; $listAttr['option.key'] = 'value'; $listAttr['id'] = 'msc_option_' . oseObject::getValue($first, 'id'); $listAttr['option.text'] = 'text'; $listAttr['list.select'] = oseObject::getValue($obj, 'id'); $listAttr['option.attr'] = 'attr'; $combo = oseHTML::getInstance('Select')->genericlist($option, 'msc_option', $listAttr); $firstNode['price'] = "<div class='msc-price-box'><span>" . JText::_('Options') . ":</span>" . $buildList->drawPrice($combo . '<div></div>') . '</div>'; } $hackback = JText::_('Subscribe'); $needle = JText::_('Add'); if (isset($firstNode['button'])) { $firstNode['button'] = preg_replace("/{$hackback}/", $needle, $firstNode['button'], 1); } $firstNode = $buildList->drawFirst($firstNode); $row = $buildList->drawRow($firstNode); } $image = $buildList->getImage($first); $image = $buildList->drawImage($image); return $buildList->drawCard(array($image, $row)); }