当前位置: 首页>>代码示例>>PHP>>正文


PHP Shipment::toArray方法代码示例

本文整理汇总了PHP中Shipment::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Shipment::toArray方法的具体用法?PHP Shipment::toArray怎么用?PHP Shipment::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shipment的用法示例。


在下文中一共展示了Shipment::toArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: query

 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

示例2: 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

示例3: Shipment

 function init_with_data($id, $returnObj = 0)
 {
     $shipment = new Shipment($id, $this->user);
     $shipdata = $shipment->toArray();
     $preferences_q = query("SELECT settings FROM `" . $this->user['database'] . "`.account_settings WHERE group_id='" . $this->user['group'] . "'");
     $preferences_r = fetch($preferences_q);
     $preferences = json_decode($preferences_r['settings'], 1);
     if (isset($shipdata['pup_area']) && $shipdata['pup_area'] != '') {
         $preferences['shipon_settings_dad_pup_area'] = $shipdata['pup_area'];
     }
     if (isset($shipdata['del_area']) && $shipdata['del_area'] != '') {
         $preferences['shipon_settings_dad_del_area'] = $shipdata['del_area'];
     }
     $this->smarty->assign('preferences', $preferences);
     $view = $this->smarty->fetch('shipment/shipment.tpl');
     $view .= $this->load_tooltips('shipment', '0');
     $this->html['shipon_content'] = $view;
     foreach ($shipdata as $var => $val) {
         if ($var == 'id' || $var == 'timestamp' || $var == 'group_id' || $var == 'bill' || $var == 'pbnum' || $var == 'ext_id') {
             continue;
         }
         if (gettype($val) == "array" && $var == 'goods') {
             continue;
         }
         if (strpos($var, 'bill') !== false) {
             continue;
         }
         $key = 'shipon_' . $var;
         $this->return['inputs'][$key] = $val;
     }
     $this->return['inputs']['shipon_quote_no'] = '';
     $this->return['inputs']['shipon_del_date'] = date('m/d/Y');
     $goods = json_encode($shipdata['goods']);
     $html = "<script type='text/javascript'>window.goods_set_division = '" . $shipment->division . "'; window.goods_set_uom = '" . $shipment->uom . "'; window.is_recall = true; fill_goods_table('" . $goods . "');</script>";
     $this->html['shipon_content'] .= $html;
     if ($returnObj != 0) {
         return $shipment;
     }
 }
开发者ID:kamalspalace,项目名称:_CORE,代码行数:39,代码来源:shipment.php

示例4: order_save


//.........这里部分代码省略.........
                     
                     $u_total = str_replace(array(',','.'), '', $item['unit_total']);
                     $u_discount = str_replace(array(',','.'), '', $item['unit_discount']);
                     $gt += (int)$u_total;
                     $d += (int)$u_discount;
                     */
                 }
                 $total = isset($in->total_price) && $in->total_price > 0 ? $in->total_price : 0;
                 $total = str_replace(array(',', '.'), '', $total);
                 $total = (int) $total;
                 $gt = $total < $gt ? $gt : $total;
                 $disc = isset($in->total_discount) ? $in->total_discount : 0;
                 $tax = isset($in->total_tax) ? $in->total_tax : 0;
                 $cod = isset($in->cod_cost) ? $in->cod_cost : 'Paid by merchant';
                 $disc = str_replace(array(',', '.'), '', $disc);
                 $tax = str_replace(array(',', '.'), '', $tax);
                 $cod = str_replace(array(',', '.'), '', $cod);
                 $disc = (int) $disc;
                 $tax = (int) $tax;
                 $cod = (int) $cod;
                 $chg = $gt - $disc + $tax + $cod;
                 /*
                 $this->table->add_row(
                     '',
                     '',
                     'Total Price',
                     number_format($gt,2,',','.')
                 );
                 
                 $this->table->add_row(
                     '',
                     '',
                     'Total Discount',
                     number_format($disc,2,',','.')
                 );
                 
                 $this->table->add_row(
                     '',
                     '',
                     'Total Tax',
                     number_format($tax,2,',','.')
                 );
                 
                 
                 if($cod == 0){
                     $this->table->add_row(
                         '',
                         '',
                         'COD Charges',
                         'Paid by Merchant'
                     );
                 }else{
                     $this->table->add_row(
                         '',
                         '',
                         'COD Charges',
                         number_format($cod,2,',','.')
                     );
                 }
                 
                 
                 $this->table->add_row(
                     '',
                     '',
                     'Total Charges',
                     number_format($chg,2,',','.')
                 );
                 
                 $nedata['detail'] = $this->table;
                 
                 
                 $result = json_encode(array('status'=>'OK:ORDERPOSTED','timestamp'=>now(),'delivery_id'=>$delivery_id,'buyer_id'=>$buyer_id));
                 */
                 //return $ship->toArray();
             } else {
                 //$nedata['detail'] = false;
                 //$result = json_encode(array('status'=>'OK:ORDERPOSTEDNODETAIL','timestamp'=>now(),'delivery_id'=>$delivery_id));
                 //return $order;
             }
             return $ship->toArray();
             //print_r($app);
             /*
             
                             if($app->notify_on_new_order == 1){
                                 send_notification('New Delivery Order - Jayon Express COD Service',$in->email,$app->cc_to,$app->reply_to,'order_submit',$nedata,null);
                             }
             
                             if($is_new == true){
                                 $edata['fullname'] = $dataset['fullname'];
                                 $edata['username'] = $buyer_username;
                                 $edata['password'] = $password;
                                 if($app->notify_on_new_member == 1 && $in->email != 'noemail'){
                                     send_notification('New Member Registration - Jayon Express COD Service',$in->email,null,null,'new_member',$edata,null);
                                 }
             
                             }*/
         }
     }
     //$this->log_access($api_key, __METHOD__ ,$result,$args);
 }
