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


PHP AddressFormat类代码示例

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


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

示例1: getContent

 /**
  * Returns the template's HTML content
  *
  * @return string HTML content
  */
 public function getContent()
 {
     $delivery_address = new Address((int) $this->order->id_address_delivery);
     $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
     $formatted_invoice_address = '';
     if ($this->order->id_address_delivery != $this->order->id_address_invoice) {
         $invoice_address = new Address((int) $this->order->id_address_invoice);
         $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' ');
     }
     $carrier = new Carrier($this->order->id_carrier);
     $carrier->name = $carrier->name == '0' ? Configuration::get('PS_SHOP_NAME') : $carrier->name;
     $order_details = $this->order_invoice->getProducts();
     if (Configuration::get('PS_PDF_IMG_DELIVERY')) {
         foreach ($order_details as &$order_detail) {
             if ($order_detail['image'] != null) {
                 $name = 'product_mini_' . (int) $order_detail['product_id'] . (isset($order_detail['product_attribute_id']) ? '_' . (int) $order_detail['product_attribute_id'] : '') . '.jpg';
                 $path = _PS_PROD_IMG_DIR_ . $order_detail['image']->getExistingImgPath() . '.jpg';
                 $order_detail['image_tag'] = preg_replace('/\\.*' . preg_quote(__PS_BASE_URI__, '/') . '/', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR, ImageManager::thumbnail($path, $name, 45, 'jpg', false), 1);
                 if (file_exists(_PS_TMP_IMG_DIR_ . $name)) {
                     $order_detail['image_size'] = getimagesize(_PS_TMP_IMG_DIR_ . $name);
                 } else {
                     $order_detail['image_size'] = false;
                 }
             }
         }
     }
     $this->smarty->assign(array('order' => $this->order, 'order_details' => $order_details, 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'order_invoice' => $this->order_invoice, 'carrier' => $carrier, 'display_product_images' => Configuration::get('PS_PDF_IMG_DELIVERY')));
     $tpls = array('style_tab' => $this->smarty->fetch($this->getTemplate('delivery-slip.style-tab')), 'addresses_tab' => $this->smarty->fetch($this->getTemplate('delivery-slip.addresses-tab')), 'summary_tab' => $this->smarty->fetch($this->getTemplate('delivery-slip.summary-tab')), 'product_tab' => $this->smarty->fetch($this->getTemplate('delivery-slip.product-tab')), 'payment_tab' => $this->smarty->fetch($this->getTemplate('delivery-slip.payment-tab')));
     $this->smarty->assign($tpls);
     return $this->smarty->fetch($this->getTemplate('delivery-slip'));
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:36,代码来源:HTMLTemplateDeliverySlip.php

示例2: getContent

 /**
  * Returns the template's HTML content
  * @return string HTML content
  */
 public function getContent()
 {
     $invoice_address = new Address((int) $this->order->id_address_invoice);
     $country = new Country((int) $invoice_address->id_country);
     $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' ');
     $formatted_delivery_address = '';
     if ($this->order->id_address_delivery != $this->order->id_address_invoice) {
         $delivery_address = new Address((int) $this->order->id_address_delivery);
         $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
     }
     $customer = new Customer((int) $this->order->id_customer);
     $order_details = $this->order_invoice->getProducts();
     if (Configuration::get('PS_PDF_IMG_INVOICE')) {
         foreach ($order_details as &$order_detail) {
             if ($order_detail['image'] != null) {
                 $name = 'product_mini_' . (int) $order_detail['product_id'] . (isset($order_detail['product_attribute_id']) ? '_' . (int) $order_detail['product_attribute_id'] : '') . '.jpg';
                 $order_detail['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_ . 'p/' . $order_detail['image']->getExistingImgPath() . '.jpg', $name, 45, 'jpg', false);
                 if (file_exists(_PS_TMP_IMG_DIR_ . $name)) {
                     $order_detail['image_size'] = getimagesize(_PS_TMP_IMG_DIR_ . $name);
                 } else {
                     $order_detail['image_size'] = false;
                 }
             }
         }
     }
     $data = array('order' => $this->order, 'order_details' => $order_details, 'cart_rules' => $this->order->getCartRules($this->order_invoice->id), 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'tax_excluded_display' => Group::getPriceDisplayMethod($customer->id_default_group), 'tax_tab' => $this->getTaxTabContent(), 'customer' => $customer);
     if (Tools::getValue('debug')) {
         die(json_encode($data));
     }
     $this->smarty->assign($data);
     return $this->smarty->fetch($this->getTemplateByCountry($country->iso_code));
 }
