示例#1
0
 /**
  * 根据物流类型ID以及相关条件查询满足条件的物流
  * @param array $condition
  * @return array $deliveries
  * @author gehaifeng
  * 
  * $condition = array(
  *   'site_id'              => '77',    //站点id
  *   'delivery_category_id' => '9',     //物流类型ID
  *   'country_id'           => '539',   //国家ID
  *   'weight'               => '500',   //订单重量
  *   'total_price'          => '300.99',//订单总价
  * );
  * 
  * $deliveries = array(
  *   'id'                   => '10',                 //物流ID
  *   'name'                 => 'China Post',         //物流名称
  *   'url'                  => 'www.ketai-inc.com',  //物流url地址
  *   'delay'                => '5-20 days',          //物流延迟信息
  *   'delivery_price'       => '46.97',              //物流价格
  * );
  */
 public static function get_deliveries_by_condition($condition)
 {
     $category_id = $condition['delivery_category_id'];
     $weight = $condition['weight'];
     $country_id = $condition['country_id'];
     $total_price = $condition['total_price'];
     $dlv_instance = DeliveryService::get_instance();
     $dlvs = $dlv_instance->get_deliveries_by_category($category_id, $weight);
     if (empty($dlvs)) {
         return array();
     }
     $currency = BLL_Currency::get_current();
     $currency_sign = $currency['sign'];
     $deliveries = array();
     foreach ($dlvs as $dlv) {
         $flag = 0;
         $id = $dlv['id'];
         $name = $dlv['name'];
         $url = $dlv['url'];
         $delay = $dlv['delay'];
         if ($dlv['type'] == 0) {
             $flag = 1;
         } else {
             $delivery_country = Delivery_countryService::get_instance()->get_delivery_country($id, $country_id);
             if (empty($delivery_country)) {
                 if ($dlv['is_default'] == 1) {
                     $flag = 1;
                 } else {
                     continue;
                 }
             } else {
                 $flag = 1;
                 $dlv['expression'] = $delivery_country['expression'];
             }
         }
         if ($flag = 0) {
             continue;
         }
         $delivery_price = delivery::cal_fee($dlv['expression'], $weight, $total_price);
         //计算物流费用
         $deliveries[] = array('id' => $id, 'name' => $name, 'url' => $url, 'delay' => $delay, 'delivery_price' => BLL_Currency::get_price(round($delivery_price, 2)), 'currency_sign' => $currency_sign);
     }
     return $deliveries;
 }
示例#2
0
 /**
  * 订单支付成功页获取的单独的代码,向联盟发送订单成功支付信息
  *
  * @param array $order
  * @param string $affiliate_name
  * @return string
  */
 function get_code($order, $affiliate_name = 'linkshare')
 {
     //获取站点联盟信息,并判断是否
     $affiliate = Site_affiliateService::get_instance()->query_row(array('where' => array('affiliate_name' => $affiliate_name, 'site_id' => $order['site_id'], 'mark' => 1)));
     if (empty($affiliate)) {
         return '<!-- affiliate ' . $affiliate_name . ' is not exist,or been uninstalled -->';
     }
     $prm_value = json_decode($affiliate['prm_value']);
     //货币转换相关
     $currency = $affiliate['currency'] == 'default' ? Kohana::config('affiliates.affiliatefuture.currency') : $affiliate['currency'];
     /* 订单详情 */
     $where = array();
     $where['site_id'] = $order['site_id'];
     $where['order_id'] = $order['id'];
     /* 订单产品 */
     $order_products = Myorder_product::instance()->order_products($where);
     $namelist = $amtlist = $qlist = $skulist = array();
     foreach ($order_products as $key => $order_product_detail) {
         $namelist[] = urlencode($order_product_detail['name']);
         $skulist[] = $order_product_detail['SKU'];
         $qlist[] = $order_product_detail['quantity'];
         $amount = $order_product_detail['discount_price'] * $order_product_detail['quantity'] * 100;
         $amount = str_replace(',', '', $amount);
         $amtlist[] = $currency != 'default' ? BLL_Currency::get_price($amount, $order['currency'], $currency) : $amount;
     }
     $order['namelist'] = implode("|", $namelist);
     $order['skulist'] = implode("|", $skulist);
     $order['qlist'] = implode("|", $qlist);
     $order['amtlist'] = implode("|", $amtlist);
     if ($currency != 'default') {
         $order['total_product'] = isset($order['total_products']) ? BLL_Currency::get_price($order['total_products'], $order['currency'], $currency) : BLL_Currency::get_price($order['total_product'], $order['currency'], $currency);
         $order['total_product'] = str_replace(',', '', $order['total_product']);
         //$order['total_product'] = BLL_Currency::get_price($order['total_product'], $order['currency'], $currency);
         $order['currency'] = $currency;
     }
     $save_return = Affiliate_orderService::save_affiliate_order($order, $affiliate);
     if ($save_return != 1) {
         return $save_return;
     }
     $string = "<img src=\"http://track.linksynergy.com/ep" . "?mid={$prm_value->mid}" . "&ord={$order['order_num']}" . "&skulist={$order['skulist']}" . "&qlist={$order['qlist']}" . "&amtlist={$order['amtlist']}" . "&cur={$order['currency']}" . "&namelist={$order['namelist']}\" height=\"1\" width=\"1\">";
     return $string;
 }
