本文整理汇总了PHP中Order::fillFromDbPk方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::fillFromDbPk方法的具体用法?PHP Order::fillFromDbPk怎么用?PHP Order::fillFromDbPk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Order
的用法示例。
在下文中一共展示了Order::fillFromDbPk方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAttachedOrders
public function getAttachedOrders()
{
// grab attachment campaign info
$attachedCampaigns = CampaignAttachs::getAttachedByCampaign($this->campaign_id, false);
foreach ($attachedCampaigns as &$ac) {
$campaingModel = new Campaign();
$c = $campaingModel->findByPk($ac['campaign_attach_id']);
if ($c) {
$ac['campaign_attach_name_format'] = '[' . $c->campaign_id . '] ' . $c->campaign_name;
}
// is there already an order for the camp? if so build order details
$result = self::getOrderByParent($ac['campaign_attach_id'], $this->order_id);
if (!empty($result)) {
// doing this results in the instance of $this being reset to the attached order
//$o = Order::model()->fillFromDbPk($result);
$o = new Order();
$o->fillFromDbPk($result);
$ac['order_id'] = $o->getorder_id_name_link();
$ac['status'] = $o->getstatus_image();
$ac['created'] = $o->getcreated_formatted();
unset($o);
}
}
return $attachedCampaigns;
}
示例2: USING
<?php
include_once '../settings/autoload.php';
$msql = SafeMySQL::getInstance();
// grab chargeback records
$sql = "\nSELECT \n\t`at`.temp_attempt_id\n , `at`.tracking_number\n , `a`.order_id \n , `a`.amount\nFROM \n\tattempts_temp `at` \n\tJOIN attempts `a` USING (tracking_number) \nWHERE \n\t`at`.type = 'CHARGEBACK'";
$cb_success = array();
$chargeBacks = $msql->getAll($sql);
foreach ($chargeBacks as $cb) {
// check order status
$order = new Order();
if ($order->fillFromDbPk($cb['order_id'])) {
$order->chargeBackSet($cb['amount']);
// check status
if ($order->isFlag('chargeback')) {
// delete from attempts_temp
$cb_success[] = $cb['temp_attempt_id'];
echo $order->order_id . '<br>';
} else {
// order not saved? what now? leave in db for now
/*
$headers = 'From: "CB BLS' . Config::get()->prefix . ' IPN" <ipn@pinnaclecrm.com>';
mail('liebenson@gmail.com', 'Chargeback order save failed', print_r($cb,1), $headers);
*/
}
} else {
// bad order id
echo $cb['order_id'] . ' - NOT VALID ORDER<br>';
continue;
}
unset($order);
示例3: process
public function process()
{
// States list request from sales site
if ($this->wsType == 'st') {
// set headers
AF::setJsonHeaders('json');
// country_id has already been verified as set
$states = State::model()->getStatesByCID($this->post['country_id']);
// return json state list if present
Message::echoJsonSuccess(array('message' => $states));
exit;
}
// CRM Order
if ($this->wsType == 'x1') {
// EXISTING CUSTOMER CHECK
if (!$this->newCustomer) {
$this->customer = Customer::model()->fillFromDbPk($this->post['customer_id']);
$this->shippingAddress = Address::model()->fillFromDbPk($this->post['address_id']);
$this->billingAddress = Address::model()->fillFromDbPk($this->post['billing_address_id']);
}
// if customer already built then check for blacklist
$this->buildCustomer();
// EXISTING ORDER Check - DON'T NEED THIS I THINK
$this->order = new Order();
/*if (!$this->newCustomer && $this->order->fillFromDbPk($this->customer->getCustomerOkOrder($this->campaign->campaign_id)))
$this->apiError('An "OK" order already exists for this customer. Order ID ' . $this->order->order_id);*/
// addresses
if (!isset($this->shippingAddress) || !$this->shippingAddress->getPkvalue()) {
$this->buildAddress();
if ($this->post['billingSameAsShipping']) {
$this->billingAddress = $this->shippingAddress;
} else {
$this->buildAddress('billing');
}
}
// payment before order. if no payment specified allow order to still be built
if ($this->isPayment && isset($this->post['payment_id']) && $this->post['payment_id']) {
$this->payment = Payment::model()->fillFromDbPk($this->post['payment_id']);
}
if ($this->isPayment) {
$this->buildPayment();
}
// order
$this->buildOrder();
// pay or return
if ($this->isPayment) {
$this->webPayment();
} else {
$this->order->status = 'ok';
$this->order->addFlags('paid');
// this needs to be set in order to have the order get sent to fulfillment
$this->order->amount_product = '0.00';
$this->order->amount_shipping = '0.00';
$this->order->save();
}
$this->apiSuccess('Order ' . $this->order->order_id . ' created');
}
// Build prospect, click and customer info
if (in_array($this->wsType, array('p', 'l'))) {
$this->customer = new Customer();
$this->order = new Order();
$this->prospect = new Prospect();
// EXISTING ORDER/CUSTOMER CHECK - make sure there isn't already an order for this campaign and email
if ($this->customer->getCustomerByEmail($this->post['email']) && $this->customer->getCustomerOkOrder($this->campaign->campaign_id) && $this->order->fillFromDbPk($this->customer->getCustomerOkOrder($this->campaign->campaign_id))) {
$this->thankYou(true);
}
// BlueSnap Pending Order Check
// Has an order already been submitted to the gateway and is pending final approval? If so, redirect to the thankyou page
if (isset($this->customer->customer_id) && $this->order->orderPendingAttemptExists($this->campaign->campaign_id, $this->customer->customer_id)) {
$this->thankYou(true);
}
// Existing Prospect check if customer already exists. If no prospect, build click
if ($this->customer->getPkValue()) {
if (!$this->prospect->prospectExists($this->customer->customer_id, $this->campaign->campaign_id)) {
$this->buildClick();
} else {
//prospect already exists. let's update the updated column
$this->prospect->created = 'NOW():sql';
//date("Y-m-d H:i:s");
$this->prospect->save();
// check the click info. if its new then we need to double check it all
$this->buildClick($this->prospect->click_id);
}
} else {
$this->buildClick();
}
$this->buildCustomer();
$this->buildAddress();
$this->buildProspect();
// if this is not a lastchance request, then redirect the user to the order page
if ($this->wsType != 'l') {
// build return object. SET TO HTTPS WHEN TESTING IS COMPLETE
$url = $this->campaign->order_url . '?tempOrderId=' . $this->prospect->getPkValue();
$this->apiSuccess($url);
}
}
// Build Order
if (in_array($this->wsType, array('o', 'l'))) {
if ($this->wsType == 'o') {
// load objects
//.........这里部分代码省略.........
示例4: setaddressAction
function setaddressAction()
{
$this->checkLogin();
AF::setJsonHeaders('json');
$order_id = AF::get($_POST, 'order_id', false);
$order = new Order();
$order->fillFromDbPk($order_id);
$address_id = AF::get($_POST, 'address_id', false);
if (!$address_id) {
Message::echoJsonError(__('incorrect_address_id'));
}
$address_type = AF::get($_POST, 'address_type', false);
if ($address_type == "shipping") {
$order->address_id = $address_id;
} else {
$order->billing_address_id = $address_id;
}
$model = new Address();
$model = $model->getAddressById($address_id);
$table_rows = array('fname' => 'fname', 'lname' => 'lname', 'phone' => 'phone', 'address1' => 'address1', 'address2' => 'address2', 'country' => 'country_id', 'state' => 'state_id', 'city' => 'city', 'zip' => 'zip');
foreach ($table_rows as $key => $value) {
if ($value == "country_id") {
$model[$value] = $model['country_name'] . " (" . $model['country_id'] . ")";
}
if ($value == "state_id") {
$model[$value] = $model['state_name'] . " (" . $model['state_id'] . ")";
}
$table[] = "<tr><td>" . __($address_type . "_" . $key) . "</td><td>" . $model[$value] . "</td></tr>";
}
if ($order->save(false)) {
Message::echoJsonSuccess(array('message' => 'Address Updated', 'table_result' => implode('', $table)));
} else {
Message::echoJsonError('Error Saving');
}
exit;
}
示例5: deleteAction
function deleteAction()
{
$id = AF::get($_POST, 'id', 0);
$modelsID = explode(',', $id);
$errors = FALSE;
foreach ($modelsID as $id) {
$model = new Order();
if ($model->fillFromDbPk($id)) {
$orderDeleteModel = new OrderDelete();
$orderDeleteModel->fillFromArray($model->getAttributes());
if ($orderDeleteModel->save()) {
if (!$model->delete()) {
$errors = true;
}
} else {
$errors = true;
}
OrderLog::createLog($this->user->user_id, $id, 25);
} else {
$errors = TRUE;
}
if ($model->getErrors()) {
$errors = TRUE;
}
unset($model);
}
if (isset($_POST['ajax'])) {
AF::setJsonHeaders('json');
if ($errors) {
Message::echoJsonError(__('order_no_deleted'));
} else {
Message::echoJsonSuccess(__('order_deleted'));
}
}
}
示例6: switch
<?php
include_once '../settings/autoload.php';
$msql = SafeMySQL::getInstance();
//$jobModel = new Job();
//$jobModel->getOneNew();
//if(!$jobModel->job_id)
// exit();
while ($jobModel = Job::getOne()) {
switch ($jobModel->job_type) {
case 'refund':
$orderModel = new Order();
$orderModel->fillFromDbPk($jobModel->order_id);
if (!($countRefunded = $orderModel->countRefunded)) {
exit;
}
@(include_once '../../ws/class/lib.class.php');
@(include_once '../../ws/class/ipayment.class.php');
@(include_once '../../ws/class/payment.class.php');
@(include_once '../../ws/class/raven_config_demo.php');
@(include_once '../../ws/class/ravenrequest.class.php');
@(include_once '../../ws/class/payment_' . $orderModel->payment_type . '.class.php');
$paymentSystem = Payment::getPaymentSystem($orderModel);
try {
if ($paymentSystem->setRefund($countRefunded)) {
$jobModel->done();
$saveOrder = new Order();
$saveOrder->order_id = $jobModel->order_id;
$saveOrder->payment_total = $orderModel->payment_total - $countRefunded;
echo $saveOrder->payment_total . '<br>';
$saveOrder->setIsNewRecord(false);