public function remFromBasket(Product $product) { if ($this->basket[$product->getName()]) { unset($this->basket[$product->getName()]); return true; } else { throw new Exception('Product not in basket!'); } }
/** * Hozzá adja, elmenti az adatbázisban az új termék adatait. * * @param Product $product * @return Exception|string */ public function productAddStore($product) { //die("temrék neve: " . $product->getName()); if ($this->checkProductExist($product->getName()) === FALSE) { try { self::$conn->preparedInsert("termekek", array("nev", "kat_azon", "kisz_azon", "suly", "egysegar", "min_keszlet", "min_rend", "kim_azon", "akcio", "reszletek", "kep"), array($product->getName(), $product->getCategory(), $product->getPackage(), $product->getWeight(), $product->getPrice(), $product->getMinStock(), $product->getMinOrder(), $product->getHighlight(), $product->getDiscount(), $product->getDescription(), $product->getImg())); //die("Sql után!"); } catch (Exception $e) { return new Exception("Nem sikerült elmenteni a terméket!"); } //$stmt = $conn->preparedQuery("SELECT t_azon FROM termekek WHERE nev=?",array("$name")); return "Sikeres termék felvitel!"; } else { return "Létezik már ilyen termék!"; } }
public function test_initialization() { $product = new Product(); $this->assertEqual($product->getId(), 0); $this->assertEqual($product->getName(), ''); $this->assertEqual($product->getCreated(), ''); $this->assertEqual($product->getUpdated(), ''); }
/** * Modify the product name and ean in database by id. * It checks if the EAN already exists by another product, and does not overwrite. * * @param Product $product * @return bool */ public function modify(Product $product) { if ($this->checkUnique($product->getEan())) { $sth = $this->pdo->prepare("\n\t\t\t\tUPDATE product\n\t\t\t\tSET\n\t\t\t\t\tean = :_ean,\n\t\t\t\t\tname = :_name\n\t\t\t\tWHERE\n\t\t\t\t\tid = :_id\n\t\t\t"); return $sth->execute(array(':_id' => $product->getId(), ':_ean' => $product->getEan(), ':_name' => $product->getName())); } return false; }
public static function create(Product $oProduct) { $oCartProduct = new CartProduct(); $oCartProduct->setImage($oProduct->getImage()); $oCartProduct->setId($oProduct->getId()); $oCartProduct->setDescription($oProduct->getDescription()); $oCartProduct->setName($oProduct->getName()); $oCartProduct->setPrice($oProduct->getPrice()); return $oCartProduct; }
public function create(SubCategory $sub_category, $name, $description, $price, $img, $stock) { $errors = array(); $product = new Product($this->db); try { $product->setSubCategory($sub_category); $product->setName($name); $product->setDescription($description); $product->setPrice($price); $product->setImg($img); $product->setStock($stock); } catch (Exception $e) { $errors[] = $e->getMessage(); } $errors = array_filter($errors, function ($val) { return $val !== true; }); if (count($errors) == 0) { $idSubCategory = intval($product->getIdSubCategory()); $name = $this->db->quote($product->getName()); $description = $this->db->quote($product->getDescription()); $price = $this->db->quote($product->getPrice()); $img = $this->db->quote($product->getImg()); $stock = $this->db->quote($product->getStock()); $query = "INSERT INTO product(id_sub_category, name, description, price, img, stock) VALUES('" . $idSub_category . "', " . $name . ", " . $description . ", " . $price . ", " . $img . ", " . $stock . ")"; $res = $this->db->exec($query); if ($res) { $id = $this->db->lastInsertId(); if ($id) { return $this->findById($id); } else { return "Internal Server error"; } } } else { return $errors; } }
/** * Returns -1, 0, or 1 if the first Product title is smaller, equal to, * or greater than the second, respectively * @param Product $objProduct1 Product #1 * @param Product $objProduct2 Product #2 * @return integer -1, 0, or 1 */ static function cmpTitle($objProduct1, $objProduct2) { return $objProduct1->getName() == $objProduct2->getName() ? 0 : ($objProduct1->getName() < $objProduct2->getName() ? -1 : 1); }
public function getName() { //return parent::productName; return parent::getName() . '_NEW'; }
public function addItem(Product $product, $quantity) { $this->items[] = new OrderItem($product->getName(), $quantity, $product->getPrice()); }
/** * Give back a buyable product * @param Produit $p * @return Cart */ public function unBuy(Product $p) { $this->getStockage->delete($p->getName()); return $this; }
$content .= '<div class="tac smallText notice">Depot and Refill for all Lengths<br />Elements based on default length only</div>'; $content .= '<div class="tac" style="margin-top:20px;">'; $content .= '<div id="cogs-table">' . $obj_product->getProductCOGSObject()->drawDetailTable() . '</div>'; $cogs = $obj_product->getProductCOGSValue(); $content .= '<div>' . '<span id="cogs-manual-form" style="display:none;">' . '<input type="text" id="cogs-manual-input" value="' . $cogs . '" class="w100 tac" />' . '<br /><span class="notice">Set to 0 to use auto calculation</span>' . '</span>' . '<input type="button" id="cogs-manual-set" value="Set COGS Manually" />' . '</div>'; $content .= '</div>'; $content .= '</div>'; //#left-panel //MAIN FORM $style_margin_left = 'margin-left:' . (IMAGE_SIZE_THUMBNAIL_3 + 60) . 'px;'; $content .= '<div id="main-form" style="width:600px;' . $style_margin_left . '">'; $content .= '<form name="update_product" action="?open=product-detail&products_id=' . $products_id . '" method="post">'; $content .= '<input type="hidden" name="me_action" value="UPDATEPRODUCTINFO" />'; $content .= '<input type="hidden" name="products_id" value="' . $products_id . '" />'; $content .= '<div><table class="main w900" border="0" cellspacing="0" cellpadding="2">'; $content .= '<tr><td colspan="2"><h2 style="margin:0;">' . $obj_product->getName('2') . '</h2></td></tr>'; $content .= '<tr><td colspan="2"><hr /></td></tr>'; $content .= '<tr>'; $content .= '<td class="w200">TOP Category</td>'; $content .= '<td>' . $obj_product->getCategory()->getCategoryTop()->name . '</td>'; $content .= '</tr><tr>'; $content .= '<td>Category</td>'; $content .= '<td>' . $obj_product->getCategory()->getName('1') . ' / ' . $obj_product->getCategory()->getName('2') . '</td>'; $content .= '</tr><tr>'; $content .= '<td>Product ID / Code</td>'; $content .= '<td>' . $obj_product->id . ' / ' . $obj_product->code . '</td>'; $content .= '</tr><tr>'; //$content .= '<td>Product Code</td>'; //$content .= '<td><input type="text" name="products_model" value="'.$products['products_model'].'" class="input" '.$code_changable.' /></td>'; //$content .= '</tr><tr>'; $content .= '<td>Date Finalized</td>';
} return '[' . $this->getSelectedProduct() . ']-[Change:' . $this->getChange() . ']'; } /** * @return string
/** * Get cell value for Matahari catalog cell * @global Int $jng_sp_id * @global Array $sp_detail * @param String $column_key * @param Product $product * @param Int $aid * @return String */ function getMatahariCatalogCellValue($column_key, $product, $aid) { global $class_pb, $jng_sp_id, $sp_detail, $sp_values_brand, $sp_values_colors, $sp_values_navcat, $sp_values_navsubcat, $category_top_id; $lid = $sp_detail['languages_id']; if (!isset($sp_values_brand[$product->brand_id])) { $sp_brands = $class_pb->getSPbrands($product->brand_id); $sp_values_brand[$product->brand_id] = $sp_brands[$jng_sp_id]; } $product_old_function = $product->getOldProductFunction()->retrieveDetail($product->id, 'p,pd,pd2,pc,pnc,cat,pei,pci'); if ($category_top_id == '1') { if ($product_old_function['pci']['products_clear_image'] != '') { $main_image = substr($product_old_function['pci']['products_clear_image'], 23); } else { $main_image = substr($product_old_function['p']['products_image'], 23); } } else { $main_image = substr($product_old_function['p']['products_image'], 23); } $additional_images = array_values($product_old_function['pei']); $category_id = $product->category_id; $selling_points = $product->getSellingPointsAsArray($lid); switch ($column_key) { case 'Title*': if ($category_top_id == '1') { //JEWELRY $value = ucwords(strtolower($sp_values_brand[$product->brand_id])) . ' ' . $product_old_function['pd'][3]['products_name'] . ' ' . $product->getColors($lid); // $value = 'VON LORENZ' . ' ' . // $product_old_function['pd'][3]['products_name'] . ' ' . $product->getColors($lid); } else { $value = ucwords(strtolower($sp_values_brand[$product->brand_id])) . ' ' . $product->getName($lid) . ' ' . $product->getColors($lid); } break; case 'Brand': $value = $sp_values_brand[$product->brand_id]; // $value = 'VON LORENZ'; break; case 'Model': $value = ''; break; case 'Color*': $value = $product->getColors($lid); break; case 'Sale Price (Amount)*': $price = $product->getPriceSelling($jng_sp_id); $price_old = $product->getPriceSellingOld($jng_sp_id); if ($price_old <= $price) { //show blank if its not discounted $price = ''; } $value = $price; break; case 'Price (Amount)*': $price = $product->getPriceSelling($jng_sp_id); $price_old = $product->getPriceSellingOld($jng_sp_id); if ($price_old <= $price) { $price_old = $price; } $value = $price_old; break; case 'SKU*': $value = $product->getSKU($aid); break; case 'Size': //todo: translate ring sizes if ($category_top_id == '1') { if ($category_id == '29') { $value = $product->convertRingSizeToJapaneseSize($product->getLengthOrSizeAsText($aid)); } else { $value = 'One Size'; } } else { $value = $product->getLengthOrSizeAsText($aid); } break; case 'Model Number': $value = $product->getEAN($aid); break; case 'Stock': $value = $product->retrieveStockQuantity($aid); break; case 'Product Line': $value = 'Wanita'; break; case 'Normal Price (Amount)*': $value = $product->getPriceDefault(); break; case 'Normal Price (Currency)*': $value = 'IDR'; break; case 'Main Material': $value = ''; break; case 'Description*': $value = $product->getDescription($lid); break; case 'Youtube URL': $value = ''; break; case 'Highlight 1': $value = $selling_points[0]; break; case 'Highlight 2': $value = $selling_points[1]; break; case 'Highlight 3': $value = $selling_points[2]; break; case 'Highlight 4': $value = $selling_points[3]; break; case 'Highlight 5': $value = $selling_points[4]; break; case 'Highlight 6': $value = ''; break; case 'Highlight 7': $value = ''; break; case 'Highlight 8': $value = ''; break; case 'Highlight 9': $value = ''; break; case 'Highlight 10': $value = ''; break; case 'Highlight 11': $value = ''; break; case 'Highlight 12': $value = ''; break; case 'Insurance option': $value = '1'; break; case 'Handling fee (IDR)': $value = '0'; break; case 'Product Dimension': //Measurements is from Zalora Template $value = $product->displayMeasurement($lid); break; case 'Product Weight': $value = $product->displayWeight($lid); break; case 'Package Dimension (L x W x H cm)': //todo: use dynamic data $value = '40 x 35 x 3 cm'; break; case 'Certification': $value = ''; break; case 'Product Country': $value = ProductAttribute::displayAttributeName($product->id, ProductAttribute::GROUP_ID_ORIGIN, $lid); break; case 'Item Condition*': $value = 'new'; break; case 'Product Waranty': $value = ''; break; case 'Image 1*': //Currently Kristel will copy the link to this field manually. $value = $main_image; break; case 'Image 2': $value = $additional_images[0] == '' ? '' : substr($additional_images[0], 23); break; case 'Image 3': $value = $additional_images[1] == '' ? '' : substr($additional_images[1], 23); break; case 'Image 4': $value = $additional_images[2] == '' ? '' : substr($additional_images[2], 23); break; case 'Image 5': $value = $additional_images[3] == '' ? '' : substr($additional_images[3], 23); break; case 'Product Line': $value = ucfirst($product->getProductGender('1')); break; case 'Price (Currency)*': $value = 'IDR'; break; case 'Type': $value = ''; break; case 'Package Weight (Kg)': $value = 0.4; break; case 'product_id(MUST BE DELETED BEFORE UPLOAD)': $value = $product->id; break; default: $value = ''; } return $value; }
/** * The row with default value * * @param UDate $lastUpdatedInDB * @param Product $product * @param string $preFix * @param bool $debug * * @return multitype:string number */ private static function _getRowWithDefaultValues(UDate $lastUpdatedInDB, Product $product = null, $preFix = '', $debug = false) { $attributeSetDefault = 'Default'; $attributeSetName = $attributeSetDefault; $enabled = true; $sku = $statusId = $productName = $rrpPrice = $weight = $shortDescription = $fullDecription = $supplierName = $supplierCode = $manufacturerName = $asNewFrom = $asNewTo = $specialPrice = $specialPriceFromDate = $specialPriceToDate = ''; $categoryIds = array(2); //default category if ($product instanceof Product) { $sku = trim($product->getSku()); $productName = trim($product->getName()); $shortDescription = trim($product->getShortDescription()); $asNewFrom = $product->getAsNewFromDate() instanceof UDate ? $product->getAsNewFromDate()->format('Y-m-d H:i:sP') : ''; $asNewTo = $product->getAsNewToDate() instanceof UDate ? $product->getAsNewToDate()->format('Y-m-d H:i:sP') : ''; $weight = trim($product->getWeight()); if ($product->getAttributeSet() instanceof ProductAttributeSet) { $attributeSetName = $product->getAttributeSet()->getName(); self::_log('-- attributeSetName ', __CLASS__ . '::' . __FUNCTION__ . " attributeSetName={$attributeSetName}", $preFix); } //RRP if (($rrp = $product->getRRP()) instanceof ProductPrice) { $rrpPrice = StringUtilsAbstract::getValueFromCurrency($rrp->getPrice()); } //special price if (($specialPriceObj = $product->getNearestSpecialPrice()) instanceof ProductPrice) { $specialPrice = StringUtilsAbstract::getValueFromCurrency($specialPriceObj->getPrice()); $specialPriceFromDate = $specialPriceObj->getStart()->format('Y-m-d H:i:sP'); $specialPriceToDate = $specialPriceObj->getEnd()->format('Y-m-d H:i:sP'); if ($specialPrice == 0) { $specialPrice = ''; $specialPriceFromDate = '1990-10-10'; $specialPriceToDate = '2009-10-10'; } } else { // delete the special price //$specialPrice = StringUtilsAbstract::getValueFromCurrency('99999999'); //$specialPrice = '9999999'; $specialPrice = ''; $specialPriceFromDate = '1990-10-10'; $specialPriceToDate = '2009-10-10'; } // if it is the daily promotion time then overwrite the special price with the daily special price $isDailyPromotionTime = intval(SystemSettings::getSettings(SystemSettings::TYP_ISDAILYPROMOTIONTIME)); if ($isDailyPromotionTime === 1) { // get daily promotion price if (($specialPriceObj = $product->getDailySpecialPrice()) instanceof ProductPrice) { $dailySpecialPrice = StringUtilsAbstract::getValueFromCurrency($specialPriceObj->getPrice()); if ($dailySpecialPrice != 0) { $specialPrice = $dailySpecialPrice; $specialPriceFromDate = $specialPriceObj->getStart()->format('Y-m-d H:i:sP'); $specialPriceToDate = $specialPriceObj->getEnd()->format('Y-m-d H:i:sP'); } } } // if it is the daily promotion time then overwrite the special price with the daily special price $isWeekendPromotionTime = intval(SystemSettings::getSettings(SystemSettings::TYP_ISWEEKENDPROMOTIONTIME)); if ($isWeekendPromotionTime === 1) { // get weekend promotion price if (($specialPriceObj = $product->getWeekendSpecialPrice()) instanceof ProductPrice) { $weekendSpecialPrice = StringUtilsAbstract::getValueFromCurrency($specialPriceObj->getPrice()); if ($weekendSpecialPrice != 0) { $specialPrice = $weekendSpecialPrice; $specialPriceFromDate = $specialPriceObj->getStart()->format('Y-m-d H:i:sP'); $specialPriceToDate = $specialPriceObj->getEnd()->format('Y-m-d H:i:sP'); } } } //full description if (($asset = Asset::getAsset($product->getFullDescAssetId())) instanceof Asset) { //$fullDecription = '"' . $asset->read() . '"'; $fullDecription = $asset->read(); } //supplier if (count($supplierCodes = SupplierCode::getAllByCriteria('productId = ?', array($product->getId()), true, 1, 1)) > 0) { $supplierName = ($supplier = $supplierCodes[0]->getSupplier()) instanceof Supplier ? $supplier->getName() : ''; $supplierCode = trim($supplierCodes[0]->getCode()); } //Manufacturer if ($product->getManufacturer() instanceof Manufacturer) { $manufacturerName = trim($product->getManufacturer()->getName()); } //disable or enabled if (intval($product->getActive()) === 0 || intval($product->getSellOnWeb()) === 0) { $enabled = false; } else { if ($product->getStatus() instanceof ProductStatus && intval($product->getStatus()->getId()) === ProductStatus::ID_DISABLED) { $enabled = false; } } //categories if (count($categories = Product_Category::getAllByCriteria('productId = ?', array($product->getId()))) > 0) { foreach ($categories as $category) { if (!$category->getCategory() instanceof ProductCategory || ($mageCateId = trim($category->getCategory()->getMageId())) === '') { continue; } if (trim($attributeSetName) === $attributeSetDefault && ($productAttributeSet = $category->getCategory()->getProductAttributeSet()) instanceof ProductAttributeSet) { $attributeSetName = trim($productAttributeSet->getName()); } $categoryIds[] = $mageCateId; } } //ProductStatus if ($product->getStatus() instanceof ProductStatus) { $statusId = $product->getStatus()->getName(); } } $categoryIds = array_unique($categoryIds); return array("store" => 'default', "websites" => 'base', "attribute_set" => $attributeSetName, "type" => 'simple', "category_ids" => implode(',', $categoryIds), "sku" => $sku, "name" => $productName, "price" => $rrpPrice, "special_from_date" => $specialPriceFromDate, "special_to_date" => $specialPriceToDate, "special_price" => $specialPrice, "news_from_date" => $asNewFrom, "news_to_date" => $asNewTo, "status" => intval($enabled) === 1 ? 1 : 2, "visibility" => 4, "tax_class_id" => 2, "description" => $fullDecription, "short_description" => $shortDescription, "supplier" => $supplierName, "man_code" => '', "sup_code" => $supplierCode, "meta_title" => '', "meta_description" => '', "manufacturer" => $manufacturerName, "url_key" => '', "url_path" => '', "custom_design" => '', "page_layout" => '', "country_of_manufacture" => '', "msrp_enabled" => '', "msrp_display_actual_price_type" => '', "meta_keyword" => '', "custom_layout_update" => '', "custom_design_from" => '', "custom_design_to" => '', "weight" => $weight, "msrp" => 'Use config', "gift_wrapping_price" => '', "qty" => 99, "min_qty" => 99, "use_config_min_qty" => 99, "is_qty_decimal" => '', "backorders" => '', "use_config_backorders" => '', "min_sale_qty" => '', "use_config_min_sale_qty" => '', "max_sale_qty" => '', "use_config_max_sale_qty" => '', "all_ln_stock" => $statusId, "is_in_stock" => 1, "low_stock_date" => '', "notify_stock_qty" => '', "use_config_notify_stock_qty" => '', "manage_stock" => '', "use_config_manage_stock" => '', "stock_status_changed_auto" => '', "use_config_qty_increments" => '', "qty_increments" => '', "use_config_enable_qty_inc" => '', "enable_qty_increments" => '', "is_decimal_divided" => '', "stock_status_changed_automatically" => '', "use_config_enable_qty_increments" => '', "image" => '', "small_image" => '', "thumbnail" => '', "media_gallery" => '', "is_recurring" => '', "media_gallery_reset" => 0); }
<?php class Product { private $name; private $productDate; public function __construct($name, $productDate) { $this->name = $name; $this->productDate = $productDate; } public function getName() { return $this->name; } public function getProductDate() { return $this->productDate; } } $kamaboko = new Product('かまぼこ', '2009/01/01'); $chikuwa = new Product('ちくわ', '2009/01/02'); $kamabokoName = $kamaboko->getName(); $kamabokoDate = $kamaboko->getProductDate(); $chikuwaName = $chikuwa->getName(); $chikuwaDate = $chikuwa->getProductDate(); print $kamabokoName . 'は' . $kamabokoDate . 'に製造されました<br>'; print $chikuwaName . 'は' . $chikuwaDate . 'に製造されました';
public function getName() { $this->__load(); return parent::getName(); }
$row[] = ''; } else { $row[] = LAZADA_ZALORA_DEFAULT_SALE_END_DATE; } //Name if ($jng_sp_id == '1001') { if ($category_top_id == '1') { if ($category_id == '29') { if ($a['length'] > 4.6 && $a['length'] < 6.0) { $row[] = ucwords(strtolower($sp_values_brand[$p->brand_id])) . ' ' . $product_old_function['pd'][3]['products_name'] . ' ' . $p->getColors($lid); } } else { $row[] = ucwords(strtolower($sp_values_brand[$p->brand_id])) . ' ' . $product_old_function['pd'][3]['products_name'] . ' ' . $p->getColors($lid); } } else { $row[] = ucwords(strtolower($sp_values_brand[$p->brand_id])) . ' ' . $p->getName($lid) . ' ' . $p->getColors($lid); } } else { if ($category_top_id == '1') { if ($category_id == '29') { if ($a['length'] > 4.6 && $a['length'] < 6.0) { $row[] = ucwords(strtolower($sp_values_brand[$p->brand_id])) . ' ' . $product_old_function['pd'][3]['products_name'] . ' ' . $p->getColors($lid); } } else { $row[] = ucwords(strtolower($sp_values_brand[$p->brand_id])) . ' ' . $product_old_function['pd'][3]['products_name'] . ' ' . $p->getColors($lid); } } else { $row[] = $p->getName($lid); } } $csv_data[] = $row;
public function completeOrder($tid) { $transaction = Transaction::getTransactionBasedOnTID($tid); $user = new User($transaction->getUser()); $order = new Order(); $order->setTid($transaction->getTid()); $order->setUser($transaction->getUser()); $order->setCustomerName($user->getName()); $order->setUserEmail($user->getEmail()); $order->setPhone($transaction->getPhone()); $order->setShippingStreet($transaction->getShippingStreet()); $order->setShippingCity($transaction->getShippingCity()); $order->setShippingPostal($transaction->getShippingPostal()); $order->setShippingProvince($transaction->getShippingProvince()); $order->setShippingCountry($transaction->getShippingCountry()); $order->setBillingStreet($transaction->getBillingStreet()); $order->setBillingCity($transaction->getBillingCity()); $order->setBillingPostal($transaction->getBillingPostal()); $order->setBillingProvince($transaction->getBillingProvince()); $order->setBillingCountry($transaction->getBillingCountry()); $order->setCostSubtotal($transaction->getCostSubtotal()); $order->setCostTax($transaction->getCostTax()); $order->setCostShipping($transaction->getCostShipping()); $order->setCostTotal($transaction->getCostTotal()); $order->setIp($transaction->getIp()); $order->setShippingClass($transaction->getShippingClass()); $order->setPaymentClass($transaction->getPaymentClass()); $order->setDeliveryInstructions($transaction->getDeliveryInstructions()); $order->setStatus('Pending'); $order->save(); $cartItems = CartItem::getAll($transaction->getSession()); foreach ($cartItems as $cartItem) { $product = new Product($cartItem->getProduct()); $orderDetail = new OrderDetail(); $orderDetail->setOrderNb($order->getId()); $orderDetail->setProduct($product->getId()); $orderDetail->setProductName($product->getName()); $orderDetail->setQuantity($cartItem->getQuantity()); $orderDetail->save(); $cartItem->delete(); } $transaction->delete(); //Send an email to the user $this->sendEmailOrderComplete($order->getId()); return true; }
<title>商品詳細</title> </head> <body> <table border="1"> <tr> <th>商品ID</th> <th>商品名</th> <th>価格</th> </tr> <tr> <td><?php echo $product->getId(); ?> </td> <td><?php echo $product->getName(); ?> </td> <td><?php echo $product->getPrice(); ?> </td> </tr> </table> <form method="post" action="cart_add.php"> <input type="submit" value="カートに追加"> <input type="hidden" name="id" value="<?php echo $product->getId(); ?> ">
public function testName() { $this->assertSame($this->entity, $this->entity->setName('Foo')); $this->assertSame('Foo', $this->entity->getName()); $this->assertSame('Foo', $this->entity->__toString()); }
$database = new Database('localhost', 'pdo_ret', 'root', ''); $sql = "select * from product;"; $result = $database->query($sql); foreach ($result as $row) { /* Create Product and generate row */ $productId = $row[0]; $name = $row[1]; $price = $row[3]; $product = new Product($productId, $name, $price); echo '<div class="col-md-3 col-sm-6"> <a class = "link" href =""> <div class="single-shop-product"> <div class="product-upper"> <img src="" alt=""> </div> <h2><a href="?controller=pages&action=singleproduct">' . $product->getName() . '</a></h2> <div class="product-carousel-price"> <ins>$' . $product->getPrice() . '</ins> </div> <div class="product-option-shop"> <form role="form" class="form" method="post" action="?controller=control&action=addtocart"> <input type="text" hidden="true" value="' . $product->getProductId() . '" name="productid"> <div style="display: inline;"> <label>Quantity</label> <input type="number" name="quantity" class="form-control"> </div> <div style="display: inline;"> <input type="submit" value="Add to cart" class="btn"> </form>
<?php require 'Product.php'; require 'ListOfProduct.php'; require 'ListOfProductArray.php'; // NOOOOPPPPPEEE $list = new ListOfProduct(); $bigList = $list->fetchAll(); foreach ($bigList as $product) { echo $product->getName() . '<br>'; } // FLYWEIGHT MAGUEULE $list = new ListOfProductArray(); $bigList = $list->fetchAll(); $product2 = new Product('', 0); foreach ($bigList as $v) { $product2->hydrate($v); echo $product2->getName() . '<br>'; }
require_once 'includes/ShoppingCart.php'; require_once 'includes/Product.php'; require_once 'includes/Customer.php'; session_start(); if (!isset($_SESSION['customer'])) { //todo fix $customer = new Customer(rand(1, 1000)); $sc = new ShoppingCart(rand(1, 1000)); $customer->setShoppingCart(rand(1, 1000)); $_SESSION['customer'] = serialize($customer); } $customer = unserialize($_SESSION['customer']); $product = new Product($_GET['product']); $product->setPrice($_GET['price']); $customer->getShoppingCart()->setProduct([$product->getName() => $product]); $_SESSION['customer'] = serialize($customer); ?> <html> <header> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <link rel="stylesheet" href="includes/css/prism.css"> <script src="includes/js/prism.js"></script> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> <title>CityAds implementation via third party services (Google Tag Manager, Shopify). Molanco Team</title> </header> <body>