示例#3
0
 /**
  * 订单支付成功页获取的单独的代码,向联盟发送订单成功支付信息
  *
  * @param array $order
  * @param string $affiliate_name
  * @return string
  */
 function get_code($order, $affiliate_name = 'shareasale')
 {
     //检查联盟是否安装,并获取联盟的信息
     $affiliate = Site_affiliateService::get_instance()->query_row(array('where' => array('affiliate_name' => $affiliate_name, 'site_id' => $order['site_id'], 'mark' => 1)));
     if (empty($affiliate)) {
         return '<!-- affiliate ' . $affiliate_name . ' is not exist,or been uninstalled -->';
     }
     $prm_value = json_decode($affiliate['prm_value']);
     //货币转换相关
     $currency = $affiliate['currency'] == 'default' ? Kohana::config('affiliates.affiliatefuture.currency') : $affiliate['currency'];
     if ($currency != 'default') {
         $order['total_product'] = isset($order['total_products']) ? BLL_Currency::get_price($order['total_products'], $order['currency'], $currency) : BLL_Currency::get_price($order['total_product'], $order['currency'], $currency);
         $order['total_product'] = str_replace(',', '', $order['total_product']);
         //$order['total_product'] = BLL_Currency::get_price($order['total_product'], $order['currency'], $currency);
         $order['currency'] = $currency;
     }
     $save_return = Affiliate_orderService::save_affiliate_order($order, $affiliate);
     if ($save_return != 1) {
         return $save_return;
     }
     $string = "<img src=\"https://shareasale.com/sale.cfm" . "?amount={$order['total_product']}" . "&tracking={$order['order_num']}" . "&transtype=" . Kohana::config('affiliates.shareasale.transtype') . "&merchantID={$prm_value->merchantid}\" width=\"1\" height=\"1\">";
     return $string;
 }
