function test_product_initial() { $product = product(5); $input = [2, 3, 4]; $expect = 5 * 2 * 3 * 4; $actual = $product($input); $this->assertEquals($expect, $actual); }
function plug_shop($a, $p, $o) { if ($a == 'prod') { return product($p, $o); } if ($a == 'shop') { return shopping($p, $o); } }
function insertVariant($product, $variant, $quantity) { global $cart; $prod =& $cart['products'][$product['id']]; if ($prod) { $vari =& $prod['variants'][$variant['shadow_id']]; if ($vari) { $vari['quantity'] += $quantity + 0; } else { $product['variants'][$variant['shadow_id']] = variant($quantity, $variant['price'], $variant['weight']); } $prod['quantity'] += $quantity + 0; } else { $prod = product($quantity, $product['collections'], $product['tags'], $product['metas'], $product['vendor'], $product['type']); $prod['variants'][$variant['shadow_id']] = variant($quantity, $variant['price'], $variant['weight']); addProductToCategories($prod, $product['id']); $cart['products'][$product['id']] = $prod; $cart['variants'][$variant['shadow_id']] = $product['id']; } }
} } else { $page = 1; } $count_rows = count_rows($category); //common amount product $pages_count = ceil($count_rows / $perpage); // common amount pages if (!$pages_count) { $pages_count = 1; } if ($page > $pages_count) { $page = $pages_count; } $start_pos = ($page - 1) * $perpage; $products = product($category, $start_pos, $perpage); break; case 'addtocart': $goods_id = abs((int) $_GET['goods_id']); addtocart($goods_id); $_SESSION['total_sum'] = total_sum($_SESSION['cart']); $_SESSION['total_quantity'] = 0; foreach ($_SESSION['cart'] as $key => $value) { if (isset($value['price'])) { $_SESSION['total_quantity'] += $value['qty']; } else { unset($_SESSION['cart'][$key]); } } redirect(); break;
<?php $sotin1trang = 12; $trang = $_GET["trang"]; settype($trang, "int"); if ($trang <= 0) { $trang = 1; } $tongtin = product(); $tongsotin = mysql_num_rows($tongtin); $sotrang = ceil($tongsotin / $sotin1trang); ?> <div class="title_style">SẢN PHẨM</div> <div class="wrap_page_act"> <div class="search_block"> <form action="main-page.php" name="form_search" id="form_search"> <div style="padding:20px; line-height:25px"> <label>Tìm kiếm sản phẩm</label> <input type="hidden" name="p" value="search-product" /> <input type="text" name="k" placeholder="Nhập tên sản phẩm cần tìm..."> <input type="submit" class="button_style1" value="Tìm kiếm" /> </div> </form> </div> <div id="usual1" class="usual"> <ul> <li><a href="#tab1">SẢN PHẨM</a></li> <li><a href="#tab2">THÊM SẢN PHẨM</a></li> </ul> <div class="tab_content" id="tab1">
public function testProduct() { $this->assertKeysValues([[]], [[]], function () { return product(); }); $this->assertKeysValues([[0], [1]], [[1], [2]], function () { return product([1, 2]); }); $this->assertKeysValues([[0, 0], [0, 1], [1, 0], [1, 1]], [[1, 3], [1, 4], [2, 3], [2, 4]], function () { return product([1, 2], [3, 4]); }); $this->assertKeysValues([[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1]], [[1, 1, 1], [1, 1, 2], [1, 2, 1], [1, 2, 2], [2, 1, 1], [2, 1, 2], [2, 2, 1], [2, 2, 2]], function () { return product(range(1, 2), [1, 2], new \ArrayIterator([1, 2])); }); }
/** * Get product entity * * @param int $id Product id * * @return App\Models\Product */ protected function _getProduct($id = 0) { if ($id) { $product = product($id); } else { $product = new Product(); } return $product; }
<?php error_reporting(0); require_once "init.php"; require_once "config_db.php"; //require_once("include/protecteed.php"); $brand = shoes_brand(); $model = shoes_models(); $product = product(); $size = shoes_size(); $brandjs = shoes_brand(); $modeljs = shoes_models(); $productjs = product(); $sizejs = shoes_size(); $config = config(); ?> <html lang="en" > <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="author" content="The Sneaker Savant" /> <meta name="description" content="The World's foremost authority on sneaker grading. Get your sneakers professionally graded today!" /> <meta name="robots" content="index, follow" /> <title>The Sneaker Savant</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <!-- attach JavaScripts --> <script src="js/jquery-1.11.1.js"></script> <script src="js/bootstrap.min.js"></script> <script src="js/main.js"></script> <!-- attach Google Analytics --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
<?php $array = []; for ($i = 0; $i < 20; $i++) { $array[$i] = rand(0, 100) - 50; } var_dump($array); echo '<br>'; echo negative($array); echo '<br>'; echo product($array, 2, 6); echo '<br>'; echo prod_2($array, -7, 38); echo '<br>'; echo prod_min($array); function negative($a) { $neg = 0; foreach ($a as $e) { if ($e < 0) { $neg++; } } return $neg; } function product($a, $b, $d) { /*функция, которая умножает элементы с номером от b до d */ $prod = 1; if ($b > $d) { $tmp = $b;
} elseif (Mage::app()->getRequest()->getParam('route') == "feed/web_api/categories") { # -- $_GET params ------------------------------ $parent = Mage::app()->getRequest()->getParam('parent', 0); $level = Mage::app()->getRequest()->getParam('level', 1); # -- End $_GET params -------------------------- print_r(json_encode(getCategoryTree($parent, $level))); } elseif (Mage::app()->getRequest()->getParam('route') == "feed/web_api/products") { # -- $_GET params ------------------------------ $category_id = Mage::app()->getRequest()->getParam('category', 0); # -- End $_GET params -------------------------- print_r(json_encode(products($category_id))); } elseif (Mage::app()->getRequest()->getParam('route') == "feed/web_api/product") { # -- $_GET params ------------------------------ $product_id = Mage::app()->getRequest()->getParam('id', 0); # -- End $_GET params -------------------------- print_r(json_encode(product($product_id))); } elseif (Mage::app()->getRequest()->getParam('route') == "feed/web_api/random") { # -- $_GET params ------------------------------ $limit = Mage::app()->getRequest()->getParam('limit', 4); # -- End $_GET params -------------------------- print_r(json_encode(random_products($limit))); } // // Random Products Items // // http://localhost/magento/web-api.php?route=feed/web_api/random&limit=4&key=key1 // function random_products($limit) { $json = array('success' => true); $products = Mage::getModel('catalog/product')->getCollection();
function product($idProduct = "") { require_once '../../Model/ProductClass.php'; global $viewLogin; if (!$viewLogin) { header('Location: ../Front/controller.php?f=index'); } global $navegador; global $navegadorAdmin; $navegador = $navegadorAdmin; global $connection; $product = new ProductClass($connection); // var_dump($_POST); if ($idProduct != '') { $product->fetch($idProduct); if ($product->imgs == '') { $product->imgs = array('not-found.png'); } if (isset($_POST['button']) && $_POST['button'] == 'Save') { if (!is_numeric($_POST['price'])) { echo '<script>alert("Error : price It is not a numeric value")</script>'; } else { $product->name = $_POST['name']; $product->description = $_POST['description']; $product->longDescription = $_POST['longDescription']; $product->price = $_POST['price']; $product->category = $_POST['category']; $product->insertProduct(); } } if (isset($_POST['button']) && $_POST['button'] == 'Delete') { $product->deleteProduct(); header('Location: ../Back/controller.php?f=productList'); } } else { if (isset($_POST['button']) && $_POST['button'] == 'Save') { $product = new ProductClass($connection, $_POST['name'], $_POST['description'], $_POST['longDescription'], $_POST['price'], '', $_POST['category']); // cargarlo de categorias $idLastInsert = $product->insertProduct(); // var_dump($idLastInsert); if ($idLastInsert != 0) { product($idLastInsert); } // $product->insertProduct(); } } // cargarlo de categorias $options = array(array('value' => '1', 'string' => 'Book'), array('value' => '2', 'string' => 'Music')); $titulo = $product->name; $description = $product->description; $palabrasClaves = 'palabrasClaves'; require_once '../../View/Back/product.php'; }
<link rel="icon" type="image" href="images/cart.png" /> </head> <body> <header id="heading"> <!--img id="logo" src="images/1.png" height="65" width="140" /> <h1>TheProgrammingNerd1</h1--> </header> <div id="main_div"> <h3>Shopping Cart</h3> <div id="division"> <section id="main_section"> <?php display_cart(); ?> </section> <aside id="side"> <span class="your_cart">Your Cart</span> <br> <?php product(); ?> </aside> </div> </div> </header> </body> <html>