本文整理汇总了PHP中Product::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getName方法的具体用法?PHP Product::getName怎么用?PHP Product::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Product
的用法示例。
在下文中一共展示了Product::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remFromBasket
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!');
}
}
示例2: productAddStore
/**
* 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!";
}
}
示例3: test_initialization
public function test_initialization()
{
$product = new Product();
$this->assertEqual($product->getId(), 0);
$this->assertEqual($product->getName(), '');
$this->assertEqual($product->getCreated(), '');
$this->assertEqual($product->getUpdated(), '');
}
示例4: modify
/**
* 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;
}
示例5: create
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;
}
示例6: create
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;
}
}
示例7: cmpTitle
/**
* 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);
}
示例8: getName
public function getName()
{
//return parent::productName;
return parent::getName() . '_NEW';
}
示例9: addItem
public function addItem(Product $product, $quantity)
{
$this->items[] = new OrderItem($product->getName(), $quantity, $product->getPrice());
}
示例10: unBuy
/**
* Give back a buyable product
* @param Produit $p
* @return Cart
*/
public function unBuy(Product $p)
{
$this->getStockage->delete($p->getName());
return $this;
}
示例11:
$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>';
示例12: getMatahariCatalogCellValue
/**
* 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 = '';
//.........这里部分代码省略.........
示例13: _getRowWithDefaultValues
/**
* 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
//.........这里部分代码省略.........
示例14: __construct
<?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 . 'に製造されました';
示例15: getName
public function getName()
{
$this->__load();
return parent::getName();
}