开发者ID:zangles,项目名称:lennyba,代码行数:36,代码来源:HTMLTemplateInvoice.php

示例3: assignStoresSimplified

    /**
     * Assign template vars for simplified stores
     */
    protected function assignStoresSimplified()
    {
        $stores = Db::getInstance()->executeS('
		SELECT s.*, cl.name country, st.iso_code state
		FROM ' . _DB_PREFIX_ . 'store s
		' . Shop::addSqlAssociation('store', 's') . '
		LEFT JOIN ' . _DB_PREFIX_ . 'country_lang cl ON (cl.id_country = s.id_country)
		LEFT JOIN ' . _DB_PREFIX_ . 'state st ON (st.id_state = s.id_state)
		WHERE s.active = 1 AND cl.id_lang = ' . (int) $this->context->language->id);
        $addresses_formated = array();
        foreach ($stores as &$store) {
            $address = new Address();
            $address->country = Country::getNameById($this->context->language->id, $store['id_country']);
            $address->address1 = $store['address1'];
            $address->address2 = $store['address2'];
            $address->postcode = $store['postcode'];
            $address->city = $store['city'];
            $addresses_formated[$store['id_store']] = AddressFormat::getFormattedLayoutData($address);
            $store['has_picture'] = file_exists(_PS_STORE_IMG_DIR_ . (int) $store['id_store'] . '.jpg');
            if ($working_hours = $this->renderStoreWorkingHours($store)) {
                $store['working_hours'] = $working_hours;
            }
        }
        $this->context->smarty->assign(array('simplifiedStoresDiplay' => true, 'stores' => $stores, 'addresses_formated' => $addresses_formated));
    }
开发者ID:jpodracky,项目名称:dogs,代码行数:28,代码来源:StoresController.php

示例4: renderForm

 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Addresses'), 'icon' => 'icon-envelope-alt'), 'input' => array(array('type' => 'text_customer', 'label' => $this->l('Customer'), 'name' => 'id_customer', 'required' => false), array('type' => 'text', 'label' => $this->l('Identification Number'), 'name' => 'dni', 'required' => false, 'col' => '4', 'hint' => $this->l('DNI / NIF / NIE')), array('type' => 'text', 'label' => $this->l('Floor'), 'name' => 'floor', 'required' => true, 'col' => '4', 'hint' => $this->l('Floor')), array('type' => 'text', 'label' => $this->l('Lift'), 'name' => 'lift', 'required' => true, 'col' => '4', 'hint' => $this->l('Lift')), array('type' => 'text', 'label' => $this->l('Code_intercom'), 'name' => 'code_intercom', 'required' => false, 'col' => '4', 'hint' => $this->l('Code_intercom')), array('type' => 'text', 'label' => $this->l('Address alias'), 'name' => 'alias', 'required' => true, 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' &lt;&gt;;=#{}'), array('type' => 'textarea', 'label' => $this->l('Other'), 'name' => 'other', 'required' => false, 'cols' => 15, 'rows' => 3, 'hint' => $this->l('Forbidden characters:') . ' &lt;&gt;;=#{}')), 'submit' => array('title' => $this->l('Save')));
     $id_customer = (int) Tools::getValue('id_customer');
     if (!$id_customer && Validate::isLoadedObject($this->object)) {
         $id_customer = $this->object->id_customer;
     }
     if ($id_customer) {
         $customer = new Customer((int) $id_customer);
         $token_customer = Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $this->context->employee->id);
     }
     $this->tpl_form_vars = array('customer' => isset($customer) ? $customer : null, 'tokenCustomer' => isset($token_customer) ? $token_customer : null);
     // Order address fields depending on country format
     $addresses_fields = $this->processAddressFormat();
     // we use  delivery address
     $addresses_fields = $addresses_fields['dlv_all_fields'];
     // get required field
     $required_fields = AddressFormat::getFieldsRequired();
     // Merge with field required
     $addresses_fields = array_unique(array_merge($addresses_fields, $required_fields));
     $temp_fields = array();
     foreach ($addresses_fields as $addr_field_item) {
         if ($addr_field_item == 'company') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Company'), 'name' => 'company', 'required' => in_array('company', $required_fields), 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' &lt;&gt;;=#{}');
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('VAT number'), 'col' => '2', 'name' => 'vat_number', 'required' => in_array('vat_number', $required_fields));
         } elseif ($addr_field_item == 'lastname') {
             if (isset($customer) && !Tools::isSubmit('submit' . strtoupper($this->table)) && Validate::isLoadedObject($customer) && !Validate::isLoadedObject($this->object)) {
                 $default_value = $customer->lastname;
             } else {
                 $default_value = '';
             }
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Last Name'), 'name' => 'lastname', 'required' => in_array('lastname', $required_fields), 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' 0-9!&amp;lt;&amp;gt;,;?=+()@#"�{}_$%:', 'default_value' => $default_value);
         } elseif ($addr_field_item == 'firstname') {
             if (isset($customer) && !Tools::isSubmit('submit' . strtoupper($this->table)) && Validate::isLoadedObject($customer) && !Validate::isLoadedObject($this->object)) {
                 $default_value = $customer->firstname;
             } else {
                 $default_value = '';
             }
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('First Name'), 'name' => 'firstname', 'required' => in_array('firstname', $required_fields), 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' 0-9!&amp;lt;&amp;gt;,;?=+()@#"�{}_$%:', 'default_value' => $default_value);
         } elseif ($addr_field_item == 'address1') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Address'), 'name' => 'address1', 'col' => '6', 'required' => in_array('address1', $required_fields));
         } elseif ($addr_field_item == 'address2') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Address') . ' (2)', 'name' => 'address2', 'col' => '6', 'required' => in_array('address2', $required_fields));
         } elseif ($addr_field_item == 'postcode') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Zip/Postal Code'), 'name' => 'postcode', 'col' => '2', 'required' => in_array('postcode', $required_fields));
         } elseif ($addr_field_item == 'city') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('City'), 'name' => 'city', 'col' => '4', 'required' => in_array('city', $required_fields));
         } elseif ($addr_field_item == 'country' || $addr_field_item == 'Country:name') {
             $temp_fields[] = array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => in_array('Country:name', $required_fields) || in_array('country', $required_fields), 'col' => '4', 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id), 'id' => 'id_country', 'name' => 'name'));
             $temp_fields[] = array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'required' => false, 'col' => '4', 'options' => array('query' => array(), 'id' => 'id_state', 'name' => 'name'));
         } elseif ($addr_field_item == 'phone') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Home phone'), 'name' => 'phone', 'required' => in_array('phone', $required_fields) || Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'col' => '4', 'hint' => Configuration::get('PS_ONE_PHONE_AT_LEAST') ? sprintf($this->l('You must register at least one phone number.')) : '');
         } elseif ($addr_field_item == 'phone_mobile') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Mobile phone'), 'name' => 'phone_mobile', 'required' => in_array('phone_mobile', $required_fields) || Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'col' => '4', 'hint' => Configuration::get('PS_ONE_PHONE_AT_LEAST') ? sprintf($this->l('You must register at least one phone number.')) : '');
         }
     }
     // merge address format with the rest of the form
     array_splice($this->fields_form['input'], 3, 0, $temp_fields);
     return AdminController::renderForm();
 }
