/** * 객체의 인스턴스를 반환 * @return ProductManager * */ public static function get_instance() { //싱글톤 패턴 if (!isset(ProductManager::$m_instance)) { ProductManager::$m_instance = new ProductManager(); } return ProductManager::$m_instance; }
/** * Test related method * * @param array $trees * @param integer $selectedTreeId * @param boolean $resultCount * @param array $expectedResult * * @dataProvider dataProviderListTrees */ public function testListTreesResponse(array $trees, $selectedTreeId, $resultCount, $expectedResult) { $this->productManager->expects($this->any())->method('getProductsCountInCategory')->will($this->returnValue($resultCount)); $treeEntities = array(); foreach ($trees as $tree) { $treeEntities[] = $this->getCategoryMock($tree); } $result = $this->categoryExtension->listTreesResponse($treeEntities, $selectedTreeId); $this->assertSame($expectedResult, $result); }
public static function getInstance() { if (!self::$productManager) { self::$productManager = new ProductManager(); self::$productDataStore = new BeanDataStore(Product::$className, Product::$tableName); self::$productTagDataStore = new BeanDataStore(ProductTag::$className, ProductTag::$tableName); return self::$productManager; } return self::$offerManager; }
private function createProducts($productsLinks) { extract($_POST, EXTR_SKIP); foreach ($productsLinks as $productLink) { set_time_limit(0); $product = new ProductManager($productLink, $prefix); $product->addValue($queryName, 'name'); $product->addValue($queryPrice, 'price'); $product->addValue($queryDescription, 'description'); $product->addValue($querySpecifications, 'specifications'); $product->addValue($queryImages, 'images', $imgUrlBase); $product = get_object_vars($product); unset($product['xpath']); $this->addProduct($product); } $_SESSION['products'] = $this->products; $this->renderView('/searchProducts/preVisualizationProduct'); }
<?php require_once "../IConstants.inc"; require_once $ConstantsArray['dbServerUrl'] . "BusinessObjects/WishList.php"; require_once $ConstantsArray['dbServerUrl'] . "BusinessObjects/WishListDetails.php"; require_once $ConstantsArray['dbServerUrl'] . "Managers/WishListManager.php"; $success = 0; $message = ""; $call = ""; $response = null; if (isset($_GET["call"])) { $call = $_GET["call"]; } if ($call == "setWishListProduct") { try { $productManager = ProductManager::getInstance(); $products = $productManager->getProducts(); $response["products"] = $products; $success = 1; } catch (Exception $e) { $message = "Some error occured while fetching products. Please try again"; } } header('Access-Control-Allow-Origin: *'); header("Access-Control-Allow-Credentials: true"); header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS'); header('Access-Control-Max-Age: 1000'); header('Access-Control-Allow-Headers: Content-Type, Content-Range, Content-Disposition, Content-Description'); header("Content-type: application/json"); $response["success"] = $success; $response["message"] = $message;
<?php require_once 'init.php'; loadScripts(); $data = array("status" => "not set!"); if (Utils::isGET()) { $pm = new ProductManager(); $rows = $pm->updateProducts($_GET['sku'], $_GET['name'], $_GET['price'], $_GET['stock'], $_GET['description']); } else { $data = array("status" => "error", "msg" => "Only GET allowed."); } echo json_encode($data, JSON_FORCE_OBJECT);
<?php require_once 'init.php'; loadScripts(); $data = array("status" => "not set!"); if (Utils::isGET()) { $pm = new ProductManager(); $rows = $pm->findProduct($_GET['sku']); $html = ""; $image = $rows['image']; $name = $rows['name']; $stock = $rows['stock']; $sku = $rows['SKU']; $price = $rows['price']; $desc = $rows['description']; $html .= "<div class='popupitem'>\n <img data-sku-image='{$sku}' class='popupimg' src='{$image}'>\n <div class='popuptextdiv'>\n <h2 data-sku-title='{$sku}' class='popuptitle'>{$name}</h2>\n <hr class='popuphr'>\n <p data-sku-price='{$sku}' class='popupprice'>\${$price}</p>\n <p data-sku-desc='{$sku}' class='popupdescription'>{$desc}</p>\n <p class='popupstock' data-sku-stock='{$sku}'>{$stock}</p><span class='popupspan'> in stock</span>\n <a data-sku-add='{$sku}' href='#' id='startCart' class='popupbutton'>add to cart</a></div>\n <span class='closebutton'>x</span>\n </div>"; echo $html; return; } else { $data = array("status" => "error", "msg" => "Only GET allowed."); } echo json_encode($data, JSON_FORCE_OBJECT);
/** * 생성자 */ function __construct() { $this->m_sqlInfo = ProductManager::get_instance()->getSqlInfo(); $this->m_productManager = ProductManager::get_instance(); }
<?php require_once '../init.php'; loadScripts(); $data = array("status" => "not set!"); $pm = new ProductManager(); $parameters = new Parameters("POST"); $action = $parameters->getValue('action'); if ($action == 'checkstock') { //check $sku = $parameters->getValue('sku'); $rows = $pm->checkProductsStock(); echo json_encode($rows); } else { if ($action == 'update') { // sku: loginValue, newItemName: editedItemName, newPrice: editedPrice, newStock: editedStock}, $sku = $parameters->getValue('sku'); $pname = $parameters->getValue('newItemName'); $pdesc = $parameters->getValue('newDesc'); $price = $parameters->getValue('newPrice'); $stock = $parameters->getValue('newStock'); $rows = $pm->updateProduct($sku, $pname, $pdesc, $price, $stock); echo json_encode($rows); } else { if ($action == 'add') { $pname = $parameters->getValue('productName'); $pdesc = $parameters->getValue('productDesc'); $price = $parameters->getValue('productPrice'); $stock = $parameters->getValue('productStock'); $rows = $pm->addProduct($pname, $pdesc, $price, $stock); echo json_encode($rows);
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; // define the filter type chosen before sort if any $remove_item_id = addslashes(filter_input(INPUT_GET, 'remove_item_id')); $customer_id = addslashes(filter_input(INPUT_GET, 'customer_id')); $color = addslashes(filter_input(INPUT_GET, 'color')); $productMgr = new ProductManager(); $productMgr->deleteCartItem($customer_id, $remove_item_id, $color); header("Location: ./cart.php");
<h1>Lunch</h1> <?php $p = new ProductManager(); $p->productListToHTML('lunch'); ?> </div> </div> </div> <div id="dinner"> <div class="container-fluid"> <div class="jumbotron white text-center"> <h1>Dinner</h1> <?php $p = new ProductManager(); $p->productListToHTML('dinner'); ?> </div> </div> </div> <div id="aboutus"> <div class="container-fluid"> <div class="jumbotron white text-center"> <h1>About Us</h1> <div class="row"> <div class="col-md-4">
--> <?php session_start(); $_SESSION["admin_id"] = "michael"; include 'protect/admin_protect.php'; include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; include_once "./Manager/CreditManager.php"; include_once "./Manager/FdpManager.php"; include_once "./Manager/CustomerManager.php"; include_once "./Manager/PhotoManager.php"; include_once "./Manager/RewardManager.php"; include_once "./Manager/OrderManager.php"; include_once "./Manager/AddressManager.php"; $admin = $_SESSION["admin_id"]; $productMgr = new ProductManager(); $product_list = $productMgr->getAllProduct(); $no_of_products = sizeof($product_list); $creditMgr = new CreditManager(); $total_no_invitation = $creditMgr->getNoOfInvitation(); $fdpMgr = new FdpManager(); $current_cutoff = $fdpMgr->getCutoff(); $current_charge = $fdpMgr->getCharge(); ?> <html> <head> <script type="text/javascript" src="public_html/js/jquery-1.11.0.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.form/3.51/jquery.form.js"></script> <script> $(window).load(function(){
<?php include_once 'classes/Checkout.class.php'; include_once 'classes/ProductManager.class.php'; $Checkout = new Checkout(); $ProductManager = new ProductManager(); // Add the product to our basket $Checkout->addToBasket($ProductManager->getProduct($_POST['code'])); header("Location: index.php");
<?php require_once 'init.php'; loadScripts(); $data = array("status" => "not set!"); if (Utils::isGET()) { $pm = new ProductManager(); $rows = $pm->addProducts($_GET['sku'], $_GET['name'], $_GET['price'], $_GET['stock'], $_GET['path'], $_GET['description']); } else { $data = array("status" => "error", "msg" => "Only GET allowed."); } echo json_encode($data, JSON_FORCE_OBJECT);
<?php include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; // define the filter type chosen before sort if any $selected_product_id = addslashes(filter_input(INPUT_POST, 'selected_product_id')); $customer_id = addslashes(filter_input(INPUT_POST, 'customer_id')); $productMgr = new ProductManager(); $product_selected = $productMgr->getProduct($selected_product_id); $selected_product_name = $product_selected['product_name']; $selected_product_description = $product_selected['description']; $selected_product_price = $product_selected['price']; $selected_product_stock = $product_selected['stock']; $selected_product_qty_id = $selected_product_id . 'qty'; $selected_qty_msg_id = $selected_product_id . 'msg'; $selected_add_btn_id = $selected_product_id . 'btn'; //if the customer is not logged in, the default quantity of product in the cart is 0 $selected_product_in_cart = 0; //if customer is logged in, check if the product is in the cart if (!empty($customer_id)) { $selected_product_in_cart = $productMgr->retrieveItemQtyInShoppingCart($customer_id, $selected_product_id); } ?> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="text-danger fa fa-times"></i></button> <h4 class="modal-title" id="myModalLabel"><i class="text-muted"></i> <?php echo $selected_product_name; ?> </h4> </div>
} } else { $data = array("status" => "fail", "msg" => "New user name must be present - value was '{$newTitle}' for '{$sku}'."); } echo json_encode($data, JSON_FORCE_OBJECT); return; } else { if ($action == 'add') { //$data = array("action" => $action, "user_name" => $user_name); $newSKU = $parameters->getValue('newSKU'); $newTitle = $parameters->getValue('newTitle'); $newPrice = $parameters->getValue('newPrice'); $newQty = $parameters->getValue('newQty'); if (!empty($newSKU) && !empty($newTitle) && !empty($newPrice) && !empty($newQty)) { $data = array("status" => "success", "msg" => "Product added."); $um = new ProductManager(); $um->addAdminProduct($newSKU, $newTitle, $newPrice, $newQty); } else { $data = array("status" => "fail", "msg" => "First name, last name, and user name cannot be empty."); } echo json_encode($data, JSON_FORCE_OBJECT); return; } else { $data = array("status" => "fail", "msg" => "Action not understood."); } } } echo json_encode($data, JSON_FORCE_OBJECT); return; } else { $data = array("status" => "error", "msg" => "Only GET allowed.");
<?php require_once 'init.php'; loadScripts(); $data = array("status" => "not set!"); if (Utils::isGET()) { $pm = new ProductManager(); $rows = $pm->deleteProducts($_GET['sku']); } else { $data = array("status" => "error", "msg" => "Only GET allowed."); } echo json_encode($data, JSON_FORCE_OBJECT);
* To change this template file, choose Tools | Templates * and open the template in the editor. */ if (session_status() != PHP_SESSION_ACTIVE) { session_start(); } include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; include_once "./Manager/PhotoManager.php"; $photoMgr = new PhotoManager(); $filter_type = addslashes(filter_input(INPUT_POST, 'filter_type')); $customer_id = filter_input(INPUT_POST, 'customer_id'); if (empty($customer_id)) { $customer_id = ''; } $productMgr = new ProductManager(); $filtered_products = []; //$display = ''; if ($filter_type == 'allproducts') { $filtered_products = $productMgr->getAllProduct(); } else { $filtered_products = $productMgr->filterProduct($filter_type); } if (!empty($filtered_products)) { $_SESSION['results'] = $filtered_products; foreach ($filtered_products as $eachProduct) { $product_name = $eachProduct["product_name"]; $price = $eachProduct["price"]; $product_id = $eachProduct["product_id"]; $photoList = $photoMgr->getPhotos($product_id); $photo_url = $photoList["thumbnail"];
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; include_once "./Manager/PhotoManager.php"; $photoMgr = new PhotoManager(); $productMgr = new ProductManager(); $product_id = addslashes(filter_input(INPUT_POST, 'selected_product_id')); $color = addslashes(filter_input(INPUT_POST, 'color')); $qty = intval(addslashes(filter_input(INPUT_POST, 'qty'))); //$url = filter_input(INPUT_POST, 'url'); //print_r($url); $stock = $productMgr->getStock($product_id); session_start(); $userid = null; $addedQty = 0; $totalQty = 0; $qty_update = false; $cart_data = array(); if (!empty($_SESSION["userid"])) { // $userid is customer email address $userid = $_SESSION["userid"]; $cart_data['error_not_logged_in'] = false; //add product to the shopping cart if ($productMgr->retrieveItemQtyInShoppingCart($userid, $product_id, $color) > 0) { $addedQty = $productMgr->retrieveItemQtyInShoppingCart($userid, $product_id, $color);
<?php require 'fpdf17/fpdf.php'; include 'fpdf17/php-barcode.php'; include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; include_once "./Manager/CustomerManager.php"; include_once "./Manager/OrderManager.php"; include_once "./Manager/AddressManager.php"; $productMgr = new ProductManager(); $customerMgr = new CustomerManager(); $orderMgr = new OrderManager(); $addressMgr = new AddressManager(); // -------------------------------------------------- // // GET ORDER INFORMATION // -------------------------------------------------- // $order_id = implode("", $_POST); $orderList = $orderMgr->getPendingOrder(); $order = []; //var_dump($orderList); foreach ($orderList as $o) { if ($o["order_id"] === $order_id) { $order = $o; } } //$order = $orderList[$order_id]; //var_dump($order); class eFPDF extends FPDF { function TextWithRotation($x, $y, $txt, $txt_angle, $font_angle = 0) {
<!DOCTYPE html> <?php if (session_status() != PHP_SESSION_ACTIVE) { session_start(); } include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; $username = null; include_once "./templates/modal.php"; if (isset($_SESSION["userid"]) && !empty($_SESSION["userid"])) { // $userid is customer email address $userid = $_SESSION["userid"]; $pos = strpos($userid, "@"); // $username is displayed in the header $username = substr($userid, 0, $pos); $productMgr = new ProductManager(); $cart_total_qty = $productMgr->retrieveTotalNumberOfItemsInShoppingCart($userid); } ?> <style> #logo{margin-top:20px;height:97px;} .allocacocLogo{ position:absolute; margin-left:30px; z-index:-1; } .row{ margin-right: 15px }
<?php error_reporting(E_ALL); ini_set('display_errors', 'On'); include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; include_once "./Manager/PhotoManager.php"; include_once "./Manager/OrderManager.php"; $productMgr = new ProductManager(); $photoMgr = new PhotoManager(); $orderMgr = new OrderManager(); /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ $operation = ''; $operation = filter_input(INPUT_POST, 'operation'); if ($operation === '') { $operation = $_GET['operation']; } if ($operation === "add_product") { $valid = true; $product_name = filter_input(INPUT_POST, 'product_name'); $random_no = (string) rand(0, 10000); $product_id = "AL" . $random_no; $symbol_code = filter_input(INPUT_POST, 'symbol_code'); if (empty($symbol_code)) { $symbol_code = ''; } $price = filter_input(INPUT_POST, 'price');
<!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <?php if (session_status() != PHP_SESSION_ACTIVE) { session_start(); } include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; include_once "./Manager/PhotoManager.php"; $productMgr = new ProductManager(); $photoMgr = new PhotoManager(); $userid = null; $username = null; if (isset($_SESSION["userid"]) && !empty($_SESSION["userid"])) { // $userid is customer email address $userid = $_SESSION["userid"]; $pos = strpos($userid, "@"); // $username is displayed in the header $username = substr($userid, 0, $pos); $cart_items = $productMgr->retrieveFromShoppingCart($userid); $cart_total_qty = $productMgr->retrieveTotalNumberOfItemsInShoppingCart($userid); } ?> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Latest compiled and minified CSS -->
<?php require_once "includes/header.php"; require_once "includes/recipeManager.php"; require_once "includes/productManager.php"; $aAllRecipes = RecipeManager::getAllRecipes(); $aAllProducts = ProductManager::getAllProducts(); ?> <h1 class="textAlignCenter">"Get In My Belly!"</h1> <ul class="header1Home textAlignCenter marginBottom50"> <li class="bodyTextItalic">1. a phrase one says to express enjoyment of good food.</li> <li class="marginNone bodyTextItalic">2. the go-to healthy (gr)hub to satisfy the rumblings of a hungry belly.</li> </ul> <!-- main call-to-actions section --> <div class="mainImageHome eight columns floatLeft"> <img src="images/homeCookImage.jpg" alt="recipes-call-to-action-image" /> <div class="overlay"> <i class="fa fa-cutlery displayBlock headerIcon colour3A paddingTop50"></i> <h2 class="textAlignCenter paddingTop10">Make</h2> <p class="textAlignCenter colour44">A collection of healthy recipes, fit for hungry tastebuds.</p> <div class="blueButton bgBlue textAlignCenter"><a href="recipesLanding.php">See Recipes</a></div> </div> </div> <div class="mainImageHome eight columns floatLeft"> <img src="images/homeBuyImage.jpg" alt="shop-call-to-action-image" /> <div class="overlay"> <i class="fa fa-tag displayBlock headerIcon colour3A paddingTop50"></i> <h2 class="textAlignCenter paddingTop10">Buy</h2> <p class="textAlignCenter colour44">Feel-good eats to satisfy cravings.</p> <div class="blueButton bgBlue textAlignCenter"><a href="shop.php">Shop Now</a></div> </div>
//$display = 'ALL PRODUCTS'; break; } // define the sort type chosen by user $sort_type_get = addslashes(filter_input(INPUT_POST, 'sort_type')); $sort_type = ''; if ($sort_type_get == 'priceHL') { $sort_type = 'DESC'; } else { if ($sort_type_get == 'priceLH') { $sort_type = 'ASC'; } else { $sort_type = 'default'; } } $productMgr = new ProductManager(); $sorted_products = []; if ($filter_type == 'all' && $sort_type != 'default') { $sorted_products = $productMgr->sortAll($sort_type); } else { if ($filter_type != 'all' && $sort_type == 'default') { $sorted_products = $productMgr->filterProduct($filter_type); } else { if ($filter_type == 'all' && $sort_type == 'default') { $sorted_products = $productMgr->getAllProduct(); } else { $sorted_products = $productMgr->sortWithFilter($filter_type, $sort_type); } } } if (!empty($sorted_products)) {
<?php require_once 'php/init.php'; loadScripts(); $data = array("status" => "not set!"); if (Utils::isGET()) { $pm = new ProductManager(); $rows = $pm->listRentalsProducts(); $html = ""; foreach ($rows as $row) { $sku = $row['SKU']; $title = $row['title']; $price = $row['item_price']; $desc = $row['description']; $qty = $row['qty']; $html .= "<tr>\n <td data-sku-title='{$sku}'>{$title}</td>\n <td data-sku-desc='{$sku}'>{$desc}</td>\n <td><input data-sku-qty='{$sku}' type='number' value='1' min='1' max='10' step='1'/></td>\n <td data-sku-price='{$sku}'>{$price}</td>\n <td><input data-sku-add='{$sku}' type='button' value='Add'/></td>\n </tr>"; } echo $html; return; }
<?php require_once '../init.php'; loadScripts(); $data = array("status" => "not set!"); if (Utils::isGET()) { $pm = new ProductManager(); $rows = $pm->listProducts(); $html = ""; foreach ($rows as $row) { $sku = $row['SKU']; $price = $row['item_price']; $desc = $row['description']; $img = $row['item_img']; $qty = $row['item_qnty']; $color = ""; if ($qty < 5) { $color = "red"; } $html .= "<tr>\n <td data-sku-img='{$img}'><img class='product_img' src='{$img}'/></td>\n <td><input data-sku-desc='{$sku}'value='{$desc}'/></td>\n <td><input data-sku-qty='{$sku}' type='number' value='{$qty}' min='1' max='20' step='1' style='color:{$color}'/></td>\n <td><input data-sku-price='{$sku}' value='{$price}'/></td>\n <td><input data-sku-sub='{$sku}' type='button' value='Submit Update' class='btn btn-md btn-default sub_admin_update'/></td>\n </tr>"; } echo $html; return; } else { $data = array("status" => "error", "msg" => "Only GET allowed."); } echo json_encode($data, JSON_FORCE_OBJECT);
<?php $productManager = new ProductManager($db); try { $product = $productManager->findById($_GET['id']); } catch (Exception $e) { $product = $e->getMessage(); } if (!is_string($product)) { require 'views/product.phtml'; } else { echo "Nothing to show"; }
public function getLinks($xpathQuery) { //Esto es guarra arrreglarlo --> menos de 6 lneas fijo! set_time_limit(0); $urlbase = $_POST['urlBase']; $url = $_POST['urlPage']; $className = $_POST['className']; $elements = ProductManager::getAhreftLinks($url, $xpathQuery); $categories = ProductManager::setUrlBase($urlbase, $elements); $subCategories = []; foreach ($categories as $categorie) { set_time_limit(0); $subcats = ProductManager::setUrlBase($urlbase, ProductManager::getAhreftLinks($categorie, $xpathQuery)); $subCategories = array_merge($subCategories, $subcats); } $produtsLinks = []; foreach ($subCategories as $subcatLink) { set_time_limit(0); $productsFromSubCat = ProductManager::getAhreftLinks($subcatLink, $xpathQuery); $produtsLinks = array_merge($produtsLinks, $productsFromSubCat); } $produtsLinks = ProductManager::setUrlBase($urlbase, $produtsLinks); $produtsLinks = array_unique($produtsLinks); return $produtsLinks; }
<?php error_reporting(E_ALL); ini_set('display_errors', 'On'); include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; include_once "./Manager/CustomerManager.php"; include_once "./Manager/CreditManager.php"; $customerMgr = new CustomerManager(); $creditMgr = new CreditManager(); $productMgr = new ProductManager(); $email = ''; $key = ''; if (isset($_GET['email'])) { $email = $_GET['email']; } if (isset($_GET['key'])) { $key = $_GET['key']; } $invitation_link = $customerMgr->getInvitationLink($email); $retrieved_key = substr($invitation_link, strpos($invitation_link, "=") + 1); if (md5($retrieved_key) === $key) { session_start(); $customerMgr->activateAccount($email); $_SESSION["userid"] = $email; $form_data['status'] = 'success'; $form_data['message'] = ""; //Add credit to the new signed-up account if there is credit sender information in session if (isset($_COOKIE["sender_email"])) { $sender_email = $_COOKIE["sender_email"]; $creditMgr->addCredit($sender_email, $email);