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


PHP AddressFormat::getFormattedAddressFieldsValues方法代码示例

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


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

示例1: process

 public function process()
 {
     parent::process();
     $multipleAddressesFormated = array();
     $ordered_fields = array();
     $customer = new Customer((int) self::$cookie->id_customer);
     if (!Validate::isLoadedObject($customer)) {
         die(Tools::displayError('Customer not found'));
     }
     // Retro Compatibility Theme < 1.4.1
     self::$smarty->assign('addresses', $customer->getAddresses((int) self::$cookie->id_lang));
     $customerAddressesDetailed = $customer->getAddresses((int) self::$cookie->id_lang);
     $total = 0;
     foreach ($customerAddressesDetailed as $addressDetailed) {
         $address = new Address($addressDetailed['id_address']);
         $multipleAddressesFormated[$total]['ordered'] = AddressFormat::getOrderedAddressFields($addressDetailed['id_country']);
         $multipleAddressesFormated[$total]['formated'] = AddressFormat::getFormattedAddressFieldsValues($address, $multipleAddressesFormated[$total]['ordered']);
         $multipleAddressesFormated[$total]['object'] = $addressDetailed;
         unset($address);
         ++$total;
         // Retro theme < 1.4.2
         $ordered_fields = AddressFormat::getOrderedAddressFields($addressDetailed['id_country']);
     }
     // Retro theme 1.4.2
     if ($key = array_search('Country:name', $ordered_fields)) {
         $ordered_fields[$key] = 'country';
     }
     self::$smarty->assign('addresses_style', array('company' => 'address_company', 'vat_number' => 'address_company', 'firstname' => 'address_name', 'lastname' => 'address_name', 'address1' => 'address_address1', 'address2' => 'address_address2', 'city' => 'address_city', 'country' => 'address_country', 'phone' => 'address_phone', 'phone_mobile' => 'address_phone_mobile', 'alias' => 'address_title'));
     self::$smarty->assign(array('multipleAddresses' => $multipleAddressesFormated, 'ordered_fields' => $ordered_fields));
     unset($customer);
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:31,代码来源:AddressesController.php

示例2: process

 public function process()
 {
     parent::process();
     if ($id_order = Tools::getValue('id_order') and $email = Tools::getValue('email')) {
         $order = new Order((int) $id_order);
         if (!Validate::isLoadedObject($order)) {
             $this->errors[] = Tools::displayError('Invalid order');
         } elseif (!$order->isAssociatedAtGuest($email)) {
             $this->errors[] = Tools::displayError('Invalid order');
         } else {
             $customer = new Customer((int) $order->id_customer);
             $id_order_state = (int) $order->getCurrentState();
             $carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang);
             $addressInvoice = new Address((int) $order->id_address_invoice);
             $addressDelivery = new Address((int) $order->id_address_delivery);
             $inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
             $dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
             $invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields);
             $deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields);
             if ($order->total_discounts > 0) {
                 self::$smarty->assign('total_old', (double) ($order->total_paid - $order->total_discounts));
             }
             $products = $order->getProducts();
             $customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
             Product::addCustomizationPrice($products, $customizedDatas);
             $this->processAddressFormat($addressDelivery, $addressInvoice);
             self::$smarty->assign(array('shop_name' => Configuration::get('PS_SHOP_NAME'), 'order' => $order, 'return_allowed' => false, 'currency' => new Currency($order->id_currency), 'order_state' => (int) $id_order_state, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'invoice' => OrderState::invoiceAvailable((int) $id_order_state) and $order->invoice_number, 'order_history' => $order->getHistory((int) self::$cookie->id_lang, false, true), 'products' => $products, 'discounts' => $order->getDiscounts(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => (Validate::isLoadedObject($addressInvoice) and $addressInvoice->id_state) ? new State((int) $addressInvoice->id_state) : false, 'address_delivery' => $addressDelivery, 'deliveryState' => (Validate::isLoadedObject($addressDelivery) and $addressDelivery->id_state) ? new State((int) $addressDelivery->id_state) : false, 'is_guest' => true, 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'use_tax' => Configuration::get('PS_TAX'), 'customizedDatas' => $customizedDatas, 'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues, 'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues));
             if ($carrier->url and $order->shipping_number) {
                 self::$smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
             }
             self::$smarty->assign('HOOK_ORDERDETAILDISPLAYED', Module::hookExec('orderDetailDisplayed', array('order' => $order)));
             Module::hookExec('OrderDetail', array('carrier' => $carrier, 'order' => $order));
             if (Tools::isSubmit('submitTransformGuestToCustomer')) {
                 $customer = new Customer((int) $order->id_customer);
                 if (!Validate::isLoadedObject($customer)) {
                     $this->errors[] = Tools::displayError('Invalid customer');
                 }
                 if (!$customer->transformToCustomer(self::$cookie->id_lang, Tools::getValue('password'))) {
                     $this->errors[] = Tools::displayError('An error occurred while transforming guest to customer.');
                 }
                 if (!Tools::getValue('password')) {
                     $this->errors[] = Tools::displayError('Invalid password');
                 } else {
                     self::$smarty->assign('transformSuccess', true);
                 }
             }
         }
         if (sizeof($this->errors)) {
             /* Handle brute force attacks */
             sleep(1);
         }
     }
     self::$smarty->assign(array('action' => 'guest-tracking.php', 'errors' => $this->errors));
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:54,代码来源:GuestTrackingController.php

示例3: initContent

    public function initContent()
    {
        parent::initContent();
        $customer = $this->context->customer;
        /*
         * Get delivery address and data.
         */
        if ((int) $this->context->cart->id_address_delivery) {
            $shipto_delivery_address = new Address((int) $this->context->cart->id_address_delivery);
            $country_name = Db::getInstance()->getValue('SELECT name FROM ' . _DB_PREFIX_ . 'country_lang
		WHERE id_country = ' . (int) Configuration::get('SHIPTOMYID_DEFAULT_ADDR_COUNTRY') . ' ');
            $state_name = Db::getInstance()->getValue('SELECT name FROM ' . _DB_PREFIX_ . 'state
		WHERE id_state = ' . (int) Configuration::get('SHIPTOMYID_DEFAULT_ADDR_STATE') . ' ');
            $default_delivery_address = array('address1' => Configuration::get('SHIPTOMYID_DEFAULT_ADDR_ADDRESS'), 'address2' => Configuration::get('SHIPTOMYID_DEFAULT_ADDR_ADDRESS2'), 'city' => Configuration::get('SHIPTOMYID_DEFAULT_ADDR_CITY'), 'zip' => Configuration::get('SHIPTOMYID_DEFAULT_ADDR_POSTCODE'), 'phone' => Configuration::get('SHIPTOMYID_DEFAULT_ADDR_PHONE'), 'alise' => Configuration::get('SHIPTOMYID_DEFAULT_ADDR_ALIAS'), 'country' => $country_name, 'state' => $state_name);
            $this->context->smarty->assign(array('shipto_delivery_address' => $shipto_delivery_address, 'shipto_default_delivery_address' => $default_delivery_address));
        }
        /*
         * Get addresses.
         */
        $customer_addresses = $customer->getAddresses($this->context->language->id, false);
        // On supprime de la liste les addresse shipto
        foreach ($customer_addresses as $key => $address) {
            if (strpos(Tools::strtolower($address['alias']), 'ship2myid') !== false) {
                $customer_addresses[$key]['shipto_addr'] = 1;
            }
        }
        // Getting a list of formated address fields with associated values
        $formated_address_fields_values_list = array();
        foreach ($customer_addresses as $i => $address) {
            if (!Address::isCountryActiveById((int) $address['id_address'])) {
                unset($customer_addresses[$i]);
            }
            $tmp_address = new Address($address['id_address']);
            $formated_address_fields_values_list[$address['id_address']]['ordered_fields'] = AddressFormat::getOrderedAddressFields($address['id_country']);
            $formated_address_fields_values_list[$address['id_address']]['formated_fields_values'] = AddressFormat::getFormattedAddressFieldsValues($tmp_address, $formated_address_fields_values_list[$address['id_address']]['ordered_fields']);
            unset($tmp_address);
        }
        if (key($customer_addresses) != 0) {
            $customer_addresses = array_values($customer_addresses);
        }
        $this->context->smarty->assign(array('addresses' => $customer_addresses, 'formatedAddressFieldsValuesList' => $formated_address_fields_values_list));
        if (class_exists('Tools') && method_exists('Tools', 'version_compare') && Tools::version_compare(_PS_VERSION_, '1.6', '>=') === true) {
            $this->setTemplate('front-16.tpl');
        } else {
            $this->setTemplate('front.tpl');
        }
    }
开发者ID:ship2myidpresta,项目名称:shiptomyid-1,代码行数:47,代码来源:front.php

示例4: assignOrderTracking

 /**
  * Assign template vars related to order tracking informations
  */
 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) {
         $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 - $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' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'use_tax' => Configuration::get('PS_TAX')));
 }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:38,代码来源:GuestTrackingController.php

示例5: initContent

 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     if (!($id_order = (int) Tools::getValue('id_order')) || !Validate::isUnsignedId($id_order)) {
         $this->errors[] = Tools::displayError('Order ID required');
     } else {
         $order = new Order($id_order);
         if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) {
             $id_order_state = (int) $order->getCurrentState();
             $carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang);
             $addressInvoice = new Address((int) $order->id_address_invoice);
             $addressDelivery = new Address((int) $order->id_address_delivery);
             $inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
             $dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
             $invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields);
             $deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields);
             if ($order->total_discounts > 0) {
                 $this->context->smarty->assign('total_old', (double) ($order->total_paid - $order->total_discounts));
             }
             $products = $order->getProducts();
             /* DEPRECATED: customizedDatas @since 1.5 */
             $customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
             Product::addCustomizationPrice($products, $customizedDatas);
             OrderReturn::addReturnedQuantity($products, $order->id);
             $customer = new Customer($order->id_customer);
             $this->context->smarty->assign(array('shop_name' => strval(Configuration::get('PS_SHOP_NAME')), 'order' => $order, 'return_allowed' => (int) $order->isReturnable(), 'currency' => new Currency($order->id_currency), 'order_state' => (int) $id_order_state, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'invoice' => OrderState::invoiceAvailable($id_order_state) && count($order->getInvoicesCollection()), 'order_history' => $order->getHistory($this->context->language->id, false, true), 'products' => $products, 'discounts' => $order->getCartRules(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => Validate::isLoadedObject($addressInvoice) && $addressInvoice->id_state ? new State($addressInvoice->id_state) : false, 'address_delivery' => $addressDelivery, 'inv_adr_fields' => $inv_adr_fields, 'dlv_adr_fields' => $dlv_adr_fields, 'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues, 'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues, 'deliveryState' => Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state ? new State($addressDelivery->id_state) : false, 'is_guest' => false, 'messages' => CustomerMessage::getMessagesByOrderId((int) $order->id, false), 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'), 'use_tax' => Configuration::get('PS_TAX'), 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'customizedDatas' => $customizedDatas));
             if ($carrier->url && $order->shipping_number) {
                 $this->context->smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
             }
             $this->context->smarty->assign('HOOK_ORDERDETAILDISPLAYED', Hook::exec('displayOrderDetail', array('order' => $order)));
             Hook::exec('actionOrderDetail', array('carrier' => $carrier, 'order' => $order));
             unset($carrier, $addressInvoice, $addressDelivery);
         } else {
             $this->errors[] = Tools::displayError('This order cannot be found.');
         }
         unset($order);
     }
     $this->setTemplate(_PS_THEME_DIR_ . 'order-detail.tpl');
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:43,代码来源:OrderDetailController.php

示例6: _assignAddress

 protected function _assignAddress()
 {
     //if guest checkout disabled and flag is_guest  in cookies is actived
     if (Configuration::get('PS_GUEST_CHECKOUT_ENABLED') == 0 && (int) $this->context->customer->is_guest != Configuration::get('PS_GUEST_CHECKOUT_ENABLED')) {
         $this->context->customer->logout();
         Tools::redirect('');
     } else {
         if (!Customer::getAddressesTotalById($this->context->customer->id)) {
             Tools::redirect('index.php?controller=address&back=' . urlencode('order.php?step=1&multi-shipping=' . (int) Tools::getValue('multi-shipping')));
         }
     }
     $customer = $this->context->customer;
     if (Validate::isLoadedObject($customer)) {
         /* Getting customer addresses */
         $customerAddresses = $customer->getAddresses($this->context->language->id);
         // Getting a list of formated address fields with associated values
         $formatedAddressFieldsValuesList = array();
         foreach ($customerAddresses as $i => $address) {
             if (!Address::isCountryActiveById((int) $address['id_address'])) {
                 unset($customerAddresses[$i]);
             }
             $tmpAddress = new Address($address['id_address']);
             $formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields'] = AddressFormat::getOrderedAddressFields($address['id_country']);
             $formatedAddressFieldsValuesList[$address['id_address']]['formated_fields_values'] = AddressFormat::getFormattedAddressFieldsValues($tmpAddress, $formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields']);
             unset($tmpAddress);
         }
         if (key($customerAddresses) != 0) {
             $customerAddresses = array_values($customerAddresses);
         }
         if (!count($customerAddresses)) {
             $bad_delivery = false;
             if (($bad_delivery = (bool) (!Address::isCountryActiveById((int) $this->context->cart->id_address_delivery))) || !Address::isCountryActiveById((int) $this->context->cart->id_address_invoice)) {
                 $back_url = $this->context->link->getPageLink('order', true, (int) $this->context->language->id, array('step' => Tools::getValue('step'), 'multi-shipping' => (int) Tools::getValue('multi-shipping')));
                 $params = array('multi-shipping' => (int) Tools::getValue('multi-shipping'), 'id_address' => $bad_delivery ? (int) $this->context->cart->id_address_delivery : (int) $this->context->cart->id_address_invoice, 'back' => $back_url);
                 Tools::redirect($this->context->link->getPageLink('address', true, (int) $this->context->language->id, $params));
             }
         }
         $this->context->smarty->assign(array('addresses' => $customerAddresses, 'formatedAddressFieldsValuesList' => $formatedAddressFieldsValuesList));
         /* Setting default addresses for cart */
         if ((!isset($this->context->cart->id_address_delivery) || empty($this->context->cart->id_address_delivery)) && count($customerAddresses)) {
             $this->context->cart->id_address_delivery = (int) $customerAddresses[0]['id_address'];
             $update = 1;
         }
         if ((!isset($this->context->cart->id_address_invoice) || empty($this->context->cart->id_address_invoice)) && count($customerAddresses)) {
             $this->context->cart->id_address_invoice = (int) $customerAddresses[0]['id_address'];
             $update = 1;
         }
         /* Update cart addresses only if needed */
         if (isset($update) && $update) {
             $this->context->cart->update();
             // Address has changed, so we check if the cart rules still apply
             CartRule::autoRemoveFromCart($this->context);
             CartRule::autoAddToCart($this->context);
         }
         /* If delivery address is valid in cart, assign it to Smarty */
         if (isset($this->context->cart->id_address_delivery)) {
             $deliveryAddress = new Address((int) $this->context->cart->id_address_delivery);
             if (Validate::isLoadedObject($deliveryAddress) && $deliveryAddress->id_customer == $customer->id) {
                 $this->context->smarty->assign('delivery', $deliveryAddress);
             }
         }
         /* If invoice address is valid in cart, assign it to Smarty */
         if (isset($this->context->cart->id_address_invoice)) {
             $invoiceAddress = new Address((int) $this->context->cart->id_address_invoice);
             if (Validate::isLoadedObject($invoiceAddress) && $invoiceAddress->id_customer == $customer->id) {
                 $this->context->smarty->assign('invoice', $invoiceAddress);
             }
         }
     }
     if ($oldMessage = Message::getMessageByCartId((int) $this->context->cart->id)) {
         $this->context->smarty->assign('oldMessage', $oldMessage['message']);
     }
 }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:73,代码来源:ParentOrderController.php

示例7: getFormattedLayoutData

 public static function getFormattedLayoutData($address)
 {
     $layoutData = array();
     if ($address && $address instanceof Address) {
         $layoutData['ordered'] = AddressFormat::getOrderedAddressFields((int) $address->id_country);
         $layoutData['formated'] = AddressFormat::getFormattedAddressFieldsValues($address, $layoutData['ordered']);
         $layoutData['object'] = array();
         $reflect = new ReflectionObject($address);
         $public_properties = $reflect->getProperties(ReflectionProperty::IS_PUBLIC);
         foreach ($public_properties as $property) {
             if (isset($address->{$property->getName()})) {
                 $layoutData['object'][$property->getName()] = $address->{$property->getName()};
             }
         }
     }
     return $layoutData;
 }
开发者ID:jicheng17,项目名称:pengwine,代码行数:17,代码来源:AddressFormat.php

示例8: preProcess

 public function preProcess()
 {
     parent::preProcess();
     if (Tools::isSubmit('submitMessage')) {
         $idOrder = (int) Tools::getValue('id_order');
         $msgText = htmlentities(Tools::getValue('msgText'), ENT_COMPAT, 'UTF-8');
         if (!$idOrder or !Validate::isUnsignedId($idOrder)) {
             $this->errors[] = Tools::displayError('Order is no longer valid');
         } elseif (empty($msgText)) {
             $this->errors[] = Tools::displayError('Message cannot be blank');
         } elseif (!Validate::isMessage($msgText)) {
             $this->errors[] = Tools::displayError('Message is invalid (HTML is not allowed)');
         }
         if (!sizeof($this->errors)) {
             $order = new Order((int) $idOrder);
             if (Validate::isLoadedObject($order) and $order->id_customer == self::$cookie->id_customer) {
                 $message = new Message();
                 $message->id_customer = (int) self::$cookie->id_customer;
                 $message->message = $msgText;
                 $message->id_order = (int) $idOrder;
                 $message->private = false;
                 $message->add();
                 if (!Configuration::get('PS_MAIL_EMAIL_MESSAGE')) {
                     $to = strval(Configuration::get('PS_SHOP_EMAIL'));
                 } else {
                     $to = new Contact((int) Configuration::get('PS_MAIL_EMAIL_MESSAGE'));
                     $to = strval($to->email);
                 }
                 $toName = strval(Configuration::get('PS_SHOP_NAME'));
                 $customer = new Customer((int) self::$cookie->id_customer);
                 if (Validate::isLoadedObject($customer)) {
                     Mail::Send((int) self::$cookie->id_lang, 'order_customer_comment', Mail::l('Message from a customer', (int) self::$cookie->id_lang), array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{email}' => $customer->email, '{id_order}' => (int) $message->id_order, '{order_name}' => sprintf("#%06d", (int) $message->id_order), '{message}' => $message->message), $to, $toName, $customer->email, $customer->firstname . ' ' . $customer->lastname);
                 }
                 if (Tools::getValue('ajax') != 'true') {
                     Tools::redirect('order-detail.php?id_order=' . (int) $idOrder);
                 }
             } else {
                 $this->errors[] = Tools::displayError('Order not found');
             }
         }
     }
     if (!($id_order = (int) Tools::getValue('id_order')) or !Validate::isUnsignedId($id_order)) {
         $this->errors[] = Tools::displayError('Order ID required');
     } else {
         $order = new Order($id_order);
         if (Validate::isLoadedObject($order) and $order->id_customer == self::$cookie->id_customer) {
             $id_order_state = (int) $order->getCurrentState();
             $carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang);
             $addressInvoice = new Address((int) $order->id_address_invoice);
             $addressDelivery = new Address((int) $order->id_address_delivery);
             //	$stateInvoiceAddress = new State((int)$addressInvoice->id_state);
             $inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
             $dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
             $invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields);
             $deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields);
             if ($order->total_discounts > 0) {
                 self::$smarty->assign('total_old', (double) ($order->total_paid - $order->total_discounts));
             }
             $products = $order->getProducts();
             $customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
             Product::addCustomizationPrice($products, $customizedDatas);
             $customer = new Customer($order->id_customer);
             self::$smarty->assign(array('shop_name' => strval(Configuration::get('PS_SHOP_NAME')), 'order' => $order, 'return_allowed' => (int) $order->isReturnable(), 'currency' => new Currency($order->id_currency), 'order_state' => (int) $id_order_state, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'invoice' => OrderState::invoiceAvailable((int) $id_order_state) and $order->invoice_number, 'order_history' => $order->getHistory((int) self::$cookie->id_lang, false, true), 'products' => $products, 'discounts' => $order->getDiscounts(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => (Validate::isLoadedObject($addressInvoice) and $addressInvoice->id_state) ? new State((int) $addressInvoice->id_state) : false, 'address_delivery' => $addressDelivery, 'inv_adr_fields' => $inv_adr_fields, 'dlv_adr_fields' => $dlv_adr_fields, 'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues, 'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues, 'deliveryState' => (Validate::isLoadedObject($addressDelivery) and $addressDelivery->id_state) ? new State((int) $addressDelivery->id_state) : false, 'is_guest' => false, 'messages' => Message::getMessagesByOrderId((int) $order->id), 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'), 'use_tax' => Configuration::get('PS_TAX'), 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'customizedDatas' => $customizedDatas));
             if ($carrier->url and $order->shipping_number) {
                 self::$smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
             }
             self::$smarty->assign('HOOK_ORDERDETAILDISPLAYED', Module::hookExec('orderDetailDisplayed', array('order' => $order)));
             Module::hookExec('OrderDetail', array('carrier' => $carrier, 'order' => $order));
             unset($carrier);
             unset($addressInvoice);
             unset($addressDelivery);
         } else {
             $this->errors[] = Tools::displayError('Cannot find this order');
         }
         unset($order);
     }
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:77,代码来源:OrderDetailController.php

示例9: getFormattedLayoutData

 public static function getFormattedLayoutData($address)
 {
     $layoutData = array();
     if ($address && $address instanceof Address) {
         $layoutData['ordered'] = AddressFormat::getOrderedAddressFields((int) $address->id_country);
         $layoutData['formated'] = AddressFormat::getFormattedAddressFieldsValues($address, $layoutData['ordered']);
         $layoutData['object'] = get_object_vars($address);
     }
     return $layoutData;
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:10,代码来源:AddressFormat.php

示例10: generateHeaderAddresses

 public static function generateHeaderAddresses(&$pdf, $order, $addressType, $patternRules, $width)
 {
     $maxY = 0;
     $pdf->setY($pdf->GetY() + 5);
     foreach (array_keys($addressType) as $type) {
         $currentY = $pdf->GetY();
         $attributeName = 'id_address_' . $type;
         $addressType[$type]['displayed'] = '';
         $addressType[$type]['addressObject'] = new Address((int) $order->{$attributeName});
         $addressType[$type]['addressFields'] = AddressFormat::getOrderedAddressFields($addressType[$type]['addressObject']->id_country);
         $addressType[$type]['addressFormatedValues'] = AddressFormat::getFormattedAddressFieldsValues($addressType[$type]['addressObject'], $addressType[$type]['addressFields']);
         foreach ($addressType[$type]['addressFields'] as $line) {
             if ($patternsList = explode(' ', $line)) {
                 $tmp = '';
                 foreach ($patternsList as $pattern) {
                     if (!in_array($pattern, $patternRules['avoid'])) {
                         if ($pattern == 'State:name' && Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')) == 'US') {
                             $state_name =& $addressType[$type]['addressFormatedValues'][$pattern];
                             $state = new State((int) State::getIdByName($state_name));
                             if (Validate::isLoadedObject($state)) {
                                 $state_name = $state->iso_code;
                             } else {
                                 $state_name = strtoupper(substr($state_name, 0, 2));
                             }
                         }
                         $tmp .= isset($addressType[$type]['addressFormatedValues'][$pattern]) && !empty($addressType[$type]['addressFormatedValues'][$pattern]) ? Tools::iconv('utf-8', self::encoding(), $addressType[$type]['addressFormatedValues'][$pattern]) . ' ' : '';
                     }
                 }
                 $tmp = trim($tmp);
                 $addressType[$type]['displayed'] .= !empty($tmp) ? $tmp . "\n" : '';
             }
         }
         $pdf->MultiCell($width, 6.0, $addressType[$type]['displayed'], 0, 'L', 0);
         if ($pdf->GetY() > $maxY) {
             $maxY = $pdf->GetY();
         }
         $pdf->SetY($currentY);
         $pdf->SetX($width + 10);
     }
     $pdf->SetY($maxY);
     if ($maxY) {
         $pdf->Ln(5);
     }
     return $addressType;
 }
开发者ID:greench,项目名称:prestashop,代码行数:45,代码来源:PDF.php

示例11: process

 public function process()
 {
     parent::process();
     self::$smarty->assign(array('is_guest' => self::$cookie->is_guest, 'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation((int) $this->id_order), 'HOOK_PAYMENT_RETURN' => Hook::paymentReturn((int) $this->id_order, (int) $this->id_module)));
     if (self::$cookie->is_guest) {
         self::$smarty->assign(array('id_order' => $this->id_order, 'id_order_formatted' => sprintf('#%06d', $this->id_order)));
         /* If guest we clear the cookie for security reason */
         self::$cookie->logout();
     } else {
         self::$smarty->assign(array('id_order' => $this->id_order, 'id_order_formatted' => sprintf('#%06d', $this->id_order)));
     }
     //assign order details here
     $order = new Order($this->id_order);
     if (Validate::isLoadedObject($order) and $order->id_customer == self::$cookie->id_customer) {
         $id_order_state = (int) $order->getCurrentState();
         $carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang);
         $addressInvoice = new Address((int) $order->id_address_invoice);
         $addressDelivery = new Address((int) $order->id_address_delivery);
         //	$stateInvoiceAddress = new State((int)$addressInvoice->id_state);
         $inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
         $dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
         $invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields);
         $deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields);
         if ($order->total_discounts > 0) {
             self::$smarty->assign('total_old', (double) ($order->total_paid - $order->total_discounts));
         }
         self::$smarty->assign('order_total', Tools::ps_round($order->total_paid));
         self::$smarty->assign('order_total_usd', Tools::ps_round(Tools::convertPrice($order->total_paid, self::$cookie->id_currency, false)));
         $products = $order->getProducts();
         $customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
         Product::addCustomizationPrice($products, $customizedDatas);
         $customer = new Customer($order->id_customer);
         $order->customization_fee = Cart::getCustomizationCostStatic((int) $order->id_cart);
         $totalQuantity = 0;
         foreach ($products as $productRow) {
             $totalQuantity += $productRow['product_quantity'];
         }
         if (strpos($order->payment, 'COD') === false) {
             self::$smarty->assign('paymentMethod', 'ONLINE');
         } else {
             self::$smarty->assign('paymentMethod', 'COD');
         }
         $shippingdate = new DateTime($order->expected_shipping_date);
         self::$smarty->assign(array('shipping_date' => $shippingdate->format("F j, Y"), 'shop_name' => strval(Configuration::get('PS_SHOP_NAME')), 'order' => $order, 'return_allowed' => (int) $order->isReturnable(), 'currency' => new Currency($order->id_currency), 'order_state' => (int) $id_order_state, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'invoice' => OrderState::invoiceAvailable((int) $id_order_state) and $order->invoice_number, 'order_history' => $order->getHistory((int) self::$cookie->id_lang, false, true), 'products' => $products, 'discounts' => $order->getDiscounts(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => (Validate::isLoadedObject($addressInvoice) and $addressInvoice->id_state) ? new State((int) $addressInvoice->id_state) : false, 'address_delivery' => $addressDelivery, 'inv_adr_fields' => $inv_adr_fields, 'dlv_adr_fields' => $dlv_adr_fields, 'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues, 'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues, 'deliveryState' => (Validate::isLoadedObject($addressDelivery) and $addressDelivery->id_state) ? new State((int) $addressDelivery->id_state) : false, 'is_guest' => false, 'messages' => Message::getMessagesByOrderId((int) $order->id), 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'use_tax' => Configuration::get('PS_TAX'), 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'customizedDatas' => $customizedDatas, 'totalQuantity' => $totalQuantity));
         if ($carrier->url and $order->shipping_number) {
             self::$smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
         }
         self::$smarty->assign('HOOK_ORDERDETAILDISPLAYED', Module::hookExec('orderDetailDisplayed', array('order' => $order)));
         Module::hookExec('OrderDetail', array('carrier' => $carrier, 'order' => $order));
         //FB Share
         //$products = $order->getProducts();
         $orderProducts = array();
         $productMaxVal = 0;
         $productMaxId = null;
         foreach ($products as $product) {
             array_push($orderProducts, $product['product_id']);
             if ($product['product_price'] > $productMaxVal) {
                 $productMaxId = $product['product_id'];
                 $productMaxVal = $product['product_price'];
             }
         }
         $productObj = new Product($productMaxId, true, 1);
         self::$smarty->assign('fbShareProductObject', $productObj->getLink());
         self::$smarty->assign('fbShareProductObjectId', $productMaxId);
         self::$smarty->assign('orderProducts', implode(",", $orderProducts));
         self::$cookie->shareProductCode = md5(time() . $productMaxId);
         self::$cookie->write();
         unset($carrier);
         unset($addressInvoice);
         unset($addressDelivery);
     }
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:72,代码来源:OrderConfirmationController.php

示例12: initContent

 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     if (!($id_order = (int) Tools::getValue('id_order')) || !Validate::isUnsignedId($id_order)) {
         $this->errors[] = Tools::displayError('Order ID required');
     } else {
         $order = new Order($id_order);
         if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) {
             $id_order_state = (int) $order->getCurrentState();
             $carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang);
             $addressInvoice = new Address((int) $order->id_address_invoice);
             $addressDelivery = new Address((int) $order->id_address_delivery);
             $inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
             $dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
             $invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields);
             $deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields);
             if ($order->total_discounts > 0) {
                 $this->context->smarty->assign('total_old', (double) $order->total_paid - $order->total_discounts);
             }
             $products = $order->getProducts();
             /* DEPRECATED: customizedDatas @since 1.5 */
             $customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
             Product::addCustomizationPrice($products, $customizedDatas);
             OrderReturn::addReturnedQuantity($products, $order->id);
             $order_status = new OrderState((int) $id_order_state, (int) $order->id_lang);
             $customer = new Customer($order->id_customer);
             //by webkul to show order details properly on order history page
             if (Module::isInstalled('hotelreservationsystem')) {
                 require_once _PS_MODULE_DIR_ . 'hotelreservationsystem/define.php';
                 $obj_cart_bk_data = new HotelCartBookingData();
                 $obj_htl_bk_dtl = new HotelBookingDetail();
                 $obj_rm_type = new HotelRoomType();
                 if (!empty($products)) {
                     foreach ($products as $type_key => $type_value) {
                         $product = new Product($type_value['product_id'], false, $this->context->language->id);
                         $cover_image_arr = $product->getCover($type_value['product_id']);
                         if (!empty($cover_image_arr)) {
                             $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $cover_image_arr['id_image'], 'small_default');
                         } else {
                             $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code . "-default", 'small_default');
                         }
                         $unit_price = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1);
                         if (isset($customer->id)) {
                             $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($order->id_cart, (new Cart($order->id_cart))->id_guest, $type_value['product_id'], $customer->id);
                         } else {
                             $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($order->id_cart, $customer->id_guest, $type_value['product_id']);
                         }
                         $rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']);
                         $cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
                         $cart_htl_data[$type_key]['cover_img'] = $cover_img;
                         $cart_htl_data[$type_key]['name'] = $product->name;
                         $cart_htl_data[$type_key]['unit_price'] = $unit_price;
                         $cart_htl_data[$type_key]['adult'] = $rm_dtl['adult'];
                         $cart_htl_data[$type_key]['children'] = $rm_dtl['children'];
                         foreach ($cart_bk_data as $data_k => $data_v) {
                             $date_join = strtotime($data_v['date_from']) . strtotime($data_v['date_to']);
                             if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) {
                                 $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1;
                                 $num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'];
                                 $vart_quant = (int) $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] * $num_days;
                                 $amount = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1);
                                 $amount *= $vart_quant;
                                 $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount;
                             } else {
                                 $num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
                                 $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
                                 $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
                                 $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
                                 $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
                                 $amount = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1);
                                 $amount *= $num_days;
                                 $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount;
                             }
                         }
                     }
                     $this->context->smarty->assign('cart_htl_data', $cart_htl_data);
                 }
             }
             //end
             $this->context->smarty->assign(array('shop_name' => strval(Configuration::get('PS_SHOP_NAME')), 'order' => $order, 'return_allowed' => (int) $order->isReturnable(), 'currency' => new Currency($order->id_currency), 'order_state' => (int) $id_order_state, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'invoice' => OrderState::invoiceAvailable($id_order_state) && count($order->getInvoicesCollection()), 'logable' => (bool) $order_status->logable, 'order_history' => $order->getHistory($this->context->language->id, false, true), 'products' => $products, 'discounts' => $order->getCartRules(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => Validate::isLoadedObject($addressInvoice) && $addressInvoice->id_state ? new State($addressInvoice->id_state) : false, 'address_delivery' => $addressDelivery, 'inv_adr_fields' => $inv_adr_fields, 'dlv_adr_fields' => $dlv_adr_fields, 'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues, 'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues, 'deliveryState' => Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state ? new State($addressDelivery->id_state) : false, 'is_guest' => false, 'messages' => CustomerMessage::getMessagesByOrderId((int) $order->id, false), 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'), 'use_tax' => Configuration::get('PS_TAX'), 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'customizedDatas' => $customizedDatas, 'reorderingAllowed' => !(bool) Configuration::get('PS_DISALLOW_HISTORY_REORDERING')));
             if ($carrier->url && $order->shipping_number) {
                 $this->context->smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
             }
             $this->context->smarty->assign('HOOK_ORDERDETAILDISPLAYED', Hook::exec('displayOrderDetail', array('order' => $order)));
             Hook::exec('actionOrderDetail', array('carrier' => $carrier, 'order' => $order));
             unset($carrier, $addressInvoice, $addressDelivery);
         } else {
             $this->errors[] = Tools::displayError('This order cannot be found.');
         }
         unset($order);
     }
     $this->setTemplate(_PS_THEME_DIR_ . 'order-detail.tpl');
 }
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:97,代码来源:OrderDetailController.php