开发者ID:Beattle,项目名称:perrino-shop,代码行数:60,代码来源:AdminAddressesController.php

示例5: 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] = AddressFormat::getFormattedLayoutData($address);
         unset($address);
         ++$total;
         // Retro theme < 1.4.2
         $ordered_fields = AddressFormat::getOrderedAddressFields($addressDetailed['id_country'], false, true);
     }
     // 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:Evil1991,项目名称:PrestaShop-1.4,代码行数:29,代码来源:AddressesController.php

示例6: getContent

    /**
     * Returns the template's HTML content
     *
     * @return string HTML content
     */
    public function getContent()
    {
        $delivery_address = $invoice_address = new Address((int) $this->order->id_address_invoice);
        $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' ');
        $formatted_delivery_address = '';
        if ($this->order->id_address_delivery != $this->order->id_address_invoice) {
            $delivery_address = new Address((int) $this->order->id_address_delivery);
            $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
        }
        $customer = new Customer((int) $this->order->id_customer);
        $this->order->total_paid_tax_excl = $this->order->total_paid_tax_incl = $this->order->total_products = $this->order->total_products_wt = 0;
        if ($this->order_slip->amount > 0) {
            foreach ($this->order->products as &$product) {
                $product['total_price_tax_excl'] = $product['unit_price_tax_excl'] * $product['product_quantity'];
                $product['total_price_tax_incl'] = $product['unit_price_tax_incl'] * $product['product_quantity'];
                if ($this->order_slip->partial == 1) {
                    $order_slip_detail = Db::getInstance()->getRow('
						SELECT * FROM `' . _DB_PREFIX_ . 'order_slip_detail`
						WHERE `id_order_slip` = ' . (int) $this->order_slip->id . '
						AND `id_order_detail` = ' . (int) $product['id_order_detail']);
                    $product['total_price_tax_excl'] = $order_slip_detail['amount_tax_excl'];
                    $product['total_price_tax_incl'] = $order_slip_detail['amount_tax_incl'];
                }
                $this->order->total_products += $product['total_price_tax_excl'];
                $this->order->total_products_wt += $product['total_price_tax_incl'];
                $this->order->total_paid_tax_excl = $this->order->total_products;
                $this->order->total_paid_tax_incl = $this->order->total_products_wt;
            }
        } else {
            $this->order->products = null;
        }
        unset($product);
        // remove reference
        if ($this->order_slip->shipping_cost == 0) {
            $this->order->total_shipping_tax_incl = $this->order->total_shipping_tax_excl = 0;
        }
        $tax = new Tax();
        $tax->rate = $this->order->carrier_tax_rate;
        $tax_calculator = new TaxCalculator(array($tax));
        $tax_excluded_display = Group::getPriceDisplayMethod((int) $customer->id_default_group);
        $this->order->total_shipping_tax_incl = $this->order_slip->total_shipping_tax_incl;
        $this->order->total_shipping_tax_excl = $this->order_slip->total_shipping_tax_excl;
        $this->order_slip->shipping_cost_amount = $tax_excluded_display ? $this->order_slip->total_shipping_tax_excl : $this->order_slip->total_shipping_tax_incl;
        $this->order->total_paid_tax_incl += $this->order->total_shipping_tax_incl;
        $this->order->total_paid_tax_excl += $this->order->total_shipping_tax_excl;
        $total_cart_rule = 0;
        if ($this->order_slip->order_slip_type == 1 && is_array($cart_rules = $this->order->getCartRules($this->order_invoice->id))) {
            foreach ($cart_rules as $cart_rule) {
                if ($tax_excluded_display) {
                    $total_cart_rule += $cart_rule['value_tax_excl'];
                } else {
                    $total_cart_rule += $cart_rule['value'];
                }
            }
        }
        $this->smarty->assign(array('order' => $this->order, 'order_slip' => $this->order_slip, 'order_details' => $this->order->products, 'cart_rules' => $this->order_slip->order_slip_type == 1 ? $this->order->getCartRules($this->order_invoice->id) : false, 'amount_choosen' => $this->order_slip->order_slip_type == 2 ? true : false, 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address), 'tax_excluded_display' => $tax_excluded_display, 'total_cart_rule' => $total_cart_rule));
        $tpls = array('style_tab' => $this->smarty->fetch($this->getTemplate('invoice.style-tab')), 'addresses_tab' => $this->smarty->fetch($this->getTemplate('invoice.addresses-tab')), 'summary_tab' => $this->smarty->fetch($this->getTemplate('order-slip.summary-tab')), 'product_tab' => $this->smarty->fetch($this->getTemplate('order-slip.product-tab')), 'total_tab' => $this->smarty->fetch($this->getTemplate('order-slip.total-tab')), 'payment_tab' => $this->smarty->fetch($this->getTemplate('order-slip.payment-tab')), 'tax_tab' => $this->getTaxTabContent());
        $this->smarty->assign($tpls);
        return $this->smarty->fetch($this->getTemplate('order-slip'));
    }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:65,代码来源:HTMLTemplateOrderSlip.php

