This topic is locked

Hiding Order details link from Orders list if there's no order det

4/7/2008 11:17:59 AM
PHPRunner General questions
F
Fawaz author

Hi All,

In this example
http://livedemo.asprunner.net/phprunner/li...orders_list.php
How can I hide/remove Order details link from Orders list if there's no order details?
In other words, display Order details link only when the order has Order details.
Thanks,

Fawaz

J
Jane 4/8/2008

Fawaz,
you can do it editing page in the HTML mode on the Visual Editor tab.

Here is a sample:

{if $row.1showdetail}

<A href="detailtable_list.php?{$row.1detailtable_masterkeys}" {if $useAJAX} onmouseover="RollDetailsLink.showPopup(this,'detailtable_detailspreview.php'+this.href.substr(this.href.indexOf('?')));" onmouseout="RollDetailsLink.hidePopup();" {/if}>detailtable</A>

{/if}


Then count detail records on the List page: After record processed event and assign true or false to $row.1showdetail variable:

$row["1showdetail"] = true;

//or $row["1showdetail"] = false;

N
nickrix 4/14/2008

Fawaz,

you can do it editing page in the HTML mode on the Visual Editor tab.

Here is a sample:
Then count detail records on the List page: After record processed event and assign true or false to $row.1showdetail variable:


Can you help me a bit more on this - i have 5 other tables and want to display a link to them through an image but only want that image link to show if the tables exist with the matching records, can you put the table names and the bits of the above code i need to change in bold?
sorry I have to ask this, im just new to all this and want to make certain this is the right product for me and can do everything i need.

J
Jane 4/15/2008

Hi,
see my changes in bold:

{if $row.1showdetail}

<A href="detailtable_list.php?{$row.1detailtable_masterkeys}" {if $useAJAX} onmouseover="RollDetailsLink.showPopup(this,'detailtable_detailspreview.php'+this.href.substr(this.href.indexOf('?')));" onmouseout="RollDetailsLink.hidePopup();" {/if}>detailtable</A>

{/if}


//select count of values from detail table

global $conn;

$str = "select count(*) from detailtable where detailid=".$data["masterid"];

$rs = db_query($str,$conn);
if ($data = db_fetch_array($rs))

$row["1showdetail"] = true;

else

$row["1showdetail"] = false;