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
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 />";
}
}
ok now I am getting somewhere ... my output is ...
Payment module name: 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 Image[0] path:images/HP-E6930p.jpg
Products Image[0] Width: 50
Products Image[0] Height: 40
Products Quantity[0] :4
Products price[0] path:$2,320.00
Products price[0] each path:$580.00
Products Image[1] path:images/HP-E6930p.jpg
Products Image[1] Width: 50
Products Image[1] Height: 40
Products Quantity[1] :1
Products price[1] path:$560.00
Products price[1] each path:$560.00
Products in cart:
Recent OUTPUT using the testing server html source code:
HTML Code:Payment module name: ic <br>Admin title for the module International Checkout Payments <br>Admin description for the module International Checkout Payments <br>True, the number 1 means is enabled<br> <br>Products Image[0] path:<strong>https://www.store.com/store/images/HP-E6930p.jpg</strong><br> Products Image[0] Width: <strong>150</strong><br> Products Image[0] Height: <strong>150</strong><br> Products Quantity[0]: <strong><input name="cart_quantity[]" value="6" size="4" type="text"></strong><br> Products price[0]: <strong>$3,480.00</strong><br> Products price[0] each: <strong>$580.00</strong><br> Products Image[1] path:<strong>https://www.store.com/store/images/HP-E6930p.jpg</strong><br> Products Image[1] Width: <strong>150</strong><br> Products Image[1] Height: <strong>150</strong><br> Products Quantity[1]: <strong><input name="cart_quantity[]" value="1" size="4" type="text"></strong><br> Products price[1]: <strong>$560.00</strong><br> Products price[1] each: <strong>$560.00</strong><br> <p></p><h1> Products Array Loop thru contents</h1><p></p> productsImage ... https://www.store.com/store/images/HP-E6930p.jpg <br> productsName ... Hewlett Packard HP-E6930p Business Laptop <br> quantityField ... <input name="cart_quantity[]" value="6" size="4" type="text"> <br> productsPrice ... $3,480.00 <br> productsPriceEach ... $580.00 <br> id ... 2 <br> productsImage ... https://www.store.com/store/images/HP-E6930p.jpg <br> productsName ... Hewlett Packard HP-E6920p Business Laptop <br> quantityField ... <input name="cart_quantity[]" value="1" size="4" type="text"> <br> productsPrice ... $560.00 <br> productsPriceEach ... $560.00 <br> id ... 1 <br> <p>Your session ID is f9b5f16d3f3e5ec0a604b570b5d0c2d8.</p>
Last edited by icecold; 26 Apr 2010 at 07:59 PM.
so far so good but where the module method has to be called in order to pass the hidden fields to the form?
In this line inside the module ic I call for a bogus action, but nothing happens from the line of code after //This is not working:
PHP Code:function ic() {
global $order;
$this->code = 'ic';
if (IS_ADMIN_FLAG === true) {
// Payment module title in Admin
$this->title = MODULE_PAYMENT_IC_TEXT_ADMIN_TITLE;
} else {
$this->title = MODULE_PAYMENT_IC_TEXT_CATALOG_TITLE;
}
$this->description = MODULE_PAYMENT_IC_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_IC_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_IC_STATUS == 'True') ? true : false);
// This is not working
$this->form_action_url = "https://sandbox.php";
//works fine
if ((int)MODULE_PAYMENT_IC_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_IC_ORDER_STATUS_ID;
}
if (is_object($order)) $this->update_status();
}