donate button: campaign_id null or not an object

  • Christian_Belgien
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
12 years 9 months ago #10282 by Christian_Belgien
donate button: campaign_id null or not an object was created by Christian_Belgien
I include mod_jd_campaigns twice in an article, once in the intro text and once in the 'read more' text. When I click on the donate button in the 'read more' text I get the donation as I should. However, when I click on the donate button in the intro text I get an error with this error message:

Message: 'campaign_id' is null or not an object
Line: 457
Char: 4
Code: 0
URI: christianjorgensen.be/Joomla1/index.php

My setup is this:

I have written an article for each campaign. For example for campaign 'aboubakar' with campaign id 1 I have in the intro text to the article placed a {loadposition aboubakar}, and in the 'read more' text I have likewise placed a {loadposition aboubakar}. I have saved a copy of mod_jd_campaigns with the campaign-id selected in the parameters and position aboubakar.

I am a beginner, but I figured out that the donation form is called in the tmpl.default.php file of the module. I see the function donationForm(campaignId) and see that this function is called by the line:

<input type="button" class="button" onclick="donationForm(<?php echo $row->id ; ?>);" value="<?php echo JText::_('JD_DONATE'); ?>" />

As a test I print out the campaign id number out by including the code:

<tr><td><strong>Campaign id</strong></td>"
<td><?php echo $row->id ; ?></td></tr>

and the campaign id shows correctly both in the intro text and in the 'read more' text.

I shall be grateful for any help in resolving this, so that I get a workable donate button both in the intro text and in the read more text.

Please Log in or Create an account to join the conversation.

  • Christian_Belgien
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
12 years 8 months ago #10474 by Christian_Belgien
Replied by Christian_Belgien on topic Re: donate button: campaign_id null or not an object
I believe I solved it. I show the solution here - maybe this can help others. I shall first restate the problem I experienced: I write an article for each campaign and insert, using {loadposition}, an instance of mod_jd_campaigns (with the relevant Campaign Id). mod_jd_campaigns has a 'donate' button that by click calls the donation form. However, when I show several articles on one page, click on the 'donate' button gives error 'campaign_id is null or not an object'.

The cause seems to be, that the html page includes several forms with the identical name "campaign_form".

What I did was to change the name of the form by including the campaign id in the name. I changed

'<form name="campaign_form" id="campaign_form"...

to <form name="campaign_form<?php echo $row->id ; ?>" id="campaign_form<?php echo $row->id ; ?>"

I further changed the script included in the form from

'....var form = document.campaign_form ;...'

to '....var form = document.getElementById("campaign_form"+campaignId) ;....'

Could it be a feature of future releases that the name of the form in mod_jd_campaigns is unique for each campaign, for example by including, as above, the campaign id?

Please Log in or Create an account to join the conversation.

More
12 years 8 months ago #10512 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: donate button: campaign_id null or not an object
Hi Christian

Nice solution ! I will think about it and then apply this modification to future release of the extension !

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Christian_Belgien
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
12 years 8 months ago #10517 by Christian_Belgien
Replied by Christian_Belgien on topic Re: donate button: campaign_id null or not an object
Thank you for your encouraging reaction. As they say in Denmark (my home country): A blind chicken also sometimes finds a grain.

Please Log in or Create an account to join the conversation.

  • Christian_Belgien
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
12 years 8 months ago #10888 by Christian_Belgien
Replied by Christian_Belgien on topic Re: donate button: campaign_id null or not an object
...and the blind chicken is looking further. I now realise, that if the mod_donation could be bound to a specific campaign id this would be what I needed instead of tampering with mod_jd_campaigns. I did not find on mod_jdonation a parameter for choice of campaign id as there is on jd_campaigns. Has this not been implemented, or am I missing something? If not implemented, I would propose this for a future upgrade, as this would be a useful feature.

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #11616 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: donate button: campaign_id null or not an object
Hi all

Today another client asked for this. So I made small modification to the thermometer and campaigns module so that you can use different instances of these modules on same page. if anyone need it, just download it and re-install it on your site .

Tuan

Attachment mod_jd_campaigns-20111006.zip not found

Attachments:

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #11617 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: donate button: campaign_id null or not an object
Thermometer module :

Attachment mod_jd_thermometer.zip not found

Attachments:

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #11657 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: donate button: campaign_id null or not an object
Donation module :

Attachment mod_jdonation.zip not found

Attachments:

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #11658 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: donate button: campaign_id null or not an object
Please note that these modules is for Joomla 1.5, if anyone needs the same modification for Joomla 1.6, 1.7, please let me know so that I can do the modification and publish it here .

Tuan

Please Log in or Create an account to join the conversation.

Moderators: Mr. DamDũng Nguyễn Việt