示例#4
0
 /**
  * 订单支付成功页获取的单独的代码,向联盟发送订单成功支付信息
  *
  * @param array $order
  * @param string $affiliate_name
  * @return string
  */
 function get_code($order, $affiliate_name = 'webgains')
 {
     //检查联盟是否安装,并获取联盟的信息
     $affiliate = Site_affiliateService::get_instance()->query_row(array('where' => array('affiliate_name' => $affiliate_name, 'site_id' => $order['site_id'], 'mark' => 1)));
     if (empty($affiliate)) {
         return '<!-- affiliate ' . $affiliate_name . ' is not exist,or been uninstalled -->';
     }
     $prm_value = json_decode($affiliate['prm_value']);
     //货币转换相关
     $currency = $affiliate['currency'] == 'default' ? Kohana::config('affiliates.affiliatefuture.currency') : $affiliate['currency'];
     if ($currency != 'default') {
         $order['total_product'] = isset($order['total_products']) ? BLL_Currency::get_price($order['total_products'], $order['currency'], $currency) : BLL_Currency::get_price($order['total_product'], $order['currency'], $currency);
         $order['total_product'] = str_replace(',', '', $order['total_product']);
         //$order['total_product'] = BLL_Currency::get_price($order['total_product'], $order['currency'], $currency);
         $order['currency'] = $currency;
     }
     $save_return = Affiliate_orderService::save_affiliate_order($order, $affiliate);
     if ($save_return != 1) {
         return $save_return;
     }
     $string = "<!-- <webgains tracking code> -->\n\t\t<script language=\"javascript\" type=\"text/javascript\">\n\t\tvar wgOrderReference = '{$order['order_num']}';\n\t\tvar wgOrderValue = '{$order['total_product']}';\n\t\tvar wgEventID = '{$prm_value->wgeventid}';\n\t\tvar wgComment = '';\n\t\tvar wgLang = 'en_EN';\n\t\tvar wgsLang = 'javascript-client';\n\t\tvar wgVersion = '1.2';\n\t\tvar wgProgramID = '{$prm_value->wgprogramid}';\n\t\tvar wgSubDomain = 'track';\n\t\tvar wgCheckSum = '';\n\t\tvar wgItems = '';\n\t\tvar wgVoucherCode = '';\n\t\tvar wgCustomerID = '';\n\t\t\n\t\tif(location.protocol.toLowerCase() == \"https:\") wgProtocol=\"https\";\n\t\telse wgProtocol = \"http\";\n\t\t\n\t\twgUri = wgProtocol + \"://\" + wgSubDomain + \".webgains.com/transaction.html\" + \"?wgver=\" + wgVersion + \"&wgprotocol=\" + wgProtocol + \"&wgsubdomain=\" + wgSubDomain + \"&wgslang=\" + wgsLang + \"&wglang=\" + wgLang + \"&wgprogramid=\" + wgProgramID + \"&wgeventid=\" + wgEventID + \"&wgvalue=\" + wgOrderValue + \"&wgchecksum=\" + wgCheckSum + \"&wgorderreference=\"  + wgOrderReference + \"&wgcomment=\" + escape(wgComment) + \"&wglocation=\" + escape(document.referrer) + \"&wgitems=\" + escape(wgItems) + \"&wgcustomerid=\" + escape(wgCustomerID) + \"&wgvouchercode=\" + escape(wgVoucherCode);\n\t\tdocument.write('<sc'+'ript language=\"JavaScript\"  type=\"text/javascript\" src=\"'+wgUri+'\"></sc'+'ript>');\n\t\t\n\t\t</script>\n\t\t<noscript>\n\t\t<img src=\"http://track.webgains.com/transaction.html" . "?wgver=1.2" . "&wgprogramid={$prm_value->wgprogramid}" . "&wgrs=1" . "&wgvalue={$order['total_product']}" . "&wgeventid={$prm_value->wgeventid}" . "&wgorderreference={$order['order_num']}" . "&wgitems=&wgvouchercode=&wgcustomerid=\" alt=\"\" />\n\t\t</noscript>\n\t\t<!-- </webgains tracking code> -->";
     return $string;
 }
