Esempio n. 1
0
 function updateInvoiceItem($id, $quantity, $product_id, $tax_id, $description, $attr1 = "", $attr2 = "", $attr3 = "", $unit_price = "")
 {
     $attr1 = explode("-", $attr1);
     $attr1 = $attr1[2];
     //echo "Attr1: ".$attr1." ";
     $attr2 = explode("-", $attr2);
     $attr2 = $attr2[2];
     //echo "Attr2 : ".$attr2." ";
     $attr3 = explode("-", $attr3);
     $attr3 = $attr3[2];
     //echo "Attr3 : ".$attr3;
     //echo "<br /><br />";
     $product = getProduct($product_id);
     $unit_price == "" ? $product_unit_price = $product['unit_price'] : ($product_unit_price = $unit_price);
     $tax = getTaxRate($tax_id);
     $total_invoice_item_tax = $product_unit_price * $tax['tax_percentage'] / 100;
     //:100?
     $tax_amount = $total_invoice_item_tax * $quantity;
     $total_invoice_item = $total_invoice_item_tax + $product_unit_price;
     $total = $total_invoice_item * $quantity;
     $gross_total = $product_unit_price * $quantity;
     if ($db_server == 'mysql' && !_invoice_items_check_fk(null, $product_id, $tax_id, 'update')) {
         return null;
     }
     $sql = "UPDATE " . TB_PREFIX . "invoice_items \r\n\t\tSET quantity =  :quantity,\r\n\t\tproduct_id = :product_id,\r\n\t\tunit_price = :unit_price,\r\n\t\ttax_id = :tax_id,\r\n\t\ttax = :tax,\r\n\t\ttax_amount = :tax_amount,\r\n\t\tgross_total = :gross_total,\r\n\t\tdescription = :description,\r\n\t\ttotal = :total,\t\t\t\r\n\t\tattribute_1 = :attr1,\t\t\t\r\n\t\tattribute_2 = :attr2,\t\t\t\r\n\t\tattribute_3 = :attr3\t\t\t\r\n\t\tWHERE id = :id";
     //echo $sql;
     return dbQuery($sql, ':quantity', $quantity, ':product_id', $product_id, ':unit_price', $product_unit_price, ':tax_id', $tax_id, ':tax', $tax[tax_percentage], ':tax_amount', $tax_amount, ':gross_total', $gross_total, ':description', $description, ':total', $total, ':id', $id, ':attr1', $attr1, ':attr2', $attr2, ':attr3', $attr3);
 }
Esempio n. 2
0
    public static function genCartMenuHtml($cartProds)
    {
        $retStr = "";
        foreach ($cartProds as $cartProd) {
            $prod = getProduct($cartProd[prodNo]);
            $retStr .= '
					<li>
						<label>' . $prod[prodName] . '</label>
						<span>' . $cartProd[actualPrice] . '</span>
					</li>';
        }
        return $retStr;
    }
Esempio n. 3
0
function addOrderToSession($productid, $ingredients)
{
    $product = getProduct($productid);
    if ($product == null) {
        return;
    }
    if ($product['price'] == 0 && (count($ingredients) == 0 || @trim($ingredients[0]) == '')) {
        global $lang;
        echo $lang->get('without_ingredients_not_addable');
        return;
    }
    // Check if the same product is already in the cart
    $allreadythere = -1;
    if (isset($_SESSION['catering'])) {
        for ($i = 0; $i < count($_SESSION['catering']['order']['products']); $i++) {
            // Check if the product is the same
            if ($_SESSION['catering']['order']['products'][$i]['productid'] == $productid) {
                // If it has ingredients
                if (count($ingredients) > 0 && $ingredients[0] != "") {
                    // Compare the number of ingredients
                    if (count($_SESSION['catering']['order']['products'][$i]['ingredients']) == count($ingredients)) {
                        $allreadythere = $i;
                        foreach ($ingredients as $ingredient) {
                            if (!in_array($ingredient, $_SESSION['catering']['order']['products'][$i]['ingredients'])) {
                                $allreadythere = -1;
                            }
                        }
                        if ($allreadythere != -1) {
                            break 1;
                        }
                    }
                } else {
                    $allreadythere = $i;
                }
            }
        }
    }
    if ($allreadythere != -1) {
        updateOrderQuantityInSession($allreadythere, $_SESSION['catering']['order']['products'][$allreadythere]['quantity'] + 1);
    } else {
        $newproduct = array();
        $newproduct['productid'] = $productid;
        if (count($ingredients) != 0 && $ingredients[0] != "") {
            $newproduct['ingredients'] = $ingredients;
        }
        $newproduct['quantity'] = 1;
        $_SESSION['catering']['order']['products'][] = $newproduct;
    }
}
Esempio n. 4
0
<?php

