});
</script>

<div class="container">
<div class="intro-image" style="padding-top: 20px;">
    <img width="100%" src="<?php 
echo _SPPATH . _PHOTOURL . $cp->camp_welcome_pic;
?>
">
</div>

<div class="camp-images">
    <?php 
//    pr($prods);
foreach ($prods as $num => $prod) {
    $src = Pwa::getMainPic($prod);
    ?>
<div class="product col-md-4">
    <div class="product_dalaman">
        <div class="product_pic">
            <a href="<?php 
    echo _LANGPATH;
    ?>
pwa/p/<?php 
    echo $prod->prod_id;
    ?>
/<?php 
    echo urlencode($prod->prod_name);
    ?>
">
                <img src="<?php 
Exemplo n.º 2
0
    function show()
    {
        $arr = self::getCart();
        $arr_bulk = self::getCartBulk();
        //pr($arr_bulk);
        //pr($arr);
        //$qty = isset($_GET['qty'])?addslashes($_GET['qty']):1;
        $out_of_stock = 0;
        $arrOOS = self::cekStok();
        //pr($arrOOS);
        $out_of_stock = count($arrOOS);
        ?>
<style>
    h1.order{
        padding: 0;
margin: 0;
color: #111;
font-style: italic;
font-family: 'Libre Baskerville', serif;
font-size: 32px;
margin-bottom: 20px;
    }
    #fullholder{
        background-color: #efefef;
    }
    .foto100 img{
        width: 100px;
        
    }
    .headertab th{
        text-align: center;
    }
    tr.headertab{
        background-color: #efefef;
    }
    td.rp{
        text-align: right;
        
    }
    .image_oos{
        border:1px solid red;
    }
    

</style>
<style>
#squaresWaveG{
position:relative;
width:50px;
height:6px}

.squaresWaveG{
position:absolute;
top:0;
background-color:#C2C2C2;
width:6px;
height:6px;
-moz-animation-name:bounce_squaresWaveG;
-moz-animation-duration:1.3s;
-moz-animation-iteration-count:infinite;
-moz-animation-direction:linear;
-webkit-animation-name:bounce_squaresWaveG;
-webkit-animation-duration:1.3s;
-webkit-animation-iteration-count:infinite;
-webkit-animation-direction:linear;
-ms-animation-name:bounce_squaresWaveG;
-ms-animation-duration:1.3s;
-ms-animation-iteration-count:infinite;
-ms-animation-direction:linear;
-o-animation-name:bounce_squaresWaveG;
-o-animation-duration:1.3s;
-o-animation-iteration-count:infinite;
-o-animation-direction:linear;
animation-name:bounce_squaresWaveG;
animation-duration:1.3s;
animation-iteration-count:infinite;
animation-direction:linear;
}

#squaresWaveG_1{
left:0;
-moz-animation-delay:0.52s;
-webkit-animation-delay:0.52s;
-ms-animation-delay:0.52s;
-o-animation-delay:0.52s;
animation-delay:0.52s;
}

#squaresWaveG_2{
left:7px;
-moz-animation-delay:0.65s;
-webkit-animation-delay:0.65s;
-ms-animation-delay:0.65s;
-o-animation-delay:0.65s;
animation-delay:0.65s;
}

#squaresWaveG_3{
left:14px;
-moz-animation-delay:0.78s;
-webkit-animation-delay:0.78s;
-ms-animation-delay:0.78s;
-o-animation-delay:0.78s;
animation-delay:0.78s;
}

#squaresWaveG_4{
left:21px;
-moz-animation-delay:0.91s;
-webkit-animation-delay:0.91s;
-ms-animation-delay:0.91s;
-o-animation-delay:0.91s;
animation-delay:0.91s;
}

#squaresWaveG_5{
left:28px;
-moz-animation-delay:1.04s;
-webkit-animation-delay:1.04s;
-ms-animation-delay:1.04s;
-o-animation-delay:1.04s;
animation-delay:1.04s;
}

#squaresWaveG_6{
left:35px;
-moz-animation-delay:1.17s;
-webkit-animation-delay:1.17s;
-ms-animation-delay:1.17s;
-o-animation-delay:1.17s;
animation-delay:1.17s;
}

