Unfortunately, while developing eSyndiCat directory script we didn't pay much attention to processing paid submissions via PayPal. The result is that some customers started reporting different errors in PayPal module. But ...
... in this article I will describe the nitty-gritty details of how to get rid of the errors.
So, if you offer paid submissions or plan to do so in the future, and you process the payments with PayPal please read on.
Before installing the new PayPal module I would like to say a couple of words about PayPal IPN since the new module makes use of it.
IPN stands for Instant Payment Notification. This is the most reliable way of integrating PayPal into your site.
That's why we switched to this mechanism while debugging the PayPal module.
Here is what PayPal says about IPN:
Instant Payment Notification allows you to integrate your PayPal payments with your website's back-end operations, so you get immediate notification and authentication of the PayPal payments you receive.
You can learn more about PayPal IPN here.
Before using the new PayPal module you have to activate IPN by adjusting some of your PayPal account settings.
Below are the instructions on how to do it.
1. Log into your account. Click on Profile tab.
2. Click the Website Payment Preferences link.
3. On the newly opened page set Auto Return to On.
4. Save changes.
5. Now click on Profile tab again. And click the Instant Payment Notification Preferences link.
5. On the IPN Preferences page click the Edit button. Click the checkbox and in the Notification URL box below put a URL like this:
In the URL above you have to replace mydomain.com with your actual domain name. And replace dir/ with the folder where you installed eSyndiCat. Or remove it if you installed in the web root folder.
Save changes.
Congratulations! You have successfully activated IPN.
Now that IPN is activated you can start installing the new PayPal module.
I have added it to our Customer Area so you can download it. Log into eSyndiCat Customer Area, click on Mods & Patches tab, click the PayPal IPN link.
The downloaded package contains the following files:
payment-canceled.php payment-complete.php purchase.php readme.txt plugins/paypal/header.php plugins/paypal/ipn_process.php plugins/paypal/pre_paypal.php templates/payment-canceled.php templates/payment-complete.php templates/suggest-link3.php
The first step is to upload all the files to your server.
Copying PayPal module files is straighforward except for the files located in the templates/ folder of the package.
The trick is that these files are common for all the templates. So you have to put these files in corresponding template folder. E.g. if you are using GreenLeaves template you have to upload these files into templates/GreenLeaves/, not into templates/. I think you've got the point.
This module introduces some new language strings so you have to add them as well.
Below is the list of key => value pairs and explanation of each pair I used in my copy of eSyndiCat. You might want to change the values if you are using a language other than English or you don't like the wording. What matters here is the key that should not be changed and the explanation for you to understand the purpose of each string.
This is the content of the page that is displayed to the visitor after payment is completed successfully.
This is the title and content of the page displayed to the visitor if he cancels the payment.
Note: in Pro 2.0 we changed the mechanism of storing and fetching language entires: now all of them are stored in the database. You can use built in Language Manager to add entries.
Log into directory admin panel, click the Language Manager link in the left sidebar, click Add Phrase button. You will see a form similar to this:
Now type in the key, the value, select the language, and select User Frontend as the category. Click the Add button.
Do the same for all the aforementioned key => value pairs.
If you are using Pro 1.2 you should ignore this step...
... but if you are using Pro 2.0 you have to do the following.
Please open classes/Dir.php and replace the function setPlan() with the implementation below:
function setPlan($aLink, $aId, $aTid = '') { // Assign the sponsored plan to the link $sql = "UPDATE `{$this->mPrefix}links`"; $sql .= "SET `sponsored` = '1', `sponsored_start` = NOW(), "; $sql .= "`sponsored_plan_id` = '{$aId}', `sponsored_tid` = '{$aTid}' "; $sql .= "WHERE `id` = '{$aLink}'"; $this->mDb->query($sql); $admins = $this->getAdmins(); if ($admins) { foreach($admins as $key=>$value) { if ($value['payment_notif']) { $link =& $this->getLinkById($aLink); $this->mMailer->sendPaymentNotif($value, $link); } } } }
Save changes and close the file.
That's all. Now you can create plans, enable PayPal in admin panel, and accept paid submissions...
... without errors!