示例13: _assignAddress

 protected function _assignAddress()
 {
     //if guest checkout disabled and flag is_guest  in cookies is actived
     if (Configuration::get('PS_GUEST_CHECKOUT_ENABLED') == 0 and (int) self::$cookie->is_guest != Configuration::get('PS_GUEST_CHECKOUT_ENABLED')) {
         self::$cookie->logout();
         Tools::redirect('');
     } elseif (!Customer::getAddressesTotalById((int) self::$cookie->id_customer)) {
         //Tools::redirect('address.php?back=order.php?step=1');
         //self::$smarty->assign('no_address', 1);
     }
     $customer = new Customer((int) self::$cookie->id_customer);
     if (Validate::isLoadedObject($customer)) {
         /* Getting customer addresses */
         $customerAddresses = $customer->getAddresses((int) self::$cookie->id_lang);
         // Getting a list of formated address fields with associated values
         $formatedAddressFieldsValuesList = array();
         foreach ($customerAddresses as $address) {
             $tmpAddress = new Address($address['id_address']);
             $formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields'] = AddressFormat::getOrderedAddressFields($address['id_country']);
             $formatedAddressFieldsValuesList[$address['id_address']]['formated_fields_values'] = AddressFormat::getFormattedAddressFieldsValues($tmpAddress, $formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields']);
             unset($tmpAddress);
         }
         self::$smarty->assign(array('addresses' => $customerAddresses, 'formatedAddressFieldsValuesList' => $formatedAddressFieldsValuesList));
         /* Setting default addresses for cart */
         if ((!isset(self::$cart->id_address_delivery) or empty(self::$cart->id_address_delivery)) and sizeof($customerAddresses)) {
             self::$cart->id_address_delivery = (int) $customerAddresses[0]['id_address'];
             $update = 1;
         }
         if ((!isset(self::$cart->id_address_invoice) or empty(self::$cart->id_address_invoice)) and sizeof($customerAddresses)) {
             self::$cart->id_address_invoice = (int) $customerAddresses[0]['id_address'];
             $update = 1;
         }
         /* Update cart addresses only if needed */
         if (isset($update) and $update) {
             self::$cart->update();
         }
         /* If delivery address is valid in cart, assign it to Smarty */
         if (isset(self::$cart->id_address_delivery)) {
             $deliveryAddress = new Address((int) self::$cart->id_address_delivery);
             if ($deliveryAddress->id_state) {
                 $deliveryAddress->state = State::getNameById($deliveryAddress->id_state);
             }
             if (Validate::isLoadedObject($deliveryAddress) and $deliveryAddress->id_customer == $customer->id) {
                 self::$smarty->assign('delivery', $deliveryAddress);
             }
         }
         /* If invoice address is valid in cart, assign it to Smarty */
         if (isset(self::$cart->id_address_invoice)) {
             $invoiceAddress = new Address((int) self::$cart->id_address_invoice);
             if ($invoiceAddress->id_state) {
                 $invoiceAddress->state = State::getNameById($invoiceAddress->id_state);
             }
             if (Validate::isLoadedObject($invoiceAddress) and $invoiceAddress->id_customer == $customer->id) {
                 self::$smarty->assign('invoice', $invoiceAddress);
             }
         }
         //assign countries
         $countries = Country::getCountries(1);
         $country_names = Country::getActiveCountries();
         self::$smarty->assign('countries', $countries);
         self::$smarty->assign('country_names', $country_names);
         if (isset(self::$cookie->id_country)) {
             $id_current_country = self::$cookie->id_country;
         } else {
             $id_current_country = Tools::getValue('id_country', (int) $customer->id_country);
         }
         self::$smarty->assign('current_country', $id_current_country);
         //default to USA
         if (!$id_current_country) {
             $id_current_country = 21;
         }
         //assign states
         $country = new Country($id_current_country);
         if ($country->contains_states) {
             $stateData = State::getStatesByIdCountry($customer->id_country);
             self::$smarty->assign('states', $stateData);
         }
     }
     if ($oldMessage = Message::getMessageByCartId((int) self::$cart->id)) {
         self::$smarty->assign('oldMessage', $oldMessage['message']);
     }
     //Assign token for new address
     self::$smarty->assign('token', Tools::getToken(false));
     self::$smarty->assign('id_carrier', self::$cart->id_carrier);
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:85,代码来源:ParentOrderController.php

示例14: initContent

 public function initContent()
 {
     ${"GLOBALS"}["wcbwhorf"] = "id_order";
     parent::initContent();
     if (!(${${"GLOBALS"}["tdrhijkvhp"]} = (int) Tools::getValue("id_order")) || !Validate::isUnsignedId(${${"GLOBALS"}["wcbwhorf"]})) {
         $this->errors[] = Tools::displayError("Order ID required");
     } else {
         ${"GLOBALS"}["vtkcznmlk"] = "id_customer_seller";
         ${"GLOBALS"}["bwkdjg"] = "id_order";
         ${${"GLOBALS"}["thtbvco"]} = new Order(${${"GLOBALS"}["bwkdjg"]});
         ${"GLOBALS"}["tkggscllp"] = "order";
         ${${"GLOBALS"}["gfrblyem"]} = AgileSellerManager::getObjectOwnerID("order", $order->id);
         ${${"GLOBALS"}["taultlaseq"]} = AgileSellerManager::getLinkedSellerID($this->context->customer->id);
         if (Validate::isLoadedObject(${${"GLOBALS"}["thtbvco"]}) && ${${"GLOBALS"}["gfrblyem"]} == ${${"GLOBALS"}["vtkcznmlk"]} && ${${"GLOBALS"}["taultlaseq"]} > 0) {
             $fwsweyfqnpv = "dlv_adr_fields";
             $gcjosivnd = "carrier";
             ${"GLOBALS"}["pffjtshcnb"] = "deliveryAddressFormatedValues";
             $uztnjfwuwsv = "customizedDatas";
             $uvmwhue = "addressDelivery";
             ${"GLOBALS"}["atrcjjwf"] = "carrier";
             ${"GLOBALS"}["flawpcbih"] = "products";
             ${${"GLOBALS"}["tthrzd"]} = (int) $order->getCurrentState();
             ${$gcjosivnd} = new Carrier((int) $order->id_carrier, (int) $order->id_lang);
             ${"GLOBALS"}["rovfqvkjb"] = "addressDelivery";
             ${${"GLOBALS"}["hoviucftx"]} = new Address((int) $order->id_address_invoice);
             $mjqwhmgoyrm = "customizedDatas";
             ${"GLOBALS"}["qguglflbdd"] = "dlv_adr_fields";
             $sitqckqhoebi = "inv_adr_fields";
             $vejelhbyrbl = "addressDelivery";
             ${"GLOBALS"}["zpyvneijb"] = "addressInvoice";
             $tsvbkseunn = "dlv_adr_fields";
             ${"GLOBALS"}["cdlqrupc"] = "inv_adr_fields";
             ${${"GLOBALS"}["rovfqvkjb"]} = new Address((int) $order->id_address_delivery);
             ${$sitqckqhoebi} = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
             $shfzuivbjgg = "inv_adr_fields";
             ${${"GLOBALS"}["qguglflbdd"]} = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
             ${${"GLOBALS"}["elucej"]} = AddressFormat::getFormattedAddressFieldsValues(${${"GLOBALS"}["hoviucftx"]}, ${$shfzuivbjgg});
             ${${"GLOBALS"}["pffjtshcnb"]} = AddressFormat::getFormattedAddressFieldsValues(${${"GLOBALS"}["gkxhkddsjf"]}, ${$fwsweyfqnpv});
             $tbfgtqy = "order";
             if ($order->total_discounts > 0) {
                 $this->context->smarty->assign("total_old", (double) ($order->total_paid - $order->total_discounts));
             }
             ${"GLOBALS"}["ikavgzhqpt"] = "deliveryAddressFormatedValues";
             ${${"GLOBALS"}["flawpcbih"]} = $order->getProducts();
             ${${"GLOBALS"}["gdodxcerle"]} = Product::getAllCustomizedDatas((int) $order->id_cart);
             Product::addCustomizationPrice(${${"GLOBALS"}["umrxyqn"]}, ${$mjqwhmgoyrm});
             $buaccdx = "carrier";
             ${${"GLOBALS"}["cdmray"]} = new Customer($order->id_customer);
             ${"GLOBALS"}["betrwosx"] = "products";
             ${${"GLOBALS"}["bfrxhizen"]} = $order->getCurrentOrderState();
             ${${"GLOBALS"}["sslziuxrs"]} = OrderState::getOrderStates((int) $this->context->language->id);
             ${"GLOBALS"}["bwcmquq"] = "addressInvoice";
             $this->context->smarty->assign(array("order_states" => ${${"GLOBALS"}["sslziuxrs"]}));
             $this->context->smarty->assign(array("shop_name" => strval(Configuration::get("PS_SHOP_NAME")), "order" => ${${"GLOBALS"}["thtbvco"]}, "return_allowed" => (int) $order->isReturnable(), "currency" => new Currency($order->id_currency), "order_cur_state" => (int) ${${"GLOBALS"}["tthrzd"]}, "invoiceAllowed" => (int) Configuration::get("PS_INVOICE"), "invoice" => OrderState::invoiceAvailable(${${"GLOBALS"}["tthrzd"]}) && $order->invoice_number, "order_history" => $order->getHistory($this->context->language->id, false, true), "products" => ${${"GLOBALS"}["betrwosx"]}, "discounts" => $order->getCartRules(), "carrier" => ${${"GLOBALS"}["atrcjjwf"]}, "address_invoice" => ${${"GLOBALS"}["bwcmquq"]}, "invoiceState" => Validate::isLoadedObject(${${"GLOBALS"}["zpyvneijb"]}) && $addressInvoice->id_state ? new State($addressInvoice->id_state) : false, "address_delivery" => ${$uvmwhue}, "inv_adr_fields" => ${${"GLOBALS"}["cdlqrupc"]}, "dlv_adr_fields" => ${$tsvbkseunn}, "invoiceAddressFormatedValues" => ${${"GLOBALS"}["elucej"]}, "deliveryAddressFormatedValues" => ${${"GLOBALS"}["ikavgzhqpt"]}, "deliveryState" => Validate::isLoadedObject(${${"GLOBALS"}["gkxhkddsjf"]}) && $addressDelivery->id_state ? new State($addressDelivery->id_state) : false, "is_guest" => false, "messages" => CustomerMessage::getMessagesByOrderId((int) $order->id, false), "CUSTOMIZE_FILE" => Product::CUSTOMIZE_FILE, "CUSTOMIZE_TEXTFIELD" => Product::CUSTOMIZE_TEXTFIELD, "isRecyclable" => Configuration::get("PS_RECYCLABLE_PACK"), "use_tax" => Configuration::get("PS_TAX"), "group_use_tax" => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, "customizedDatas" => ${$uztnjfwuwsv}));
             if ($carrier->url && $order->shipping_number) {
                 $this->context->smarty->assign("followup", str_replace("@", $order->shipping_number, $carrier->url));
             }
             $this->context->smarty->assign("HOOK_ORDERDETAILDISPLAYED", Hook::exec("displayOrderDetail", array("order" => ${${"GLOBALS"}["thtbvco"]})));
             Hook::exec("actionOrderDetail", array("carrier" => ${${"GLOBALS"}["tvqrewgc"]}, "order" => ${$tbfgtqy}));
             unset(${$buaccdx}, ${${"GLOBALS"}["hoviucftx"]}, ${$vejelhbyrbl});
         } else {
             $this->errors[] = Tools::displayError("Cannot find this order");
         }
         unset(${${"GLOBALS"}["tkggscllp"]});
     }
     self::$smarty->assign(array("seller_tab_id" => 4));
     $this->setTemplate("sellerorderdetail.tpl");
 }
开发者ID:sho5kubota,项目名称:guidingyou2,代码行数:68,代码来源:sellerorderdetail.php

示例15: generateAddress

 public static function generateAddress(Address $address, $patternRules, $newLine = "\r\n", $separator = ' ', $style = array())
 {
     $addressFields = AddressFormat::getOrderedAddressFields($address->id_country);
     $addressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($address, $addressFields);
     $addressText = '';
     foreach ($addressFields as $line) {
         if ($patternsList = explode(' ', $line)) {
             $tmpText = '';
             foreach ($patternsList as $pattern) {
                 if (!in_array($pattern, $patternRules['avoid'])) {
                     $tmpText .= isset($addressFormatedValues[$pattern]) ? (isset($style[$pattern]) ? sprintf($style[$pattern], $addressFormatedValues[$pattern]) : $addressFormatedValues[$pattern]) . $separator : '';
                 }
             }
             $tmpText = trim($tmpText);
             $addressText .= !empty($tmpText) ? $tmpText . $newLine : '';
         }
     }
     return strtoupper($addressText);
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:19,代码来源:AddressFormat.php


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