#squaresWaveG_7{
left:42px;
-moz-animation-delay:1.3s;
-webkit-animation-delay:1.3s;
-ms-animation-delay:1.3s;
-o-animation-delay:1.3s;
animation-delay:1.3s;
}

#squaresWaveG_8{
left:49px;
-moz-animation-delay:1.43s;
-webkit-animation-delay:1.43s;
-ms-animation-delay:1.43s;
-o-animation-delay:1.43s;
animation-delay:1.43s;
}

@-moz-keyframes bounce_squaresWaveG{
0%{
background-color:#C2C2C2;
}

100%{
background-color:#FFFFFF;
}

}

@-webkit-keyframes bounce_squaresWaveG{
0%{
background-color:#C2C2C2;
}

100%{
background-color:#FFFFFF;
}

}

@-ms-keyframes bounce_squaresWaveG{
0%{
background-color:#C2C2C2;
}

100%{
background-color:#FFFFFF;
}

}

@-o-keyframes bounce_squaresWaveG{
0%{
background-color:#C2C2C2;
}

100%{
background-color:#FFFFFF;
}

}

@keyframes bounce_squaresWaveG{
0%{
background-color:#C2C2C2;
}

100%{
background-color:#FFFFFF;
}

}

</style>


<div id="squaresWaveG" style="display:none; float: right; margin-right: 20px;">
<div id="squaresWaveG_1" class="squaresWaveG">
</div>
<div id="squaresWaveG_2" class="squaresWaveG">
</div>
<div id="squaresWaveG_3" class="squaresWaveG">
</div>
<div id="squaresWaveG_4" class="squaresWaveG">
</div>
<div id="squaresWaveG_5" class="squaresWaveG">
</div>
<div id="squaresWaveG_6" class="squaresWaveG">
</div>
<div id="squaresWaveG_7" class="squaresWaveG">
</div>
<div id="squaresWaveG_8" class="squaresWaveG">
</div>
</div>
<h1 class="order">Order Form </h1>

<div id="out_of_stock_alert" class="alert alert-danger" style="<?php 
        if (!$out_of_stock) {
            ?>
display:none;<?php 
        }
        ?>
">
        Jumlah Stok Tidak Mencukupi, Kurangi Jumlah Pesanan atau hapus pesanan anda.
 </div>

<div class="table-responsive">
    <table class="table table-bordered" style="background-color: #fff;">
    <thead>
        <tr class="headertab">
            <th><?php 
        echo Lang::t('No');
        ?>
</th>
            <th><?php 
        echo Lang::t('Image');
        ?>
</th>
            <th><?php 
        echo Lang::t('Name');
        ?>
</th>
            <th><?php 
        echo Lang::t('Price');
        ?>
</th>
            <th><?php 
        echo Lang::t('Qty');
        ?>
</th>
            <th><?php 
        echo Lang::t('Total');
        ?>
</th>
        </tr>
    </thead>
    <input type="hidden" value="<?php 
        echo $this->beratkardus;
        ?>