示例7: getContent

 /**
  * Returns the template's HTML content
  * @return string HTML content
  */
 public function getContent()
 {
     $delivery_address = new Address((int) $this->order->id_address_delivery);
     $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
     $formatted_invoice_address = '';
     if ($this->order->id_address_delivery != $this->order->id_address_invoice) {
         $invoice_address = new Address((int) $this->order->id_address_invoice);
         $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' ');
     }
     $carrier = new Carrier($this->order->id_carrier);
     $carrier->name = $carrier->name == '0' ? Configuration::get('PS_SHOP_NAME') : $carrier->name;
     $order_details = $this->order_invoice->getProducts();
     if (Configuration::get('PS_PDF_IMG_DELIVERY')) {
         foreach ($order_details as &$order_detail) {
             if ($order_detail['image'] != null) {
                 $name = 'product_mini_' . (int) $order_detail['product_id'] . (isset($order_detail['product_attribute_id']) ? '_' . (int) $order_detail['product_attribute_id'] : '') . '.jpg';
                 $order_detail['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_ . 'p/' . $order_detail['image']->getExistingImgPath() . '.jpg', $name, 45, 'jpg', false);
                 if (file_exists(_PS_TMP_IMG_DIR_ . $name)) {
                     $order_detail['image_size'] = getimagesize(_PS_TMP_IMG_DIR_ . $name);
                 } else {
                     $order_detail['image_size'] = false;
                 }
             }
         }
     }
     $this->smarty->assign(array('order' => $this->order, 'order_details' => $order_details, 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'order_invoice' => $this->order_invoice, 'carrier' => $carrier));
     return $this->smarty->fetch($this->getTemplate('delivery-slip'));
 }