示例#5
0
 /**
  * 订单支付成功页获取的单独的代码,向联盟发送订单成功支付信息
  *
  * @param array $order
  * @param string $affiliate_name
  * @return string
  */
 function get_code($order, $affiliate_name = 'clixgalore')
 {
     //获取站点联盟信息,并判断是否
     $affiliate = Site_affiliateService::get_instance()->query_row(array('where' => array('affiliate_name' => $affiliate_name, 'site_id' => $order['site_id'], 'mark' => 1)));
     if (empty($affiliate)) {
         return '<!-- affiliate ' . $affiliate_name . ' is not exist,or been uninstalled -->';
     }
     $prm_value = json_decode($affiliate['prm_value']);
     //货币转换相关
     $currency = $affiliate['currency'] == 'default' ? Kohana::config('affiliates.affiliatefuture.currency') : $affiliate['currency'];
     if ($currency != 'default') {
         $order['total_product'] = isset($order['total_products']) ? BLL_Currency::get_price($order['total_products'], $order['currency'], $currency) : BLL_Currency::get_price($order['total_product'], $order['currency'], $currency);
         $order['total_product'] = str_replace(',', '', $order['total_product']);
         //$order['total_product'] = BLL_Currency::get_price($order['total_product'], $order['currency'], $currency);
         $order['currency'] = $currency;
     }
     $save_return = Affiliate_orderService::save_affiliate_order($order, $affiliate);
     if ($save_return != 1) {
         return $save_return;
     }
     //要返回的联盟的代码
     $string = "<!--begin clixGalore code -->" . "<img src=\"https://www.clixGalore.com/AdvTransaction.aspx" . "?AdID={$prm_value->adid}" . "&SV={$order['total_product']}" . "&OID={$order['order_num']}\" height=\"1\" width=\"1\" border=\"0\">" . "<!--end clixGalore code -->";
     return $string;
 }
示例#6
0
 /**
  * 订单支付成功页获取的单独的代码,向联盟发送订单成功支付信息
  *
  * @param array $order
  * @param string $affiliate_name
  * @return string
  */
 function get_code($order, $affiliate_name = 'earnmoney')
 {
     //获取站点联盟信息,并判断是否
     $affiliate = Site_affiliateService::get_instance()->query_row(array('where' => array('affiliate_name' => $affiliate_name, 'site_id' => $order['site_id'], 'mark' => 1)));
     if (empty($affiliate)) {
         return '<!-- affiliate ' . $affiliate_name . ' is not exist,or been uninstalled -->';
     }
     $prm_value = json_decode($affiliate['prm_value']);
     //检查参数格式是否正确,如果参数格式不正确不予以处理
     $params = cookie::get('earnmoney_params');
     $strDecode = self::uriDecode($params);
     $aryParams = explode('|', $strDecode);
     if ('nid' == $aryParams[0] && 'uid' == $aryParams[2] && 'resource' == $aryParams[4] && 'url' == $aryParams[6]) {
         $url = $aryParams[7];
         $uid = $aryParams[3];
         $nid = $aryParams[1];
         $resource = $aryParams[5];
     } else {
         return '<!-- prams format is not exact -->';
     }
     //货币转换相关
     $currency = $affiliate['currency'] == 'default' ? Kohana::config('affiliates.affiliatefuture.currency') : $affiliate['currency'];
     if ($currency != 'default') {
         $order['total_product'] = isset($order['total_products']) ? BLL_Currency::get_price($order['total_products'], $order['currency'], $currency) : BLL_Currency::get_price($order['total_product'], $order['currency'], $currency);
         $order['total_product'] = str_replace(',', '', $order['total_product']);
         //$order['total_product'] = BLL_Currency::get_price($order['total_product'], $order['currency'], $currency);
         $order['currency'] = $currency;
     }
     $save_return = Affiliate_orderService::save_affiliate_order($order, $affiliate);
     if ($save_return != 1) {
         return $save_return;
     }
     $post_var = "uid=" . $uid . "&nid=" . $nid . "&order_num=" . $order['order_num'] . "&order_amount=" . $order['total_product'] . "&referAddress=" . "http://" . $_SERVER['HTTP_HOST'] . "/";
     self::cul_em($post_var);
     return '<!-- earnmoney 数据发送成功 -->';
 }