" id="beratkardus">
        <?php 
        $no = 0;
        $totalanb = 0;
        //isi berat awal
        $totalberat = $this->beratkardus;
        foreach ($arr_bulk as $numb => $objb) {
            $pid = $objb['id'];
            if ($pid == "" || $pid < 1) {
                continue;
            }
            $exp = explode(",", $pid);
            $no++;
            //berat paket
            $beratpaket = 0;
            //get all product
            $arrProd = array();
            $out_of_stock_bulk = 0;
            foreach ($exp as $numc => $obj_real) {
                $p = new ProdModel();
                $p->getByID($obj_real);
                $src = Pwa::getMainPic($p);
                $p->src = $src;
                $arrProd[] = $p;
                $beratpaket += $p->prod_berat_gram;
                if (in_array($obj_real, $arrOOS)) {
                    $out_of_stock_bulk = 1;
                }
            }
            ?>
    <input type="hidden" value="<?php 
            echo $beratpaket;
            ?>
" id="beratpaket_<?php 
            echo $numb;
            ?>
">
    <tr>
        <td><?php 
            echo $no;
            ?>
</td>
        <td>
            <?php 
            foreach ($arrProd as $numd => $prod) {
                ?>
            <div class="imageprod prod_<?php 
                echo $prod->prod_id;
                ?>
" style="width: 80px; height: 80px; overflow: hidden; float:left;">
                <img  src="<?php 
                echo $prod->src['thumbs'];
                ?>
" style="height:80px;">
            </div>
            <?php 
            }
            ?>
                
        </td>
        <td>
            <?php 
            foreach ($arrProd as $numd => $prod) {
                ?>
            <div class="prod_cart_name">
                <a target="_blank" href="<?php 
                echo _SPPATH;
                ?>
pwa/p/<?php 
                echo $prod->prod_id;
                ?>
/<?php 
                echo urlencode($prod->prod_name);
                ?>
">
                <?php 
                echo $prod->prod_name;
                ?>
                </a>
            </div>
            <?php 
            }
            ?>
            <i title='Remove Item from Cart' onclick="document.location='<?php 
            echo _SPPATH;
            ?>
cartweb/remItemBulk?id=<?php 
            echo $numb;
            ?>
';" style="cursor: pointer;" class="glyphicon glyphicon-remove"></i>
     
        </td>
        <td class="rp">
            <?php 
            $total_satu_bulk = 0;
            foreach ($arrProd as $numd => $prod) {
                $total_satu_bulk += $prod->prod_bulk_price;
            }
            echo "Rp." . rupiah($total_satu_bulk);
            ?>
                
        </td>
        <td style="text-align: center;">
            
            
            
        <input type="hidden" value="<?php 
            echo $total_satu_bulk;
            ?>
" id="hargabarubulk_<?php 
            echo $numb;
            ?>
">
        <select id="selectbulk_<?php 
            echo $numb;
            ?>
" >
        <?php 
            for ($x = 1; $x <= $this->max_order_qty_bulk; $x++) {
                ?>
        <option <?php 
                if ($objb['qty'] == $x) {
                    echo 'selected';
                }
                ?>
 value="<?php 
                echo $x;
                ?>
"><?php 
                echo $x;
                ?>
</option>
        <?php 
            }
            ?>
        </select>
        <script>
        $('#selectbulk_<?php 
            echo $numb;
            ?>
').change(function(){
            var slc = $('#selectbulk_<?php 
            echo $numb;
            ?>
').val();
            $('#squaresWaveG').show();
            $.get('<?php 
            echo _SPPATH;
            ?>
CartWeb/addQtyBulk?id=<?php 
            echo $numb;
            ?>
&qty='+slc,function(data){
                //alert(data);
                var slc = $('#selectbulk_<?php 
            echo $numb;
            ?>
').val();
                if(data.bool){
                    $('#out_of_stock').val('0');
                    $('#out_of_stock_alert').hide();
                    $('.imageprod').removeClass('image_oos');
                }else{
                    alert(data.err);
                    $('#out_of_stock_alert').show();
                    $('#out_of_stock').val('1');
                    var arr = data.oos;
                    $('.imageprod').removeClass('image_oos');
                    for(var key=0;key<arr.length;key++){
                        $('.prod_'+arr[key]).addClass('image_oos');
                    }
                }
                $('#squaresWaveG').hide();
                
            },'json');
                var hargabaru = $('#hargabarubulk_<?php 
            echo $numb;
            ?>
').val();
                var total = $('#totalAllHide').val();
                var subtotalLama = parseInt($('#subtotalhide_bulk_<?php 
            echo $numb;
            ?>
').val());


                var a = parseInt(slc);
                var harga = parseInt(hargabaru);
                var totalAll = parseInt(total);

                var subtotal = a*harga;
                var diff = subtotal-subtotalLama;
                //console.log(subtotal);
                $('#subtotal_bulk_<?php 
            echo $numb;
            ?>
').html('Rp.'+NilaiRupiah(subtotal)+',-');
                $('#subtotalhide_bulk_<?php 
            echo $numb;
            ?>
').val(subtotal);

                $('#totalAll').html('Rp.'+NilaiRupiah(totalAll+diff)+',-');

                $('#totalAllHide').val(totalAll+diff);
            
                //update berat
                
                var beratpaket = parseInt($('#beratpaket_<?php 
            echo $numb;
            ?>
').val());
                var beratretail = parseInt($('#beratretail').val());
                var beratkardus= parseInt($('#beratkardus').val());
                //isi ke tempatnya
                var kg = (beratkardus+beratretail+(beratpaket*slc))/1000;
                
                $('#jneweight').html(kg);
                $('#beratbulk').val(beratpaket*slc);
                $('#jneweight_hidden').val((beratkardus+beratretail+(beratpaket*slc)));
                
                var jne_kg_price = $('#jneprice_hidden').val();
                
                //hitung berdasarkan grenze
                var kg_batas = Math.floor(kg)+parseFloat(<?php 
            echo $this->jne_grenze;
            ?>
);
                if(kg>=kg_batas){
                    kg = Math.ceil(kg);
                }else{
                    kg = Math.floor(kg);
                }
                
                
                $('#totalShipCost').html('<b>Rp.'+NilaiRupiah(jne_kg_price*kg)+',-</b>');
                $('#totalAllPlusShipCost').html('<b>Rp.'+NilaiRupiah(totalAll+diff+(jne_kg_price*kg))+',-</b>');
                
                //for calculate
                $('#totalShipCost_hidden').val(jne_kg_price*kg);
                $('#totalAllPlusShipCost_hidden').val(totalAll+diff+(jne_kg_price*kg));
        });    
        
        
        </script>
            
        </td>
        <input type="hidden" value="<?php 
            echo $total_satu_bulk * $objb['qty'];
            ?>
" id="subtotalhide_bulk_<?php 
            echo $numb;
            ?>
">
        <td class="rp" id="subtotal_bulk_<?php 
            echo $numb;
            ?>
">
            
            Rp.<?php 
            echo rupiah($total_satu_bulk * $objb['qty']);
            ?>
        </td>
    </tr>
            <?php 
            $totalanb += $total_satu_bulk * $objb['qty'];
            $totalberat += $beratpaket * $objb['qty'];
        }
        $totalan = $totalanb;
        //simpan berat bulk
        ?>
    <input type="hidden" value="<?php 
        echo $totalberat - $this->beratkardus;
        ?>
" id="beratbulk">   
    <input type="hidden" value="<?php 
        echo $totalanb;
        ?>
" id="hargabulk"> 
        <?php 
        //$no = 0;
        //$totalan=0;
        $beratretail = 0;
        foreach ($arr as $num => $obj) {
            $pid = $obj['id'];
            if ($pid == "" || $pid < 1) {
                continue;
            }
            $no++;
            $p = new ProdModel();
            $p->getByID($pid);
            if ($p->prod_diskon > 0) {
                $hrgbaru = ceil((100 - $p->prod_diskon) / 100 * $p->prod_price);
            } else {
                $hrgbaru = $p->prod_price;
            }
            $hrgbaru = $p->prod_satuan_price;
            $totalan += $hrgbaru * $obj['qty'];
            $src = Pwa::getMainPic($p);
            //obj
            $out_of_stock_satuan = 0;
            if (in_array($pid, $arrOOS)) {
                $out_of_stock_satuan = 1;
            }
            //isi berat
            $totalberat += $p->prod_berat_gram * $obj['qty'];
            $beratretail += $p->prod_berat_gram * $obj['qty'];
            ?>
<tr>
    <td><?php 
            echo $no;
            ?>
</td>
    <td><div class="foto100 imageprod prod_<?php 
            echo $p->prod_id;
            ?>
">
        <img  src="<?php 
            echo $src['thumbs'];
            ?>
">
        </div></td>
    
        <td><a target="_blank" href="<?php 
            echo _SPPATH;
            ?>
pwa/p/<?php 
            echo $p->prod_id;
            ?>
/<?php 
            echo urlencode($p->prod_name);
            ?>
">
        <?php 
            echo $p->prod_name;
            ?>
            </a>
            <i title='Remove Item from Cart' onclick="document.location='<?php 
            echo _SPPATH;
            ?>
cartweb/remItem?id=<?php 
            echo $p->prod_id;
            ?>
';" style="cursor: pointer;" class="glyphicon glyphicon-remove"></i>
    </td>
    <td class="rp">Rp.<?php 
            echo rupiah($hrgbaru);
            ?>
</td>
    <td style="text-align: center;">
        
        
        
        <input type="hidden" value="<?php 
            echo $hrgbaru;
            ?>
" id="hargabaru_<?php 
            echo $p->prod_id;
            ?>
">
        <input type="hidden" value="<?php 
            echo $p->prod_berat_gram;
            ?>
" id="beratproduk_<?php 
            echo $p->prod_id;
            ?>
">
        <select id="select_<?php 
            echo $p->prod_id;
            ?>
" >
        <?php 
            for ($x = 1; $x <= $this->max_order_qty_satuan; $x++) {
                ?>
        <option <?php 
                if ($obj['qty'] == $x) {
                    echo 'selected';
                }
                ?>
 value="<?php 
                echo $x;
                ?>
"><?php 
                echo $x;
                ?>
</option>
        <?php 
            }
            ?>
        </select>
        <script>
        $('#select_<?php 
            echo $p->prod_id;
            ?>
').change(function(){
            var slc = $('#select_<?php 
            echo $p->prod_id;
            ?>
').val();
            $('#squaresWaveG').show();
            $.get('<?php 
            echo _SPPATH;
            ?>
CartWeb/addQty?id=<?php 
            echo $p->prod_id;
            ?>
&qty='+slc,function(data){
                //alert(data);
                console.log(data);
                var slc = $('#select_<?php 
            echo $p->prod_id;
            ?>
').val();
                $('#squaresWaveG').hide();
                if(data.bool){
                    $('#out_of_stock').val('0');
                    $('#out_of_stock_alert').hide();
                    $('.imageprod').removeClass('image_oos');
                }else{
                    alert(data.err);
                    $('#out_of_stock_alert').show();
                    $('#out_of_stock').val('1');
                    var arr = data.oos;
                    $('.imageprod').removeClass('image_oos');
                    for(var key=0;key<arr.length;key++){
                        $('.prod_'+arr[key]).addClass('image_oos');
                    }
                }
            },'json');
            var hargabaru = $('#hargabaru_<?php 
            echo $p->prod_id;
            ?>
').val();
                var total = $('#totalAllHide').val();
                var subtotalLama = parseInt($('#subtotalhide_<?php 
            echo $p->prod_id;
            ?>
').val());


                var a = parseInt(slc);
                var harga = parseInt(hargabaru);
                var totalAll = parseInt(total);

                var subtotal = a*harga;
                var diff = subtotal-subtotalLama;
                //console.log(subtotal);
                $('#subtotal_<?php 
            echo $p->prod_id;
            ?>
').html('Rp.'+NilaiRupiah(subtotal)+',-');
                $('#subtotalhide_<?php 
            echo $p->prod_id;
            ?>
').val(subtotal);

                $('#totalAll').html('Rp.'+NilaiRupiah(totalAll+diff)+',-');

                $('#totalAllHide').val(totalAll+diff);
            
                //update berat
                
                var beratproduk = parseInt($('#beratproduk_<?php 
            echo $p->prod_id;
            ?>
').val());
                var beratbulk = parseInt($('#beratbulk').val());
                var beratkardus= parseInt($('#beratkardus').val());
                //isi ke tempatnya
                var kg = (beratkardus+beratbulk+(beratproduk*slc))/1000;
                $('#jneweight').html(kg);
                $('#beratretail').val(beratproduk*slc);
                $('#jneweight_hidden').val((beratkardus+beratbulk+(beratproduk*slc)));
                
                //hitung berdasarkan grenze
                var kg_batas = Math.floor(kg)+parseFloat(<?php 
            echo $this->jne_grenze;
            ?>
);
                if(kg>=kg_batas){
                    kg = Math.ceil(kg);
                }else{
                    kg = Math.floor(kg);
                }
                
                //hitung shipping cost
                var jne_kg_price = $('#jneprice_hidden').val();
                $('#totalShipCost').html('<b>Rp.'+NilaiRupiah(jne_kg_price*kg)+',-</b>');
                $('#totalAllPlusShipCost').html('<b>Rp.'+NilaiRupiah(totalAll+diff+(jne_kg_price*kg))+',-</b>');
                
                //for calculate
                $('#totalShipCost_hidden').val(jne_kg_price*kg);
                $('#totalAllPlusShipCost_hidden').val(totalAll+diff+(jne_kg_price*kg));
        });    
        
        
        </script>
        
    </td>
    <input type="hidden" value="<?php 
            echo $hrgbaru * $obj['qty'];
            ?>
" id="subtotalhide_<?php 
            echo $p->prod_id;
            ?>
">
    <td class="rp" id="subtotal_<?php 
            echo $p->prod_id;
            ?>
">Rp.<?php 
            echo rupiah($hrgbaru * $obj['qty']);
            ?>
</td>
</tr>
            <?php 
        }
        ?>
<input type="hidden" value="<?php 
        echo $beratretail;
        ?>
" id="beratretail">
<tr>
    <td colspan="5"></td>
    <input type="hidden" value="<?php 
        echo $totalan;
        ?>
" id="totalAllHide">
    <td class="rp" style="font-weight: bold;" id="totalAll">Rp.<?php 
        echo rupiah($totalan);
        ?>
</td>
</tr>
<?php 
        $totalberat_kg = $totalberat / 1000;
        ?>
<tr >
    <input type="hidden" value="<?php 
        echo $totalberat;
        ?>
" id="jneweight_hidden">
    <input type="hidden" value="<?php 
        echo $totalberat_kg;
        ?>
" id="jneweight_kg_hidden">
    <input type="hidden" value="8000" id="jneprice_hidden">
    <input type="hidden" value="8000" id="jneprice_reg_hidden">
    <input type="hidden" value="15000" id="jneprice_yes_hidden">
    <input type="hidden" value="1" id="jneprice_yes_hidden_exist">
    <input type="hidden" value="<?php 
        echo $out_of_stock;
        ?>
" id="out_of_stock">
    <td colspan="2" style="text-align: center;"><img src="<?php 
        echo _SPPATH;
        ?>
images/gaido.png" height="90px"></td>
    <td colspan="4">Estimated Weight = <span id="jneweight"><?php 
        echo $totalberat_kg;
        ?>
</span> kg <br> Harga Gaido per kg = <span id='jneprice'>Rp.8000,-</span> (<span id="jnecity">Jakarta Pusat</span>)
<!--        <div id="setModeShip_reg">-->
<!--        <input id="radio_reg" type="radio" name="setModeShip" checked onclick="setModeShip('reg');"> REG (Regular)-->
<!--        </div>-->
<!--        <div id="setModeShip_yes">-->
<!--            <input type="radio" name="setModeShip" onclick="setModeShip('yes');"> YES (Yakin Esok Sampai)-->
<!--        </div>-->
    </td>
    
</tr>
<?php 
        $kg_batas = floor($totalberat_kg) + $this->jne_grenze;
        if ($totalberat_kg >= $kg_batas) {
            $totalberat_kg = ceil($totalberat_kg);
        } else {
            $totalberat_kg = floor($totalberat_kg);
        }
        ?>
<tr>
    <td colspan="5"><b>Shipping Cost</b> <i style="color: #ff0000">*akan dihitung ulang setelah anda memilih kota tujuan.</i></td>
    <td class="rp" id="totalShipCost"><b>Rp.<?php 
        echo rupiah(8000 * $totalberat_kg);
        ?>
</b></td>
    <input type="hidden" value="<?php 
        echo 8000 * $totalberat_kg;
        ?>
" id="totalShipCost_hidden">
</tr>
<tr>
    <td colspan="5"><b>Total</b> </td>
    <td class="rp" id="totalAllPlusShipCost"><b>Rp.<?php 
        echo rupiah($totalan + 8000 * $totalberat_kg);
        ?>
</b></td>
    <input type="hidden" value="<?php 
        echo $totalan + 8000 * $totalberat_kg;
        ?>
" id="totalAllPlusShipCost_hidden">
</tr>
</table>  
</div>
<script>

<?php 
        if ($out_of_stock) {
            ?>
    function oos(){
        var data = JSON.parse('<?php 
            echo json_encode($arrOOS);
            ?>
');
        var arr = data;
        $('.imageprod').removeClass('image_oos');
        for(var key=0;key<arr.length;key++){
            $('.prod_'+arr[key]).addClass('image_oos');
        }
    }
    $(document).ready(function(){
        oos();
        //alert('in');
    });
<?php 
        }
        ?>
    
function NilaiRupiah(jumlah)  
{  
    var titik = ".";
    var nilai = new String(jumlah);  
    var pecah = [];  
    while(nilai.length > 3)  
    {  
        var asd = nilai.substr(nilai.length-3);  
        pecah.unshift(asd);  
        nilai = nilai.substr(0, nilai.length-3);  
    }  

    if(nilai.length > 0) { pecah.unshift(nilai); }  
    nilai = pecah.join(titik);
    return nilai;  
}
function updateCost(){
    var total = parseInt($('#totalAllHide').val());
    var kg = parseInt($('#jneweight_hidden').val())/1000;
    
    //hitung berdasarkan grenze
    var kg_batas = Math.floor(kg)+parseFloat(<?php 
        echo $this->jne_grenze;
        ?>
);
    if(kg>=kg_batas){
        kg = Math.ceil(kg);
    }else{
        kg = Math.floor(kg);
    }
                
     //hitung shipping cost
    var jne_kg_price = $('#jneprice_hidden').val();
    //for showing
    $('#totalShipCost').html('<b>Rp.'+NilaiRupiah(jne_kg_price*kg)+',-</b>');    
    $('#totalAllPlusShipCost').html('<b>Rp.'+NilaiRupiah(total+(jne_kg_price*kg))+',-</b>');
    //for calculate
    $('#totalShipCost_hidden').val(jne_kg_price*kg);
    $('#totalAllPlusShipCost_hidden').val(total+(jne_kg_price*kg));
}
var mode_jne = "reg";
function setModeShip(mode){
    if(mode == "yes"){
        var jne_yes_price = $('#jneprice_yes_hidden').val();
        $('#jneprice_hidden').val(jne_yes_price);
        $('#jneprice').html('Rp.'+NilaiRupiah(jne_yes_price)+',-');
    }
    if(mode == "reg"){
        var jne_reg_price = $('#jneprice_reg_hidden').val();
        $('#jneprice_hidden').val(jne_reg_price);
        $('#jneprice').html('Rp.'+NilaiRupiah(jne_reg_price)+',-');
    }
    mode_jne = mode;
    updateCost();
}
    </script>
        <?php 
    }
?>
            </div>
        </div>
    </div>
    <div class="col-md-7">
        <div class="prod-story-title">
            <?php 
echo Lang::t('PRODUCT STORY');
?>
        </div>
        <div class="prod-story-text">
            <?php 
echo $p->prod_story;
?>
        </div>
    </div>
    <div class="clearfix"></div>
</div>

<?php 
$p = new Pwa();
$p->rec($p, $id);
?>
</div>
<?php 
/**
 * Created by PhpStorm.
 * User: elroy
 * Date: 8/29/15
 * Time: 12:45 PM
 */
Exemplo n.º 4
0
    function productPrinter($prod, $cp)
    {
        //pr($prod);
        $src = Pwa::getMainPic($prod);
        //elseif($nr == 1)$mainpic = $exp[0];
        if ($prod->prod_diskon > 0) {
            $hrgbaru = ceil((100 - $prod->prod_diskon) / 100 * $prod->prod_price);
        } else {
            $hrgbaru = $prod->prod_price;
        }
        //cek apakah stok ada
        if ($prod->prod_stock > 0) {
            $adastock = 1;
        } else {
            $adastock = 0;
        }
        //cek apakah stok ada
        if ($prod->prod_stock > 0 && $prod->prod_stock <= Efiwebsetting::getData('stock_limit')) {
            $limited_stock = 1;
        } else {
            $limited_stock = 0;
        }
        ?>
                <style>
                    .product_dalaman{
                        margin: 5px;
                        background-color: #e6e6e6;
                    }
                    .prod_price{
                        font-weight: bold;
                        font-style: italic;
                        padding-bottom: 20px;
                    }
                    .prod_button{
                        padding-bottom: 10px;
                    }
                    .product_name a{
                        font-size: 17px;
                        color: #323232;
                        font-weight: bold;
                    }
                    .coret{
                        text-decoration: line-through;
                    }
                    .pcon{
                        padding: 5px;
                    }
                    .product_name{
                        padding-bottom: 10px;
                    }
                    
                </style>
<div class="product col-md-3 col-sm-12 col-xs-12">
    
    <div class="product_dalaman">
        <?php 
        if (!$adastock) {
            ?>
        <div style="position: absolute;z-index: 1; font-weight: bold; font-size: 3vmin; padding: 10px; color:white; background-color: #888;">
            OUT OF STOCK
        </div>
        <?php 
        }
        ?>
        <?php 
        if ($limited_stock) {
            ?>
        <div style="position: absolute;z-index: 1; font-weight: bold; font-size: 3vmin; padding: 10px; color:white; background-color: red;">
            LIMITED STOCK
        </div>
        <?php 
        }
        ?>
    <div class="product_pic">
        <?php 
        if ($prod->prod_diskon > 0) {
            ?>
        <div style="color:white;position: absolute; z-index: 1; width: 80px; height: 80px; background-color: rgba(180,2,2,0.8); border-radius: 0px; border-bottom-right-radius: 10px;">
            <div style="float: right; width: 20px; height: 20px; margin-right: 0px; margin-top: 30px;">%</div>
            <div style="font-size: 45px; margin-left: 10px; margin-top: 5px; position: absolute; text-align: center;"><?php 
            echo $prod->prod_diskon;
            ?>
</div>
            <div style="margin-top: 55px; margin-left: 28px;" >off</div>
        </div>
        <?php 
        }
        ?>
        <a href="<?php 
        echo _SPPATH;
        ?>
pwa/p/<?php 
        echo $prod->prod_id;
        ?>
/<?php 
        echo urlencode($prod->prod_name);
        ?>
">
            <img width="100%" src="<?php 
        echo $src["thumbs"];
        ?>
" alt="<?php 
        echo $prod->prod_name;
        ?>
">
        </a>
    </div>
        <div class="pcon">    
    <div class="product_name">
        <a href="<?php 
        echo _SPPATH;
        ?>
pwa/p/<?php 
        echo $prod->prod_id;
        ?>
/<?php 
        echo urlencode(str_replace("/", " or ", $prod->prod_name));
        ?>
">
        <?php 
        echo $prod->prod_name;
        ?>
        </a>
    </div>
    <!--div class="prod_descr">
        
        <div class="prod_price">
            Harga Toko <br> Rp. <span class="coret"><?php 
        echo rupiah($prod->prod_price);
        ?>
</span>
        </div>
        <div class="prod_price">
            Harga Satuan <br> Rp. <span class="big"><?php 
        echo rupiah($prod->prod_satuan_price);
        ?>
</span> 
             </div>
        <div class="prod_price">
            Harga Hemat <br> Rp. <span class="bigger"><?php 
        echo rupiah($prod->prod_bulk_price);
        ?>
</span>
        </div>
        
    </div>-->
        <div class="prod_button btn-group" role="group">
            
            <?php 
        if (Auth::isLogged()) {
            if ($adastock) {
                ?>
            <?php 
                if ($cp->camp_type < 2) {
                    ?>
            <button onclick="addPahe('<?php 
                    echo $prod->prod_id;
                    ?>
','<?php 
                    echo $prod->prod_name;
                    ?>
','<?php 
                    echo $src["thumbs"];
                    ?>
');" class="btn btn-danger"><i class="glyphicon glyphicon-shopping-cart"></i> <?php 
                    echo Lang::t('Hemat');
                    ?>
</button>
            <?php 
                }
                ?>
            <?php 
                if ($cp->camp_type == 2 || $cp->camp_type == 0) {
                    ?>
            <button onclick="document.location='<?php 
                    echo _SPPATH;
                    ?>
addOrder?pid=<?php 
                    echo $prod->prod_id;
                    ?>
';" class="btn btn-danger"><i class="glyphicon glyphicon-shopping-cart"></i> <?php 
                    echo Lang::t('Satuan');
                    ?>
</button>                    
            <?php 
                }
                ?>
            <?php 
            }
        }
        ?>
            <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
pwa/p/<?php 
        echo $prod->prod_id;
        ?>
/<?php 
        echo urlencode($prod->prod_name);
        ?>
';" class="btn btn-default"><?php 
        echo Lang::t('View');
        ?>
</button>
        </div>
    <div id="pahe_meldung_<?php 
        echo $prod->prod_id;
        ?>
" class="pahemeldung" style="display: none;">Keranjang Harga Hemat diupdate</div>
        </div>
    </div>
</div>
        <?php 
    }
Exemplo n.º 5
0
<?php

class pwa
{
    public $var;
    function __construct()
    {
        $this->var = array();
    }
    function test()
    {
        $cont = array();
        $cont["mykey"] = "myvalue";
        foreach ($cont as $this->var['key'] => $this->var['value']) {
            var_dump($this->var['value']);
        }
    }
}
$myPwa = new Pwa();
$myPwa->test();
echo "Done\n";