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


PHP DAOFactory::getShoppingCartDAO方法代碼示例

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


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

示例1: getCart

function getCart($idCart)
{
    try {
        $cart = DAOFactory::getShoppingCartDAO()->load($idCart);
        if (!$cart) {
            return false;
        }
        $cart->apartamentoObj = json_decode($cart->apartamento);
        $cart->excursionesArray = json_decode($cart->excursiones);
        if ($cart->monedaId) {
            $cart->moneda = DAOFactory::getMonedaDAO()->load($cart->monedaId);
        }
        return $cart;
    } catch (Exception $e) {
        print_r($e);
        return false;
    }
}
開發者ID:randyibarrola,項目名稱:active,代碼行數:18,代碼來源:cart.php

示例2: getReservaByLocalizador

function getReservaByLocalizador($localizador, $withCardData = false)
{
    try {
        $reservas = DAOFactory::getReservaDAO()->queryByLocalizador($localizador);
        if (!$reservas || !count($reservas)) {
            return false;
        }
        $reserva = $reservas[count($reservas) - 1];
        $idReserva = $reserva->id;
        $reserva->productos = DAOFactory::getReservaProductoDAO()->queryByReservaId($idReserva);
        $reserva->usuario = getUsuario($reserva->usuarioId);
        $reserva->pagos = DAOFactory::getReservaPagoDAO()->queryByReservaId($idReserva);
        if ($reserva->pagos) {
            $clave = getClaveByHotel($reserva->hotelId);
            foreach ($reserva->pagos as $pago) {
                if ($pago->formaPago == 'tarjeta') {
                    if (!$withCardData) {
                        $pago->tarjetaNumero = false;
                        $reserva->cardData = true;
                    } else {
                        if ($pago->tarjetaNumero && strlen(trim($pago->tarjetaNumero))) {
                            $pago->tarjetaNumero = Encrypter::decrypt($pago->tarjetaNumero, $clave);
                        }
                    }
                    if (!$withCardData) {
                        $pago->cvv = false;
                    } else {
                        if ($pago->cvv && strlen(trim($pago->cvv))) {
                            $pago->cvv = Encrypter::decrypt($pago->cvv, $clave);
                        }
                    }
                }
            }
        }
        $reserva->alojamiento = array();
        $reserva->extras = array();
        foreach ($reserva->productos as $kp => $p) {
            if (strcmp($p->tipo, 'apartamento') == 0) {
                $p->noches = ceil((strtotime($p->final) - strtotime($p->inicio)) / (24 * 60 * 60));
                if (strpos($p->nombre, '(')) {
                    $n = explode('(', $p->nombre);
                    $pax = trim($n[count($n) - 1]);
                    $reserva->productos[$kp]->pax = substr($pax, 0, strlen($pax) - 1);
                }
                array_push($reserva->alojamiento, $p);
            } else {
                if ($p->eventoTpv && strlen($p->eventoTpv)) {
                    $p->eventoTpv = json_decode($p->eventoTpv);
                }
                if ($p->entradas) {
                    $p->entradasList = json_decode($p->entradas);
                    $cant = 0;
                    foreach ($p->entradasList as $entrada) {
                        $cant += $entrada->entradas;
                    }
                    $p->tickets = $cant;
                }
                array_push($reserva->extras, $p);
            }
        }
        if ($reserva->monedaId) {
            $reserva->moneda = DAOFactory::getMonedaDAO()->load($reserva->monedaId);
        }
        if ($reserva->idiomaId) {
            $reserva->idioma = DAOFactory::getIdiomaDAO()->load($reserva->idiomaId);
        }
        if ($reserva->cartId) {
            $reserva->cart = DAOFactory::getShoppingCartDAO()->load($reserva->cartId);
            $reserva->cart->apto = json_decode($reserva->cart->apartamento);
        }
        return $reserva;
    } catch (Exception $e) {
        return false;
    }
}
開發者ID:randyibarrola,項目名稱:active,代碼行數:75,代碼來源:reserva.php


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