开发者ID:awidarto,项目名称:jexadmin,代码行数:101,代码来源:AwbController.php

示例5: define

 function generate_pdf()
 {
     define('FPDF_FONTPATH', 'includes/pdf/font/');
     require_once 'includes/pdf/fpdf.php';
     require_once 'includes/pdf/fpdi.php';
     //get layout xml
     $pdf_xml = file_get_contents($this->user['folder'] . "/templates/pdf.xml");
     // if we state explicitly to show rates on waybill, then we use a different template
     if (isset($_REQUEST['show_rates']) && $_REQUEST['show_rates'] > 0) {
         $pdf_xml = file_get_contents($this->user['folder'] . "/templates/pdf_rates.xml");
     }
     $xml = new SimpleXMLElement($pdf_xml);
     $pdf = new AlphaPDI('P', 'pt', array($xml->pdf_pt_width, $xml->pdf_pt_height));
     $pdf->SetAutoPageBreak(false);
     $pdf->AddPage();
     $pdf->setSourceFile($this->user['folder'] . "/pdf/default.pdf");
     $tplIdx = $pdf->importPage(1);
     $pdf->useTemplate($tplIdx, 0, 0, 0, 0, false);
     // Check for external shipment data
     if (isset($_REQUEST['bill_id'])) {
         $req = array();
         $req['pbnum'] = $_REQUEST['bill_id'];
         $req['bill_to_code'] = $this->user['bill_to_code'];
         $integrate = new IntegrationHandler($this->user);
         $data = $integrate->process_request('order_details_request', $req);
         // Prevent order numbers from being inputted sequentially
         if ($data == false) {
             return false;
         }
         $data['sent'] = 1;
     } else {
         $shipment = new Shipment($_REQUEST['id'], $this->user);
         $data = $shipment->toArray();
     }
     $data['ship_name'] = clean_string($data['ship_name']);
     $data['ship_street1'] = clean_string($data['ship_street1']);
     $data['ship_street2'] = clean_string($data['ship_street2']);
     $data['ship_city'] = clean_string($data['ship_city']);
     $data['cons_name'] = clean_string($data['cons_name']);
     $data['cons_street1'] = clean_string($data['cons_street1']);
     $data['cons_street2'] = clean_string($data['cons_street2']);
     $data['cons_city'] = clean_string($data['cons_city']);
     $xml_data = $xml->LAYOUT->DATA->children();
     $radios_data = $xml->LAYOUT->RADIOS->children();
     $goods_data = $xml->LAYOUT->GOODS->column_data->children();
     $select_data = $xml->LAYOUT->SELECT->children();
     $custom_data = $xml->LAYOUT->CUSTOM->children();
     $pdf->SetFont('Helvetica', 'B', '12');
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetAlpha(0.75);
     foreach ($xml_data as $entry) {
         if ($entry['size']) {
             $pdf->SetFontSize($entry['size']);
         }
         if (!$entry["multiline"]) {
             $pdf->SetXY($entry['x'], $entry['y']);
         }
         if (isset($entry["maxlength"]) && strlen($data[(string) $entry]) > $entry["maxlength"]) {
             $data[(string) $entry] = substr($data[(string) $entry], 0, (int) $entry["maxlength"]);
         }
         if ($entry["array"] && isset($data[(string) $entry['array']][(string) $entry])) {
             if ($entry["multiline"]) {
                 $pdf->MultiCell($entry['width'], $entry['height'], $data[(string) $entry['array']][(string) $entry]);
             } else {
                 if ($entry["letter_spacing"]) {
                     $pdf->CellFitSpaceForce($entry["width"], 0, $data[(string) $entry['array']][(string) $entry]);
                 } else {
                     $pdf->Write(0, strtoupper($data[(string) $entry['array']][(string) $entry]));
                 }
             }
         } elseif (isset($data[(string) $entry])) {
             if ($entry["multiline"]) {
                 if ($entry == 'pup_note' && $data[(string) $entry] != '') {
                     $data[(string) $entry] = "PU-" . $data[(string) $entry];
                 } else {
                     if ($entry == 'del_note' && $data[(string) $entry] != '') {
                         $data[(string) $entry] = "DL-" . $data[(string) $entry];
                     }
                 }
                 $textRaw = wordwrap($data[(string) $entry], 31, '\\n');
                 $wrapArr = explode('\\n', $textRaw);
                 $i = 0;
                 foreach ($wrapArr as $line) {
                     if ($i == 0) {
                         $pdf->SetXY($entry['x'], $entry['y']);
                     } else {
                         $pdf->SetXY($entry['x'], (int) $entry['y'] + $i * 10);
                     }
                     $pdf->MultiCell($entry['width'], 0, $line);
                     $i++;
                 }
             } else {
                 if ($entry["letter_spacing"]) {
                     if (isset($entry["type"]) && $entry["type"] == 'date') {
                         $dateArr = explode('/', $data[(string) $entry]);
                         $i = 0;
                         foreach ($dateArr as $line) {
                             if ($i == 1) {
                                 $pdf->SetXY($entry['x'], $entry['y']);
                             } else {
//.........这里部分代码省略.........
开发者ID:kamalspalace,项目名称:_CORE,代码行数:101,代码来源:view_manager.php


注:本文中的Shipment::toArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。