示例#7
0
 /**
  * 订单支付成功页获取的单独的代码,向联盟发送订单成功支付信息
  *
  * @param array $order
  * @param string $affiliate_name
  * @return string
  */
 public function get_code($order, $affiliate_name = 'affiliatefuture')
 {
     //获取站点联盟信息,并判断是否
     $affiliate = Site_affiliateService::get_instance()->query_row(array('where' => array('affiliate_name' => $affiliate_name, 'site_id' => $order['site_id'], 'mark' => 1)));
     if (empty($affiliate)) {
         return '<!-- affiliate ' . $affiliate_name . ' is not exist,or been uninstalled -->';
     }
     $prm_value = json_decode($affiliate['prm_value']);
     //货币转换相关
     $currency = $affiliate['currency'] == 'default' ? Kohana::config('affiliates.affiliatefuture.currency') : $affiliate['currency'];
     if ($currency != 'default') {
         $order['total_product'] = isset($order['total_products']) ? BLL_Currency::get_price($order['total_products'], $order['currency'], $currency) : BLL_Currency::get_price($order['total_product'], $order['currency'], $currency);
         $order['total_product'] = str_replace(',', '', $order['total_product']);
         //$order['total_product'] = BLL_Currency::get_price($order['total_product'], $order['currency'], $currency);
         $order['currency'] = $currency;
     }
     $save_return = Affiliate_orderService::save_affiliate_order($order, $affiliate);
     if ($save_return != 1) {
         return $save_return;
     }
     //要返回的联盟的代码
     $string = "<script language=\"javascript\" src=\"https://scripts.affiliatefuture.com/AFFunctions.js\"></script>\n\t\t<script language=\"javascript\">\n\t\t   var merchantID = {$prm_value->merchantid};\n\t\t   var orderValue = '{$order['total_product']}';\n\t\t   var orderRef = '{$order['order_num']}';\n\t\t   var payoutCodes = '" . Kohana::config('affiliates.affiliatefuture.payoutcodes') . "';\n\t\t   var offlineCode = '" . Kohana::config('affiliates.affiliatefuture.offlinecode') . "';\n\t\t   AFProcessSaleV2(merchantID, orderValue, orderRef,payoutCodes,offlineCode);\n\t\t</script>";
     return $string;
 }
示例#8
0
 /**
  * 订单支付成功页获取的单独的代码,向联盟发送订单成功支付信息
  *
  * @param array $order
  * @param string $affiliate_name
  * @return string
  */
 function get_code($order, $affiliate_name = 'commissionjunction')
 {
     //获取站点联盟信息,并判断是否
     $affiliate = Site_affiliateService::get_instance()->query_row(array('where' => array('affiliate_name' => $affiliate_name, 'site_id' => $order['site_id'], 'mark' => 1)));
     if (empty($affiliate)) {
         return '<!-- affiliate ' . $affiliate_name . ' is not exist,or been uninstalled -->';
     }
     $prm_value = json_decode($affiliate['prm_value']);
     //货币转换相关
     $currency = $affiliate['currency'] == 'default' ? Kohana::config('affiliates.affiliatefuture.currency') : $affiliate['currency'];
     if ($currency != 'default') {
         $order['total_product'] = isset($order['total_products']) ? BLL_Currency::get_price($order['total_products'], $order['currency'], $currency) : BLL_Currency::get_price($order['total_product'], $order['currency'], $currency);
         $order['total_product'] = str_replace(',', '', $order['total_product']);
         //$order['total_product'] = BLL_Currency::get_price($order['total_product'], $order['currency'], $currency);
         $order['currency'] = $currency;
     }
     $save_return = Affiliate_orderService::save_affiliate_order($order, $affiliate);
     if ($save_return != 1) {
         return $save_return;
     }
     //要返回的联盟的代码
     $string = "<img src=\"https://www.emjcd.com/u" . "?AMOUNT={$order['total_product']}" . "&CID={$prm_value->cid}" . "&OID={$order['order_num']}" . "&TYPE=" . $prm_value->actionid . "&CURRENCY={$order['currency']}&" . "METHOD=IMG\" height=\"1\" width=\"1\">";
     return $string;
 }