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


PHP Cart66Common::appendWurlQueryString方法代码示例

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


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

示例1:

    // Apply CSS class for subscription products
    if (Cart66Session::get('Cart66Cart')->hasSubscriptionProducts() || Cart66Session::get('Cart66Cart')->hasMembershipProducts()) {
        echo ' subscription';
    }
    ?>
">
      <input type="hidden" class="ajax-tax-cart" name="ajax-tax-cart" value="<?php 
    echo Cart66Session::get('Cart66Cart')->hasTaxableProducts() ? 'true' : 'false';
    ?>
" />
      <input type="hidden" name="cart66-gateway-name" value="<?php 
    echo $gatewayName;
    ?>
" id="cart66-gateway-name" />
      <?php 
    $url = Cart66Common::appendWurlQueryString('cart66AjaxCartRequests');
    if (Cart66Common::isHttps()) {
        $url = preg_replace('/http[s]*:/', 'https:', $url);
    } else {
        $url = preg_replace('/http[s]*:/', 'http:', $url);
    }
    ?>
      <input type="hidden" name="confirm_url" value="<?php 
    echo $url;
    ?>
" id="confirm-url" />
      <?php 
    if ($cart->requireShipping()) {
        ?>
        <h2><?php 
        _e('Shipping Address', 'cart66');
开发者ID:arraysoftlab,项目名称:tracy-thedarkroom.com,代码行数:31,代码来源:shipping_address.php

示例2: initCheckout

 public function initCheckout($amount)
 {
     $cart = Cart66Session::get('Cart66Cart');
     $tax = $this->getTaxAmount();
     $order = array('return_url' => Cart66Common::appendWurlQueryString('task=mijireh_notification'), 'tax' => $tax, 'shipping' => $cart->getShippingCost(), 'discount' => $cart->getDiscountAmount(), 'subtotal' => $cart->getSubTotal(), 'total' => number_format($cart->getGrandTotal() + $tax, 2, '.', ''), 'items' => array());
     // Prepare the shipping address if it is available
     if (strlen($this->_shipping['address']) > 3) {
         $order['shipping_address'] = array('first_name' => $this->_shipping['firstName'], 'last_name' => $this->_shipping['lastName'], 'street' => $this->_shipping['address'], 'apt_suite' => $this->_shipping['address2'], 'city' => $this->_shipping['city'], 'state_province' => $this->_shipping['state'], 'zip_code' => $this->_shipping['zip'], 'country' => $this->_shipping['country'], 'phone' => $this->_payment['phone']);
     }
     // Add shipping method and promotion code as meta_data
     $order['meta_data'] = array('shipping_method' => Cart66Session::get('Cart66Cart')->getShippingMethodName(), 'coupon' => Cart66Common::getPromoMessage(), 'custom-field' => $this->_payment['custom-field']);
     // Add logged in users id to the meta_data for membership product upgrades/extensions
     $account_id = Cart66Common::isLoggedIn();
     if ($account_id) {
         $order['meta_data']['account_id'] = $account_id;
     }
     // Add coupon code as meta_data
     foreach ($cart->getItems() as $key => $item) {
         $sku = $item->getItemNumber();
         $order_item_data = array('sku' => $sku, 'name' => $item->getFullDisplayName(), 'price' => $item->getProductPrice(), 'quantity' => $item->getQuantity());
         if ($custom_desc = $item->getCustomFieldDesc()) {
             $order_item_data['name'] .= "\n" . $custom_desc;
         }
         if ($custom_info = $item->getCustomFieldInfo()) {
             $order_item_data['name'] .= "\n" . $custom_info;
         }
         $order['items'][$key] = $order_item_data;
         $option_info = trim($item->getOptionInfo());
         if (!empty($option_info)) {
             $order['meta_data']['options_' . $sku] = $option_info;
         }
         if ($item->hasAttachedForms()) {
             $form_ids = $item->getFormEntryIds();
             if (is_array($form_ids) && count($form_ids)) {
                 $form_ids = implode(',', $form_ids);
                 $order['meta_data'][$key]['gforms_' . $sku] = $form_ids;
             }
         }
     }
     // DBG
     /*
     echo "<pre>";
     print_r($order);
     echo "</pre>";
     die();
     */
     try {
         //Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Sending Order To Mijireh" . print_r($order, true));
         $access_key = Cart66Setting::getValue('mijireh_access_key');
         $rest = new PestJSON(MIJIREH_CHECKOUT);
         $rest->setupAuth($access_key, '');
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Sending Order To Mijireh: " . print_r($order, true));
         $result = $rest->post('/api/1/orders', $order);
         wp_redirect($result['checkout_url']);
         //wp_redirect(MIJIREH_CHECKOUT .  '/checkout/' . $result['order_number']);
         exit;
     } catch (Pest_Unauthorized $e) {
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] REST Request Failed because it was unauthorized: " . $e->getMessage());
         $this->response['error_message'] = __("Your Mijireh Access key is invalid, please check your access settings and try again", "cart66");
         $this->response['error_code'] = 1;
         if (strlen($this->_shipping['address']) < 3) {
             $gatewayResponse = $this->getTransactionResponseDescription();
             $exception = Cart66Exception::exceptionMessages(66500, __('Your order could not be processed for the following reasons:', 'cart66'), array('error_code' => 'Error: ' . $gatewayResponse['errorcode'], strtolower($gatewayResponse['errormessage'])));
             echo Cart66Common::getView('views/error-messages.php', $exception);
         }
     } catch (Exception $e) {
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] REST Request Failed: " . $e->getMessage());
     }
 }
开发者ID:rbredow,项目名称:allyzabbacart,代码行数:69,代码来源:Cart66Mijireh.php


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