コード例 #1
0
ファイル: home.php プロジェクト: Adam88Stanley/portfolio
 public function getproduct()
 {
     $http = new Http();
     if ($http->get('key1') == 0) {
         return;
     }
     $product = new \models\Product($http->get('key1'));
     $data['id'] = $http->get('key1');
     $data['name'] = $product->getName();
     $data['img'] = $product->getImage();
     $data['desc'] = $product->getDescription();
     $data['price'] = $product->getPrice();
     echo $this->render('quickview', $data);
 }
コード例 #2
0
<?php

$product = new \models\Product();
$products = $product->findAll();
?>

<div class="panel panel-default">
    <div class="panel-heading">All avaliable products</div>
    <div class="panel-body">
        <p>Table contain all products and description.</p>
    </div>
    <table class="table">
        <thead>
        <tr>
            <th>Name</th>
            <th>Discount</th>
            <th>Description</th>
            <th>Currency</th>
            <th>Price</th>
        </tr>
        </thead>
        <?php 
$table_products = '';
if ($products) {
    foreach ($products as $single_product) {
        $currency = $db->find(new \models\Currency(), ['id' => $single_product['currency_id']]);
        $pr_discount = $single_product['product_discount'] > 0 ? $single_product['product_discount'] . ' %' : 'None';
        $table_products .= '<tr>';
        $table_products .= '<td>' . $single_product['product_name'] . '</td>';
        $table_products .= '<td>' . $pr_discount . '</td>';
        $table_products .= '<td>' . $single_product['product_description'] . '</td>';