当前位置: 首页>>代码示例>>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;未经允许,请勿转载。