Пример #1
0
    public function inputProduct()
    {
        $myapp_id = AppAccount::getAppID();
        if ($myapp_id == "" || $myapp_id < 1) {
            die("Not valid App ID");
        }
        $cam = new MCampaignModel();
        $arrCam = $cam->getWhere("camp_app_id = '{$myapp_id}' ");
        $prod = new MProdModel();
        $arrProd = $prod->getWhere("prod_app_id = '{$myapp_id}' ");
        $_SESSION['arrProd'] = $arrProd;
        ?>
        <div class="input-group">

            <span class="input-group-addon" id="basic-addon1">Select Campaign :</span>
            <select class="form-control" onchange="getMatrix();" id="camp_select">
                <option value=""></option>
                <?php 
        foreach ($arrCam as $c) {
            ?>
                    <option value="<?php 
            echo $c->camp_id;
            ?>
"><?php 
            echo $c->camp_name;
            ?>
</option>
                <?php 
        }
        ?>
            </select>
        </div><!-- /input-group -->



        <div id="camp_matrix" style="padding-top: 20px;">

        </div>

        <script>
            function getMatrix(){
                var slc = $("#camp_select").val();
                if(slc!="")
                    $("#camp_matrix").load("<?php 
        echo _SPPATH;
        ?>
MCampApp/getMatrix?cid="+slc);
            }
        </script>
        <style>
            .productcamp{
                background-color: #dedede;
                margin: 5px;
                padding: 5px;
            }

        </style>
        <?php 
        //pr($arrProd);
    }
    public function createComplexForm($cal, $webClass)
    {
        //        pr($cal);
        $t = time();
        $mp = new MProdModel();
        $id = isset($_GET['id']) ? addslashes($_GET['id']) : 0;
        if ($id) {
            $mp->getByID($id);
        }
        ?>

    <div class="col-md-2 ">
        <div class="product_menu_left">
        <div class="product_menu_left_inside" id="product_info_<?php 
        echo $t;
        ?>
" onclick="$('#loadingtop').show().fadeOut();$('.product_form_inside').hide();$('#product_info_form_<?php 
        echo $t;
        ?>
').toggle();">
            Info
        </div>
        <div class="product_menu_left_inside" id="product_variant_<?php 
        echo $t;
        ?>
"  onclick="$('#loadingtop').show().fadeOut();$('.product_form_inside').hide();$('#product_variant_form_<?php 
        echo $t;
        ?>
').toggle();">
            Additional
        </div>
        <div class="product_menu_left_inside" id="product_seo_<?php 
        echo $t;
        ?>
"  onclick="$('#loadingtop').show().fadeOut();$('.product_form_inside').hide();$('#product_price_form_<?php 
        echo $t;
        ?>
').toggle();">
            Price and Dimension
        </div>
        <div class="product_menu_left_inside" id="product_seo_<?php 
        echo $t;
        ?>
"  onclick="$('#loadingtop').show().fadeOut();$('.product_form_inside').hide();$('#product_seo_form_<?php 
        echo $t;
        ?>
').toggle();">
            SEO
        </div>
        <div class="product_menu_left_inside" id="product_seo_<?php 
        echo $t;
        ?>
"  onclick="$('#loadingtop').show().fadeOut();$('.product_form_inside').hide();$('#product_info_form_<?php 
        echo $t;
        ?>
').toggle();">
            Relation
        </div>

        </div>
    </div>
        <div class="col-md-10">
            <div class="product_form">
            <div id="product_save_<?php 
        echo $t;
        ?>
" style="text-align: right; padding-bottom: 10px; border-bottom: 1px dashed #cccccc;">
                <button class="btn btn-default">CANCEL</button> <button class="btn btn-danger">SAVE</button>
            </div>
                <div class="product_form_inside" id="product_info_form_<?php 
        echo $t;
        ?>
">
                    <h1>Info</h1>
                    <?php 
        MProdModel::infoForm($mp);
        ?>

                </div>

                <div class="product_form_inside" id="product_variant_form_<?php 
        echo $t;
        ?>
" style="display: none;">
                    <h1>Additional</h1>

                    <?php 
        MProdModel::additionalForm($mp);
        ?>
                </div>
                <div class="product_form_inside" id="product_price_form_<?php 
        echo $t;
        ?>
" style="display: none;">
                    <h1>Price and Dimension</h1>

                    <?php 
        MProdModel::priceForm($mp);
        ?>
                </div>

                <div class="product_form_inside" id="product_seo_form_<?php 
        echo $t;
        ?>
" style="display: none;">
                    <h1>SEO</h1>

                    <?php 
        MProdModel::seo($mp);
        ?>
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
        <style>
            .product_menu_left,.product_form{
                background-color: #FFFFFF;

            }
            .product_form{
                /*margin-left: 10px;*/
                padding: 10px;
            }
            .product_form_inside h1{
                padding: 0;
                margin: 0;
                background-color: #cccccc;
                padding: 5px;
                margin-bottom: 10px;
                color: #FFFFFF;
            }
            .product_form_inside{
                background-color: #f6f6f6;
            }
            .product_menu_left_inside{
                cursor: pointer;
                border-bottom: 1px solid #bbbbbb;
                font-weight: bold;
                color: #999999;
                padding: 10px;
            }
            .product_menu_left_inside:hover{
                background-color: #cccccc;
                color: #FFFFFF;
            }
        </style>
        <?php 
    }
 function isiCart()
 {
     $json['bool'] = 0;
     $totalplusdiskon = addslashes($_POST['totalplusdiskon']);
     $total = addslashes($_POST['total']);
     $diskon = addslashes($_POST['diskon']);
     $arr = CartWeb::myCart();
     $mm = new MTranDetail();
     $mm->detail_date = leap_mysqldate();
     $mm->detail_diskon = $diskon;
     $mm->detail_price = $total;
     $mm->detail_price_total = $totalplusdiskon;
     if (MemberLogin::isLogged()) {
         $mm->detail_macc_id = MemberLogin::getID();
     }
     $mm->detail_ses_id = session_id();
     $mm->detail_qty = CartWeb::totalCart();
     if ($mm->save()) {
         foreach ($arr as $obj) {
             $obj->status = 2;
             $obj->load = 1;
             $obj->save();
             //update bought
             $mprod = new MProdModel();
             $mprod->getByID($obj->variant_id);
             $mprod->updateBought();
         }
         session_regenerate_id();
         $json['bool'] = 1;
     }
     //if sukses
     echo json_encode($json);
     die;
 }
    function transaction()
    {
        $bulan = addslashes($_GET['m']);
        if ($bulan == "") {
            $bulan = date("F Y");
            $days_ago = date('Y-m-01');
            // hard-coded '01' for first day
            $days_now = date('Y-m-t');
        } else {
            $bulan = urldecode($bulan);
            $days_ago = date('Y-m-01', strtotime($bulan));
            // hard-coded '01' for first day
            $days_now = date('Y-m-t', strtotime($bulan));
        }
        $numberDays = cal_days_in_month(CAL_GREGORIAN, date('n', strtotime($bulan)), date('Y', strtotime($bulan)));
        $days_ago = date('Y-m-01', strtotime($bulan));
        // hard-coded '01' for first day
        $days_now = date('Y-m-01', strtotime('+1 month', strtotime($bulan)));
        $t = time();
        //get average transaction value
        //latest transaction
        //max transaction
        //min transaction
        //most buyed products
        //most viewed products
        //        $tt = new LL_AccStatement();
        //        $arrTt = $tt->getWhere("Cash_Value > 0 AND (TransactionDateTime BETWEEN '$days_ago' AND '$days_now') ORDER BY TransactionDateTime DESC");
        $ll = new MTranDetail();
        $arrTt = $ll->getWhere("(detail_date BETWEEN '{$days_ago}' AND '{$days_now}')");
        $value = 0;
        foreach ($arrTt as $tts) {
            $value += $tts->detail_price_total;
        }
        $atv = $value / count($arrTt);
        $arrStats['Orders'] = $arrTt;
        //        pr($arrTt);
        //        echo $atv;
        ?>
<div class="row">
        <div class="col-md-12">
            <h1>
                Transaction Dashboard
                <small><?php 
        echo $bulan;
        ?>
</small>
            </h1>
            <ol class="breadcrumb">
                <li>
                    <?php 
        echo Lang::t('Select Timeframe');
        ?>
                </li>
                <li class="active">
                    <?php 
        $start = new DateTime('11 months ago');
        // So you don't skip February if today is day the 29th, 30th, or 31st
        $start->modify('first day of this month');
        $end = new DateTime();
        $interval = new DateInterval('P1M');
        $period = new DatePeriod($start, $interval, $end);
        ?>
                    <select id="apptimeselector_<?php 
        echo $t;
        ?>
">
                        <?php 
        foreach ($period as $dt) {
            ?>
                            <option value="<?php 
            echo urlencode($dt->format('F Y'));
            ?>
" <?php 
            if ($dt->format('F Y') == $bulan) {
                echo "selected";
            }
            ?>
>
                                <?php 
            echo $dt->format('F Y') . "<br>";
            ?>
                            </option>
                        <?php 
        }
        ?>

                    </select>
                    <script>
                        $("#apptimeselector_<?php 
        echo $t;
        ?>
").change(function(){
                            var slc = $("#apptimeselector_<?php 
        echo $t;
        ?>
").val();
                            openLw("Transaction","<?php 
        echo _SPPATH;
        ?>
BIWebTransaction/transaction?m="+slc,"fade");
                        });
                    </script>
                </li>
            </ol>
        </div>
        </div>

        <div class="row">
            <div class="col-md-3">
                <div class="small-box bg-red">
                    <div class="inner">
                        <?php 
        $mtrans = new MTranDetail();
        global $db;
        $q = "SELECT SUM(detail_price_total) as total, COUNT(*) AS num FROM {$mtrans->table_name}";
        $arrTotal = $db->query($q, 1);
        ?>
                        <h3><small style="color: white;font-weight: bold;"><?php 
        echo idr($arrTotal->total);
        ?>
</small></h3>
                        <p>Lifetime Sales</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-bag"></i>
                    </div>
                    <!--                            <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>-->
                </div>
            </div>
            <div class="col-md-3">
                <div class="small-box bg-aqua">
                    <div class="inner">
                        <h3><small style="color: white;font-weight: bold;"><?php 
        echo idr($atv);
        ?>
</small></h3>
                        <p>Average Transaction Value</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-bag"></i>
                    </div>
                    <!--                            <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>-->
                </div>
            </div>
            <div class="col-md-3">
                <div class="small-box bg-green">
                    <div class="inner">

                        <h3><small style="color: white;font-weight: bold;"><?php 
        echo idr($value);
        ?>
</small></h3>

                        <p>Total Transactions</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-stats-bars"></i>
                    </div>
                    <!--                            <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>-->
                </div>
            </div>
            <div class="col-md-3">
                <div class="small-box bg-yellow">
                    <div class="inner">


                        <h3><?php 
        echo count($arrTt);
        ?>
</h3>

                        <p>Number of Transactions</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-stats-bars"></i>
                    </div>
                    <!--                            <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>-->
                </div>
            </div>

        </div>

        <div class="row">
            <div class="col-md-12">
                <div class="box box-default">
                    <div class="box-header with-border">
                        <h3 class="box-title">Transaction Stats</h3>

                        <div class="box-tools pull-right">
                            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                            </button>
                            <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                        </div>
                    </div>
                    <div class="box-body chart-responsive">

                        <?php 
        //            $days_ago = date('Y-m-d', strtotime('-30 days', time()));
        //            $days_now =  date("Y-m-d");
        $data = BIPenjualan::getAppStats($arrStats, $days_ago, $days_now);
        //                        $data = self::getAppStats($arrStats,$days_ago,$days_now);
        ?>


                    </div>
                    <!-- /.box-body -->
                </div>
            </div>

        </div>

        <?php 
        //latest transactions
        $tt = new MTranDetail();
        $arrTtNew = $tt->getWhere("(detail_date BETWEEN '{$days_ago}' AND '{$days_now}') ORDER BY detail_date DESC LIMIT 0,10");
        ?>
        <div class="row">
            <div class="col-md-6">
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">Latest Transactions</h3>

                        <div class="box-tools pull-right">
                            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                            </button>
                            <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div class="table-responsive">
                            <table class="table no-margin">
                                <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>Date</th>
                                    <th>Discount</th>
                                    <th>SubTotal</th>
                                    <th>Total</th>

                                </tr>
                                </thead>
                                <tbody>
                                <?php 
        foreach ($arrTtNew as $tt) {
            ?>
                                <tr>
                                    <td><?php 
            echo $tt->detail_id;
            ?>
</td>
                                    <td><?php 
            echo date("d-m-Y", strtotime($tt->detail_date));
            ?>
</td>
                                    <td><?php 
            echo idr($tt->detail_diskon);
            ?>
</td>
                                    <td><?php 
            echo idr($tt->detail_price);
            ?>
</td>
                                    <td><?php 
            echo idr($tt->detail_price_total);
            ?>
</td>

                                </tr>
                                <?php 
        }
        ?>

                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer clearfix">

                        <a href="javascript:openLw('Transaction_Detail', '<?php 
        echo _SPPATH;
        ?>
Msales/MTranDetail', 'fade');
                                activkanMenuKiri('Transaction_Detail');" class="btn btn-sm btn-default btn-flat pull-right">View All Transactions</a>
                    </div>
                    <!-- /.box-footer -->
                </div>
            </div>
            <?php 
        $arrSales = array();
        $prods = array();
        //calculate top products based on sales
        $lltt = new CartPortal();
        global $db;
        $q = "SELECT variant_id,COUNT(*) as count FROM {$lltt->table_name} WHERE (date_updated BETWEEN '{$days_ago}' AND '{$days_now}') GROUP BY variant_id ORDER BY count DESC LIMIT 0,10";
        $arrSales2 = $db->query($q, 2);
        //            pr($arrSales2);
        foreach ($arrSales2 as $pp) {
            $prod = new MProdModel();
            $prod->getByID($pp->variant_id);
            $pp->prod = $prod;
        }
        //            pr($arrSales2);
        //            $arrProd =  $lltt->getWhereFromMultipleTable("(date_updated BETWEEN '$days_ago' AND '$days_now') AND VariantID = detail_varian_id ");
        //
        //            foreach($arrTt as $tt){
        //                $arrProd = $lltt->getWhereFromMultipleTable("detail_trans_id = ".$tt->TransactionID." AND VariantID = detail_varian_id ",array("LL_Article_WImage"));
        //
        ////                pr($arrProd);
        //                foreach($arrProd as $prod){
        //                    $arrSales[$prod->VariantID] += $prod->detail_price_total;
        //                    $prods[$prod->VariantID] = $prod;
        //                }
        //            }
        //
        //            arsort($arrSales);
        //            $arrSales = array_reverse($arrSales);
        //            pr($arrSales);
        ?>
            <div class="col-md-6">
                <div class="box box-success">
                    <div class="box-header with-border">
                        <h3 class="box-title">Top Products</h3>

                        <div class="box-tools pull-right">
                            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                            </button>
                            <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div class="table-responsive">
                            <table class="table no-margin">
                                <thead>
                                <tr>
                                    <th>ID</th>
<!--                                    <th>Picture</th>-->
                                    <th>Name</th>
                                    <th>Qty</th>
                                    <th>Value</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php 
        foreach ($arrSales2 as $varid => $saledata) {
            //                                    if($varid == '2887')continue;
            ?>
                                <tr>
                                    <td><?php 
            echo $saledata->variant_id;
            ?>
</td>

<!--                                    <td>--><?php 
            //=$prods[$varid]->BaseArticleImageFile;
            ?>
<!--</td>-->
                                    <td><?php 
            echo $saledata->prod->BaseArticleNameENG;
            ?>
</td>
                                    <td><?php 
            echo $saledata->count;
            ?>
</td>
                                    <td>
                                        <?php 
            echo idr($saledata->count * $saledata->prod->SellingPrice);
            ?>
                                    </td>
                                </tr>
                                <?php 
        }
        ?>

                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
<!--                     /.box-body-->
                    <div class="box-footer clearfix">
<!--                        <a href="javascript::;" class="btn btn-sm btn-info btn-flat pull-left">Place New Order</a>-->
                        <a href="javascript:openLw('LL_Article', '<?php 
        echo _SPPATH;
        ?>
LLProdWeb/LL_Article_WImage', 'fade');
                                activkanMenuKiri('LL_Article');" class="btn btn-sm btn-default btn-flat pull-right">View All Articles</a>
                    </div>
                    <!-- /.box-footer -->
                </div>
            </div>
        </div>
        <style>
            ul.legend li{
                list-style: none;
                line-height: 30px;
            }
            ul.legend li div{
                float: left;
                margin-top: 10px;
                margin-right: 15px;
            }
            .legend-item{
                float: left;
                margin: 10px;
                line-height: 30px;
                margin-right: 5px;
            }
            .legend-item div{
                float: left;
                margin-top: 10px;
                margin-right: 5px;
            }
            .breadcrumb {
                padding: 8px 15px;
                margin-bottom: 20px;
                list-style: none;
                background-color: #f5f5f5;
                border-radius: 4px;
            }
            .breadcrumb {
                float: right;
                background: transparent;
                margin-top: 0;
                margin-bottom: 0;
                font-size: 12px;
                padding: 7px 5px;
                position: absolute;
                top: 15px;
                right: 10px;
                border-radius: 2px;
            }
            .users-list-name{
                white-space: nowrap;
            }
        </style>
    <?php 
    }
    $url = "http://localhost:8888/tbsecom/LLProdWeb/getItems?token=" . $token;
    $contents = file_get_contents($url);
    $obj = json_decode($contents);
    $arrN = $obj->results;
    foreach ($arrN as $ss) {
        if (!in_array($ss->VariantID, $sudah)) {
            $sudah[] = $ss->VariantID;
            $sem[$ss->VariantID] = $ss;
        } else {
            $sem[$ss->VariantID]->TaggingLevel3ID .= " " . $ss->TaggingLevel3ID;
        }
    }
    \Leap\View\InputConditionTBS::printer($sem);
}
if ($action == "2") {
    $n = new \MProdModel();
    $m = new MArticleTagging();
    $z = new MProdCat();
    $mode = "all";
    if ($mode == "all") {
        $n->default_read_coloms = "*";
        $arrN = $n->getAll();
    } else {
        if ($mode == "filter1") {
            $arrN = $n->getWhereFromMultipleTable("{$n->table_name}.BaseArticleID = ecommultiple__articletagging.BaseArticleID", array("MArticleTagging"));
        } else {
            $arrN = $n->getWhereFromMultipleTable("{$n->table_name}.BaseArticleID = ecommultiple__articletagging.BaseArticleID AND ecommultiple__articletagging.TaggingLevel3ID = ecommultiple__product_category.cat_id", array("MArticleTagging", "MProdCat"));
        }
    }
    $sudah = array();
    $num = 0;
 function sync_article()
 {
     $token = IMBAuth::createOAuth();
     $url = "http://localhost:8888/tbsecom/LLProdWeb/LL_Article_WImage?cmd=ws&mws=getall&token=" . $token;
     //        pr($_POST);
     $contents = file_get_contents($url);
     $obj = json_decode($contents);
     $nn = new MProdModel();
     global $db;
     $db->query("UPDATE {$nn->table_name} SET prod_active = 0", 1);
     //        pr($obj);
     $num = 0;
     $gagal = 0;
     $gagalArr = array();
     foreach ($obj->results as $new) {
         $nn = new MProdModel();
         $nn->fill(toRow($new));
         $nn->prod_active = 1;
         if ($_POST['radio'] == "truncate") {
             $nn->prod_seo_title = $new->VariantNameENG;
             $nn->prod_seo_meta_description = $new->ArticleInfoENG;
             $nn->prod_seo_meta_key = $new->VariantNameENG;
             $nn->prod_seo_fbog_title = $new->VariantNameENG;
             $nn->prod_seo_fbog_description = $new->ArticleInfoENG;
             $nn->prod_seo_fbog_image = _BPATH . _PHOTOURL . "products/" . $new->BaseArticleImageFile;
         } else {
             $nn2 = new MProdModel();
             $nn2->getByID($nn->VariantID);
             $nn->prod_seo_title = $nn2->prod_seo_title;
             $nn->prod_seo_meta_description = $nn2->prod_seo_meta_description;
             $nn->prod_seo_meta_key = $nn2->prod_seo_meta_key;
             $nn->prod_seo_fbog_title = $nn2->prod_seo_fbog_title;
             $nn->prod_seo_fbog_description = $nn2->prod_seo_fbog_description;
             $nn->prod_seo_fbog_image = $nn2->prod_seo_fbog_image;
         }
         if ($nn->save(1)) {
             $num++;
         } else {
             $gagal++;
             $gagalArr = $new->VariantID;
         }
     }
     $json['success'] = $num;
     $json['failed'] = $gagal;
     $json['failed_arr'] = $gagalArr;
     echo json_encode($json);
     die;
 }
    public function p()
    {
        $t = time() . rand(1, 100);
        $id = $this->id . "attrib_" . $t;
        //        echo $id;
        $exp = explode(",", $this->value);
        $llimit = count($exp);
        if ($llimit < 1) {
            $llimit = 0;
        }
        ?>

        <input type="text" name="<?php 
        echo $this->name;
        ?>
" id="<?php 
        echo $this->id;
        ?>
_<?php 
        echo $t;
        ?>
" class="<?php 
        echo $this->id;
        ?>
" value="<?php 
        echo $this->value;
        ?>
">
        <div class="attribute_adder">
            <div id="submitter_<?php 
        echo $id;
        ?>
" style="padding: 10px; text-align: right; float: right;">
                <!--                <button id="butsave_--><?php 
        //=$id;
        ?>
<!--" type="button" class="btn btn-default">Save Attributes</button>-->
                <button id="but_<?php 
        echo $id;
        ?>
" type="button" class="btn btn-default">Add Attribute </button>
            </div>

            <div id="attbox_<?php 
        echo $id;
        ?>
">
            </div>

        </div>
        <div id="allprod" style="display: none; background-color: #FFFFFF; padding: 10px;">
            <div style="float: right; width: 10px; height: 10px;" onclick="$('#allprod').hide();">x</div>
            <?php 
        $n = new \MProdModel();
        $arrN = $n->getOrderBy("VariantID ASC");
        self::printer($arrN);
        ?>
        </div>
        <script>
            var featSudah = [];
            var opt_<?php 
        echo $id;
        ?>
 = [
                '<option value="all">all</option>',
//                '<option value="price">Price</option>',
                '<option value="variantID">VariantID</option>',
                '<option value="baseID">BaseID</option>',
                '<option value="category">Category</option>'
            ];

            var optcommand_<?php 
        echo $id;
        ?>
 = [
                'variantID',
                'baseID',
                'category'
            ];

            var opt2a_<?php 
        echo $id;
        ?>
 = [
                '<option value=""></option>',
                '<option value="=">=</option>',
                '<option value="&gt;">&gt;</option>',
                '<option value="&gt;=<">&gt;=</option>',
                '<option value="=&lt;">=&lt;</option>',
                '<option value="&lt;">&lt;</option>'
            ];

            var opt2b_<?php 
        echo $id;
        ?>
 = [
                '<option value=""></option>',
                '<option value="is">is one of</option>',
                '<option value="is_not">is not one of</option>'
            ];

            var opt3a_<?php 
        echo $id;
        ?>
 = '<input type="number" id="span3">';

            var attr_<?php 
        echo $id;
        ?>
 = [];
            var attrnr_<?php 
        echo $id;
        ?>
 = <?php 
        echo $llimit;
        ?>
;
            <?php 
        if ($llimit > 0) {
            ?>
            //create attributes
            <?php 
            foreach ($exp as $num => $ee) {
                $exp2 = explode(";", $ee);
                $option1 = $exp2[0];
                $option2 = $exp2[1];
                $option3 = $exp2[1];
                ?>
            createAttr<?php 
                echo $id;
                ?>
('<?php 
                echo $num;
                ?>
','<?php 
                echo $option1;
                ?>
','<?php 
                echo $option2;
                ?>
','<?php 
                echo $option3;
                ?>
');
            <?php 
            }
            //foreach
            ?>

            function createAttr<?php 
            echo $id;
            ?>
(lokalid,option1,option2,option3){

                var selecttext = '';
                for(var x=0;x<opt_<?php 
            echo $id;
            ?>
.length;x++){
                    selecttext += opt_<?php 
            echo $id;
            ?>
[x];
                }
                var text2 = "<div class='condition form-inline'><select class='form-control' id='select1_"+lokalid+"' onchange='updateSpan2(\""+lokalid+"\");'>"+selecttext+"</select><span id='span2_"+lokalid+"'></span><span id='span3_"+lokalid+"'></span></div>";
                $("#attbox_<?php 
            echo $id;
            ?>
").append(text2);
                $("#submitter_<?php 
            echo $id;
            ?>
").show();
            }
            <?php 
        }
        ?>

            function updateSpan2(lokalid){
                var slc = $('#select1_'+lokalid).val();

                activeLokalID = lokalid;


                var selecttext = '';
                if(slc == "all"){
                    $('#span2_'+lokalid).html('');
                    $('#span3_'+lokalid).html('');
                    return "";
                }
                else if(slc == "price"){
                    for(var x=0;x<opt2a_<?php 
        echo $id;
        ?>
.length;x++){
                        selecttext += opt2a_<?php 
        echo $id;
        ?>
[x];
                    }
                    featSudah.push(slc);
                }else{
                    for(var x=0;x<opt2b_<?php 
        echo $id;
        ?>
.length;x++){
                        selecttext += opt2b_<?php 
        echo $id;
        ?>
[x];
                    }
                    featSudah.push(slc);
                }
                $('#span3_'+lokalid).html('');
                $('#span2_'+lokalid).html("<select class='form-control' id='select2_"+lokalid+"' onchange='updateSpan3(\""+lokalid+"\");'>"+selecttext+"</select>");
            }

            var activeLokalID = 0;

            function updateSpan3(lokalid){
                var slc2 = $('#select1_'+lokalid).val();

                var slc = $('#select2_'+lokalid).val();

                activeLokalID = lokalid;
//                $('#span3_'+lokalid).html(slc);

                var selecttext = '';
                if(slc2 == "price"){

                    $('#span3_'+lokalid).html('<input onchange="updateHiddenCondition();" class="form-control" type="number" id="isi_span3_'+lokalid+'">');

                }else{
                    /// load from database....
                    if(slc2 == "variantID"){
                        //uncheck all checkbox
                        $('.variant_check').prop("checked",false);
                        checkedVariant = [];
                        $('#allprod').show();
                        html = "<input type='text' class='form-control' id='isi_span3_"+lokalid+"'>";

                    }
                    if(slc2 == "baseID"){
                        <?php 
        $n = new \MProdModel();
        $arrN = $n->getWhere("ArticleType = 'Base' ORDER BY BaseArticleID ASC");
        $cc = '';
        foreach ($arrN as $num => $nn) {
            $cc .= "<input type='checkbox'>" . $num . ". " . $nn->BaseArticleID . " " . $nn->BaseArticleNameENG . "<br>";
        }
        ?>
                        var html = "<?php 
        echo $cc;
        ?>
";
                    }
                    if(slc2 == "category"){
                        <?php 
        $n = new \MProdCat();
        $arrN = $n->getWhere("cat_parent_id != '-1' ORDER BY cat_name ASC");
        $cc = '';
        foreach ($arrN as $num => $nn) {
            $cc .= "<input type='checkbox'>" . $num . ". " . $nn->cat_id . " " . $nn->cat_name . "<br>";
        }
        ?>
                        var html = "<?php 
        echo $cc;
        ?>
";
                    }
                    $('#span3_'+lokalid).html(html);

                }


            }


            $("#but_<?php 
        echo $id;
        ?>
").click(function(){
                var lokalid = attrnr_<?php 
        echo $id;
        ?>
;
//                var text = "<div class='attr_box'>Attr Name : <input id='attrtext_<?php 
        //=$id;
        ?>
//_"+lokalid+"' type='text'> Stok : <input id='attrstok_<?php 
        //=$id;
        ?>
//_"+lokalid+"' type='number'></div>";


                var selecttext = '';
                for(var x=0;x<opt_<?php 
        echo $id;
        ?>
.length;x++){

                    if(jQuery.inArray( optcommand_<?php 
        echo $id;
        ?>
[x], featSudah ) !== -1){
                        continue;
                    }


                    selecttext += opt_<?php 
        echo $id;
        ?>
[x];
                }
                var text2 = "<div class='condition form-inline'><select class='form-control' id='select1_"+lokalid+"' onchange='updateSpan2(\""+lokalid+"\");'>"+selecttext+"</select><span id='span2_"+lokalid+"'></span><span id='span3_"+lokalid+"'></span></div>";
                $("#attbox_<?php 
        echo $id;
        ?>
").append(text2);

                $("#submitter_<?php 
        echo $id;
        ?>
").show();
                attrnr_<?php 
        echo $id;
        ?>
++;
            });

//            $("#butsave_<?php 
        //=$id;
        ?>
//").click(function(){
//
//                updateHiddenCondition();
////                alert(energy);
//
////                $("#<?php 
        ////=$this->totalstock_id;
        ?>
////").val(totalstok);
//            });

            function updateHiddenCondition(){
                var gab = [];
                var totalstok = 0;
//                alert(attrnr_<?php 
        //=$id;
        ?>
//);
                //parsing all the inputs
                for(var x = 0;x<attrnr_<?php 
        echo $id;
        ?>
;x++){

//                    alert(x);

                    var isi3 = $("#isi_span3_"+x).val();
                    var isi2 = $("#select2_"+x).val();
                    var isi1 = $("#select1_"+x).val();

                    if(isi1=="" || isi2 =="" || isi3 == ""){
                        //error1
                        alert("Missing Attributes ");
                    }
                    else {
                        gab.push(isi1+";"+isi2+";"+isi3);
                    }

                }

                var energy = gab.join("|");

                $("#<?php 
        echo $this->id;
        ?>
_<?php 
        echo $t;
        ?>
").val(energy);
            }
        </script>
        <style>
            .condition{
                padding: 5px;
            }
        </style>
    <?php 
    }
    public static function printer($id, $name)
    {
        if ($_GET['cardnr'] != '' && $_GET['dob'] != '') {
            //diloginkan langsung
            MemberLogin::loginkanLangsung();
        }
        $prod = new MProdModel();
        $prod->getByID($id);
        if ($prod->VariantID == "") {
            MemberLogin::handleNotFound();
        }
        $pc = new ProductAtCategory();
        $imgurl = $pc->imgURL . $prod->BaseArticleImageFile;
        if ($prod->BaseArticleImageFile == "") {
            $imgurl = $pc->noimage;
        }
        $prod->updateView();
        global $template;
        if ($prod->prod_seo_title != "") {
            $template->title = $prod->prod_seo_title;
        }
        if ($prod->prod_seo_meta_description != "") {
            $template->metades = $prod->prod_seo_meta_description;
        }
        if ($prod->prod_seo_meta_key != "") {
            $template->metakey = $prod->prod_seo_meta_key;
        }
        $addTextToHead = '';
        if ($prod->prod_seo_fbog_title != "") {
            $addTextToHead .= '<meta property="og:title" content=" ' . $prod->prod_seo_fbog_title . ' " />';
        }
        if ($prod->prod_seo_fbog_description != "") {
            $addTextToHead .= '<meta property="og:description" content="' . $prod->prod_seo_fbog_description . '" />';
        }
        if ($prod->prod_seo_fbog_image != "") {
            $addTextToHead .= '<meta property="og:image"  content="' . _BPATH . _PHOTOURL . $prod->prod_seo_fbog_image . '" />';
        }
        if ($addTextToHead != "") {
            $actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
            $addTextToHead .= '<meta property="og:site_name" content="' . $template->title . '"/>';
            $addTextToHead .= '<meta property="og:url" content="' . $actual_link . '" />';
            $addTextToHead .= '<meta property="fb:app_id" content="510260392457364" />';
            $addTextToHead .= '<meta property="og:type" content="website" />';
        }
        $template->addTextToHead($addTextToHead);
        /*
         * Apply rule to variant
         *
         */
        $rules = MCPRule::getRules();
        $rules2variant = MCPRule::getRules2Variant();
        if (count($rules2variant[$id]) > 0) {
            $uu = $rules2variant[$prod->VariantID];
            //set icon
            $prod->rule_icon = _SPPATH . _PHOTOURL . $rules[$uu[0]]->rule_icon;
            //                            pr($uu);
            //diskon
            $diskon = 0;
            foreach ($uu as $ruleygkena) {
                $r = $rules[$ruleygkena];
                $diskon = max($r->rule_discount, $diskon);
            }
            $prod->rule_discount = $diskon;
        } else {
            $prod->rule_icon = "";
            //default rule icon
            $prod->rule_discount = 0;
        }
        $prod->final_price = (100 - $prod->rule_discount) / 100 * $prod->SellingPrice;
        //    pr($prod);
        ?>
        <div style="margin-top: 40px;" class="donly">&nbsp;</div>
        <div class="col-md-4 col-md-offset-1" >

            <img src="<?php 
        echo $imgurl;
        ?>
" style="width: 100%;">
        </div>
        <div class="col-md-6">
            <h1 style="font-size: 25px;"><?php 
        echo $prod->BaseArticleNameENG;
        ?>
</h1>

        <div style="float: left; line-height: 40px;">
            <img src="http://thebodyshop.ugc.bazaarvoice.com/6097-en_gb/4_7/5/rating.gif" class="BVImgOrSprite" alt="4.7 / 5" title="4.7 / 5">
            </div>
            <?php 
        if ($prod->rule_icon != "") {
            $uu = $rules2variant[$prod->VariantID];
            ?>
                <div style="float: right; opacity: 0.7;">
                    <?php 
            foreach ($uu as $ruleygkena) {
                $r = $rules[$ruleygkena];
                ?>
                        <a style="text-decoration: none;" href="#" data-toggle="tooltip" data-placement="bottom" title="<?php 
                echo $r->rule_description;
                ?>
">
                        <img  style="width: 30px; height: 30px; margin: 5px;" src="<?php 
                echo _SPPATH . _PHOTOURL . $r->rule_icon;
                ?>
">
                        </a>
                    <?php 
            }
            ?>
                </div>
                <script>
                    $(document).ready(function(){
                        $('[data-toggle="tooltip"]').tooltip();
                    });
                </script>
            <?php 
        }
        ?>
            <div class="clearfix"></div>

            <p style="margin-top: 20px; margin-bottom: 10px;"><?php 
        echo $prod->ArticleInfoENG;
        ?>
</p>

            <?php 
        $pricetext = "";
        if ($prod->rule_discount > 0) {
            $pricetext = "IDR " . idr($prod->SellingPrice);
        }
        ?>
            <div class="priceprod priceprod_small"><?php 
        echo $pricetext;
        ?>
</div>
            <div class="priceprod">IDR <?php 
        echo idr($prod->final_price);
        ?>
</div>
            <div class="traditional_add">
                <a class="add" data-toggle="modal" data-variant="<?php 
        echo $prod->VariantID;
        ?>
"
                   data-url="<?php 
        echo _SPPATH;
        ?>
pr/p/<?php 
        echo $prod->VariantID;
        ?>
/<?php 
        echo ProductAtCategory::bersihkanNama($prod->BaseArticleNameENG);
        ?>
"
                   data-imgUrl="<?php 
        echo $imgurl;
        ?>
"
                   data-articlename="<?php 
        echo $prod->BaseArticleNameENG;
        ?>
"
                   data-target="#myModal" style="cursor: pointer; font-size: 20px; padding: 10px;">ADD TO BAG</a>
            </div>
            <div class="pemesanan" style="display: none;">
                <div style="float: left;">
                <table class="qtyvar">
                    <tr>
                        <td>Quantity</td>
<!--                        <td>Varian</td>-->
                    </tr>
                    <tr>
                        <td>
                        <select class="form-control">
                            <?php 
        for ($x = 1; $x < 10; $x++) {
            ?>
                                <option value="<?php 
            echo $x;
            ?>
"><?php 
            echo $x;
            ?>
</option>
                            <?php 
        }
        ?>
                        </select>
                        </td>
                        <td>
<!--                            <select class="form-control">-->
<!--                                <option value="">Varian 1</option>-->
<!--                                <option value="">Varian 2</option>-->
<!--                            </select>-->
                        </td>
                    </tr>
                </table>
                </div>
                <div style="margin-left: 220px;">
                    <div class="addbut">

                    </div>
                </div>
                <div class="clearfix"></div>
            </div>

        </div>

        <div class="clearfix"></div>

        <style>
            table.qtyvar td{
                padding: 5px;
            }
            .pemesanan{
                border: 1px solid #cccccc;
                background-color: #efefef;
                padding: 10px;
            }
            .addbut{
                background-color: #e2007a;
                color: #FFFFFF;
                padding: 10px;
                font-size: 19px;
                font-weight: bold;
                text-align: center;
                margin-top: 15px;
                width: 190px;
            }

            .priceprod{
                color: #e2007a;
                font-size: 37px;
                font-weight: bold;
                /*margin-top: 20px;*/
                margin-bottom: 20px;
            }
            .priceprod_small{
                font-size: 15px;
                margin-top: 20px;
                text-decoration: line-through;
                margin-bottom: 0px;
            }
            .imgstamp{
                position: absolute;
                width: 60px;
                /*height: 50px;*/
                overflow: hidden;
                opacity: 0.6;
            }
            div.imgstamp img{
                /*min-width: 100% !important;*/
                /*min-height: 100% !important;*/
            }
        </style>
        <div class="col-md-10 col-md-offset-1" style="margin-top: 40px;" >
            <ul class="nav nav-tabs nav-justified">
                <li class="active"><a data-toggle="tab" href="#review">REVIEW</a></li>
                <li><a data-toggle="tab" href="#ingredients">INGREDIENTS</a></li>
                <li><a data-toggle="tab" href="#howtouse">HOW TO USE</a></li>
                <li><a data-toggle="tab" href="#whatsinside">WHATS INSIDE</a></li>
            </ul>
            <div class="tab-content isilain">
                <div id="review" class="tab-pane fade in active dalaman">
                    <div class="review_item">
                        <div class="col-md-3">
                        <div class="review_username">Jeanne Schroeder</div>
                        <div class="review_star"><img src="http://thebodyshop.ugc.bazaarvoice.com/6097-en_gb/4_0/5/rating.gif" class="BVImgOrSprite" alt="4 / 5" title="4 / 5"></div>
                        </div>
                        <div class="col-md-9">
                            <div class="review_date">20 January 2016</div>
                        <div class="review_text">
                            <div class="review_title">GOOD BUY</div>
                            I'm a natural sister. Recently did the big chop so my hair is completely natural no relaxed ends and its very coarse and doesn't exactly have a curl pattern. For other natural girls I'd say I'm a 4C (4D really lool) in regards of hair texture. Through my transition i noticed that my scalp is very dry, itchy and flaky even after washing it a day or 2 later it'll flake up. I've tried nizoral shampoo recommended by a friend which is also good for dry & itchy scalp however i felt it left my feeling hard afterwards plus its like £6 for a very small bottle. I'm a lover of all things body shop so when i saw this I'd thought I'd give it a go. It smells great it feels my hair feeling soft and scalp free from flaking. I had a lil flaking a few days after so i applied oil to my scalp as normal to defuse it. i've used this shampoo twice now and the second time round it definietly had a better affect so after 3 months or so i can only imagine my scalp would have improved
                        </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="review_item noborder" style="margin-top: 20px;">
                        <div class="col-md-3">
                            <div class="review_username">Michelle Stark</div>
                            <div class="review_star"><img src="http://thebodyshop.ugc.bazaarvoice.com/6097-en_gb/4_0/5/rating.gif" class="BVImgOrSprite" alt="4 / 5" title="4 / 5"></div>
                        </div>
                        <div class="col-md-9">
                            <div class="review_date">7 January 2016</div>
                            <div class="review_text">
                                <div class="review_title">LIFE CHANGER!</div>
                                My son (aged 11 and an early developer, I think this is why he started with his scalp problem) is over the moon as am I. We tried everything from Leading Anti-Dandruff Brands to home remedies. This worked after the first use and his scalp was clear after the second use. This is the only shampoo he can use as it helps to keep his sore flaking scalp under control. He uses it 3 times a week and has no flakes or red sores/itching. Highly recommend.
                                <br><br>Downside: There are chemicals like SLS in it which I know cause flakes/eczema etc, but seeing as it is the only shampoo that keeps his head clear we will continue to use it.

                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                </div>
                <div id="ingredients" class="tab-pane fade dalaman">
                    <?php 
        echo $prod->IngredientENG;
        ?>
                </div>
                <div id="howtouse" class="tab-pane fade dalaman">
                    <?php 
        echo $prod->HowToUseENG;
        ?>
                </div>
                <div id="whatsinside" class="tab-pane fade dalaman">
                    <?php 
        echo $prod->WhatInsideENG;
        ?>
                </div>
            </div>
        </div>
        <style>
            .review_item{
                border-bottom: 1px dotted #cccccc;
                padding-bottom: 20px;
            }
            .review_username{
                font-weight: bold;
            }
            .review_title{
                font-weight: bold;
                margin-bottom: 20px;
                font-size: 15px;
            }
            .review_date{
                text-align: right;
                font-size: 11px;
                color: #888888;
                float: right;
            }
            .isilain{
                /*background-color: #efefef;*/
                border: 1px solid #dddddd;
                border-top: 0px;
            }
            .isilain h3{
                padding: 0;
                margin: 0;

            }
            .dalaman{
                padding: 20px;
            }
            .nav-tabs li{
                background-color: #efefef;
                border-right: 1px solid #FFFFFF;
            }
            .nav-tabs li a{
                color: #7FB719;
            }
            .nav-tabs li.active a{
                font-weight: bold;
                color: #999999;
            }
        </style>
        <div class="clearfix"></div>
        <?php 
        $at = new LL_ArticleTagging_wbase();
        $ats = $at->getWhereFromMultipleTable("BaseArticleID = '{$prod->BaseArticleID}' AND TaggingLevel3ID = cat_id", array("MProdCat"));
        //        pr($ats);
        if (count($ats) > 0) {
            ?>
            <div class="col-md-10 col-md-offset-1" style="margin-top: 20px;">
                Similar Categories : <?php 
            foreach ($ats as $cat) {
                ?>
                    <span class="category"><a class="discover"
                                              href="<?php 
                echo _SPPATH;
                ?>
pr/w3/<?php 
                echo $cat->cat_id;
                ?>
/<?php 
                echo $cat->cat_name;
                ?>
"><?php 
                echo $cat->cat_name;
                ?>
</a> </span> &nbsp;
                    <?php 
                $impcat[] = "TaggingLevel3ID = '{$cat->cat_id}'";
            }
            $queryImp = implode(" OR ", $impcat);
            $atprod = $at->getWhereFromMultipleTable("(" . $queryImp . ") AND ArticleType = 'Base' AND {$prod->table_name}.VariantID != '{$id}' AND {$at->table_name}.BaseArticleID = {$prod->table_name}.BaseArticleID LIMIT 0,12", array("MProdModel"));
            $atprod = array_reverse($atprod);
            //                            pr($atprod);
            $sudahCarousel = array();
            foreach ($atprod as $atss) {
                if (!in_array($atss->VariantID, $sudahCarousel)) {
                    $sudahCarousel[] = $atss->VariantID;
                    $masukan[] = $atss;
                }
            }
            $atprod = $masukan;
            if (count($atprod) > 0) {
                ?>


                <div class="recommended_items"
                     style="margin-top: 10px; border:1px dashed #cccccc; padding-right: 10px; padding-left: 10px; margin-bottom: 30px;">
                    <!--recommended_items-->

                    <div id="recommended-item-carousel" class="carousel slide" data-ride="carousel">
                        <div class="carousel-inner" style="padding: 20px;">
                            <?php 
                $cnt = count($atprod);
                $page = ceil($cnt / 4);
                for ($x = 1; $x <= $page; $x++) {
                    ?>
                                <div class="item <?php 
                    if ($x == 1) {
                        echo "active";
                    }
                    ?>
">
                                    <?php 
                    for ($y = 0; $y < 4; $y++) {
                        if (count($atprod) > 0) {
                            $atss = array_pop($atprod);
                            //durchlaufen disini ..thd rule
                            if (count($rules2variant[$atss->VariantID]) > 0) {
                                $uu = $rules2variant[$atss->VariantID];
                                //set icon
                                $atss->rule_icon = _SPPATH . _PHOTOURL . $rules[$uu[0]]->rule_icon;
                                //                            pr($uu);
                                //diskon
                                $diskon = 0;
                                foreach ($uu as $ruleygkena) {
                                    $r = $rules[$ruleygkena];
                                    $diskon = max($r->rule_discount, $diskon);
                                }
                                $atss->rule_discount = $diskon;
                            } else {
                                $atss->rule_icon = "";
                                //default rule icon
                                $atss->rule_discount = 0;
                            }
                            $atss->final_price = (100 - $atss->rule_discount) / 100 * $atss->SellingPrice;
                            $pc = new ProductAtCategory();
                            $imgurl = $pc->imgURL . $atss->BaseArticleImageFile;
                            if ($atss->BaseArticleImageFile == "") {
                                $atss = $pc->noimage;
                            }
                            ?>
                                            <div class="prod-item col-md-3 col-sm-6 col-xs-6">

                                                <a href="<?php 
                            echo _SPPATH;
                            ?>
pr/p/<?php 
                            echo $atss->VariantID;
                            ?>
/<?php 
                            echo ProductAtCategory::bersihkanNama($atss->BaseArticleNameINA);
                            ?>
">
                                                    <?php 
                            if ($atss->rule_icon != "") {
                                ?>
                                                        <div class="imgstamp_ole">
                                                            <img src="<?php 
                                echo $atss->rule_icon;
                                ?>
" width="60px">
                                                        </div>
                                                    <?php 
                            }
                            ?>
                                                    <div class="product_list_item_img2">
                                                    <img
                                                        src="<?php 
                            echo $imgurl;
                            ?>
"
                                                        >
                                                    </div>
                                                </a>
                                                <b class="elips"><a
                                                        href="<?php 
                            echo _SPPATH;
                            ?>
pr/p/<?php 
                            echo $atss->VariantID;
                            ?>
/<?php 
                            echo ProductAtCategory::bersihkanNama($atss->BaseArticleNameINA);
                            ?>
">
                                                        <?php 
                            echo $atss->BaseArticleNameINA;
                            ?>
</a></b>

                                                <!--                                <p class="elips">-->
                                                <?php 
                            //=$atss->ArticleInfoENG;
                            ?>
<!--</p>-->

                                                <!--                                <div class="rating">-->
                                                <!--                                    <div class="rating">-->
                                                <!--                                        <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>-->
                                                <!--                                    </div>-->
                                                <!---->
                                                <!--                                </div>-->
                                                <?php 
                            //pr($obj);
                            if ($atss->rule_discount > 0) {
                                ?>
                                                    <div class="item_price item_price_small">
                                                        IDR <?php 
                                echo idr($atss->SellingPrice);
                                ?>
</div>
                                                    <div class="item_price">IDR <?php 
                                echo idr($atss->final_price);
                                ?>
</div>
                                                <?php 
                            } else {
                                ?>
                                                    <div class="item_price item_price_small"></div>
                                                    <div class="item_price">IDR <?php 
                                echo idr($atss->final_price);
                                ?>
</div>
                                                <?php 
                            }
                            ?>

                                                <a class="discover_more"
                                                   href="<?php 
                            echo _SPPATH;
                            ?>
pr/p/<?php 
                            echo $atss->VariantID;
                            ?>
/<?php 
                            echo ProductAtCategory::bersihkanNama($atss->BaseArticleNameINA);
                            ?>
">Discover
                                                    More</a>
                                            </div>
                                        <?php 
                        }
                        ?>
                                    <?php 
                    }
                    ?>

                                </div>
                            <?php 
                }
                ?>


                        </div>
                        <a class="left recommended-item-control" href="#recommended-item-carousel" data-slide="prev">
                            <i class="glyphicon glyphicon-chevron-left"></i>
                        </a>
                        <a class="right recommended-item-control" href="#recommended-item-carousel" data-slide="next">
                            <i class="glyphicon glyphicon-chevron-right"></i>
                        </a>
                    </div>
                </div>
                <?php 
            }
            ?>
                <div class="clearfix"></div>


            </div>
            <style>
                .elips {

                    /*font-weight: bold;*/
                    color: #777777;
                    height: 40px;
                    text-overflow: ellipsis;
                    margin-top: 10px;
                    overflow: hidden;
                    /*white-space:nowrap;*/
                    display: -webkit-box;
                    -webkit-line-clamp: 2;
                    -webkit-box-orient: vertical;
                    text-align: center;
                }
                .product_list_item_img2 {
                    width: 100%;
                    height: 147px;
                    overflow: hidden;
                    margin: auto;
                    text-align: center;
                }

                .product_list_item_img2 img {
                    max-width: 100%;
                    max-height: 100%;
                }
                .elips a {
                    color: #666666;
                }

                .recommended-item-control {
                    position: absolute;
                    top: 41%;
                }

                .left {
                    left: 0;
                }

                .right {
                    right: 0;
                }

                .discover {
                    color: #e2007a;
                }

                .imgstamp_ole {
                    position: absolute;
                    width: 60px;
                    height: 60px;
                    overflow: hidden;
                }

                div.imgstamp_ole img {
                    min-width: 60px;
                    min-height: 60px;
                }

                .item_price {
                    color: #e2007a;
                    font-size: 25px;
                }

                .item_price_small {
                    text-decoration: line-through;
                    font-size: 13px;
                    height: 18px;
                }

                .discover_more {
                    color: #666666;
                    text-decoration: underline;
                    font-size: 12px;
                }
            </style>
        <?php 
        }
        //        pr($prod);
    }
    function products()
    {
        ?>
        <h1 style="margin-top: 0;">Behaviour Analytics</h1>
        <div class="row">
        <div class="col-md-4">
        <div class="penjualan_container">
        <div class="penjualan">
            <h2 class="penjualan_money_h2" style="margin-bottom: 20px;">Last Search Terms</h2>
            <?php 
        $sL = new MSearchLog();
        $arrSl = $sL->getOrderBy("slog_date DESC LIMIT 0,30");
        if (count($arrSl) > 0) {
            $slsudah = array();
            ?>
                <table class="table table-striped"><?php 
            foreach ($arrSl as $sll) {
                if (!in_array($sll->slog_keyword, $slsudah)) {
                    $slsudah[] = $sll->slog_keyword;
                    ?>
                        <tr>
                            <td>
                                <div class="searchkeyword"><?php 
                    echo $sll->slog_keyword;
                    ?>
</div>
                            </td>
                        </tr>

                    <?php 
                }
            }
            ?>
</table><?php 
        } else {
            ?>
                <p>We couldn't find any records.</p>
            <?php 
        }
        ?>
        </div>
        <hr>
        <div class="penjualan">
            <h2 class="penjualan_money_h2" style="margin-bottom: 20px;">Top Search Terms</h2>
            <?php 
        $sL = new MSearchLog();
        global $db;
        $q = "SELECT slog_keyword,COUNT(*) as count FROM {$sL->table_name} GROUP BY slog_keyword ORDER BY count DESC LIMIT 0,10";
        $arrSl = $db->query($q, 2);
        //                    pr($arrSl);
        //                    $arrSl = $sL->getOrderBy("slog_date DESC LIMIT 0,30");
        if (count($arrSl) > 0) {
            $slsudah = array();
            ?>
                <table class="table table-striped"><?php 
            foreach ($arrSl as $sll) {
                if (!in_array($sll->slog_keyword, $slsudah)) {
                    $slsudah[] = $sll->slog_keyword;
                    ?>
                        <tr>
                            <td>
                                <div class="searchkeyword"><?php 
                    echo $sll->slog_keyword;
                    ?>
</div>
                            </td>
                            <td>
                                <div class="searchkeyword"><?php 
                    echo $sll->count;
                    ?>
</div>
                            </td>
                        </tr>

                    <?php 
                }
            }
            ?>
</table><?php 
        } else {
            ?>
                <p>We couldn't find any records.</p>
            <?php 
        }
        ?>
        </div>
        </div>
            <div class="penjualan_container" style="margin-top: 20px;">
                <div class="penjualan">
                    <h2 class="penjualan_money_h2" style="margin-bottom: 20px;">Most Viewed Products</h2>

        <?php 
        $prod = new MProdModel();
        $mEff = $prod->getOrderBy("fg_viewed DESC LIMIT 0,6");
        $pc = new ProductAtCategory();
        ?>
                    <table class="table table-striped">
                        <?php 
        foreach ($mEff as $key => $obj) {
            $t = time() . rand(0, 100);
            $imgurl = $pc->imgURL . $obj->BaseArticleImageFile;
            if ($obj->BaseArticleImageFile == "") {
                $imgurl = $pc->noimage;
            }
            ?>
            <tr>
                <td>
                    <div class="view_prod">
                        <?php 
            echo $obj->BaseArticleNameENG;
            ?>
                    </div>
                </td>
                <td>
                    <?php 
            echo $obj->fg_viewed;
            ?>
                </td>
            </tr>

            <?php 
        }
        ?>
                    </table>
                </div>
                <hr>
                <div class="penjualan">
                    <h2 class="penjualan_money_h2" style="margin-bottom: 20px;">Most Added To Cart</h2>

                    <?php 
        $prod = new MProdModel();
        $mEff = $prod->getOrderBy("fg_carted DESC LIMIT 0,6");
        $pc = new ProductAtCategory();
        ?>
                    <table class="table table-striped">
                        <?php 
        foreach ($mEff as $key => $obj) {
            $t = time() . rand(0, 100);
            $imgurl = $pc->imgURL . $obj->BaseArticleImageFile;
            if ($obj->BaseArticleImageFile == "") {
                $imgurl = $pc->noimage;
            }
            ?>
                            <tr>
                                <td>
                                    <div class="view_prod">
                                        <?php 
            echo $obj->BaseArticleNameENG;
            ?>
                                    </div>
                                </td>
                                <td>
                                    <?php 
            echo $obj->fg_viewed;
            ?>
                                </td>
                            </tr>

                        <?php 
        }
        ?>
                    </table>
                </div>
            </div>


        </div>

        <div class="col-md-8">

            <div class="penjualan_container">
                <div class="penjualan">
                    <h2 class="penjualan_money_h2" style="margin-bottom: 20px;">Most Effective Products</h2>

                    <?php 
        $prod = new MProdModel();
        $mEff = $prod->getOrderBy("fg_cb DESC LIMIT 0,6");
        $pc = new ProductAtCategory();
        foreach ($mEff as $key => $obj) {
            $t = time() . rand(0, 100);
            $imgurl = $pc->imgURL . $obj->BaseArticleImageFile;
            if ($obj->BaseArticleImageFile == "") {
                $imgurl = $pc->noimage;
            }
            ?>
                    <div class="product_list_item col-md-4 noborder">
                        <div class="product_list_item_dalaman">

                            <div id="imgasli_<?php 
            echo $obj->VariantID;
            ?>
_<?php 
            echo $t;
            ?>
" class="product_list_item_img">

                                <a title="<?php 
            echo $obj->BaseArticleNameENG;
            ?>
"
                                   href="<?php 
            echo _SPPATH;
            ?>
pr/p/<?php 
            echo $obj->VariantID;
            ?>
/<?php 
            echo ProductAtCategory::bersihkanNama($obj->BaseArticleNameENG);
            ?>
">
                                    <img id="imgTarget_<?php 
            echo $obj->VariantID;
            ?>
" src="<?php 
            echo $imgurl;
            ?>
">
                                </a>
                            </div>

                            <div class="product_list_item_text">
                                <div class="name" style="text-align: center;">
                                    <a title="<?php 
            echo $obj->BaseArticleNameENG;
            ?>
"
                                       href="<?php 
            echo _SPPATH;
            ?>
pr/p/<?php 
            echo $obj->VariantID;
            ?>
/<?php 
            echo ProductAtCategory::bersihkanNama($obj->BaseArticleNameENG);
            ?>
">
                                        <?php 
            echo $obj->BaseArticleNameENG;
            ?>
                                    </a>
                                </div>
                                <div class="fg" style="text-align: center; font-size: 25px; font-weight: bold;">
                                    <?php 
            echo round($obj->fg_cb, 3) * 100;
            ?>
 %
                                </div>

                            </div>
                        </div>
                        </div>
                        <?php 
        }
        //                    pr($mEff);
        ?>
                    <div class="clearfix"></div>
                </div>
</div>
            <div class="penjualan_container" style="margin-top: 20px;">

                <div class="penjualan">
                    <h2 class="penjualan_money_h2" style="margin-bottom: 20px;">Least Effective Products</h2>

                    <?php 
        $prod = new MProdModel();
        $mEff = $prod->getWhere("fg_cb>0 ORDER BY fg_cb ASC LIMIT 0,6");
        $pc = new ProductAtCategory();
        foreach ($mEff as $key => $obj) {
            $t = time() . rand(0, 100);
            $imgurl = $pc->imgURL . $obj->BaseArticleImageFile;
            if ($obj->BaseArticleImageFile == "") {
                $imgurl = $pc->noimage;
            }
            ?>
                        <div class="product_list_item col-md-4 noborder">
                            <div class="product_list_item_dalaman">

                                <div id="imgasli_<?php 
            echo $obj->VariantID;
            ?>
_<?php 
            echo $t;
            ?>
" class="product_list_item_img">

                                    <a title="<?php 
            echo $obj->BaseArticleNameENG;
            ?>
"
                                       href="<?php 
            echo _SPPATH;
            ?>
pr/p/<?php 
            echo $obj->VariantID;
            ?>
/<?php 
            echo ProductAtCategory::bersihkanNama($obj->BaseArticleNameENG);
            ?>
">
                                        <img id="imgTarget_<?php 
            echo $obj->VariantID;
            ?>
" src="<?php 
            echo $imgurl;
            ?>
">
                                    </a>
                                </div>

                                <div class="product_list_item_text">
                                    <div class="name" style="text-align: center;">
                                        <a title="<?php 
            echo $obj->BaseArticleNameENG;
            ?>
"
                                           href="<?php 
            echo _SPPATH;
            ?>
pr/p/<?php 
            echo $obj->VariantID;
            ?>
/<?php 
            echo ProductAtCategory::bersihkanNama($obj->BaseArticleNameENG);
            ?>
">
                                            <?php 
            echo $obj->BaseArticleNameENG;
            ?>
                                        </a>
                                    </div>
                                    <div class="fg" style="text-align: center; font-size: 25px; font-weight: bold;">
                                        <?php 
            echo round($obj->fg_cb, 3) * 100;
            ?>
 %
                                    </div>

                                </div>
                            </div>
                        </div>
                    <?php 
        }
        //                    pr($mEff);
        ?>
                    <div class="clearfix"></div>
                </div>
            </div>
            </div>

        </div>

        <style>
            .penjualan_container{
                border: 1px solid #dedede;
                background-color: white;
                padding: 20px;
            }
            .penjualan_money_h2{
                padding: 0;
                margin: 0;
                font-size: 20px;
                margin-bottom: 20px;
                color: #666666;
            }
            .penjualan_money{
                font-size: 25px;
            }
            .penjualan{
                margin-bottom: 20px;
            }
        </style>
<?php 
    }
    function mycart()
    {
        $cartModel = new CartPortal();
        $arr = CartWeb::myCart();
        //        pr($arr);
        //        $mm = new MTranDetail();
        //        $mm->printColumlistAsAttributes();
        if (count($arr) > 0) {
            $rules = MCPRule::getRules();
            $rule2varians = MCPRule::getRules2Variant();
            $cart_rules = MCPRCartRule::getRules();
            //            $cart_rule2varians = MCPRCartRule::getRules2Variant();
            //            pr($cart_rule2varians);
            //            pr($cart_rules);
            ?>
<!--            <div class="monly" style="margin-top: 80px;"></div>-->
            <h1 class="tbs">YOUR SHOPPING BAG</h1>
            <div class="monly">
                <?php 
            $pc = new ProductAtCategory();
            $total = 0;
            $totaldiskon = 0;
            foreach ($arr as $ss) {
                $obj = new MProdModel();
                $obj->getByID($ss->variant_id);
                $imgurl = $pc->imgURL . $obj->BaseArticleImageFile;
                if ($obj->BaseArticleImageFile == "") {
                    $imgurl = $pc->noimage;
                }
                //durchlaufen disini ..thd rule
                if (count($rule2varians[$obj->VariantID]) > 0) {
                    $uuss = $rule2varians[$obj->VariantID];
                    //set icon
                    $obj->rule_icon = _SPPATH . _PHOTOURL . $rules[$uuss[0]]->rule_icon;
                    //                            pr($uu);
                    //diskon
                    $diskon = 0;
                    foreach ($uuss as $ruleygkena) {
                        $r = $rules[$ruleygkena];
                        $diskon = max($r->rule_discount, $diskon);
                    }
                    $obj->rule_discount = $diskon;
                } else {
                    $obj->rule_icon = "";
                    //default rule icon
                    $obj->rule_discount = 0;
                }
                //                        $totaldiskon += $obj->rule_discount/100*$obj->SellingPrice;
                $obj->final_price = (100 - $obj->rule_discount) / 100 * $obj->SellingPrice;
                $total += $ss->qty * $obj->final_price;
                ?>
                    <div style="background-color: #f6f6f6; padding: 10px; margin: 5px;">
                    <div class="col-sm-6 col-xs-6" style="text-align: center;">
                        <img width="100%" src="<?php 
                echo $imgurl;
                ?>
">
                        <div style="margin-top: 10px; margin-bottom: 10px;">
                            <?php 
                echo $obj->VariantNameENG;
                ?>
                        </div>


                        <a onclick="removeFromCart('<?php 
                echo $obj->VariantID;
                ?>
');" class="remove">remove <i class="glyphicon glyphicon-play"></i></a>

                    </div>
                    <div class="col-sm-6 col-xs-6" style="padding-top: 10px;">
                        <div class="col-sm-6 col-xs-6" style="text-align: right;line-height: 34px;">Qty &nbsp; </div>
                        <div class="col-sm-6 col-xs-6">
                            <select onchange="updateQtyCart('<?php 
                echo $obj->VariantID;
                ?>
',$(this).val());" class="form-control">
                                <?php 
                for ($x = 1; $x < 10; $x++) {
                    ?>
                                    <option <?php 
                    if ($ss->qty == $x) {
                        echo "selected";
                    }
                    ?>
 value="<?php 
                    echo $x;
                    ?>
"><?php 
                    echo $x;
                    ?>
</option>
                                <?php 
                }
                ?>
                            </select>
                        </div>
                        <div class="clearfix"></div>
                        <div style="text-align: right; margin-top: 20px;">
                            <?php 
                if ($obj->final_price != $obj->SellingPrice) {
                    ?>
                                 Price <br><i class="oldprice" style="font-size: 12px; text-decoration: line-through;"><?php 
                    echo idr($obj->SellingPrice);
                    ?>
</i><br>
                                <br>
                            <?php 
                }
                ?>

                             Item Price <br><i class="newprice"><?php 
                echo idr($obj->final_price);
                ?>
</i>
                        </div>

                    </div>
                    <div class="clearfix"></div>
                        <hr class="dotted">
                        <h3 style="text-align: right;">
                            IDR <?php 
                echo idr($ss->qty * $obj->final_price);
                ?>
                        </h3>
                    </div>
                <?php 
            }
            ?>
            </div>
            <div class="table-responsive donly">
                <table class="table tbs table-bordered table-striped">
                    <thead>
                    <tr>
                        <th>
                            PRODUCT
                        </th>
                        <th>QUANTITY</th>
                        <th>UNIT PRICE</th>
                        <th>TOTAL</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php 
            $pc = new ProductAtCategory();
            $total = 0;
            $totaldiskon = 0;
            foreach ($arr as $ss) {
                $obj = new MProdModel();
                $obj->getByID($ss->variant_id);
                $imgurl = $pc->imgURL . $obj->BaseArticleImageFile;
                if ($obj->BaseArticleImageFile == "") {
                    $imgurl = $pc->noimage;
                }
                //durchlaufen disini ..thd rule
                if (count($rule2varians[$obj->VariantID]) > 0) {
                    $uuss = $rule2varians[$obj->VariantID];
                    //set icon
                    $obj->rule_icon = _SPPATH . _PHOTOURL . $rules[$uuss[0]]->rule_icon;
                    //                            pr($uu);
                    //diskon
                    $diskon = 0;
                    foreach ($uuss as $ruleygkena) {
                        $r = $rules[$ruleygkena];
                        $diskon = max($r->rule_discount, $diskon);
                    }
                    $obj->rule_discount = $diskon;
                } else {
                    $obj->rule_icon = "";
                    //default rule icon
                    $obj->rule_discount = 0;
                }
                //                        $totaldiskon += $obj->rule_discount/100*$obj->SellingPrice;
                $obj->final_price = (100 - $obj->rule_discount) / 100 * $obj->SellingPrice;
                $total += $ss->qty * $obj->final_price;
                ?>
                        <tr>
                            <td>
                                <div class="product_list_item_img_cart">
                                    <img src="<?php 
                echo $imgurl;
                ?>
">
                                </div>
                                <div class="product_name">
                                    <?php 
                echo $obj->VariantNameENG;
                ?>
                                </div>
                            </td>
                            <td style="text-align: center;">
                                <select onchange="updateQtyCart('<?php 
                echo $obj->VariantID;
                ?>
',$(this).val());" class="form-control">
                                    <?php 
                for ($x = 1; $x < 10; $x++) {
                    ?>
                                        <option <?php 
                    if ($ss->qty == $x) {
                        echo "selected";
                    }
                    ?>
 value="<?php 
                    echo $x;
                    ?>
"><?php 
                    echo $x;
                    ?>
</option>
                                    <?php 
                }
                ?>
                                </select>
                                <a onclick="removeFromCart('<?php 
                echo $obj->VariantID;
                ?>
');" class="remove">remove <i class="glyphicon glyphicon-play"></i></a>
                            </td>
                            <td class="sprice">
                                <?php 
                if ($obj->final_price != $obj->SellingPrice) {
                    ?>
                                <i class="oldprice" style="font-size: 12px; text-decoration: line-through;"><?php 
                    echo idr($obj->SellingPrice);
                    ?>
</i><br>
                            <?php 
                }
                ?>
                                <i class="newprice"><?php 
                echo idr($obj->final_price);
                ?>
</i>
                            </td>
                            <td class="sprice"><?php 
                echo idr($ss->qty * $obj->final_price);
                ?>
</td>
                        </tr>
                        <?php 
            }
            ?>
                    </tbody>
                </table>
                <script>
                    function updateQtyCart(id,qty){
                        $.post("<?php 
            echo _SPPATH;
            ?>
CartWeb/updateQty",{
                            id:id,qty:qty
                        },function(data){
//                           alert(data);
                            if(data.bool){
                                location.reload();
                            }else{
                                alert("Error");
                            }
                        },'json');
                    }
                    function removeFromCart(id){
                        $.post("<?php 
            echo _SPPATH;
            ?>
CartWeb/removeFrom",{
                            id:id
                        },function(data){
//                           alert(data);
                            if(data.bool){
                                location.reload();
                            }else{
                                alert("Error");
                            }
                        },'json');
                    }
                </script>
            </div>
            <div class="col-md-7" style="padding-right: 0px; padding-left: 0px;">
            <div class="col-md-6  col-sm-6 col-xs-6 donly" style="border: 1px solid #dedede; height: 150px;">

                <h4 style="color: #E2007A;">Is this a Gift?</h4>
                <div class="col-md-4 col-sm-6 col-xs-6" style="padding-left: 0px;">
                    <img width="100%" src="<?php 
            echo _SPPATH;
            ?>
images/bagm_l.jpg">
                </div>
                <div class="col-md-8  col-sm-6 col-xs-6" style="margin-top: 20px;">
                    <button class="btn btn-success" style="background-color: #7fb719;border-color: #7fb719;">ADD GIFT OPTION</button>
                </div>

            </div>
            <div class="col-md-6  col-sm-6 col-xs-6 donly" style="padding: 0px !important;" >
                <div style="1px solid #DDEBA9;background-color: #F3FAD9;
                margin-left: 15px; margin-right: 15px; padding: 10px; height: 150px;">
                    <h4 style="color: #E2007A; padding: 0; margin: 0; margin-bottom: 10px;">Promotion Codes</h4>
                    <p style="font-size: 12px;">If you have a promotion code, please add it here...</p>
                    <input type="text" class="form-control" placeholder="code" style="width: 100px;display: inline;">
                    <button class="btn btn-success" style="background-color: #7fb719;vertical-align: top;border-color: #7fb719;">VERIFY CODE</button>
                </div>

            </div>
                <div class="clearfix"></div>

                <div  class="rule_applied" style="<?php 
            if (count($cart_rules) < 1) {
                echo "display:none;";
            }
            ?>
">
                    <h5 style="margin-top: 0; padding-top: 0;">Applicable Promotions</h5>
                    <?php 
            $numpromo = 0;
            foreach ($cart_rules as $crules) {
                if ($crules->rule_apply_to == "by_percent") {
                    if ($total >= $crules->rule_amount_limit) {
                        $numpromo++;
                        ?>

                                *<?php 
                        echo $crules->rule_name;
                        ?>
<br>
                            <?php 
                    }
                }
                if ($crules->rule_apply_to == "free_shipping") {
                    if ($total >= $crules->rule_amount_limit) {
                        $numpromo++;
                        ?>
                                *<?php 
                        echo $crules->rule_name;
                        ?>
<br>
                                <?php 
                    }
                }
            }
            ?>
                </div>
                <div class="clearfix monly" style="margin-bottom: 10px;"></div>
                <script>
                    <?php 
            if ($numpromo < 1) {
                ?>
                    $(document).ready(function(){
                        $('.rule_applied').hide();
                    });
                <?php 
            }
            ?>
                </script>
                <style>
                    .rule_applied{
                        margin-top: 10px; background-color: #f6f6f6; padding: 10px; margin-right: 15px;
                    }
                </style>

            </div>
            <div class="col-md-5" style="padding-right: 0px; padding-left: 0px;">

                <?php 
            $cartdiskon = 0;
            $isFreeShipping = 0;
            foreach ($cart_rules as $crules) {
                if ($crules->rule_apply_to == "by_percent") {
                    if ($total >= $crules->rule_amount_limit) {
                        $cartdiskon = max($cartdiskon, $crules->rule_discount);
                    }
                }
                if ($crules->rule_apply_to == "free_shipping") {
                    if ($total >= $crules->rule_amount_limit) {
                        $isFreeShipping = 1;
                    }
                }
            }
            $cartdikonharga = $cartdiskon / 100 * $total;
            $totaldiskon = $totaldiskon + $cartdikonharga;
            ?>
                <div class="subtotal">
                    <h4 style="color: #444444;">
                        <div class="col-md-7 col-sm-6 col-xs-6" style="padding: 0px;">
                            Subtotal
                        </div>
                        <div class="col-md-5 col-sm-6 col-xs-6" style="padding: 0px;">
                            IDR <?php 
            echo idr($total);
            ?>
                        </div> <div class="clearfix"></div>
                    </h4>
                    <h4 style="color: #E2007A;">
                        <div class="col-md-7 col-sm-6 col-xs-6" style="padding: 0px;">
                           Extra Discount
                        </div>
                        <div class="col-md-5 col-sm-6 col-xs-6" style="padding: 0px;">
                            IDR <?php 
            echo idr($totaldiskon);
            ?>
                        </div><div class="clearfix"></div>
                    </h4>
<!--                    <h4 style="color: #E2007A;">-->
<!--                        <div class="col-md-7" style="padding: 0px;">-->
<!--                            Loyalty Programme Voucher-->
<!--                        </div>-->
<!--                        <div class="col-md-5" style="padding: 0px;">-->
<!--                            IDR 0-->
<!--                        </div><div class="clearfix"></div>-->
<!--                    </h4>-->
                    <div class="clearfix"></div>
                    <hr>
                    <h4>
                        <div class="col-md-7 col-sm-6 col-xs-6"  style="padding: 0px;">
                            Delivery
                        </div>
                        <div class="col-md-5 col-sm-6 col-xs-6" style="padding: 0px;">
                            <select <?php 
            if ($isFreeShipping) {
                ?>
disabled<?php 
            }
            ?>
>
                                <?php 
            if ($isFreeShipping) {
                ?>
                                    <option>Free Delivery IDR 0</option>
                                <?php 
            }
            ?>
                                <option>delivery1 IDR 30.000</option>
                                <option>cepat IDR 50.000</option>
                            </select>
                        </div><div class="clearfix"></div>
                         </h4>
                    <hr>
                    <h3>Total IDR <?php 
            echo idr($total - $totaldiskon);
            ?>
</h3>
                </div>
                <div style="text-align: right; padding-top: 20px;">
                    <button id="checkoutButton" class="btn btn-success btn-lg" style="background-color: #E2007A;border-color:#E2007A; ">
                        CHECK OUT SECURELY NOW <i class="glyphicon glyphicon-play"></i> </button>
<script>
    $('#checkoutButton').click(function(){
        $.post("<?php 
            echo _SPPATH;
            ?>
CartWeb/isiCart",{
            totalplusdiskon : <?php 
            echo $total - $totaldiskon;
            ?>
,
            total : <?php 
            echo $total;
            ?>
,
            diskon : <?php 
            echo $totaldiskon;
            ?>
        },function(data){
            if(data.bool){
                document.location = "<?php 
            echo _SPPATH;
            ?>
checkout";
            }
            else{
                alert("error");
            }
        },'json');
    });
</script>
                </div>
                  </div>
            <div class="clearfix"></div>
            <div class="monly" style="margin-top: 30px;"></div>
            <div class="lanjut">
                <a href="<?php 
            echo _SPPATH;
            ?>
">continue shopping</a>
            </div>
            <style>
                a.remove{
                  color: #888888;
                    font-size: 12px;
                    cursor: pointer;
                }
                .subtotal{
                    border: 1px solid #BBBBBB;color: #666666; background-color: #EBEBEB; text-align: right;
                    padding-right: 10px;
                    padding-left: 10px;;
                }
                .subtotal hr{

                    border:1px dashed #999999;
                }
                .subtotal h4{
                    font-size: 16px;
                }
                h1.tbs{

                    clear: both;
                    color: #7FB719;
                    margin-top:50px;
                    font: 40px bebasneue,Impact,Charcoal,sans-serif;
                }
                .product_list_item_img_cart {
                    width: 80px;
                    height: 80px;
                    overflow: hidden;
                    margin: 5px;
                    text-align: center;
                    float: left;

                }

                .product_list_item_img_cart img{
                    max-width: 100%;
                    max-height: 100%;
                }
                .product_name{
                    margin-left: 100px;
                    height: 90px;
                    font-weight: bold;
                    color: #777777;
                    line-height: 90px;
                    text-overflow: ellipsis;

                    overflow: hidden;
                    /*white-space:nowrap;*/
                    display: -webkit-box;
                    -webkit-line-clamp: 1;
                    -webkit-box-orient: vertical;
                }
                table.tbs thead{
                    background-color: #dedede;

                }
                table.tbs thead th{
                    text-align: center;
                }
                .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
                    vertical-align: middle;
                }
                .sprice{

                    text-align: right;
                    font-weight: bold;
                    color :#888888;

                }
            </style>
        <?php 
        } else {
            ?>
            <h1 style="margin-top: 50px; margin-bottom: 50px; text-align: center">Empty BAG</h1>

        <?php 
        }
    }
Пример #11
0
 function search()
 {
     $q = addslashes($_GET['qsearch']);
     //        echo $q;
     $n = new MProdModel();
     $m = new MArticleTagging();
     $z = new MProdCat();
     $tambahan = "({$n->table_name}.BaseArticleNameENG LIKE '%{$q}%' OR {$n->table_name}.VariantNameENG LIKE '%{$q}%'  OR {$n->table_name}.VariantID LIKE '%{$q}%')";
     $arrN = $n->getWhereFromMultipleTable("{$n->table_name}.BaseArticleID = ecommultiple__articletagging.BaseArticleID AND {$tambahan}", array("MArticleTagging"));
     //        pr($arrN);
     $obj = new Pr();
     $obj->results = $arrN;
     ProductAtCategory::printer($obj, "", "", "", "", 3);
     MSearchLog::saveSLog($q);
 }