Forums

Identify Originating Article in Email

johntennock 09 May, 2011
Hi, my first post on this forum.

I am setting up a rudimentary shop in which we want to use Joomla articles to describe and illustrate items for sale, and include a form in the article so that if anyone wants to buy one of the articles they can fill in their details so that we receive an email request. ChronoForms does the job perfectly but it would be best if we could just have just one form and use the plugin to include it in each article.

I am wondering if there is some way of including in the email, details (preferably the title) of the article in which the form was processed. Otherwise it looks like I would need to modify the form, or create a new one, each time a new item is made available.

Searching through all the parameters it almost looks possible, but I am no programmer and don't want to poke around in areas I don't understand.

Any suggestions appreciated.
GreyHead 09 May, 2011
Hi johntennock,

There's no risk of damaging anything but getting the article title can be tricky in Joomla!.

Here are some ways of getting the article id (with the id you can easily look up any other information about the article).

If you are not using SEF URLs then it is easy
<?php
$article_id = JRequest::getInt('id', '', 'get');
?>


If you are using SEF URLs then it depends on the SEF Manager that you are using. If you have sh404SEF or AceSEF then you can look up the underlying URL in the database and then use the same code as above.

If you are using Joomla! URLs then there is no easy look up route. Here's something I worked out for a client.
<?php
$menus =& JSite::getMenu();
$menu  =& $menus->getActive();
$uri   =& JFactory::getURI($menu->link);
$article_id = $uri->getVar('id');
?>


Bob
adelrami 27 May, 2011
Hi Grey,
I tried this but it didnt work with me.. all what i wanna do, is to include in the submitted email the article ID or its title.
Well this is my situation
Joomla 1.5.20
Chronoform 4
chronoform plugin installed
installation validated
Joomla SEF enabled

Thanks in advance
GreyHead 27 May, 2011
Hi adelrami,

I spotted a typo in my original code. This line
$article_id = JRequest::getInt('id', ''m 'get');
should be
$article_id = JRequest::getInt('id', '', 'get');


In CFv4 the code would need to go into a Custom Code element and the value put into a hidden input.

Bob
adelrami 27 May, 2011
Hi Grey,
Thanks fro your quick reply
i pasted that code
<?php
$article_id = JRequest::getInt('id', '', 'get');
?>

in the Custom Code - After Email(s) tab

it didnt work๐Ÿ˜Ÿ i mean didnt include,
i remember in the older veriosn 3.1 we used to iclude {title} in the email template, do i need to insert any code here to.. appreciate your help

Ok i added {id} in the email template and it did work and included the article ID

now how about making it include the page title or the article title rather than the ID.\
thanks
adelrami 28 May, 2011
Please help, check my previous post plz , i hope this could be fixed before downgrading to v 3.1๐Ÿ˜Ÿ
GreyHead 28 May, 2011
Hi adelrami,

Well, that code will probably get you the article id but doesn't do anything with it.
<?php
$article_id = JRequest::getInt('id', '', 'get');
$form->data['article_id'] = $article_id;
?>

You can then use {article_id} to include this in your email; or you can look up the article title in the jos_content table.

Bob
This topic is locked and no more replies can be posted.