本文整理汇总了PHP中Gateway::getAvailableByCampaignID方法的典型用法代码示例。如果您正苦于以下问题:PHP Gateway::getAvailableByCampaignID方法的具体用法?PHP Gateway::getAvailableByCampaignID怎么用?PHP Gateway::getAvailableByCampaignID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gateway
的用法示例。
在下文中一共展示了Gateway::getAvailableByCampaignID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getavailablebycampaignAction
function getavailablebycampaignAction()
{
$this->checkLogin();
AF::setJsonHeaders('json');
$campaign_id = AF::get($_POST, 'campaign_id', false);
if (!$campaign_id) {
Message::echoJsonError(__('incorrect_campaign_id'));
}
$modelProduct = new Product();
$products = $modelProduct->getAvailableByCampaignID($campaign_id);
$modelShipping = new Shipping();
$shipping = $modelShipping->getAvailableByCampaignID($campaign_id);
$modelGateways = new Gateway();
$gateways = $modelGateways->getAvailableByCampaignID($campaign_id);
//$campaignModel = new Campaign();
//$campaignModel->fillFromDbPk($campaign_id);
//$campaign = $campaignModel->getDataArray();
//$countryModel = new Country();
//$countries = $countryModel->getCountries($campaignModel->country_id);
Message::echoJsonSuccess(array('message' => array('products' => $products, 'shipping' => $shipping, 'gateways' => $gateways)));
exit;
}
示例2: createAction
public function createAction()
{
$model = new Order();
$_POST['status'] = 'new';
$isPayment = AF::get($_POST, 'is_payment');
if (!$isPayment) {
$_POST['ps'] = 'pn';
$_POST['payment_method'] = 'cc_debit';
}
/*$rtr = '';
foreach($_POST as $k => $v) {
$rtr .= " '".$k."' => '".$v."',";
}
Message::echoJsonSuccess($rtr);*/
// is this also a new customer creation
if (isset($_POST['newCus']) && $_POST['newCus'] == 1) {
$cust = new Customer();
$this->performAjaxValidation($cust);
//$shipData = (array)json_decode($_POST['shipAddr']);
//$shipData['address_type'] = 'shipping';
$this->performAjaxFormFieldsValidation($_POST, explode(',', 'shipping_fname,shipping_lname,shipping_phone,shipping_address1,shipping_city,shipping_state_id,shipping_country_id,shipping_zip'));
//Message::echoJsonSuccess('made it2');
if (!$_POST['billingSameAsShipping']) {
//$billData = (array)json_decode($_POST['billAddr']);
//$billData['address_type'] = 'billing';
$this->performAjaxFormFieldsValidation($_POST, explode(',', 'billing_fname,billing_lname,billing_phone,billing_address1,billing_city,billing_state_id,billing_country_id,billing_zip'));
}
$orderRules = "campaign_id,gateway_id,shipping_id,amount_product,amount_shipping,payment_total";
} else {
$_POST['newCus'] = 0;
$orderRules = "customer_id,campaign_id,gateway_id,shipping_id,amount_product,amount_shipping,payment_total,address_id,billing_address_id";
if (isset($_POST['address_id']) && empty($_POST['billing_address_id'])) {
$_POST['billing_address_id'] = $_POST['address_id'];
}
// before billing validation
}
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model, explode(',', $orderRules));
if (isset($_POST['model']) && $_POST['model'] == 'Order') {
$isOrderPay = $this->access->actionAccess('order_is_pay') ? (bool) AF::get($_POST, 'is_payment') : false;
$_POST['is_payment'] = $isOrderPay ? 1 : 0;
// JSON success and error commands handled in the WS functions
$ws = new WS();
$ws->crmInit($_POST);
$ws->process();
}
$orderID = AF::get($this->params, 'order_id', false);
$prospectID = AF::get($this->params, 'prospect_id', false);
$payments = array();
if ($orderID) {
$model->fillFromDbPk($orderID);
// if we use clone model then we cannot grab related fields
$model->getCopyModel();
$orderProducts = OrderProducts::getProductsArrayByOrder($model->order_id);
$payment_methods = ProfileGateways::getMethodsByProfileGateway($model->campaign->profile_id, $model->gateway_id);
$cPayments = new Payments('Payment');
$payments = $cPayments->getResultsByCustomerId($model->customer_id, false);
} elseif ($prospectID) {
$modelProspect = Prospect::model()->findByPk($prospectID);
if (!$modelProspect) {
throw new AFHttpException(0, 'incorrect_id');
}
$model->customer_id = $modelProspect->customer_id;
$model->campaign_id = $modelProspect->campaign_id;
$model->address_id = $modelProspect->address_id;
$orderProducts = array();
$payment_methods = array();
} else {
$orderProducts = array();
$payment_methods = array();
}
$productModel = new Product();
$products = $productModel->getAvailableByCampaignID($model->campaign_id);
$countryModel = new Country();
$languages = $countryModel->getLanguages();
$states = $model->country_id ? State::model()->getStatesByCID($model->country_id) : array();
//$model->country_ids='de,ir';
$countries = $countryModel->getCountries();
$campaigns = Campaign::model()->cache()->findAllInArray();
$shippingModel = new Shipping();
$shipping = $shippingModel->getAvailableByCampaignID($model->campaign_id);
$modelGateways = new Gateway();
//$modelGateways->getGateways()
$gateways = $orderID ? $modelGateways->getAvailableByCampaignID($model->campaign_id) : array();
$methods = Method::model()->cache()->findAllInArray();
$fields_expyear = array('current_year' => date("Y"), 'last_year' => date("Y") + 12);
Assets::js('jquery.form');
Assets::js('jquery.autocomplete');
Assets::js('as24.bind-1.3.5.min');
Assets::js('jquery-ui');
Assets::css('jquery-ui');
$this->addToPageTitle('Create Order');
$this->render('create', array('model' => $model, 'products' => $products, 'languages' => $languages, 'campaigns' => $campaigns, 'states' => $states, 'countries' => $countries, 'fields_expyear' => $fields_expyear, 'shipping' => $shipping, 'gateways' => $gateways, 'orderProducts' => $orderProducts, 'payment_methods' => $payment_methods, 'payments' => $payments, 'methods' => $methods));
}