Ok so my question is can I add the sample script (changing all the site1, site2 to my URL's) on the zend cart IPN page and keep that as the central IPN page and maintain functionality on both? So it would look something like this.....
- Code: Select all
<?php
/*
---- Central IPN Processing: ---------------------------------------------------------------------------------
With PayPal® Pro integration you absolutely MUST set an IPN URL inside your PayPal® account.
PayPal® Pro integration does NOT allow the IPN location to be overridden on a per-transaction basis.
So ... if you're using a single PayPal® Pro account for multiple cross-domain installations,
and you need to receive IPN notifications for each of your domains; you'll want to create
a central IPN processing script that scans variables in each IPN response,
forking itself out to each of your individual domains.
In rare cases when this is necessary, you'll find two variables in all IPN responses for s2Member.
The originating domain name will always be included somewhere within, either:
`custom` and/or `rp_invoice_id`; depending on the type of transaction.
These variables can be used to test incoming IPNs, and fork to the proper installation.
---- Instructions: -------------------------------------------------------------------------------------------
1. Set the IPN URL ( in your PayPal® account ) to the location of this script on your server.
This central processor forks IPNs out to a particular installation of s2Member ( on a particular domain ).
2. Now, here's where the magic happens ( PLEASE CHANGE: www.site1.com, www.site2.com. ).
*/
if (preg_match ("/^www\.site1\.com/i", $_POST["custom"]) || preg_match ("/~www\.site1\.com~/i", $_POST["rp_invoice_id"]))
curlpsr ("http://www.site1.com/?s2member_paypal_notify=1", http_build_query ($_POST));
/**/
else if (preg_match ("/^www\.site2\.com/i", $_POST["custom"]) || preg_match ("/~www\.site2\.com~/i", $_POST["rp_invoice_id"]))
curlpsr ("http://www.site2.com/?s2member_paypal_notify=1", http_build_query ($_POST));
/*
This is just a utility function ( you must have the cURL extension for PHP enabled ).
*/
function curlpsr ($url = FALSE, $postvars = FALSE, $max_con_secs = 20, $max_stream_secs = 20, $headers = FALSE)
{
if (($url = trim ($url)) && ($c = curl_init ()))
{
curl_setopt_array ($c, /* Configure options. */
array (CURLOPT_URL => $url, CURLOPT_POST => true,/**/
CURLOPT_FOLLOWLOCATION => false, CURLOPT_MAXREDIRS => 0,/**/
CURLOPT_CONNECTTIMEOUT => (int)$max_con_secs, CURLOPT_TIMEOUT => (int)$max_stream_secs, /* Initial connection & stream seconds. */
CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => (array)$headers, CURLOPT_POSTFIELDS => $postvars,/**/
CURLOPT_ENCODING => "", CURLOPT_VERBOSE => true, CURLOPT_FAILONERROR => true, CURLOPT_FORBID_REUSE => true, CURLOPT_SSL_VERIFYPEER => false));
/**/
$o = trim (curl_exec ($c));
/**/
curl_close($c);
}
/**/
return (strlen ($o)) ? $o : false;
}
?>
<?php
/**
* Page Template
*
* Loaded automatically by index.php?main_page=checkout_success.<br />
* Displays confirmation details after order has been successfully processed.
*
* @package templateSystem
* @copyright Copyright 2003-2010 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_checkout_success_default.php 16313 2010-05-22 08:15:39Z wilt $
*/
?>
<div class="centerColumn" id="checkoutSuccess">
<!--bof -gift certificate- send or spend box-->
<?php
// only show when there is a GV balance
if ($customer_has_gv_balance ) {
?>
<div id="sendSpendWrapper">
<?php require($template->get_template_dir('tpl_modules_send_or_spend.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_send_or_spend.php'); ?>
</div>
<?php
}
?>
<!--eof -gift certificate- send or spend box-->
<h1 id="checkoutSuccessHeading"><?php echo HEADING_TITLE; ?></h1>
<div id="checkoutSuccessOrderNumber"><?php echo TEXT_YOUR_ORDER_NUMBER . $zv_orders_id; ?></div>
<!--affiliate tracking -->
MY AFFILIATE TRACKING CODE FOR ZEND CART ONLY
<!-- eof affiliate tracking -->
<?php if (DEFINE_CHECKOUT_SUCCESS_STATUS >= 1 and DEFINE_CHECKOUT_SUCCESS_STATUS <= 2) { ?>
<div id="checkoutSuccessMainContent" class="content">
<?php
/**
* require the html_defined text for checkout success
*/
require($define_page);
?>
</div>
<?php } ?>
<!-- bof payment-method-alerts -->
<?php
if (isset($_SESSION['payment_method_messages']) && $_SESSION['payment_method_messages'] != '') {
?>
<div class="content">
<?php echo $_SESSION['payment_method_messages']; ?>
</div>
<?php
}
?>
<!-- eof payment-method-alerts -->
<!--bof logoff-->
<div id="checkoutSuccessLogoff">
<?php
if (isset($_SESSION['customer_guest_id'])) {
echo TEXT_CHECKOUT_LOGOFF_GUEST;
} elseif (isset($_SESSION['customer_id'])) {
echo TEXT_CHECKOUT_LOGOFF_CUSTOMER;
}
?>
<div class="buttonRow forward"><a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo zen_image_button(BUTTON_IMAGE_LOG_OFF , BUTTON_LOG_OFF_ALT); ?></a></div>
</div>
<!--eof logoff-->
<br class="clearBoth" />
<!--bof -product notifications box-->
<?php
/**
* The following creates a list of checkboxes for the customer to select if they wish to be included in product-notification
* announcements related to products they've just purchased.
**/
if ($flag_show_products_notification == true) {
?>
<fieldset id="csNotifications">
<legend><?php echo TEXT_NOTIFY_PRODUCTS; ?></legend>
<?php echo zen_draw_form('order', zen_href_link(FILENAME_CHECKOUT_SUCCESS, 'action=update', 'SSL')); ?>
<?php foreach ($notificationsArray as $notifications) { ?>
<?php echo zen_draw_checkbox_field('notify[]', $notifications['products_id'], true, 'id="notify-' . $notifications['counter'] . '"') ;?>
<label class="checkboxLabel" for="<?php echo 'notify-' . $notifications['counter']; ?>"><?php echo $notifications['products_name']; ?></label>
<br />
<?php } ?>
<div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_UPDATE, BUTTON_UPDATE_ALT); ?></div>
</form>
</fieldset>
<?php
}
?>
<!--eof -product notifications box-->
<!--bof -product downloads module-->
<?php
if (DOWNLOAD_ENABLED == 'true') require($template->get_template_dir('tpl_modules_downloads.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_downloads.php');
?>
<!--eof -product downloads module-->
<div id="checkoutSuccessOrderLink"><?php echo TEXT_SEE_ORDERS;?></div>
<div id="checkoutSuccessContactLink"><?php echo TEXT_CONTACT_STORE_OWNER;?></div>
<h3 id="checkoutSuccessThanks" class="centeredContent"><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3>
</div>