本文整理汇总了PHP中Shipment类的典型用法代码示例。如果您正苦于以下问题:PHP Shipment类的具体用法?PHP Shipment怎么用?PHP Shipment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Shipment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getRealTimeRates
public static function getRealTimeRates(ShippingRateCalculator $handler, Shipment $shipment)
{
$rates = new ShippingRateSet();
$handler->setWeight($shipment->getChargeableWeight());
$order = $shipment->order->get();
if ($order->isMultiAddress->get()) {
$address = $shipment->shippingAddress->get();
} else {
$address = $order->shippingAddress->get();
}
if (!$address) {
return $rates;
}
$handler->setDestCountry($address->countryID->get());
$handler->setDestState($address->state->get() ? $address->state->get()->code->get() : $address->stateName->get());
$handler->setDestZip($address->postalCode->get());
$config = $shipment->getApplication()->getConfig();
$handler->setSourceCountry($config->get('STORE_COUNTRY'));
$handler->setSourceZip($config->get('STORE_ZIP'));
$handler->setSourceState($config->get('STORE_STATE'));
foreach ($handler->getAllRates() as $k => $rate) {
$newRate = new ShipmentDeliveryRate();
$newRate->setApplication($shipment->getApplication());
$newRate->setCost($rate->getCostAmount(), $rate->getCostCurrency());
$newRate->setServiceName($rate->getServiceName());
$newRate->setClassName($rate->getClassName());
$newRate->setProviderName($rate->getProviderName());
$newRate->setServiceId($rate->getClassName() . '_' . $k);
$rates->add($newRate);
}
return $rates;
}
开发者ID:saiber,项目名称:www,代码行数:32,代码来源:ShipmentDeliveryRate.php
示例2: actionInfo
/**
* Displays the currently logged in user's account information
*/
public function actionInfo()
{
// Get id of logged in user
$user_id = Yii::app()->user->getId();
$customer = Customer::model()->findByPk($user_id);
$commande = Commande::model()->findAllByAttributes(array('bilkey' => $user_id));
$service_details = Customer::model()->getCustomerServiceDetails($user_id);
$shipment_details = Customer::model()->getShipmentsByCustomerBilkey($user_id);
if (isset($_POST['Customer'])) {
$customer->setScenario('user_edit');
// Populate our new models from the input arrays
$customer->attributes = $_POST['Customer'];
// If a model saves, we know it's valid
if ($customer->validate()) {
// Send email to info@mailnetwork and client
$customer->save();
$this->actionEmailChanges('customer', $customer, $customer);
}
}
$shipment_model = new Shipment('search');
$shipment_model->unsetAttributes();
// clear any default values
$shipment_model->bilkey = $user_id;
if (isset($_GET['Shipment'])) {
$shipment_model->attributes = $_GET['Shipment'];
}
$this->render('//shared/user-info', array('customer_model' => $customer, 'customer' => $customer, 'commande' => $commande, 'service_details' => $service_details, 'shipment_details' => $shipment_details, 'shipment_model' => $shipment_model));
}
开发者ID:E-SOFTinc,项目名称:Mailnetwork_Yii,代码行数:31,代码来源:UserController.php
示例3: createShipmentFromEntity
/**
* Create Shipment
*/
static function createShipmentFromEntity($entity, $price = null)
{
$price = (double) is_null($price) ? $entity->getPrice() : $price;
$shipment = new Shipment();
$shipment->setId($entity->getId())->setPrice($price)->setIsDiscountable($entity->getIsDiscountable())->setIsTaxable($entity->getIsTaxable());
return $shipment;
}
开发者ID:luoshulin,项目名称:falcon,代码行数:10,代码来源:Factory.php
示例4: view_pdf
function view_pdf($id)
{
$preferences_q = query("SELECT settings FROM `" . $this->user['database'] . "`.account_settings WHERE group_id='" . $this->user['group'] . "' ORDER BY id DESC");
$preferences_r = fetch($preferences_q);
$this->smarty->assign('preferences', json_decode($preferences_r['settings'], 1));
$shipment = new Shipment($id, $this->user);
$this->smarty->assign('shipment', $shipment->toArray());
$this->html['shipon_content'] = $this->smarty->fetch('history/view_pdf.tpl') . $this->get_pdf_footer($id);
}
开发者ID:kamalspalace,项目名称:_CORE,代码行数:9,代码来源:history.php
示例5: getShipment
private function getShipment()
{
$shipment = new Shipment();
$shipment->setFromIsResidential(false)->setFromStateProvinceCode('IN')->setFromPostalCode('46205')->setFromCountryCode('US')->setToIsResidential(true)->setToPostalCode('20101')->setToCountryCode('US');
$package = new Package();
$package->setLength(12)->setWidth(4)->setHeight(3)->setWeight(3);
$shipment->addPackage($package);
return $shipment;
}
开发者ID:dlashua,项目名称:shipping,代码行数:9,代码来源:ShipmentTest.php
示例6: getModel
/**
* @param Shipment $dataObject
* @return \Magento\Sales\Model\Order\Shipment
* @throws \Exception
*/
public function getModel(Shipment $dataObject)
{
$this->shipmentLoader->setOrderId($dataObject->getOrderId());
$this->shipmentLoader->setShipmentId($dataObject->getEntityId());
$items = [];
foreach ($dataObject->getItems() as $item) {
$items[$item->getOrderItemId()] = $item->getQty();
}
$shipmentItems = ['items' => $items];
$this->shipmentLoader->setShipment($shipmentItems);
$this->shipmentLoader->setTracking($dataObject->getTracks());
return $this->shipmentLoader->load();
}
开发者ID:aiesh,项目名称:magento2,代码行数:18,代码来源:ShipmentConverter.php
示例7: setJneStatusOrder
/**
* Set shipment status to completed
*
* @param Shipment $shipment
* @param string $recepient_name
*/
private function setJneStatusOrder(Shipment $shipment, $status, $recepient_name = '')
{
$event = new ShipmentEvent();
$shipment->setScenario('event');
$event->created = time();
$event->event_time = $event->created;
$event->shipment_id = $shipment->id;
$event->user_id = User::USER_SYSTEM;
switch (strtoupper($status)) {
case 'DELIVERED':
$event->status = ShipmentStatus::POD;
$shipment->shipping_status = ShipmentStatus::POD;
$shipment->event_time = $event->event_time;
$shipment->recipient_name = $recepient_name;
break;
case 'MANIFESTED':
$event->status = ShipmentStatus::MDE;
$shipment->shipping_status = ShipmentStatus::MDE;
$shipment->event_time = $event->event_time;
break;
case 'RECEIVED ON DESTINATION':
$event->status = ShipmentStatus::ARR;
$shipment->shipping_status = ShipmentStatus::ARR;
$shipment->event_time = $event->event_time;
break;
case 'ON PROCESS':
$event->status = ShipmentStatus::OTW;
$shipment->shipping_status = ShipmentStatus::OTW;
$shipment->event_time = $event->event_time;
break;
}
try {
$trans = Yii::app()->db->beginTransaction();
if ($event->save()) {
if ($shipment->save()) {
$trans->commit();
$this->printf('Shipment set to %s', $status);
return true;
} else {
print_r($shipment->getErrors());
throw new CException();
}
} else {
print_r($event->getErrors());
throw new CException();
}
} catch (CException $e) {
$trans->rollback();
throw $e;
}
}
开发者ID:aantonw,项目名称:dcourier.system,代码行数:57,代码来源:CheckJneStatusCommand.php
示例8: fromXml
/**
* @param \SimpleXMLElement $xml
*
* @return Response
*/
public function fromXml(\SimpleXMLElement $xml)
{
foreach ($xml->Shipment as $xml) {
$this->addShipment(Shipment::fromXml($xml));
}
return $this;
}
开发者ID:camigreen,项目名称:ttop,代码行数:12,代码来源:Response.php
示例9: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate($shipment_id = '')
{
$model = new Booking();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
$awb = '';
if (is_numeric($shipment_id)) {
$shipment = Shipment::model()->findByPk($shipment_id);
if ($shipment instanceof Shipment) {
$model->address = $shipment->shipper_address;
$model->city = $shipment->shipper_city;
$model->postal = $shipment->shipper_postal;
$model->country = $shipment->shipper_country;
$model->phone = $shipment->shipper_phone;
$model->shipment_id = $shipment->id;
$awb = $shipment->awb;
}
}
if (isset($_POST['Booking'])) {
$model->attributes = $_POST['Booking'];
$model->setAttribute('booking_code', dechex(time()));
if ($model->save()) {
if (!empty($model->shipment_id) || $model->shipment_id != '') {
$shipment->booking_id = $model->id;
$tes = $shipment->update();
}
Yii::app()->user->setFlash('success', 'Success to add new booking, ' . $model->booking_code);
$this->redirect(array('index'));
}
}
$this->render('create', array('model' => $model, 'awb' => $awb));
}
开发者ID:aantonw,项目名称:dcourier.system,代码行数:36,代码来源:BookingController.php
示例10: __construct
public function __construct($data = [], $connection = null)
{
$this->connection = $connection;
foreach (['id', 'order_reference', 'shop_system', 'customer_number', 'service_point_reference', 'weight_in_g'] as $prop) {
if (isset($data[$prop])) {
$this->{$prop} = $data[$prop];
}
}
foreach (['recipient', 'billing_contact'] as $prop) {
$this->{$prop} = isset($data[$prop]) ? new Address($data[$prop]) : null;
}
foreach (['subtotal', 'shipping_cost', 'tax_value'] as $prop) {
$this->{$prop} = isset($data[$prop]) ? Money::import($data[$prop]) : null;
}
$this->product = isset($data['product']) ? new Product($data['product'], $this->connection) : null;
if (isset($data['items'])) {
$this->items = [];
foreach ($data['items'] as $item_data) {
$this->items[] = new Item($item_data);
}
}
if (isset($data['shipments'])) {
$this->shipments = [];
foreach ($data['shipments'] as $url) {
$this->shipments[] = Shipment::import($url, $this->connection);
}
}
}
开发者ID:sendworks,项目名称:sendworks-php,代码行数:28,代码来源:Order.php
示例11: generateInventoryReportsByRange
/**
* Generate inventory reports by range
*/
public function generateInventoryReportsByRange()
{
$from = Input::get('from');
$to = Input::get('to');
$stock_id = Input::get('stock');
$data = Shipment::generateInventoryReport($from, $to, $stock_id);
return $data;
}
开发者ID:fagray,项目名称:fposs,代码行数:11,代码来源:ReportsController.php
示例12: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$shipped = Shipment::where('deliverytime', 'like', '2016-01-11%')->get();
//print_r($shipped);
foreach ($shipped as $shipment) {
$is_there = Geolog::where('datetimestamp', '=', $shipment->deliverytime)->where('deliveryId', '=', $shipment->delivery_id)->where('sourceSensor', '=', 'gps')->get();
if ($is_there) {
print_r($is_there);
$stay = array_pop($is_there->toArray());
foreach ($is_there as $there) {
print 'there' . "\r\n";
print_r($there);
//$there->remove();
}
print 'stay' . "\r\n";
print_r($stay);
if ($stay) {
$stay->latitude = doubleval($shipment->latitude);
$stay->longitude = doubleval($shipment->longitude);
//$stay->save();
}
}
}
/*
$dbox = Orderlog::where('pickupStatus','=',Config::get('jayon.trans_status_pickup'))
->where('pickuptime','!=','0000-00-00 00:00:00')
->orderBy('created_at','desc')
//->groupBy('created_at')
->get();
if($dbox){
print count($dbox)."\r\n";
foreach($dbox as $dbx){
print_r(array($dbx->pickupStatus, $dbx->pickuptime) );
$ship = Shipment::where('delivery_id','=',$dbx->deliveryId)
->where('pickuptime','!=','0000-00-00 00:00:00')
->first();
if($ship){
print 'before : '.$ship->pickup_status."\r\n";
print 'before : '.$ship->pickuptime."\r\n";
$pickuptime = ($dbx->pickuptime == '0000-00-00 00:00:00')? date('Y-m-d H:i:s', $dbx->created_at->sec ) :$dbx->pickuptime;
$ship->pickup_status = $dbx->pickupStatus;
$ship->pickuptime = $pickuptime;
$ship->save();
//print_r( $ship->toArray());
print 'after : '.$ship->pickup_status."\r\n";
print 'after : '.$ship->pickuptime."\r\n";
}
}
}
*/
}
开发者ID:awidarto,项目名称:jexadmin,代码行数:63,代码来源:Backtrack.php
示例13: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$delivereds = Orderlog::where('appname', '=', Config::get('jex.tracker_app'))->where('status', '=', 'delivered')->orderBy('deliveryId', 'desc')->orderBy('created_at', 'desc')->groupBy('deliveryId')->get(array('deliveryId', 'merchantTransId', 'deliverytime'));
/*
$pendingan = Orderlog::where('appname','=',Config::get('jex.tracker_app'))
->where('pendingCount','!=', strval(0))
->orderBy('created_at','desc')
->orderBy('deliveryId','desc')
->groupBy('deliveryNote')
->get(array( 'deliveryId', 'deliveryNote','status' ));
*/
$count = 0;
$data = '';
foreach ($delivereds as $d) {
$shipment = \Shipment::where('delivery_id', '=', $d->deliveryId)->first();
if ($shipment) {
if (date('Y-m-d', strtotime($d->deliverytime)) != date('Y-m-d', strtotime($shipment->deliverytime))) {
//print $d->deliveryId." ".$d->deliverytime." ".$shipment->deliverytime."\r\n";
$data .= '"' . $d->deliveryId . '","' . $d->merchantTransId . '","' . $d->deliverytime . '","' . $shipment->deliverytime . '"' . "\r\n";
$shipment->deliverytime = $d->deliverytime;
$shipment->save();
$count++;
}
}
}
print $data;
//print "\r\ndifferent date : ".$count;
/*
$pc = array();
foreach ($pendingan as $p) {
if(isset($pc[$p->deliveryId])){
if($p->status == 'pending'){
$pc[$p->deliveryId] = $pc[$p->deliveryId] + 1;
}
}else{
$pc[$p->deliveryId] = 1;
}
}
*/
//print_r($pc);
/*
foreach($pc as $d=>$c){
//print $d->deliveryId." ".$d->deliverytime."\r\n";
$count++;
$shipment = \Shipment::where('delivery_id','=',$d)->first();
if($shipment){
$shipment->pending_count = $c;
//$shipment->status = 'delivered';
//$shipment->deliverytime = $d->deliverytime;
//$shipment->save();
}
//print_r($d->toArray());
}
*/
print "\r\n" . $count;
}
开发者ID:awidarto,项目名称:jexadmin,代码行数:63,代码来源:DeliveryBacktrack.php
示例14: loadByOrder
/**
* Loads a shipment and its packages for a given order.
*
* @param array $order_id
* An order ID.
*
* @return \Drupal\uc_fulfillment\Shipment[]
* Array of shipment object for the given order.
*/
public static function loadByOrder($order_id)
{
$shipments = array();
$result = db_query('SELECT sid FROM {uc_shipments} WHERE order_id = :id', [':id' => $order_id]);
while ($shipment_id = $result->fetchField()) {
$shipments[] = Shipment::load($shipment_id);
}
return $shipments;
}
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:18,代码来源:Shipment.php
示例15: listPickup
public static function listPickup($shipmentId)
{
$criteria = new CDbCriteria();
$criteria->condition = 'id = :id and shipping_status=11';
$criteria->params[':id'] = $shipmentId;
$model = Shipment::model()->find($criteria);
if ($model == null) {
return false;
}
return $model->awb;
}
开发者ID:aantonw,项目名称:dcourier.system,代码行数:11,代码来源:Pickup.php
示例16: SetupShipment
protected function SetupShipment()
{
// Lookup Object PK information from Query String (if applicable)
// Set mode to Edit or New depending on what's found
$intShipmentId = QApplication::QueryString('intShipmentId');
if ($intShipmentId) {
$this->objShipment = Shipment::Load($intShipmentId);
if (!$this->objShipment) {
throw new Exception('Could not find a Shipment object with PK arguments: ' . $intShipmentId);
}
}
}
开发者ID:heshuai64,项目名称:einv2,代码行数:12,代码来源:packing_list.php
示例17: getRealTimeRates
public static function getRealTimeRates(ShippingRateCalculator $handler, Shipment $shipment)
{
$rates = new ShippingRateSet();
$handler->setWeight($shipment->getChargeableWeight());
$order = $shipment->order->get();
// TODO: fix issue when address has zip and country data, but are missing city, user and record id!
// (now workround - get address id, if $address has no id, load address by id)
if ($order->isMultiAddress->get()) {
$address = $shipment->shippingAddress->get();
$arr = $shipment->toArray();
} else {
$address = $order->shippingAddress->get();
$arr = $order->toArray();
}
if (!$address->getID() && array_key_exists('shippingAddressID', $arr)) {
$address = ActiveRecordModel::getInstanceByID('UserAddress', $arr['shippingAddressID'], true);
}
if (!$address) {
return $rates;
}
$handler->setDestCountry($address->countryID->get());
$handler->setDestState($address->state->get() ? $address->state->get()->code->get() : $address->stateName->get());
$handler->setDestZip($address->postalCode->get());
$handler->setDestCity($address->city->get());
$config = $shipment->getApplication()->getConfig();
$handler->setSourceCountry($config->get('STORE_COUNTRY'));
$handler->setSourceZip($config->get('STORE_ZIP'));
$handler->setSourceState($config->get('STORE_STATE'));
foreach ($handler->getAllRates() as $k => $rate) {
$newRate = new ShipmentDeliveryRate();
$newRate->setApplication($shipment->getApplication());
$newRate->setCost($rate->getCostAmount(), $rate->getCostCurrency());
$newRate->setServiceName($rate->getServiceName());
$newRate->setClassName($rate->getClassName());
$newRate->setProviderName($rate->getProviderName());
$newRate->setServiceId($rate->getClassName() . '_' . $k);
$rates->add($newRate);
}
return $rates;
}
开发者ID:saiber,项目名称:livecart,代码行数:40,代码来源:ShipmentDeliveryRate.php
示例18: save
public function save($shipment)
{
if ($shipment->id) {
$path = "shipments/" . $shipment->id;
} else {
$path = "shipments";
}
$response = $this->client()->post($path, ['json' => $shipment->toHash()]);
if ($response->getStatusCode() == 200) {
return Shipment::import(json_decode($response->getBody(), true), $this->connection);
} else {
$this->raiseError($response);
}
}
开发者ID:sendworks,项目名称:sendworks-php,代码行数:14,代码来源:ShipmentsCollection.php
示例19: __construct
public function __construct()
{
$this->config = parse_ini_file('config.ini', true);
Shipment::$database_connect = mysql_connect($this->config['database']['host'], $this->config['database']['user'], $this->config['database']['password']);
if (!Shipment::$database_connect) {
echo "Unable to connect to DB: " . mysql_error(Shipment::$database_connect);
exit;
}
mysql_query("SET NAMES 'UTF8'", Shipment::$database_connect);
if (!mysql_select_db($this->config['database']['name'], Shipment::$database_connect)) {
echo "Unable to select mydbname: " . mysql_error(Shipment::$database_connect);
exit;
}
//$this->startTime = date("Y-m-d 13:30:00",mktime(0, 0, 0, date("m"), date("d")-1, date("Y")));
}
开发者ID:heshuai64,项目名称:ebo,代码行数:15,代码来源:Shipment2.php
示例20: postLast
public function postLast()
{
$in = Input::get();
$orderid = trim($in['orderId']);
$orderff = trim($in['orderFf']);
$delivery_id = trim($in['delivery_id']);
if (isset($in['delivery_id'])) {
$order = Shipment::where('fulfillment_code', '=', $orderff)->where('no_sales_order', '=', $orderid)->where('delivery_id', '=', $delivery_id)->orderBy('pick_up_date', 'desc')->first();
} else {
$order = Shipment::where('fulfillment_code', '=', $orderff)->where('no_sales_order', '=', $orderid)->orderBy('pick_up_date', 'desc')->first();
}
$statuses = array();
if ($order) {
if ($order->logistic_type == 'external') {
$conf = Config::get('cs.' . $order->consignee_olshop_cust);
if (!isset($conf['status'])) {
$conf = Config::get('cs.default');
}
$mdl = Threeplstatuses::where($conf['awb'], '=', strval($order->{$conf['order_awb']}))->where(function ($q) use($order) {
$q->where('consignee_olshop_cust', '=', strval($order->consignee_olshop_cust))->orWhere('consignee_logistic_id', '=', strval($order->consignee_olshop_cust));
});
if (count($conf['group']) > 0) {
foreach ($conf['group'] as $g) {
$mdl = $mdl->groupBy($g);
}
}
$mdl = $mdl->orderBy($conf['order'], 'desc');
if ($conf['status'] == 'single') {
//$statuses = $mdl->take(1)->timeout(-1)->get();
$statuses = $mdl->timeout(-1)->first();
} else {
if (count($conf['get']) > 0) {
$statuses = $mdl->timeout(-1)->get($conf['get']);
} else {
$statuses = $mdl->timeout(-1)->get();
}
}
if ($statuses) {
$statuses = $statuses->toArray();
} else {
$statuses = array();
}
//print_r($statuses);
}
$order->picList = $this->picList($order);
}
return View::make('cs.lastdetail')->with('order', $order)->with('status', $statuses)->render();
}
开发者ID:awidarto,项目名称:bilnatracker,代码行数:48,代码来源:CsController.php
注:本文中的Shipment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论