开发者ID:zangles,项目名称:lennyba,代码行数:32,代码来源:HTMLTemplateDeliverySlip.php

示例8: getShopAddress

 /**
  * Returns the shop address
  *
  * @return string
  */
 protected function getShopAddress()
 {
     $shop_address = '';
     $shop_address_obj = $this->shop->getAddress();
     if (isset($shop_address_obj) && $shop_address_obj instanceof Address) {
         $shop_address = AddressFormat::generateAddress($shop_address_obj, array(), ' - ', ' ');
     }
     return $shop_address;
 }
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:14,代码来源:HTMLTemplate.php

示例9: getContent

 /**
  * Returns the template's HTML content
  * @return string HTML content
  */
 public function getContent()
 {
     $delivery_address = new Address((int) $this->order->id_address_delivery);
     $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
     $formatted_invoice_address = '';
     if ($this->order->id_address_delivery != $this->order->id_address_invoice) {
         $invoice_address = new Address((int) $this->order->id_address_invoice);
         $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' ');
     }
     $this->smarty->assign(array('order' => $this->order, 'order_details' => $this->order_invoice->getProducts(), 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'order_invoice' => $this->order_invoice));
     return $this->smarty->fetch($this->getTemplate('delivery-slip'));
 }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:16,代码来源:HTMLTemplateDeliverySlip.php

示例10: getContent

 /**
  * Returns the template's HTML content
  * @return string HTML content
  */
 public function getContent()
 {
     $delivery_address = new Address((int) $this->order->id_address_delivery);
     $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
     $formatted_invoice_address = '';
     if ($this->order->id_address_delivery != $this->order->id_address_invoice) {
         $invoice_address = new Address((int) $this->order->id_address_invoice);
         $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' ');
     }
     $this->smarty->assign(array('order_return' => $this->order_return, 'return_nb_days' => (int) Configuration::get('PS_ORDER_RETURN_NB_DAYS'), 'products' => OrderReturn::getOrdersReturnProducts((int) $this->order_return->id, $this->order), 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'shop_address' => AddressFormat::generateAddress($this->shop->getAddress(), array(), '<br />', ' ')));
     return $this->smarty->fetch($this->getTemplate('order-return'));
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:16,代码来源:HTMLTemplateOrderReturn.php

