Перейти к содержимому


Фотография
- - - - -

Frontend Submission Email Address Useage


Лучший Ответ Kess , 05 June 2014 - 16:27

Hello,

 

You need to add window.parent there like this:

jQuery(document).ready(function() {
    jQuery('#sendto').val(window.parent.jQuery('.element-10ced810-a1e3-49cc-b4f7-81e777df869a').text());
});
Перейти к сообщению


  • Закрытая тема Тема закрыта
Сообщений в теме: 8

#1 tobypsl2

tobypsl2

Отправлено 03 March 2014 - 12:13

I am using JBZoo for a jobs listing and have set up a frontend submission form to allow posting of jobs.

 

In the backend of Zoo in the submissions config an email can be specified to receive confirmation of posting.

 

One of the fields I have included on the submission form is a tracking email which is used to track applications.

 

I really need two uses of this email address:

 

1. The posting confirmation goes to this address as well as the one specified in submissions config

 

2. People can 'apply to' this email address (attaching a document). Or this email address appears in the description as an email link.

 

The native ZOO component has no way of making 1 happen.  This is unfortunate since frontend submission suggests the possibility of registered site users posting content.

 

For 2 I could simply include the field in the description (I use the product catalog) and the email would appear as a link. I could use any label here to point people to using this email to 'apply'.

 

But this is not ideal as really this email should not be visible - the email would ideally be sent via a form not by opening the users email client.

 

So I have options here (I am hoping ;) ):

 

Use some native ZOO / JBZOO functionality which may include:

  • A form element - but I am unaware of this
  • Modifying the purchase basket - but this seems like a lot of work probably beyond my comprehension

Or I could use a third party component to create a contact form - such as RSForms Pro - and somehow 'collect' the JBZoo field for use as an address in the contact form.

 

I'm hoping there is a simple alternative means of achieving this...

 

Thanks.


  • 0

#2 Kess

Kess

Отправлено 04 March 2014 - 15:09

Hello,

 

Sorry for a delayed answer.

 

1. Please, describe this part in more detail. I'm not sure that I understand it correctly.

 

2. As you said, it should be possible to do with RSForm Pro. You can include a form in the full layout of a job offer, then using some jQuery add the value of email element to one of the fields in the form. Both the element and the corresponding form field can be hidden if you wish. Then you just need to set this form field as the recipient of the form - http://www.rsjoomla....selection-.html  - here you can see how it can be done.


  • 0

#3 tobypsl2

tobypsl2

Отправлено 04 March 2014 - 19:23

I'll have to read upon how to do that with jQuery then but it sounds promising.

 

When someone submits an item via the frontend submission form an email goes to the administrator of the site. The admin email is configured in the 'edit submissions' area - there is a field for 'Email notification'.

 

In my case when a job is uploaded it has a unique email associated with it (and entered as a field on the submissions form) and I would like to send a confirmation to this email - but the native ZOO app is not set up for this. (although it has been requested several times)


  • 0

#4 Kess

Kess

Отправлено 07 March 2014 - 13:27

You can add a recipient of submission notification by editing this file - administrator/components/com_zoo/events/submission.php

 

there is this code there:

$submission->app->submission->sendNotificationMail($event['item'], array_flip(explode(',', $recipients)), 'mail.submission.new.php');

You need to get the value of a field with e-mail address and add it to $recipients before it is executed.

 

For example, the email element id is "a44e9fce-a89d-459b-9db4-58692e69a600" (you can see it while editing your item type), then you need to add following code:

$data = $event['item']->getElement('a44e9fce-a89d-459b-9db4-58692e69a600')->data();
$recipients .= ',' . $data[0]['value'];

  • 0

#5 tobypsl2

tobypsl2

Отправлено 30 May 2014 - 13:45

Hi Kess

 

when you say: 

 

2. As you said, it should be possible to do with RSForm Pro. You can include a form in the full layout of a job offer, then using some jQuery add the value of email element to one of the fields in the form. Both the element and the corresponding form field can be hidden if you wish. Then you just need to set this form field as the recipient of the form - http://www.rsjoomla....selection-.html  - here you can see how it can be done.

 

 

do you mean include a form as an element in the full layout of a job offer (using a content plugin code) or include it in a module position or something? 

 

And do you know where I would look to find the jQuery to populate an RSForm Pro field with a Zoo data field?

 

Thanks.


  • 0

#6 Kess

Kess

Отправлено 01 June 2014 - 14:35

I made a test example how it can be done.

 

1. You can include a form either using content plugin in a "Textarea" element or as a module in a "Joomla module" element. In my example I'll be using the second method - RSForm module inserted in the "Full" layout using "Joomla module" element:

v4r_200x0.png

 

2. Let's make a simple form for this example. It will contain such fields as user name, user email and a file upload for his CV. Also it will need a hidden field which will be used to get an email of the form recepient:

643_200x0.png

 

puo_200x0.png

 

3. Now we need to output the email address of the job offer author and this form in our item. In our example it will be "Full" layout of the Product item type:

z51_200x0.png

 

4. Now open an item and inspect the page. We need to find classes or IDs of author email element and of the hidden form field so we can use them in a script:

632_200x0.jpg

 

xgm_200x0.png

 

5. Now we need to hide author email as you wanted and put its value to the hidden field of our form. This goes to CSS:

.element-10ced810-a1e3-49cc-b4f7-81e777df869a {
    display: none;
}

and this is a script that can get the value:

jQuery(document).ready(function() {
    jQuery('#sendto').val(jQuery('.element-10ced810-a1e3-49cc-b4f7-81e777df869a').text());
});

That's all you need.

 

This is what i get on the email specified as the author email after the form is submitted:

yut_200x0.png


Сообщение отредактировал Kess: 01 June 2014 - 14:38

  • 1

#7 tobypsl2

tobypsl2

Отправлено 04 June 2014 - 15:51

Hi Kess

 

that's an outstanding answer it worked fine.  

 

I had to get my head around what goes where - but eventually, after linking the javascript function to the form send button it worked nicely.  I also didn't realise that the coe would pick up BOTH the field label and the value - so I first had to not show the label (otherwise RS Form cannot recognise as a valid email).

 

I am now trying to put the form in a modal popup because there is a lot of information on it and together with the advert it is a long page.

 

Although when I look at the modal window using firebug I can see the main page ZOO fields - the form is no longer picking up the email address.

 

I use the modals by no number because they tend to be least buggy and play nicest with other third parties. It is in iFrame mode so i can load the thank you message after send.

 

RS Form Pro have a method for enabling lightbox loading but it involves a template hack and yootheme update too frequently to bother with that.

 

Off the top of your head are you aware why the javascript code wouldn't pickup the email field when the form opens in a modal window?  If not no worries I'll figure something else out.

 

Thanks again for your help,

 

Toby


  • 0

#8 Kess

Kess

Отправлено 05 June 2014 - 16:27   Лучший Ответ

Hello,

 

You need to add window.parent there like this:

jQuery(document).ready(function() {
    jQuery('#sendto').val(window.parent.jQuery('.element-10ced810-a1e3-49cc-b4f7-81e777df869a').text());
});

  • 0

#9 tobypsl2

tobypsl2

Отправлено 06 June 2014 - 09:36

Brilliant thanks.


  • 0




Click to return to top of page in style!