Categories > TinyButStrong general >

blank page

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: handoko
Date: 2011-12-13
Time: 17:36

blank page

Hi skrol,

i have a problem with my tbs page, this is the step,
1. customer choose their product through produkpilih.html

<!-- BEGIN CENTER -->
<script type="text/javascript" language="javascript">
    function clickradio(o, s)
    {
        o.value = s;
    }
</script>
<script type="text/javascript" src="/js/lightbox/lightbox.js"></script>

<link rel="stylesheet" href="/js/lightbox/lightbox.css" type="text/css" media="screen" />

<div class="main-content"></div>
<div class="block-green"></div>
    <div class="block-green-title">[var.hometitle]</div>
    <div class="block-green-content" align="center"></div>
        <form method="post" name="form1" action="[var.config.siteURL]?page=customer.customercart">
        <input type="hidden" name="act" value="add" />
        <input type="hidden" name="id" value="[var._GET.id]" />[var._GET.act;if [val]!='lihat';then '

        <div class="successMsg"><b>Silahkan pilih spesifikasi produk lebih dahulu...</b></div>       ';noerr]
               
        <table width="100%" cellspacing="4" cellpadding="3" id="content">
        <tr valign="top">
            <td>
                <div style="margin-left:15px;color:#AEADAB;text-align:left;">[var.retrieve.productname]</div>
                <table width="100%" cellpadding="3">
                <tr valign="top">
                    <td width="120" align="left">
                        <div style="margin-bottom:4px;"><a href="[var.sys.imgProdDir][blk.imagename;block=div].jpg" rel="lightbox" title="[blk.productid]" rev="[var.config.siteURL]"><img src="[var.sys.imgProdDir][blk.imagename].thumb.jpg" border="0" class="thumb" alt="thumb" /></a></div>
                    </td>
                    <td align="left"><br />
                        <div style="margin-bottom:10px;border-bottom:1px solid #D3D3D2;"><font size="3" color="navy"><b>[var.retrieve.productid]</b></font></div>
                        [var.retrieve.remark;htmlconv=no]
                       
                        <p><b>Harga</b> : <span class="product-price" style="padding-left:10px">Rp. [var.retrieve.price;frm='0,000.00']</span></p>
                        <p><small><i><font color="#BDBCBB">Klik foto untuk melihat gambar lebih detil.</font></i></small></p>
                        <div style="margin-bottom:10px;"><font size="2" color="green"><b>Pilih Spesifikasi Produk</b></font></div>
                        <div>
                        <table width="100%" cellpadding="1">
                            <tr>
                                <td><b>[type.description;block=table]</b>
                                <input type="hidden" name="spec_[type.type]" value="[type.defspec]" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                <table>
                                    <tr>[spec;block=tr;serial;p1=[type.type]]
                                        <td><input type="radio" name="[type.type]" id="chk_[spec_1.id;block=td]" checked="checked" onclick="clickradio(document.form1.spec_[type.type],'[spec_1.id]')" />[spec_1.description]</td>
                                        <td><input type="radio" name="[type.type]" id="chk_[spec_2.id;block=td]" onclick="clickradio(document.form1.spec_[type.type],'[spec_2.id]')" />[spec_2.description]</td>
                                        <td><input type="radio" name="[type.type]" id="chk_[spec_3.id;block=td]" onclick="clickradio(document.form1.spec_[type.type],'[spec_3.id]')" />[spec_3.description]</td>
                                        <td><input type="radio" name="[type.type]" id="chk_[spec_4.id;block=td]" onclick="clickradio(document.form1.spec_[type.type],'[spec_4.id]')" />[spec_4.description]</td>
                                        <td><input type="radio" name="[type.type]" id="chk_[spec_5.id;block=td]" onclick="clickradio(document.form1.spec_[type.type],'[spec_5.id]')" />[spec_5.description]</td>
                                    </tr>
                                    <tr>
                                        <td>[spec;block=tr;serial;][spec_0;block=td;]&nbsp;</td>
                                    </tr>
                                </table>
                                </td>
                            </tr>
                        </table>
                       
                        <div style="margin-top:4px;">&nbsp;<b>Jumlah</b> &nbsp;&nbsp;<input type="text" name="txtjml" size="4" onkeypress="return integerOnly();" value="1" /></div>
                        </form>
                        <div style="margin-top:8px;border-bottom:1px solid #D3D3D2;"><a href="javascript:document.form1.submit();"><img src="[var.sys.imgDir]add-to-cart.gif" border="0" alt="thumb" /> </a><br /><br /></div>

                        </div>
                    </td>
                </tr>
                </table>
            </td>
        </tr>
        </table>

2. and then the input carried into customercart.php
$sys['siteTitle'] = "Keranjang Belanja :: ".$config['siteTitle'];

if ($_GET['act']=='del'){
    $query = "DELETE FROM eroza_cart WHERE remoteid = '$remoteid' and seq = '$_GET[seq]'";
    $db->query($query);
    $query = "DELETE FROM eroza_cartspec WHERE remoteid = '$remoteid' and seq = '$_GET[seq]'";
    $db->query($query);
}
if ($_GET['act']=='add' || $_POST['act']=='add'){
    $id = (!empty($_GET['id'])) ? $_GET['id'] : $_POST['id'];
    $jml = (!empty($_POST['txtjml'])) ? $_POST['txtjml'] : "1";
   
    $rseq = $db->get_results("select seq from eroza_cart where remoteid = '$remoteid' order by seq desc limit 1",ARRAY_A);
    if (empty($rseq)) { $seq = "1"; } else { $seq = $rseq[0]['seq'] + 1; }
   
    $rprc = $db->get_results("select price from eroza_products where productid = '$id' limit 1",ARRAY_A);
    if (empty($rprc)) { $price = "0"; } else { $price = $rprc[0]['price']; }
    $total = $jml * $price;

    $qset = " SET remoteid = '$remoteid', seq = '$seq', productid = '$id', price = '$price', qty = '$jml', total = '$total', custid = '$_SESSION[custid]'";
    $db->query("insert into eroza_cart $qset ");

    $q = "select * from eroza_productspectype where type in (select distinct type from eroza_rfproductspec where id in (select specid from eroza_productspec where productid = '$id')) order by description";
    $rs = $db->get_results($q,ARRAY_A);
    if (empty($rs)) $rs = array();
    $specdesc = "";
    $db->debug();
   
    foreach ($rs as $a => $b) {
    //foreach ($rs as $a) {
        $chk = $_POST['spec_'.$b["type"]];
        //echo var_dump($chk);
       
        if (!empty($chk)) {
            $q = "select * from eroza_rfproductspec where id = '$chk'";
            $r = $db->get_row($q);
            $db->debug();
            $specdesc .= $b["description"]." : ".$r->description.", ";
            //echo var_dump($r);
            $q = "insert into eroza_cartspec (remoteid, seq, specid) values('$remoteid','$seq','$chk');";
            $db->query($q);
        }
    }
    $specdesc = substr($specdesc,0,strlen($specdesc)-2);
   
    $q = "update eroza_cart set spec_desc = '$specdesc' where remoteid = '$remoteid' and seq = '$seq'";
    $db->query($q);
    $db->debug();
}

if ($_POST['act']=='save') {
    $qty = $_POST["qty_".$_POST["seq"]];
    $q = " update eroza_cart SET qty = '$qty', total = $qty*price where remoteid = '$remoteid' and seq = '$_POST[seq]' ";
    //print $q;
    $db->query($q);
}

$q = "select c.*, p.productname from eroza_cart c left join eroza_products p on p.productid = c.productid where c.remoteid = '$remoteid'";
$rs = $db->get_results($q,ARRAY_A);
$db->debug();
if (empty($rs)) $rs = array();

$q = "select ifnull(sum(total),0) as total from eroza_cart c where c.remoteid = '$remoteid'";
$rt = $db->get_results($q,ARRAY_A);
$totalprice = $rt[0]['total'];

$main = new clsTinyButStrong;
$main->LoadTemplate(THEMES_DIR.$template);
$main->MergeBlock('blk',$rs);

$main->show(TBS_NOTHING);   
$htmlMain = $main->Source;

the page result is blank,


can you help me what is the main problem and solution.


Thanks
By: Skrol29
Date: 2011-12-13
Time: 21:50

Re: blank page

Hi Handoko,

They are few HTML errors in your template, but that is not the cause of your bug.
- <div> before <table width="100%" cellpadding="1"> should be deleted
- </form> should be moved up to the bottom

You do $main->MergeBlock('blk',$rs); but there is no block named  "blk" in your template.
This cannot produce your bug.

I can see nothing that can produce a blank result, except that you are not showing the result but only save it into a string variable.


By: handoko
Date: 2011-12-14
Time: 00:41

Re: blank page

Hi Skrol,

this is sub templete...

but if i move
- </form> to before
-<table width="100%" cellspacing="4" cellpadding="3" id="content">

the page work fine except no data can be processed to above database query...

this is the sub template of customercart.php
<script type="text/javascript">
    function editqty(s)
    {
        document.form1.act.value = "save";
        document.form1.seq.value = s;
        document.form1.submit();
    }
</script>
<div class="main-content">
[onshow.chk]
[onshow.r]
<div class="block-green">
    <div class="block-green-title">Keranjang Belanja</div>
    <div class="block-green-content">
<table width="100%" cellpadding="4">
<tr>
    <td colspan="2">
        <div style="font-family:Tahoma;font-size:16px;font-weight:bold;color:#0A6C1D;margin-bottom:8px;">Isi Keranjang Belanja Anda :</div>
        <form name="form1" method="post" action="[var.config.siteURL]?page=[var._GET.page]" onsubmit="return cekmandatory()">
        <input type="hidden" name="act" value="add" />
        <input type="hidden" name="seq" value="" />
        <table width="100%" cellpadding="5" cellspacing="0">
            <tr>
                <td style="border-bottom:1px solid #D3D3D2;border-top:1px solid #D3D3D2;"><b>Kode produk</b></td>
                <td style="border-bottom:1px solid #D3D3D2;border-top:1px solid #D3D3D2;"><b>Harga</b></td>
                <td style="border-bottom:1px solid #D3D3D2;border-top:1px solid #D3D3D2;"><b>Jumlah</b></td>
                <td style="border-bottom:1px solid #D3D3D2;border-top:1px solid #D3D3D2;"><b>Subtotal</b></td>
                <td style="border-bottom:1px solid #D3D3D2;border-top:1px solid #D3D3D2;" align="center"><b>Ubah</b></td>
            </tr>
            <tr style="height: 5%"><td colspan="5"></td></tr>
            <tr valign="middle">
                <td><a href="[var.config.siteURL]?page=product.productdetail&amp;id=[blk.productid]">[blk.productid;block=tr]</a><br />
                [blk.productname]<br />[blk.spec_desc]</td>
                <td>[blk.price;frm='0.000,00']</td>
                <td><input type="text" name="qty_[blk.seq]" value="[blk.qty]" onkeypress="return integerOnly();" size="3" maxlength="3" /></td>
                <td>[blk.total;frm='0.000,00']</td>
                <td width="80" align="center"><a href="javascript:editqty('[blk.seq]');" class="edit" title="ubah">&nbsp;</a> <a href="[var.config.siteURL]?page=[var._GET.page]&amp;act=del&amp;seq=[blk.seq]" class="delete" title="hapus">&nbsp;</a></td>
            </tr>
            <tr class="row1">
                <td colspan="5" align="center">[blk;block=tr;nodata]<font color="red">Keranjang belanja kosong</font></td>
            </tr>
        </table>
        <table width="100%" cellpadding="10" cellspacing="0" style="border-top:1px solid #D3D3D2;border-bottom:1px solid #D3D3D2;margin-top:10px;">
            <tr>
                <td align="center"><b>Total</b></td>
                <td align="center"><b>Rp. [var.totalprice;frm='0.000,00']</b></td>
            </tr>
        </table>
        <div style="margin-top:8px;">
        <table width="100%" cellpadding="10" cellspacing="0">
            <tr valign="middle">
                <td align="left" width="60%"><a href="[var.config.siteURL]" style="font-family:Tahoma;font-size:16px;font-weight:bold;color:#B2B6B3;text-decoration:none;"><img src="[var.sys.imgDir]cart.gif" border="0" align="left" alt= "cart" /> &nbsp;&nbsp;Lanjutkan Belanja</a></td>
                <td align="left"><a href="[var.config.siteURL]?page=customer.checkout" style="font-family:Tahoma;font-size:16px;font-weight:bold;color:#B2B6B3;text-decoration:none;"><img src="[var.sys.imgDir]forward.png" border="0" align="left" alt="forward" /> &nbsp;&nbsp;Selesai Belanja</a></td>
            </tr>
        </table>
        </div>
        <div class="successMsg" style="margin-top:15px;" [onload_1;block=div;when [var.totalprice]!=0;]>Biaya total diatas belum termasuk ongkos kirim. Daftar ongkos kirim bisa dilihat di <a href="[var.config.siteURL]?page=pengiriman">tabel ongkos kirim</a>.</div>
        </form>
      </td>
    </tr>
</table>
</div>
</div>
</div>

need your help
By: Skrol29
Date: 2011-12-15
Time: 23:32

Re: blank page

Hi Handoko,

I must say I'm a bit lost.

> the page work fine except no data can be processed to above database query...

How can it be ? What is the relation between the query and the template structure ?

> this is the sub template of customercart.php

How and when this sub-template is inserted into the main template ? There is no clue of that.
By: handoko
Date: 2011-12-16
Time: 03:19

Re: blank page

hi skrol,

the problem has been solved,
the main cause is that i put

[onshow.chk]
[onshow.r]

when i delete it , it works fine

Thanks