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


PHP Cart::search方法代码示例

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


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

示例1: removeCart

 public function removeCart($image_id)
 {
     $row = Cart::search(array('id' => $image_id));
     if ($row) {
         //print_r($row);exit;
         Cart::remove($row[0]);
     }
     return Redirect::route('order-cart');
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:9,代码来源:OrderController.php

示例2: postDelete

 public function postDelete()
 {
     if (Request::ajax()) {
         $productId = Input::get('productId');
         $rows = Cart::search(array('id' => $productId));
         $rowId = $rows[0];
         Cart::update($rowId, 0);
         $total = Cart::total();
         return Response::json(array('productId' => $productId, 'quantity' => $quantity, 'total' => $total));
     }
 }
开发者ID:Rotron,项目名称:shop,代码行数:11,代码来源:CartController.php

示例3: getItem

 /**
  * Setup the layout used by the controller.
  *
  * @return void
  */
 protected function getItem()
 {
     if (Request::ajax()) {
         $inp = Input::all();
         $misc = Misc::where('item_id', '=', $inp['id'])->where('item_talla', '=', $inp['talla'])->where('item_color', '=', $inp['color'])->where('deleted', '=', 0)->first();
         $aux = Misc::where('item_id', '=', $inp['id'])->where('deleted', '=', 0)->first();
         $img = Images::where('deleted', '!=', 1)->where('misc_id', '=', $aux->id)->first();
         $talla = Tallas::find($inp['talla']);
         $color = Colores::find($inp['color']);
         Cart::add(array('id' => $inp['id'], 'name' => $inp['name'], 'qty' => 1, 'options' => array('misc' => $misc->id, 'img' => $img->image, 'talla' => $inp['talla'], 'talla_desc' => $talla->talla_desc, 'color' => $inp['color'], 'color_desc' => $color->color_desc), 'price' => $inp['price']));
         $rowid = Cart::search(array('id' => $inp['id'], 'options' => array('talla' => $inp['talla'], 'color' => $inp['color'])));
         $item = Cart::get($rowid[0]);
         return Response::json(array('rowid' => $rowid[0], 'img' => $img->image, 'id' => $item->id, 'name' => $item->name, 'talla' => $talla->talla_desc, 'color' => $color->color_desc, 'qty' => $item->qty, 'price' => $item->price, 'subtotal' => $item->subtotal, 'cantArt' => Cart::count(), 'total' => Cart::total()));
     }
 }
开发者ID:bakuryuthem0,项目名称:nia,代码行数:20,代码来源:ItemController.php

示例4: Cart

$objUser->selectByUserId($localUserid);
// Find if User is able for purchasing
$OK_to_purchase = 0;
$cnpj = $objUser->CNPJ_CPF;
if ($_SESSION["userType"] == 1 or $_SESSION["userType"] == 3 or $_SESSION["userType"] == 4) {
    $OK_to_purchase = 1;
}
// Check if an item will be deleted
if ($action == $strDelete) {
    $objCart = new Cart($dbcat);
    $objCart->removeId($ID);
} else {
    // Check if an item had its media changed
    if ($action == "changePrice") {
        $objCart = new Cart($dbcat);
        $objCart->search($ID);
        searchMedia($dbcat, $objMedia, $objCart->media);
        $objCart->media = $matMedia[$mid]->getMedia();
        $sql = "SELECT * FROM Scene WHERE SceneId='" . $objCart->sceneId . "'";
        $dbcat->query($sql) or $dbcat->error($sql);
        $row = $dbcat->fetchRow();
        //$objCart->price = getPriceFromSatellite( $row["Satellite"], 1, $objCart->media );
        $objCart->price -= $objMedia[0]->getPrice($_SESSION['userLang']);
        $objCart->price += $matMedia[$mid]->getPrice($_SESSION['userLang']);
        // Apply changes
        $objCart->modify();
    }
}
// Searching for cart
$sql = "SELECT * FROM Cart WHERE Cart.sesskey='{$PHPSESSID}'";
$dbcat->query($sql) or $dbcat->error($sql);
开发者ID:Desenvolvimento-DGI,项目名称:Catalogo,代码行数:31,代码来源:cart.php

示例5: generateRequest

 function generateRequest($dbusercat)
 {
     //       require ("../include/mailMessage_".$_SESSION['userLang'].".php");
     //       require	("../catalogov2.0/cart_".$_SESSION['userLang'].".php");
     require "mailMessage_" . $_SESSION['userLang'] . ".php";
     require "cart_" . $_SESSION['userLang'] . ".php";
     include_once "globals.php";
     // Today
     $dbcadastro = $GLOBALS["dbusercat"];
     $today = date("Y-m-d H:i:s");
     $messageItem = "\t";
     setlocale(LC_MONETARY, 'bra');
     // Serching user
     $objUser = new User($dbusercat);
     $objUser->selectByUserId($this->userId);
     // Generating Request
     $objReq = new Request($this->bd);
     $reqIp = $_SERVER['REMOTE_ADDR'];
     $sql = "SELECT COUNTRY_NAME FROM ipToCountry WHERE IP_FROM <= inet_aton('{$reqIp}') AND IP_TO >= inet_aton('{$reqIp}')";
     $dbcadastro->query($sql) or $dbcadastro->error($sql);
     $row = $dbcadastro->fetchRow();
     $reqCountry = $row[COUNTRY_NAME];
     $objReq->fill($this->userId, $today, 0, 0, 0, 0, $this->operator, $this->addressId, $reqIp, $reqCountry);
     if (!($reqId = $objReq->insert())) {
         echo "Problema inserindo o request!";
         return false;
     }
     // Generating Request Itens
     $nItensReq = 0;
     for ($i = 0; $i < $this->nItens; $i++) {
         $carItem = $this->cart[$i]["Id"];
         $objItemCart = new Cart($this->bd);
         $objItemCart->search($carItem);
         $price = $objItemCart->price;
         $userType = $objUser->getTypeOfUser();
         if ($price == 0 or $price > 0 and $userType != 2) {
             //Searching the scene
             $sql = "SELECT * FROM Scene WHERE SceneId='" . $objItemCart->sceneId . "'";
             $this->bd->query($sql) or $this->bd->error($sql);
             $itens = $this->bd->numRows();
             if ($itens == 0) {
                 echo "Erro nas Cenas";
                 return false;
             }
             $row = $this->bd->fetchRow();
             $this->bd->freeResult($results);
             // Setting email message
             //$price = money_format('%10.2n', $objItemCart->price);
             $messageItem .= sprintf("\n%-8d%s\t\t%s", $i + 1, $strMessageSatellite, $row["Satellite"]);
             $messageItem .= sprintf("\n%-9s%s\t%s\t\t\t\t%s\t\tR\$%7.2f", " ", $strInstrument, $row["Sensor"], $objItemCart->media, $objItemCart->price);
             $messageItem .= sprintf("\n%-9s%s/%s\t%s/%s", " ", $strMessagePath, $strMessageRow, $row["Path"], $row["Row"]);
             $messageItem .= sprintf("\n%-9s%s\t\t\t%s\n", " ", $strDate, $row["Date"]);
             $reqTot += $objItemCart->price;
             // Generate Request Item
             if (!$objItemCart->generateReqItem($reqId, $userType)) {
                 echo "<br>Problema ao gerar item de pedido a partir do Carrinho</br>";
                 return false;
             }
             // Removing from cart
             if (!$objItemCart->removeId()) {
                 echo "<br>Problema ao remover pedido do Carrinho</br>";
                 return false;
             }
             $nItensReq++;
         }
     }
     $this->nItens -= $nItensReq;
     if ($reqTot) {
         $messageItem .= sprintf("%s\n\t\t\t\t\t\t\t\t%s\tR\$%7.2f\n\n", str_repeat("-", 98), $strTotal, $this->total);
     } else {
         $messageItem .= sprintf("%s\n\n", str_repeat("-", 98));
     }
     // Generating E-mail
     $message = sprintf($mailMsgReq1, $objUser->fullname, $reqId);
     if ($reqTot) {
         $message .= " " . $mailMsgReq2;
     }
     $message .= $mailMsgReq3 . str_repeat("-", 98);
     $message .= $messageItem;
     $message .= $mailMsgAtus;
     if (!mail($objUser->email, $mailSubReq . $reqId, $message, $mailSender)) {
         echo "Problema ao enviar o e-mail";
         return false;
     }
     // Returnind Request Number
     return $reqId;
 }
开发者ID:Desenvolvimento-DGI,项目名称:Catalogo,代码行数:87,代码来源:cart.class.php

示例6: showProduct

 public function showProduct($link)
 {
     $rows = Cart::search(array('id' => (string) Product::where('link', '=', $link)->firstOrFail()->id));
     return View::make('shop.product', ['product' => Product::where('link', '=', $link)->firstOrFail(), 'setting' => Config::get('setting'), 'rowId' => $rows[0]]);
 }
开发者ID:Rotron,项目名称:shop,代码行数:5,代码来源:ProductController.php

示例7: searchItem

 public function searchItem($id)
 {
     return \Cart::search(array('id' => $id));
 }
开发者ID:abada,项目名称:webshop,代码行数:4,代码来源:CartWorker.php

示例8: removeToCart

 public function removeToCart()
 {
     $product = Product::where('code', '=', Input::get('product'))->firstOrFail();
     $rowId = Cart::search(array('id' => $product->code));
     Cart::remove($rowId[0]);
     Session::flash('message', 'Successfully ' . $product->name . ' deattached to the basket');
     return Redirect::to('product');
 }
开发者ID:elioth010,项目名称:carretilla_online,代码行数:8,代码来源:OrderController.php

示例9: User

// Variables
$total = 0;
$nReqRefused = 0;
$userid = $_SESSION['userId'];
// Serching user
$objUser = new User($dbusercat);
$objUser->selectByUserId($userid);
// Instanciating Cart Group
$objCartG = new CartGroup($dbcat);
$objCartG->fill($sesskey, $userid);
$mediaCD = false;
// Showing cart itens
for ($i = 0; $i < $objCartG->nItens; $i++) {
    // cart itens
    $objCart = new Cart($dbcat);
    $objCart->search($objCartG->cart[$i]["Id"]);
    if ($objCart->media == "CD") {
        $mediaCD = true;
    }
    //Searching the scene
    $sql = "SELECT * FROM Scene WHERE SceneId='" . $objCart->sceneId . "'";
    $dbcat->query($sql) or $dbcat->error($sql);
    $itens = $dbcat->numRows();
    if ($itens == 0) {
        die("Erro nas Cenas");
    }
    $row = $dbcat->fetchRow();
    $dbcat->freeResult($results);
    /*
       // Veritifying user Type
       if(!$objCart->price or ($objCart->price and $objUser->getTypeOfUser()!=2))
开发者ID:Desenvolvimento-DGI,项目名称:Catalogo,代码行数:31,代码来源:cartRequest.php

示例10: testCartCanSearch

 public function testCartCanSearch()
 {
     Cart::add(1, 'Product 1', 1, 10.0, array('size' => 'large', 'color' => 'red'));
     Cart::add(2, 'Product 2', 1, 10.0, array('size' => 'large'));
     $row1 = '17351068ba2f30bac8d3ccb1ad94dfe6';
     $row2 = '5b9865a287421917623bdcf99f7de904';
     $search = Cart::search(array('id' => 1, 'name' => 'Product 1'));
     $this->assertEquals($search, array($row1));
     $search = Cart::search(array('id' => 2, 'name' => 'Product 1'));
     $this->assertFalse($search);
     $search = Cart::search(array('id' => 2, 'name' => 'Product 2'));
     $this->assertEquals($search, array($row2));
     $search = Cart::search(array('id' => 1, 'price' => 10.0));
     $this->assertEquals($search, array($row1));
     $search = Cart::search(array('qty' => 1, 'price' => 10.0));
     $this->assertEquals($search, array($row1, $row2));
     $search = Cart::search(array('id' => 2, 'kaas' => 'Product 2'));
     $this->assertFalse($search);
     $search = Cart::search(array('id' => 2, 'options' => array('size' => 'large')));
     $this->assertEquals($search, array($row2));
     $search = Cart::search(array('options' => array('size' => 'large')));
     $this->assertEquals($search, array($row1, $row2));
     $search = Cart::search(array('id' => 1, 'options' => array('color' => 'red')));
     $this->assertEquals($search, array($row1));
     $search = Cart::search(array('options' => array('color' => 'red', 'size' => 'large')));
     $this->assertEquals($search, array($row1));
 }
开发者ID:yashb,项目名称:generator,代码行数:27,代码来源:CartTest.php


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