Ivan

Link page from witch quick form sanded email

22 posts in this topic

Hi,

Is it possible to add function when message sent from quick form it grabs link from what page the message was sent or maybe title of article and pack it in sent message?

Share this post


Link to post
Share on other sites

HI Ivan.

It is possible.

Please try to use this solution

Open file /mod_btquickcontact/helpers/helper.php

Find this line

$body .= '</table>';

Add right above it this code

$j = JURI::getInstance();
$requestUri = JURI::current();
if($j->getQuery()) $requestUri .= '?' . $j->getQuery();
$body.='<tr><td><b>From URL:</b></td><td><a href="'. $requestUri .'">' . $requestUri . '</a></td></tr>';

I hope it will help you.

Thanks

Share this post


Link to post
Share on other sites

HI Ivan.

It is possible.

Please try to use this solution

Open file /mod_btquickcontact/helpers/helper.php

Find this line

$body .= '</table>';

Add right above it this code

$j = JURI::getInstance();
$requestUri = JURI::current();
if($j->getQuery()) $requestUri .= '?' . $j->getQuery();
$body.='<tr><td><b>From URL:</b></td><td><a href="'. $requestUri .'">' . $requestUri . '</a></td></tr>';

I hope it will help you.

Thanks

Great this works very nice. Is it too much trouble to catch title of article instead?

Share this post


Link to post
Share on other sites

It is very hard.

So i can't help you

But how do you think about getting page title (web page title) instead of get article's title

Because the module is plugin on many page, It hard to know what page is article, what page is k2 item ...

Share this post


Link to post
Share on other sites

It is very hard.

So i can't help you

But how do you think about getting page title (web page title) instead of get article's title

Because the module is plugin on many page, It hard to know what page is article, what page is k2 item ...

Hmm i can try give me a code.

Share this post


Link to post
Share on other sites

If I know how I wouldn’t ask a question here, but never mind this solution with page title is no good for me. I need to find solution haw to get a K2 item title and put it in quick contact subject field. I think it could be done with ID reference of that K2 item.

Share this post


Link to post
Share on other sites

If you only apply this feature on only one component example k2, i think it is more easy.

You completely can get item id from current url, then use SQL query get to item id.

This is my advice.

Share this post


Link to post
Share on other sites

Hi

Please try to replace whole my above code to by new one

$uri = JURI::getInstance();
$router = JSite::getRouter();
$query = $router->parse($uri);

if($query['option'] == 'com_k2' && $query['view'] == 'item' && intval($query['id'])){
$db = JFactory::getDbo();
$db->setQuery('SELECT title FROM #__k2_items WHERE id = ' . intval($query['id']));
$rs = $db->loadResult();
if($rs){
$body.='<tr><td><b>From K2 Item:</b></td><td><a href="'. $uri->toString() .'">' . $rs . '</a></td></tr>';
}

}

Share this post


Link to post
Share on other sites

Hi

Please try to replace whole my above code to by new one

$uri = JURI::getInstance();
$router = JSite::getRouter();
$query = $router->parse($uri);

if($query['option'] == 'com_k2' && $query['view'] == 'item' && intval($query['id'])){
$db = JFactory::getDbo();
$db->setQuery('SELECT title FROM #__k2_items WHERE id = ' . intval($query['id']));
$rs = $db->loadResult();
if($rs){
$body.='<tr><td><b>From K2 Item:</b></td><td><a href="'. $uri->toString() .'">' . $rs . '</a></td></tr>';
}

}

When I replace code from your first post with new one I cant open page that contains quickcontact modul. I recive only blank bage.

Share this post


Link to post
Share on other sites

when I turn on errocode show on site I recive this error:

Parse error: syntax error, unexpected T_PUBLIC in /home/ndujmovi/public_html/modules/mod_btquickcontact/helpers/helper.php on line 316

and it refer on this line:

316 public static function fetchHead($params) {

$document = JFactory::getDocument();

$header = $document->getHeadData();

$mainframe = JFactory::getApplication();

$template = $mainframe->getTemplate();

$layout = $params->get('layout', 'default');

$templatePath = JPATH_SITE . '/templates/' . $template . '/html/mod_btquickcontact';

$templateURL = JURI::root() . 'templates/' . $template . '/html/mod_btquickcontact/';

$moduleTmplURL = JURI::root() . 'modules/mod_btquickcontact/tmpl/';

$loadJquery = $params->get('load_jquery', 1);

foreach ($header['scripts'] as $scriptName => $scriptData) {

if (substr_count($scriptName, '/jquery')) {

$loadJquery = false;

}

}

Share this post


Link to post
Share on other sites

Opps maybe i create wrong block of the code, as you see there is a bracket } out side of block.

Maybe you don't see it and only copy code inside block.

Please check it.

I'm sorry

Share this post


Link to post
Share on other sites

Maybe there is problem with new code.

It is better for me If you give me your admin account and FTP account via extensions@bowthemes.com

If not, please give me more time, i will try again on my localhost.

Thanks

Share this post


Link to post
Share on other sites

Hi there.

I see my code work correctly. Please take a look to this image

http://prntscr.com/64gb7y

K2 items is Bangkok and it is a link to test page.

Thx you rock. Works like a charm. I am looking at you code and I can’t find where I did work. Thx again. This is nice feature which you could implement in your quickcontatc as default option. I saw lots of same requests.

Do you think this logic could be implemented in agent contact form from property page, so agent could receive property item name sanded from that item page?

Thx again.

Share this post


Link to post
Share on other sites

Oh. I'm sorry.

I didn't notice this, i also don't believe this problem exists.

Please re-active FTP account that you sent to me or give me other one.

I will check it again.

Share this post


Link to post
Share on other sites

Oh. I'm sorry.

I didn't notice this, i also don't believe this problem exists.

Please re-active FTP account that you sent to me or give me other one.

I will check it again.

Thx now it is great.

Share this post


Link to post
Share on other sites