當前位置: 首頁>>代碼示例>>PHP>>正文


PHP shopfunctions::getStateByID方法代碼示例

本文整理匯總了PHP中shopfunctions::getStateByID方法的典型用法代碼示例。如果您正苦於以下問題:PHP shopfunctions::getStateByID方法的具體用法?PHP shopfunctions::getStateByID怎麽用?PHP shopfunctions::getStateByID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在shopfunctions的用法示例。


在下文中一共展示了shopfunctions::getStateByID方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: plgVmConfirmedOrder

    /**
     * Form Creation
     */
    function plgVmConfirmedOrder($cart, $order)
    {
        if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
            return NULL;
        }
        if (!$this->selectedThisElement($method->payment_element)) {
            return FALSE;
        }
        $lang = JFactory::getLanguage();
        $filename = 'com_virtuemart';
        $lang->load($filename, JPATH_ADMINISTRATOR);
        if (!class_exists('VirtueMartModelOrders')) {
            require JPATH_VM_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'orders.php';
        }
        if (!class_exists('VirtueMartModelCurrency')) {
            require JPATH_VM_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'currency.php';
        }
        $jinput = JFactory::getApplication()->input;
        //Account Settings
        $environment = $method->pagamastarde_env;
        $discount = $method->pagamastarde_discount;
        if ($environment == 'test') {
            $account_id = $method->pagamastarde_test_account;
            $account_key = $method->pagamastarde_test_key;
        } else {
            $account_id = $method->pagamastarde_real_account;
            $account_key = $method->pagamastarde_real_key;
        }
        //Callback urls
        $url_ok = JURI::root() . 'index.php?option=com_virtuemart' . '&view=pluginresponse' . '&task=pluginresponsereceived' . '&vmethod=pagantis' . '&status=ok' . '&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . $jinput->get('Itemid', '', INT) . '&lang=' . $jinput->get('lang', '', CMD);
        $url_ko = JURI::root() . 'index.php?option=com_virtuemart' . '&view=pluginresponse' . '&task=pluginresponsereceived' . '&vmethod=pagantis' . '&status=ko' . '&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . $jinput->get('Itemid', '', INT) . '&lang=' . $jinput->get('lang', '', CMD);
        $cancelled_url = JURI::root() . 'index.php?option=com_virtuemart' . '&view=cart' . '&task=checkout' . '&vmethod=pagantis' . '&status=ko' . '&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . $jinput->get('Itemid', '', INT) . '&lang=' . $jinput->get('lang', '', CMD);
        $callback_url = JURI::root() . 'index.php?option=com_virtuemart' . '&view=pluginresponse' . '&task=pluginresponsereceived' . '&vmethod=pagantis' . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id;
        //Order ID
        $order_id = strval($order['details']['BT']->order_number);
        //Order email & Full name
        $customer_email = $order['details']['BT']->email;
        $customer_name = $order['details']['BT']->first_name . ' ' . $order['details']['BT']->last_name;
        //Order Amount
        //Precio del pedido
        $order_amount = number_format((double) $order['details']['BT']->order_total, 2, '.', '');
        $order_amount = str_replace('.', '', $order_amount);
        $order_amount = floatval($order_amount);
        //Currency
        $currency = self::PAGAMASTARDE_CURRENCY;
        //Lang code
        $lang_site = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2);
        if (!in_array($lang_site, self::$lang_codes)) {
            $lang_code = "en";
        } else {
            $lang_code = $lang_site;
        }
        //address
        $address = $order['details']['BT']->address_1 . " " . $order['details']['BT']->address_2;
        $city = $order['details']['BT']->city;
        $country = shopfunctions::getCountryByID($order['details']['BT']->virtuemart_country_id, 'country_name');
        $state = shopfunctions::getStateByID($order['details']['BT']->virtuemart_state_id, 'state_name');
        $zip = $order['details']['BT']->zip;
        //shipping
        $saddress = !isset($order['details']['ST']->address_1) ? '' : $order['details']['ST']->address_1 . " " . $order['details']['ST']->address_2;
        $scity = !isset($order['details']['ST']->city) ? '' : $order['details']['ST']->city;
        $scountry = !isset($order['details']['ST']->virtuemart_country_id) ? '' : shopfunctions::getCountryByID($order['details']['ST']->virtuemart_country_id, 'country_name');
        $sstate = !isset($order['details']['ST']->virtuemart_state_id) ? '' : shopfunctions::getStateByID($order['details']['ST']->virtuemart_state_id, 'state_name');
        $szip = !isset($order['details']['ST']->zip) ? '' : $order['details']['ST']->zip;
        //phone
        $phone = $order['details']['BT']->phone_1;
        $mobile_phone = $order['details']['BT']->phone_2;
        $this->log("Creating Form");
        $this->log("OrderID:" . $order_id);
        //Signature
        $signature = hash('sha512', $account_key . $account_id . $order_id . $order_amount . $currency . $url_ok . $url_ko . $callback_url . $discount . $cancelled_url);
        //Order description
        $description = 'OrderID: ' . $order_id;
        //shippment and tax
        $products = '';
        $i = 1;
        $products .= '<input name="items[' . $i . '][description]" type="hidden" value="Gastos de envío">';
        $products .= '<input name="items[' . $i . '][quantity]" type="hidden" value="1">';
        $products .= '<input name="items[' . $i . '][amount]" type="hidden" value="' . round($order['details']['BT']->order_shipment + $order['details']['BT']->order_shipment_tax, 2) . '">';
        $i++;
        /* tax included in the item price
           $products .= '<input name="items['.$i.'][description]" type="hidden" value="Impuestos">';
           $products .= '<input name="items['.$i.'][quantity]" type="hidden" value="1">';
           $products .= '<input name="items['.$i.'][amount]" type="hidden" value="'.number_format($order['details']['BT']->order_billTaxAmount,2).'">';
           $i++;
           */
        //Products description
        foreach ($cart->products as $product) {
            $products .= '<input name="items[' . $i . '][description]" type="hidden" value="' . addslashes($product->product_name) . '">';
            $products .= '<input name="items[' . $i . '][quantity]" type="hidden" value="' . $product->quantity . '">';
            $products .= '<input name="items[' . $i . '][amount]" type="hidden" value="' . round($product->prices['salesPrice'] * $product->quantity, 2) . '">';
            $i++;
        }
        //HTML necesary to send Paga+Tarde Request
        $form = '<html><head><title>Redirección Paga+Tarde</title></head><body><div style="margin: auto; text-align: center;">';
        $form .= '
            <form action="' . self::PAGAMASTARDE_URL . '" method="post" name="vm_pagamastarde_form" id="pagamastarde_form">
//.........這裏部分代碼省略.........
開發者ID:pagantis,項目名稱:pagamastarde-virtuemart,代碼行數:101,代碼來源:pagamastarde.php


注:本文中的shopfunctions::getStateByID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。