require_once './Popo/Produkt.php';
require_once './Popo/Kommentar.php';
require_once './dbconnection.php';
//$produktid = $_GET['produktID'];
$conn = establishConnection();
$produkt = getProduct($_GET['produktID']);
if (isset($_POST['menge'])) {
    $produkt->setMenge($_POST['menge']);
    if (!isset($_SESSION['bestellung'])) {
        $_SESSION['bestellung'] = array($produkt);
    } else {
        $_SESSION['bestellung'][] = $produkt;
    }
    echo "<script type='text/javascript'> alert('Der Warenkorb wurde erfolgreich befüllt! \\nUm ihre Produkte anzuzeigen, sehen sie im Warenkorb nach') </script>";
}
if (isset($_POST['kommentar'])) {
    insertKommentar($_GET['produktID'], $_POST['kommentar']);
}
$kommis = getKommentare($_GET['produktID']);
?>

<div class="container">
    <h1>Detailansicht</h1>
    <table class="table table-bordered">
        <tbody>
        <tr>
            <td><h3> Name </h3></td>
            <td> <?php 
echo $produkt->getName();
function getCategory($id, $privilege)
{
    // the ID of the category that has been selected as a part of the q argument, make sure that one is seleted in the dropdown that is returned
    //if privilege is = COMM, return one thing, if not, return the other
    //the id is the value of the select/option
    //get the product for each iteration for the selected category
    //Return an array of products
    //These products can then be passed to the processMethod
    //which then selects the appropriate support method to
    //display the products
    $db = connect(0, 0, 0);
    $result_cat = $db->query('select category_id, name, description from CATEGORY where category_id = ' . $id);
    $row = $result_cat->fetch_assoc();
    $a = array('selector' => '#category', 'content' => array('category_id' => $row['category_id'], 'name' => $row['name'], 'description' => $row['description']));
    if ($privilege == 'COMM') {
        //echo "</p>Making it ehre</a>" ;
        if ($id == 0) {
            $result_products = $db->query('select * from PRODUCT');
        } else {
            $result_products = $db->query('select product_id from PRODUCT where category_id = ' . $id);
        }
        $num_results = $result_products->num_rows;
        $b = array();
        for ($i = 0; $i < $num_results; $i++) {
            //echo "<p>Getting a product</p>";
            $row = $result_products->fetch_assoc();
            $j = $row['product_id'];
            $b[$i] = getProduct(intval($j), 'SYSTEM');
            $a['content']['product'][] = $b[$i]->toAssocArray();
            //echo "<p>Fetched products : ".$i."</p>";
        }
        echo json_encode($a);
    } elseif ($privilege == 'ADMIN') {
    } else {
        echo "RETRIEVAL_ERROR";
    }
}
Esempio n. 6
0
																	<?php 
    while ($row = mysql_fetch_array($result_prj)) {
        ?>
                                                                    <tr <?php 
        if ($sno % 2 == 1) {
            ?>
 bgcolor="#F5F2F1" <?php 
        }
        ?>
>
                                                                        <td align="center" class="tableText"><?php 
        echo $sno;
        ?>
</td>
                                                                        <td align="center" class="tableText"><?php 
        echo getProduct('ProductName', 'rec_id', getCount("ProductId", "rec_id", $row["CountId"]));
        ?>
</td>
                                                                        <td align="center" class="tableText"><?php 
        echo getCount("Count", "rec_id", $row["CountId"]);
        ?>
</td>
                                                                        <td align="center" class="tableText"><?php 
        echo $row['StockInKgs'];
        ?>
&nbsp;Kg</td>
                                                                        <td align="center" class="tableText"><?php 
        echo $row['StockInBale'];
        ?>
&nbsp;Bale</td>
                                                                        <td align="center" class="tableText"><?php 
Esempio n. 7
0
function isMinqteSupQte($ref)
{
    $produit = getProduct($ref);
    if ($produit['qte_min'] >= $produit['qte']) {
        return true;
    } else {
        return false;
    }
}
?>
</td>
                                                                    <td align="center"><?php 
echo getBuyer('BuyerName', 'rec_id', getDispatchNumber("BuyerId", "rec_id", $row['DispatchNumberId']));
?>
</td>
                                                                    <td align="center"><?php 
echo $row['Port'];
?>
</td>
                                                                    <td align="center"><?php 
echo getCountry(getBuyer('CountryId', 'rec_id', $row['BuyerId']));
?>
</td>
                                                                    <td align="center"><?php 
echo getProduct("ProductName", "rec_id", $row['ProductId']);
?>
</td>
                                                                    <td align="center"><?php 
echo $row['Quantity'];
?>
</td>
                                                                    <td align="center"><?php 
echo $row['Price'];
?>
</td>
                                                                   	<?
																	$sql_doc = "select * from ".$mysql_adm_table_prefix."document_master where DocumentFor='Export'";
																	$result_doc = mysql_query($sql_doc) or die("Error in Query :".$sql_doc."<br>".mysql_error().":".mysql_errno());
																	
																	if(mysql_num_rows($result_doc)>0)
																$prdid = $_POST["txt_product"];
                                                            ?>
                                                            
                                                            
                                                            <table align="center" width="100%" border="0" class="border">
                                                                <tr>
                                                                	<td colspan="10" class="gredBg">
                                                                    	REPORT SUMMARY AS ON <?php 
echo $Date;
?>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                	<td width="22%" rowspan="3"  class="gredBg">
																		<?php 
echo getProduct("ProductName", "rec_id", $prdid);
?>
																	</td>
                                                                  <td width="8%" rowspan="3" class="gredBg">
																		Lot Number																  </td>
                                                                  <td colspan="2" class="gredBg">
                                                               	  Op. Stock                                                                    </td>
                                                                    <td colspan="2" class="gredBg">
                                                               	  Received                                                                    </td>
                                                                    <td colspan="2" class="gredBg">
                                                               	  Issued/Mixing                                                                    </td>
                                                                    <td colspan="2" class="gredBg">
                                                                    	Closing Stock                                                                    </td>
                                                              </tr>
                                                                <tr>
                                                                	<td width="9%" class="gredBg">
Esempio n. 10
0
<?php

require_once __DIR__ . '/vendor/autoload.php';
use Src\Controller\AtlasController;
define('CALLED_FROM_FUNCTIONS', true);
// Routing Rules
if (!isset($_GET['action'])) {
    echo json_encode(['error' => 'Action is missing in request parameter!']);
    return;
}
switch ($_GET['action']) {
    case 'listAll':
        ListAll();
        break;
    case 'detail':
        getProduct();
        break;
    default:
        ListAll();
}
function ListAll()
{
    $atlasController = new AtlasController();
    $atlasController->index();
}
function getProduct()
{
    $productId = $_GET['product-id'];
    $atlasController = new AtlasController();
    $atlasController->detail($productId);
}
Esempio n. 11
0
    require '../scraperwiki-php/scraperwiki.php';
    require '../scraperwiki-php/scraperwiki/simple_html_dom.php';
} else {
    require 'scraperwiki.php';
    require 'scraperwiki/simple_html_dom.php';
}
//
// // Read in a page
echo "Opening prodlist.csv for reading...\n";
if (($f = fopen("./prodlist.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($f)) !== FALSE) {
        echo "Retrieving " . $data[0] . "\n";
        $produrl = $data[3];
        $prodtype = $data[1];
        $prodcat = $data[2];
        if (!getProduct($produrl, $prodtype, $prodcat)) {
            fputcsv($e, $data);
        }
    }
    fclose($f);
}
fclose($o);
fclose($r);
fclose($i);
fclose($e);
// parse the categories and save to database
/** database columns:
sku
_store
_attribute_set
_type
Esempio n. 12
0
$invoiceItems = $invoiceobj->getInvoiceItems($master_invoice_id);
//var_dump($invoiceItems);
$customers = getActiveCustomers();
$preference = getPreference($invoice['preference_id']);
$billers = getActiveBillers();
//$taxes = getActiveTaxes(); <--- look into this
$defaults = getSystemDefaults();
$taxes = getTaxes();
$preferences = getActivePreferences();
$products = getActiveProducts();
for ($i = 1; $i <= 4; $i++) {
    $customFields[$i] = show_custom_field("invoice_cf{$i}", $invoice["custom_field{$i}"], "write", '', "details_screen", '', '', '');
}
foreach ($invoiceItems as $key => $value) {
    //get list of attributes
    $prod = getProduct($value['product_id']);
    $json_att = json_decode($prod['attribute']);
    if ($json_att !== null) {
        $html = "<tr id='json_html" . $key . "'><td></td><td colspan='5'><table><tr>";
        foreach ($json_att as $k => $v) {
            if ($v == 'true') {
                $attr_name_sql = sprintf('select 
                    a.name as name, a.enabled as enabled,  t.name type 
                    from 
                        si_products_attributes as a, 
                        si_products_attribute_type as t 
                   where 
                        a.type_id = t.id
                        AND a.id = %d', $k);
                $attr_name = dbQuery($attr_name_sql);
                $attr_name = $attr_name->fetch();
Esempio n. 13
0
<?php

//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();
#get the invoice id
$product_id = $_GET['id'];
$product = getProduct($product_id);
#get custom field labels
$customFieldLabel = getCustomFieldLabels();
$pageActive = "products";
$smarty->assign('pageActive', $pageActive);
$smarty->assign('product', $product);
$smarty->assign('customFieldLabel', $customFieldLabel);
$sql = "select * from " . TB_PREFIX . "products_attributes";
$sth = dbQuery($sql);
$attributes = $sth->fetchAll();
$smarty->assign("attributes", $attributes);
$sql_matrix = "select * from " . TB_PREFIX . "products_matrix where product_id = {$product_id} order by id";
$sth_matrix = dbQuery($sql_matrix);
$matrix = $sth_matrix->fetchAll();
$smarty->assign("matrix", $matrix);
$sql_matrix1 = "select * from " . TB_PREFIX . "products_matrix where product_id = {$product_id} and product_attribute_number = 1 ";
$sth_matrix1 = dbQuery($sql_matrix1);
$matrix1 = $sth_matrix1->fetch();
$smarty->assign("matrix1", $matrix1);
$sql_matrix2 = "select * from " . TB_PREFIX . "products_matrix where product_id = {$product_id} and product_attribute_number = 2 ";
$sth_matrix2 = dbQuery($sql_matrix2);
$matrix2 = $sth_matrix2->fetch();
$smarty->assign("matrix2", $matrix2);
$sql_matrix3 = "select * from " . TB_PREFIX . "products_matrix where product_id = {$product_id} and product_attribute_number = 3 ";
$sth_matrix3 = dbQuery($sql_matrix3);
$condlimit = $opi_limit != false && $opi_limit != NULL;
if (is_true_array($products)) {
    foreach ($products as $key => $p) {
        ?>

    <?php 
        if (is_array($p) && $p['id']) {
            ?>
        <?php 
            $pArray = $p;
            ?>
        <?php 
            $variants = array();
            ?>
        <?php 
            $p = getProduct($p['id']);
            ?>
        <?php 
            $p->firstVariant = getVariant($pArray['id'], $pArray['variant_id']);
            ?>
        <?php 
            $variants[] = $p->firstVariant;
            ?>
    <?php 
        } else {
            ?>
        <?php 
            $variants = $p->getProductVariants();
            ?>
    <?php 
        }
Esempio n. 15
0
$data = array("sku", "review_title", "rating", "reviewer", "reviewer_loc", "review_date", "review_detail");
fputcsv($r, $data);
if ($local) {
    require '../scraperwiki-php/scraperwiki.php';
    require '../scraperwiki-php/scraperwiki/simple_html_dom.php';
} else {
    require 'scraperwiki.php';
    require 'scraperwiki/simple_html_dom.php';
}
//
// // Read in a page
echo "Opening prodlist.csv for reading...\n";
if (($f = fopen("./uniqprod.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($f)) !== FALSE) {
        $produrl = $baseurl . $data[3];
        if (!getProduct($produrl)) {
            fputcsv($e, array($data[0], $data[1], $data[2], $data[3]));
        }
    }
    fclose($f);
}
fclose($o);
fclose($r);
fclose($i);
fclose($e);
// parse the categories and save to database
/** database columns:
sku
_store
_attribute_set
_type
Esempio n. 16
0
function subContent($code, $id, $kod, $pp_kod)
{
    if ($kod == 1) {
        ?>
      <div class="col-md-12">
        <?php 
        getProduct($id, $pp_kod);
        ?>
      </div>
      <div class="col-md-12">&nbsp;</div>
      <div class="col-md-12">
        <button class="btn btn-primary" onclick="content('<?php 
        echo $code;
        ?>
')"><i class="fa fa-arrow-left"></i> Back</button>
        <button class="btn btn-primary" onclick="subContent(2,'<?php 
        echo $pp_kod;
        ?>
')">Next <i class="fa fa-arrow-right"></i></a>
      </div>
    <?php 
    } elseif ($kod == 2) {
        $query = "SELECT pp_ref_no,pp_nama_brand,pp_nama_generic,pp_nama FROM p_product WHERE pp_kod='{$pp_kod}'";
        $result = selQuery($query);
        $row = mysqli_fetch_assoc($result);
        ?>
    <div class="col-md-12">
      <div class="row">
        <div class="alert alert-sm alert-border-left alert-primary"><b>Product Information</b></div>
        <div class="col-md-6">
        <?php 
        if ($id == 2) {
            ?>
        <b>Call No : </b>
        <p><?php 
            echo isEmpty($pp_kod);
            ?>
</p>
        <?php 
        } else {
            ?>
        <b>Reference No : </b>
        <p><?php 
            echo isEmpty($row['pp_ref_no']);
            ?>
</p>
        <?php 
        }
        ?>
        <input type="hidden" id="pp_kod" value="<?php 
        echo $pp_kod;
        ?>
" />
        </div>
        <div class="col-md-6">
        <b>Brand Name : </b>
        <p><?php 
        echo isEmpty($row["pp_nama_brand"]);
        ?>
</p>
        </div>
        <div class="col-md-6">
        <b>Generic Name : </b>
        <p><?php 
        echo isEmpty($row["pp_nama_generic"]);
        ?>
</p>
        </div>
        <div class="col-md-6">
        <b>Full product name : </b>
        <p><?php 
        echo isEmpty($row["pp_nama"]);
        ?>
</p>
        </div>
      </div>
      <div class="row">
        <div class="section-divider"></div>
      </div>
    </div>
      <?php 
        if ($id == 2 || $id == 5 || $id == 6) {
            ?>
      <div class="col-md-12">
      <?php 
            getValidList($id, $pp_kod);
            ?>
      </div>
      <?php 
        } else {
            ?>
      <div class="col-md-12">
        <?php 
            distributedList($id, $pp_kod);
            ?>
      </div>
      <?php 
        }
        ?>
      <div class="col-md-12">
        <?php 
        documentList($id, $pp_kod);
        ?>
      </div>
      <div class="col-md-12">
        <?php 
        analysisProtocol($id, $pp_kod);
        ?>
      </div>
      <div class="col-md-12">
        <?php 
        sectionS($id, $pp_kod);
        ?>
      </div>
      <div class="col-md-12">
        <?php 
        coaProduct($id, $pp_kod);
        ?>
      </div>
      <?php 
        if ($id == 2 || $id == 5 || $id == 6) {
            ?>
      <div class="col-md-12">
        <?php 
            distributedList($id, $pp_kod);
            ?>
      </div>
      <?php 
        }
        ?>
      <div class="col-md-12">
        <?php 
        officerWork($id, $pp_kod);
        ?>
      </div>
      <div class="col-md-12">&nbsp;</div>
      <div class="col-md-12">
        <button class="btn btn-primary" onclick="subContent(1,'<?php 
        echo $pp_kod;
        ?>
')"><i class="fa fa-arrow-left"></i> Back</button>
        <?php 
        if ($id != 2) {
            ?>
        <button class="btn btn-primary" onclick="chronology(0,'<?php 
            echo $pp_kod;
            ?>
')"><i class="fa fa-sort-alpha-asc"></i> Chronology</button>
        <?php 
        }
        if ($id == 2) {
            ?>
        <label id="screenBtn" <?php 
            if (screening($pp_kod) == "false") {
                echo "style='display:none;'";
            } else {
                echo "";
            }
            ?>
>
          <button class="btn btn-primary" onclick="approveScreen('<?php 
            echo $pp_kod;
            ?>
','<?php 
            echo $code;
            ?>
')"><i class="fa fa-check"></i> Approve</button>
          <button class="btn btn-primary" onclick="rejectScreen('<?php 
            echo $pp_kod;
            ?>
','<?php 
            echo $code;
            ?>
')"><i class="fa fa-times"></i> Reject</button>
        </label>
        <?php 
        } elseif ($id == 5 || $id == 6) {
            ?>
        <button class="btn btn-primary" onclick="sendLab('<?php 
            echo $pp_kod;
            ?>
','<?php 
            echo $code;
            ?>
')"><i class="fa fa-send"></i> Send to Lab</button>
        <?php 
        } elseif ($id == 8 or evaluate($pp_kod) == 2) {
            ?>
        <button class="btn btn-primary" id="assignPhar" onclick="assignPharma('<?php 
            echo $code;
            ?>
','<?php 
            echo $pp_kod;
            ?>
')"><i class="fa fa-undo"></i> Send Back to Pharmacist</button>
        <button class="btn btn-primary" onclick="approveEvaluate('<?php 
            echo $pp_kod;
            ?>
','<?php 
            echo $_SESSION['ru_kod'];
            ?>
','<?php 
            echo $code;
            ?>
')"><i class="fa fa-check"></i> Approve</button>
        <?php 
        } elseif (evaluate($pp_kod) == 1) {
            ?>
        <button class="btn btn-primary" id="assignPhar" onclick="assignPharma('<?php 
            echo $code;
            ?>
','<?php 
            echo $pp_kod;
            ?>
')"><i class="fa fa-check-square-o"></i> Send to Pharmacist</button>
        <?php 
        } elseif (evaluate($pp_kod) == 0) {
            ?>
        <label id="evaluateButton"><?php 
            echo evaluation($pp_kod);
            ?>
</label>
        <?php 
        }
        ?>
      </div>
    <?php 
    }
}
Esempio n. 17
0
        }
        $content .= '
        <h3>URL Not working</h3>
        Found an URL that doesn\'t work? Please submit it using the form below and one of our representatives will review the submission as fast as possible.<br>
        <form method="post">
        URL:<input type="text" name="url-bad" value="" /><br>
        Captcha: <input name="captcha" type="text">
        <img src="captcha.php" /><br>
        <input type="submit" name="submit" value="Submit" />
        </form>

        <h3>General Contact Form</h3>
        Our general contact form is temporarily disabled due to technical difficulties. Please come back later.';
        $title = 'Contact Page';
        break;
    case 'about':
        $content = 'Super Secure Company (SSC) LLC is a multi-million dollar company founded in 1937 which delivers extremly good products for nice people in over 137 countries. Last year SSC LLC became the largest provider of awesome goods in the world, with over 133.337.456 products sold world wide. Some our pretty amazing products: <br><br>';
        $title = 'About us';
        break;
    case '':
    default:
        $title = 'Super Secure Company LLC';
        $content = 'Super Secure Company (SSC) LLC is a multi-million dollar company founded in 1937 which delivers extremly good products for nice people in over 137 countries. Last year SSC LLC became the largest provider of awesome goods in the world, with over 133.337.456 products sold world wide. Some our pretty amazing products: <br><br>';
        foreach ($products as $prod) {
            $content .= getProduct($prod);
            //todo replace below links
            $content .= '<br><a href="mailto:your-friend@gmail.com?body=' . urlencode('Nice product http://10.13.37.13/?page=product&prod=' . $prod) . '">Send Mail to a Friend</a> | <a href="http://10.13.37.13/?page=print&load_template=1&url=' . base64_encode('http://10.13.37.13/?page=product&prod=' . $prod) . '">Details</a>';
        }
        break;
}
echo showContent($title, $content);
function AddToCartAndUpdateTotals()
{
    global $woocommerce;
    $product_id = $_POST["product_id"];
    $woocommerce->cart->add_to_cart($product_id, $_POST["quantity"]);
    $return["product_name"] = getProduct($product_id)->get_title();
    $return["total_incart"] = $woocommerce->cart->get_cart_total();
    $return["total_items"] = $woocommerce->cart->get_cart_contents_count();
    $return["cart_menu"] = updateCartSubmenu();
    echo json_encode($return);
}
Esempio n. 19
0
            $product['id'] = $id;
            $product['description'] = $description;
            $product['production'] = $production;
            $product['expiration'] = $expiration;
            $product['price'] = $price;
            $product['amount'] = $amount;
            return $product;
            // echo "<tr>\n<td>$description</td>\n<td>".date("d/m/Y",strtotime($production))."</td>\n<td>".$date->format('d/m/Y')."</td>\n<td>R$ $price</td>\n<td>$amount</td>\n<td><a class=\"link_ajax\" href=\"edit?id=$id\">Editar</a></td>\n</tr>";
        }
        $stmt->close();
        $conn->close();
    } else {
        echo "Falha na conexão: " . $conn->error;
    }
}
$product = getProduct($_SESSION['id'], $_GET['id']);
?>
<div class="col-md-4 col-md-offset-4">
    <a class="btn btn-primary link_ajax" href="products.php">Voltar</a>
    <h1>Editar produto</h1>
    <form id="formAjax" action="../../controllers/editProduct.php" method="post">
        <input type="hidden" name="prod_id" value="<?php 
echo $product['id'];
?>
">
        <div class="form-group" id="">
            <label for="InputDesc">Descrição do Produto</label>
            <input type="text" class="form-control" id="InputDesc" maxlength="255" name="description" value="<?php 
echo $product['description'];
?>
">
Esempio n. 20
0
<?php

require_once 'config.php';
require_once 'sample-data/category.php';
require_once 'product_model.php';
$productEntityID = $_GET['entity_id'];
$product = getProduct($productEntityID);
$categories = mainCategory($DB);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Web Shop App</title>
</head>
<body>
<div class="product-listing">
    <?php 
if ($categories) {
    ?>
        <div class="category-menu">
            <ul>
                <?php 
    foreach ($categories as $category) {
        ?>
                    <li> <!-- echo entity id da ga upiše u url -->
                        <a href="category_page.php?entity_id=<?php 
        echo $category['entity_id'];
        ?>
"><?php 
        echo $category['name'];
<meta charset="utf-8">

<?php 
require_once 'src/helper.php';
require_once 'src/action.php';
function getProduct($time = 0)
{
    $id = rand(100000000, 10000000000);
    $product = new stdClass();
    $product->id = $id;
    $product->title = 'title' . $id;
    $product->price = 20000;
    $product->url = 'http://chotot.vn/';
    $product->location = 'Saigon';
    $product->thumbnail = 'http://static.chotot.com.vn/listing_thumbs/10/do-chuyen-dung-giong-nuoi-trong-may-pha-ca-phe-promac-hai-group-1068914457.jpg';
    $product->created_at = $time ? $time : time() + 20;
    return $product;
}
var_dump(getProduct());
for ($i = 0; $i < 2; $i++) {
    $productModel->insertProduct(getProduct(time() + 20));
}
//parseAllProducts($url);
Esempio n. 22
0
<?php

// initialize
include_once '../../../common/init.php';
if (!isLoggedInAdmin()) {
    redirect('');
} else {
    // include needed database functions
    include_once $BASE_PATH . 'database/products.php';
    $id = $_GET['id'];
    // fetch data
    $product = getProduct($id);
    // send data to smarty
    $smarty->assign('product', $product);
    // display smarty template
    $smarty->display('manager/products/view_product.tpl');
}
Esempio n. 23
0
    <body>
    <center>
        <?php 
require_once '../includes/session-start.req-inc.php';
require_once '../functions/cart-functions.php';
require_once '../functions/dbconnect.php';
require_once '../functions/util.php';
require_once '../functions/category-functions.php';
require_once '../functions/products-functions.php';
$action = filter_input(INPUT_POST, 'action');
if ($action == 'Empty cart') {
    emptyCart();
}
startCart();
$total = 0;
$checkoutProducts = array();
$items = getCart();
foreach ($items as $id) {
    $checkoutProducts[] = getProduct($id);
}
include '../includes/checkout.html.php';
?>
        
         <form action="#" method="post">
        <a href="index.php">Go Back</a>
        <input type="submit" name="action" value="Empty cart">
        </form>
    </center>
    </body>
</html>
Esempio n. 24
0
        ?>
 class="text_1">
                                                                    <td align="center"><?php 
        echo $sno;
        ?>
</td>
                                                                    <td align="center"><?php 
        echo getDispatchNumber('DispatchNumber', 'rec_id', $row['DispatchNumberId']);
        ?>
</td>
                                                                    <td align="center"><?php 
        echo getPINumber('PiNumber', 'rec_id', $row['PiId']);
        ?>
</td>
                                                                    <td align="center"><?php 
        echo getProduct('ProductName', 'rec_id', $row['ProductId']);
        ?>
</td>
                                                                    <td align="center"><?php 
        echo getCount('Count', 'rec_id', $row['CountId']);
        ?>
</td>
                                                                    <td align="center"><?php 
        echo $row['Quantity'];
        ?>
</td>
                                                                    <td align="center"><?php 
        echo $row['NowOfferedQty'];
        ?>
</td>
                                                                    <td align="center">
Esempio n. 25
0
                    <td align="center" style="border-bottom:#000000 solid 1px;"><span class="print_text">AMOUNT (Rs.)</span></td>
                </tr>
		<?
            $sql_detail = "select * from ".$mysql_adm_table_prefix."pi_detail where PiId = '$rec_id'"; 
            $result_detail = mysql_query($sql_detail) or die("Error in Query : ".$sql_detail."<br/>".mysql_error()."<br/>".mysql_errno());
            $i = 1;
			$total_qty = 0;
			$total_amount = 0;
			$no_pck = 0;
            while($row_detail = mysql_fetch_array($result_detail))
            {
        
        ?>                
                <tr style="vertical-align:top">
                	<td align="center" style="border-right:#000000 solid 1px;"><span class="print_text"><?=$i?></span></td>
                    <td class="print_text" style="border-right:#000000 solid 1px;"><?=getCount('Count','rec_id',$row_detail['CountId'])?>&nbsp;<?=getProduct('ProductName','rec_id',$row_detail['ProductId'])?></td>
                    <td align="center" style="border-right:#000000 solid 1px;"><span class="print_text"><?=$no_pck?>&nbsp;</span></td>
                    <td align="center" style="border-right:#000000 solid 1px;"><span class="print_text"><?=$row_detail['Quantity']?></span></td>
                    <td align="right" style="border-right:#000000 solid 1px;padding-right:5px;"><span class="print_text"><?=$row_detail['Price']?></span></td>
                    <td align="right" style="padding-right:5px;"><span class="print_text"><? $amount = round($row_detail['Quantity']*$row_detail['Price']);echo $amount;?></span></td>
                </tr>
		<?
            $i++;
			$total_qty = $total_qty+$row_detail['Quantity'];
			$total_amount = $total_amount+$amount;
            }
        ?>                
                <tr style="height:30px;">
                	<td class="print_text" style="border-right:#000000 solid 1px;padding-top:10px;">&nbsp;</td>
                    <td align="right" style="border-right:#000000 solid 1px;padding-right:5px;padding-top:10px;"><span class="print_text"><b>Total</b></span></td>
                    <td align="center" style="border-right:#000000 solid 1px;padding-top:10px;"><span class="print_text"><?=$no_pck?></span>&nbsp;</td>
chdir("../../common");
require_once "init.php";
chdir("../database");
require_once "storeFrontend.php";
// Get data
$storeId = intval($_GET["storeId"]);
$userId = $_SESSION['storesLogin'][$storeId]['userId'];
$address = $_GET["address"];
setUserAddress($userId, $address);
$cart = $_SESSION['storesLogin'][$storeId]['cart'];
// Create order
$orderId = newOrder($userId);
$total = 0;
foreach ($cart as $item) {
    $productId = $item["id"];
    $quantity = $item["qt"];
    $baseCost = getProduct($productId);
    $baseCost = $baseCost["price"];
    $total += $quantity * $baseCost;
    addProductToOrder($orderId, $productId, $quantity, $baseCost);
}
// Create an invoice
$code = substr(str_shuffle(md5(time())), 0, 10);
$store = getStoreById($storeId);
$domain = $store[0]["domain"];
$vat = $store[0]["vat"];
$total *= 1 + $vat;
$id = createInvoice($code, $total, $vat, $orderId);
// Clear cart
$_SESSION['storesLogin'][$storeId]['cart'] = array();
header("Location: ../../pages/store/invoice.php?orderId=" . $orderId);
        <b>Agent Seal No.</b>&nbsp;<?php 
echo $agent_seal_no;
?>
      
        <br/>
    </td>
    <td valign="top"><b><?php 
echo $no_pkg;
?>
</b> STANDARD EXPORT SEAWORTHY PALLENTS&nbsp;</td>
    <td valign="top" style="border-right:#000000 solid thin;" class="print_text">
	<?php 
echo getCount('Count', 'rec_id', $row_detail['CountId']);
?>
&nbsp;<?php 
echo getProduct('ProductName', 'rec_id', $row_detail['ProductId']);
?>
<br/><br/>
    <b>H.S. CODE :</b> <?php 
echo $hs_code;
?>
    </td>
    <td valign="top" style="border-right:#000000 solid thin;" class="print_text"><?php 
echo $row_detail['NowOfferedQty'];
?>
</td>
    <td valign="top" style="border-right:#000000 solid thin;" align="center"><span class="print_text"><?php 
echo $row_detail['Price'];
?>
</span></td>
    <td align="right" style="padding-right:5px;vertical-align:top"><span class="print_text"><?php 
Esempio n. 28
0
 public function item()
 {
     $item_title = 'Продукт';
     $product_id = Catalog::getIdByPath($_REQUEST['item_id']);
     // парсим id продукта
     $this->data['product'] = getProduct($product_id);
     if ($this->data['product']['category'] != 0) {
         $this->data['category'] = getCategory($this->data['product']['category']);
     } else {
         $this->data['category'] = false;
     }
     $this->data['category-no-image'] = 'http://placehold.it/150x100';
     // картинка-заглушка
     // TODO: Получаем товар. Рисуем картинку, описание, таблицу спецификации и т.д.
     $this->render('templates/catalog-item.phtml', $item_title);
 }
Esempio n. 29
0
<?php

include_once "field_const.php";
if (isset($_POST[ordNo], $_POST["className"])) {
    include_once "Order.php";
    include_once "User.php";
    include_once "Product.php";
    $orderLine = getOrderLinesByOrdNo($_POST[ordNo]);
    if (!isset($orderLine)) {
        echo "No result found";
        return;
    }
    $retTable = "<table class='" . $_POST["className"] . "'>\n\t\t\t<caption>Ordered Products of " . $_POST[ordNo] . "</caption>\n\t\t\t\t<thead>\t\t\n\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t<th>Product No</th>\n\t\t\t\t\t<th>Product Name</th>\n\t\t\t\t\t<th>Supplier Name</th>\n\t\t\t\t\t<th>Qty</th>\n\t\t\t\t\t<th>Price</th>\n\t\t\t\t\t<th>Total</th></tr>\n\t\t\t\t</thead><tbody>";
    $format = "<tr><td align='center'>%s</td><td align='center'>%s</td>\n\t\t<td align='center'>%s</td><td align='center'>%d</td><td align='center'>\$%5.2f</td><td align='center'>\$%5.2f</tr>";
    $total = 0;
    while ($row = $orderLine->fetch_assoc()) {
        $product = getProduct($row[prodNo]);
        $name = $product[prodName];
        $supplier = getSupplier($product[suppNo]);
        $supName = $supplier[suppName];
        $total += $row[actualPrice] * $row[qty];
        $retTable .= sprintf($format, $row[prodNo], $name, $supName, $row[qty], $row[actualPrice], $row[qty] * $row[actualPrice]);
    }
    $retTable .= "</tbody><tfoot><tr><td colspan='4'/><td>Total Amount</td><td align='center'>\${$total}</td></tfoot></table>";
    echo $retTable;
    return;
}
Esempio n. 30
0
error_reporting(0);
include_once "../Brain/field_const.php";
include_once "../Brain/functions.php";
include_once "../Brain/ShoppingCart.php";
include_once "../Brain/Product.php";
include_once "../Brain/UserControl.php";
if (!UserControl::checkState()) {
    echo "Error: You must login first!";
    return;
}
regGet('act', 'prodNo', 'qty');
if (!isset($act) || !isset($prodNo)) {
    echo "Error: No action specified";
    return;
}
$cart = new SCart();
$prod = getProduct($prodNo);
//$cart->clear();
if ($act == 'add') {
    if (!isset($qty)) {
        $qty = 1;
    }
    $cart->addProduct($prodNo, $prod[prodPrice], $qty);
    //if not success
    //...
} else {
    $cart->removeItem($prodNo);
}
$cartProds = $cart->getProducts();
//var_dump($cartProds);
echo SCart::genCartMenuHtml($cartProds);