I don't see why you couldn't do it that way.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
I read Paypal files, and the Paypal template button file, and is calling ipn_main_handler.php, linking to it,
so in my case do you you think if I link directly to my payment class will work? Won't it try to write to CONFIGURE table and return an error?HTML Code:<div id="PPECbutton" class="buttonRow"> <a href="<?php echo zen_href_link('ipn_main_handler.php', 'type=ec', 'SSL', true, true, true); ?>"><img src="<?php echo MODULE_PAYMENT_PAYPALWPP_EC_BUTTON_IMG ?>" alt="<?php echo MODULE_PAYMENT_PAYPALWPP_TEXT_BUTTON_ALTTEXT; ?>" /></a> </div>
I know you can instantiate a class, but my understanding of PHP Objects is still limited, so I am not sure how that will behave, If that specific method will make a new conflict ... or if I can have new instance, and don't worry about it ...
Last edited by icecold; 6 Apr 2010 at 12:27 AM.
Yes, but that's just the URL that the button goes to when you click it. You don't need to use ipn_main_handler or anything like that. Use whatever you want for your unique needs. PayPal does way more than what you're talking about, so has only marginal similarities to your needs.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
ok I managed to display the nice button ... but when I click the link I got a permission problem ...
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
www.store.com
04/06/10 00:22:47
Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_autoindex_color PHP/5.1.6
I fixed the problem but now I get a blank page I created a handler, where the class is instantiated and echoed some vars inside the class, but the output is a black screen ...
I draw the button and call the handler using a link
HTML Code:<div id="ICbutton" class="buttonRow"> <a href="<?php echo zen_href_link('ic_main_handler.php', 'type=ic', 'NONSSL', true, true, true); ?>"><img src="<?php echo MODULE_PAYMENT_IC_BUTTON_IMG; ?>" alt="<?php echo MODULE_PAYMENT_IC_TEXT_BUTTON_ALTTEXT; ?>" /></a> </div>
Here is my handler's code(I am not sure those requires are needed, tested both ways and same result, blank page):
I even created a $test var inside the class and echoed it in the handler along with some variables, to see if I can get some output but it's not working ...PHP Code:/**
* handle International Checkout processing:
*/
if (isset($_GET['type']) && $_GET['type'] == 'ic') {
// this is an ic handler request
// require('includes/application_top.php');
// require(DIR_WS_CLASSES . 'payment.php');
// See if the ic module is enabled.
if (defined('MODULE_PAYMENT_IC_STATUS') && MODULE_PAYMENT_IC_STATUS == 'True') {
$ic_module = 'ic';
// init the payment object
$payment_modules = new ic();
$payment_modules->ic();
//Test class internal vars
echo $payment_modules->test; // Test variable assigned with a value to check output
echo $payment_modules->code;
echo $payment_modules->title;
echo $payment_modules->description;
echo $payment_modules->enabled;
}
}
I can't get any values from the vars inside the shopping cart, inside my method process_button I tested the $_SESSION['cart'] and it returned true for both is set and is an object ...
but $products is still empty ...
PHP Code:function process_button() {
global $products, $currencies;
//Test and return
if (isset($_SESSION['cart'])) {echo 'Session variable is already created.';}
else {echo 'Session variable is not yet created.';}
if (is_object($_SESSION['cart'])) {echo 'Session variable is an object type.';}
else {echo 'Session variable is not an object type.';}
echo"<br />";
$products = $_SESSION['cart']->get_products();
echo $products;
return; // test if anything is inside $products so far is empty
get_products() will return an array ... which you can't display by merely using echo(). You would need to echo print_r($products, TRUE) if you wanted to see the array contents that way
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
ok, I
made a modification but now I don't get anything from that function ...
I am getting an empty string ... so far ...PHP Code:function process_button() {
global $products, $currencies, $results;
if (isset($_SESSION['cart'])) {
echo 'Session variable is already created.';
} else {
echo 'Session variable is not yet created.';
}
if (is_object($_SESSION['cart'])) {
echo 'Session variable is an object type.';
} else {
echo 'Session variable is not an object type.';
}
echo"<br />";
$products = $_SESSION['cart']->get_products();
$results = print_r($products, true);
echo $results;
return;
}
My output is:
ic
Admin title for the module International Checkout Payments
Admin description for the module International Checkout Payments
True, the number 1 means is enabled
products in cart:
and it's coming from my modified Paypal IPN handler
PHP Code:if (isset($_GET['type']) && $_GET['type'] == 'ic') {
// this is an ic handler request
require_once('includes/modules/payment/ic.php');
//require_once('includes/modules/pages/shopping_cart/header_php.php');
require('includes/application_top.php');
require(DIR_WS_CLASSES . 'payment.php');
include('includes/languages/english/modules/payment/ic.php');
// See if the ic module is enabled.
if (defined('MODULE_PAYMENT_IC_STATUS') && MODULE_PAYMENT_IC_STATUS == 'True') {
$ic_module = 'ic';
// init the payment object
$payment_modules = new ic();
$payment_modules->ic();
//Test class internal vars
//$products=$_SESSION['cart'];
//echo $products;
echo $payment_modules->code . "<br />";
echo "Admin title for the module " . $payment_modules->title . "<br />";
echo "Admin description for the module " . $payment_modules->description . "<br />";
echo "True, the number " . $payment_modules->enabled . " means is enabled<br />";
echo "products in cart: " . $payment_modules->results . "<br />";
}
}