示例11: getFormat

 public function getFormat()
 {
     $fields = AddressFormat::getOrderedAddressFields($this->country->id, true, true);
     $required = array_flip(AddressFormat::getFieldsRequired());
     $format = ['id_address' => (new FormField())->setName('id_address')->setType('hidden'), 'id_customer' => (new FormField())->setName('id_customer')->setType('hidden'), 'back' => (new FormField())->setName('back')->setType('hidden'), 'token' => (new FormField())->setName('token')->setType('hidden'), 'alias' => (new FormField())->setName('alias')->setLabel($this->getFieldLabel('alias'))];
     foreach ($fields as $field) {
         $formField = new FormField();
         $formField->setName($field);
         $fieldParts = explode(':', $field, 2);
         if (count($fieldParts) === 1) {
             if ($field === 'postcode') {
                 if ($this->country->need_zip_code) {
                     $formField->setRequired(true);
                 }
             }
         } elseif (count($fieldParts) === 2) {
             list($entity, $entityField) = $fieldParts;
             // Fields specified using the Entity:field
             // notation are actually references to other
             // entities, so they should be displayed as a select
             $formField->setType('select');
             // Also, what we really want is the id of the linked entity
             $formField->setName('id_' . strtolower($entity));
             if ($entity === 'Country') {
                 $formField->setType('countrySelect');
                 $formField->setValue($this->country->id);
                 foreach ($this->availableCountries as $country) {
                     $formField->addAvailableValue($country['id_country'], $country[$entityField]);
                 }
             } elseif ($entity === 'State') {
                 if ($this->country->contains_states) {
                     $states = State::getStatesByIdCountry($this->country->id);
                     foreach ($states as $state) {
                         $formField->addAvailableValue($state['id_state'], $state[$entityField]);
                     }
                     $formField->setRequired(true);
                 }
             }
         }
         $formField->setLabel($this->getFieldLabel($field));
         if (!$formField->isRequired()) {
             // Only trust the $required array for fields
             // that are not marked as required.
             // $required doesn't have all the info, and fields
             // may be required for other reasons than what
             // AddressFormat::getFieldsRequired() says.
             $formField->setRequired(array_key_exists($field, $required));
         }
         $format[$formField->getName()] = $formField;
     }
     return $this->addConstraints($this->addMaxLength($format));
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:52,代码来源:CustomerAddressFormatter.php

示例12: getShopAddress

 /**
  * Returns the shop address
  * @return string
  */
 protected function getShopAddress()
 {
     $shop_address = '';
     if (Validate::isLoadedObject($this->shop)) {
         Shop::setContext(Shop::CONTEXT_SHOP, $this->shop->id);
         $shop_address_obj = $this->shop->getAddress();
         if (isset($shop_address_obj) && $shop_address_obj instanceof Address) {
             $shop_address = AddressFormat::generateAddress($shop_address_obj, array(), ' - ', ' ');
         }
         return $shop_address;
     }
     return $shop_address;
 }
开发者ID:NathanGiesbrecht,项目名称:PrestaShopAutomationFramework,代码行数:17,代码来源:HTMLTemplate.php

示例13: getContent

 /**
  * Returns the template's HTML content
  * @return string HTML content
  */
 public function getContent()
 {
     $country = new Country((int) $this->order->id_address_invoice);
     $invoice_address = new Address((int) $this->order->id_address_invoice);
     $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' ');
     $formatted_delivery_address = '';
     if ($this->order->id_address_delivery != $this->order->id_address_invoice) {
         $delivery_address = new Address((int) $this->order->id_address_delivery);
         $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
     }
     $customer = new Customer((int) $this->order->id_customer);
     $this->smarty->assign(array('order' => $this->order, 'order_details' => $this->order_invoice->getProducts(), 'cart_rules' => $this->order->getCartRules($this->order_invoice->id), 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'tax_excluded_display' => Group::getPriceDisplayMethod($customer->id_default_group), 'tax_tab' => $this->getTaxTabContent(), 'customer' => $customer));
     return $this->smarty->fetch($this->getTemplateByCountry($country->iso_code));
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:18,代码来源:HTMLTemplateInvoice.php

示例14: getContent

 /**
  * Returns the template's HTML content
  * @return string HTML content
  */
 public function getContent()
 {
     $delivery_address = new Address((int) $this->order->id_address_delivery);
     $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
     $formatted_invoice_address = '';
     if ($this->order->id_address_delivery != $this->order->id_address_invoice) {
         $invoice_address = new Address((int) $this->order->id_address_invoice);
         $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' ');
     }
     $carrier = new Carrier($this->order->id_carrier);
     $carrier->name = $carrier->name == '0' ? Configuration::get('PS_SHOP_NAME') : $carrier->name;
     $this->smarty->assign(array('order' => $this->order, 'order_details' => $this->order_invoice->getProducts(), 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'order_invoice' => $this->order_invoice, 'carrier' => $carrier));
     return $this->smarty->fetch($this->getTemplate('delivery-slip'));
 }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:18,代码来源:HTMLTemplateDeliverySlip.php

示例15: process

 public function process()
 {
     parent::process();
     $customer = new Customer((int) self::$cookie->id_customer);
     if (!Validate::isLoadedObject($customer)) {
         die(Tools::displayError('Customer not found'));
     }
     self::$smarty->assign('addresses', $customer->getAddresses((int) self::$cookie->id_lang));
     $values = array();
     $customer_address = $customer->getAddresses((int) self::$cookie->id_lang);
     foreach ($customer_address as $addr_item) {
         $ordered_fields = AddressFormat::getOrderedAddressFields($addr_item['id_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('ordered_fields', $ordered_fields);
 }
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:16,代码来源:AddressesController.php


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