本文整理汇总了PHP中app\models\Product::GetProductByID方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::GetProductByID方法的具体用法?PHP Product::GetProductByID怎么用?PHP Product::GetProductByID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Product
的用法示例。
在下文中一共展示了Product::GetProductByID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: EditProduct
public function EditProduct($id)
{
$title = $_POST["productTitle"];
$description = $_POST["productDescription"];
$price = $_POST["productPrice"];
$hasModels = $_POST["productHasModels"];
$category = $_POST["productCategory"];
$subcategory = $_POST["subCategorySelect"];
if (Input::hasFile("product_picture")) {
$has_file = true;
$file = Input::file("product_picture");
$folder = '/images/';
$destinationPath = public_path() . $folder;
$filename = str_random(6) . '_' . $file->getClientOriginalName();
$img_path = $folder . $filename;
$uploadSuccess = $file->move($destinationPath, $filename);
$pd = Product::GetProductByID($id);
$img = $pd[0]->product_image;
if (File::exists(public_path() . $img)) {
File::delete(public_path() . $img);
}
} else {
$has_file = false;
$pd = Product::GetProductByID($id);
$img = $pd[0]->product_image;
$img_path = $img;
}
Product::EditProduct($id, $title, $description, $price, $category, $subcategory, $img_path, $hasModels);
return Redirect::to("admin/edit_product/" . $id);
}
示例2: ProcessBasketData
public function ProcessBasketData()
{
$products = array();
$ids = array();
$quantity = array();
foreach (Session::get("basketProducts") as $product) {
array_push($ids, $product[0]);
if (!isset($quantity[$product[0]][$product[1]])) {
$quantity[$product[0]][$product[1]] = 1;
} else {
$quantity[$product[0]][$product[1]]++;
}
}
//print_r(implode(", ", $ids));
if (count($ids) == 0) {
array_push($ids, -1);
}
//print_r($quantity);
//Session::flush();
$productList = array();
foreach ($quantity as $key => $item) {
foreach ($item as $key2 => $value) {
$prod = Product::GetProductByID($key);
if ($key2 == "-1") {
$key2 = "";
}
$prod[0]->model = $key2;
$prod[0]->quantity = $value;
if ($key2 != "") {
$prod[0]->product_name .= '(' . $key2 . ')';
}
$cat = Category::TranslateCategoryIndex($prod[0]->product_main_category);
$sub = Category::TranslateSubcategoryIndex($prod[0]->product_sub_category);
$prod[0]->product_main_category = $cat[0]->category_eng_name;
$prod[0]->product_sub_category = $sub[0]->sub_category_eng_name;
array_push($productList, $prod);
}
}
//$products = Product::GetProductsForBasket('(' . implode(", ", $ids) . ')');
//$data["quantity"] = $quantity;
$data["products"] = $productList;
return $data;
}