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


PHP PrestaShopCollection::getFirst方法代码示例

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


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

示例1: assignOrderTracking

 /**
  * Assigns template vars related to order tracking information
  *
  * @param PrestaShopCollection $order_collection
  *
  * @throws PrestaShopException
  */
 protected function assignOrderTracking($order_collection)
 {
     $customer = new Customer((int) $order_collection->getFirst()->id_customer);
     $order_collection = $order_collection->getAll();
     $order_list = array();
     foreach ($order_collection as $order) {
         $order_list[] = $order;
     }
     foreach ($order_list as &$order) {
         /** @var Order $order */
         $order->id_order_state = (int) $order->getCurrentState();
         $order->invoice = OrderState::invoiceAvailable((int) $order->id_order_state) && $order->invoice_number;
         $order->order_history = $order->getHistory((int) $this->context->language->id, false, true);
         $order->carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang);
         $order->address_invoice = new Address((int) $order->id_address_invoice);
         $order->address_delivery = new Address((int) $order->id_address_delivery);
         $order->inv_adr_fields = AddressFormat::getOrderedAddressFields($order->address_invoice->id_country);
         $order->dlv_adr_fields = AddressFormat::getOrderedAddressFields($order->address_delivery->id_country);
         $order->invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($order->address_invoice, $order->inv_adr_fields);
         $order->deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($order->address_delivery, $order->dlv_adr_fields);
         $order->currency = new Currency($order->id_currency);
         $order->discounts = $order->getCartRules();
         $order->invoiceState = Validate::isLoadedObject($order->address_invoice) && $order->address_invoice->id_state ? new State((int) $order->address_invoice->id_state) : false;
         $order->deliveryState = Validate::isLoadedObject($order->address_delivery) && $order->address_delivery->id_state ? new State((int) $order->address_delivery->id_state) : false;
         $order->products = $order->getProducts();
         $order->customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
         Product::addCustomizationPrice($order->products, $order->customizedDatas);
         $order->total_old = $order->total_discounts > 0 ? (double) $order->total_paid - (double) $order->total_discounts : false;
         if ($order->carrier->url && $order->shipping_number) {
             $order->followup = str_replace('@', $order->shipping_number, $order->carrier->url);
         }
         $order->hook_orderdetaildisplayed = Hook::exec('displayOrderDetail', array('order' => $order));
         Hook::exec('actionOrderDetail', array('carrier' => $order->carrier, 'order' => $order));
     }
     $this->context->smarty->assign(array('shop_name' => Configuration::get('PS_SHOP_NAME'), 'order_collection' => $order_list, 'return_allowed' => false, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'is_guest' => true, 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'use_tax' => Configuration::get('PS_TAX')));
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:43,代码来源:GuestTrackingController.php


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