User defined buttons

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Fakiro82
User
Posts: 108

Re: User defined buttons

Post by Fakiro82 »

Hi,
if i want to pass more value in url, how can i do this?

I try to write code:

if ($this->getCurrentMasterTable() != "") { // make sure the detail list page is being displayed when it contains the master table (Master/Detail List page)
$options = &$this->OtherOptions;
$option = $options["action"];
$item = &$option->Add("mybutton"); 
$ordineFattura = urlencode($this->OrderId->CurrentValue);
$CodiceOggetto = urlencode($this->ItemCode->CurrentValue);
$DescrizioneOggetto = urlencode($this->Description->CurrentValue);
$Quantita = urlencode($this->Quantity->CurrentValue);
$Prezzo = urlencode($this->Price->CurrentValue);
$Totale = urlencode($this->NetTotal->CurrentValue);
$item->Body = "<a class=\"ewAction\" href=\"Fattura.php?OrderId=".$ordineFattura. "&ItemCode=".$CodiceOggetto. "&Description=".$DescrizioneOggetto. "&Quantity=".$Quantita. "&Price=".$Prezzo. "&NetTotal=".$Totale. "\">Genera Fattura 2</a>";

}
}

but not work.

Thank you much,
Andrea.


mobhar
User
Posts: 11702

Post by mobhar »

Fakiro82 wrote:
but not work.

Please always explain it in more detail. What did you mean "not work"? Did you enable the Debug mode from "Tools" -> "Advanced Settings", and did you see any error message?


Fakiro82
User
Posts: 108

Post by Fakiro82 »

Sorry for my explain.

I need to pass more than 1 value in url to create Invoice document. The tables are ORDER_TABLE and DETAILS_TABLE. ORDER TABLE is join with DETAILS_TABLE.
In my case, I need to pass value to insert in invoice document. Now if I pass the Inovoice OrderID $ordineFattura = urlencode($this->OrderId->CurrentValue); this work because this value is in Master Table (if (this->getCurrentMasterTable() != ""). But, if I try to pass the other value (belong DETAILS_TABLE), like $DescrizioneOggetto = urlencode($this->Description->CurrentValue); this not work because is in Detail Table.

I ask to you if you know a method to do this or also the other method to pass value in other page (invoice.php) without write values in Url (when I pass value in URL, this value are visibile and this is not good). Do you know other method? Or Do you know like encrypt url?

Andrea.


sangnandar
User
Posts: 980

Post by sangnandar »

Fakiro82 wrote:
But, if I try to pass the other value (belong DETAILS_TABLE), like $DescrizioneOggetto
= urlencode($this->Description->CurrentValue); this not work because is in Detail
Table.

If you are in master/detail mode, it means: you are actually in List Page of the detail table.
Now, in List Page there are records (with s), hence calling
$this->Description->CurrentValue;
with
$options = &$this->OtherOptions;
is a wrongdoing because, well...which value? there are many (records).
Either it will be empty or call an error.

The solution would be to move your button within the row, that is calling
$this->Description->CurrentValue;
with
$opt = &$this->ListOptions;

You can refer to ListOptions_Load() and ListOptions_Rendered() server events in the help file to find more examples.


Fakiro82
User
Posts: 108

Post by Fakiro82 »

Hi sangnandar,
sorry but i don't undestand how to do this.
What do you mean move your button within the row?

Thank you so much,
Andrea.


mobhar
User
Posts: 11702

Post by mobhar »

Fakiro82 wrote:
the other method to pass value in other page (invoice.php) without write values in
Url

Then try to use "Session Variable". Google "php session variable".


emezty
User
Posts: 2

Post by emezty »

how about adding button per row? and update another table (e.g add to cart)
Thanks in advance


mobhar
User
Posts: 11702

Post by mobhar »

You may simply use "ListOptions_Load" and "ListOptions_Rendered" server events. Please read "Server Events and Client Scripts" topic from PHPMaker Help menu for more info and example.


Post Reply