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