1
Edwinspie
Forms problem
  • 2007/12/28 22:29

  • Edwinspie

  • Just popping in

  • Posts: 84

  • Since: 2006/8/18


Hi all,

My site www.elephantcoasttourism.com has got about 250 product owners,(accommodations and /or touroperators)created with smartsection.
On every product page is currently a link to one general liaise form.
Is there a way that i can have the product page from where the form is clicked, to appear in a formfield?
In other words: if a visitor clicks the enquiry link on the AAA lodge page, the name AAA lodge should automaticaly appear somewhere in the data of mail that is sent to the admin.
I know there is a solution in cloning the form and linking each product to its specific form, but liaise only has got 2 digits in the form_id and i need 250 forms.....

Any suggestions are welcome!

Edwin

2
trabis
Re: Forms problem
  • 2007/12/29 2:37

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Hi Edwinspie,
You only need 2 lines of code!

Open file liaise/include/form_render.php

Add around line 104:

$form_output->addElement(new XoopsFormHidden("ID"$ID));
//add this line
$form_output->addElement(new XoopsFormHidden("URL"$_SERVER['HTTP_REFERER']));
//end


Then open liaise/include/form_execute.php

Replace around line 276

//replace the original line for this one
$xoopsMailer->assign("MSG"$_POST['URL']."n".implode("n"$msg));
//end

if( count($err) < ){
    if( !
$xoopsMailer->send(true) ){
        
$err[] = $xoopsMailer->getErrors();
    }
}


Then just add a link to the liaise form under a product page.

I was needing this to, thanks for the sugestion!

3
Edwinspie
Re: Forms problem
  • 2007/12/29 8:47

  • Edwinspie

  • Just popping in

  • Posts: 84

  • Since: 2006/8/18


Hi Trabis,

In one word: GREAT!


One small problem though: all the results in the mail get an extra letter "n" at the end of every field.
( jan becommes jann, new york becomes new yorkn and so on )

I am far from a coder but i see in your code for the form execute, that you use the letter "n" two times between brackets(as a value????)

Should I change somthing here ?

Thanks a million already for your solution!

Edwin

4
Shine
Re: Forms problem
  • 2007/12/29 8:53

  • Shine

  • Just can't stay away

  • Posts: 822

  • Since: 2002/7/22


That is because the presented code deletes the SLASH \ infront of the n
//replace the original line for this one 
$xoopsMailer->assign("MSG"$_POST['URL']."SLASHn".implode("SLASHn"$msg)); 
//end


Read for the word SLASH the symbol: \

5
trabis
Re: Forms problem
  • 2007/12/29 14:52

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Thanks Shine! The code was correct yes but copyng it to this Box deleted the slash. It is a bug...
So where is "n" it is suposed to show "\n"


6
Edwinspie
Re: Forms problem
  • 2007/12/29 15:27

  • Edwinspie

  • Just popping in

  • Posts: 84

  • Since: 2006/8/18


Thanks guys!

Works like a dream now! You saved me a hell of a job!
Lett me know when you're in South Africa: you both deserved more than a few beers!

Thank a lot!

Edwin

Login

Who's Online

167 user(s) are online (116 user(s) are browsing Support Forums)


Members: 0


Guests: 167


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits