Forums / Addon Payment Modules / Create a new module for International Checkout payment module

Create a new module for International Checkout payment module

Locked

Started by icecold on 3 Dec 2009, 8:09 PM · Views: 13,224

Results 21 to 40 of 64
This thread is locked. New replies are disabled.
14 Mar 2010, 8:51 PM
#21
icecold avatar

icecold

Zen Follower

Join Date:
Jul 2008
Posts:
360
Plugin Contributions:
0

Create a new module for International Checkout payment module

zamzom:

I don't understand why you use html input command, do you expect your customers to enter that data from a form? I think those items knowledge must be available in your cart items data, and you need fetch/form them somehow from there (i don't know how).

Paypal.php module creates paypal session history and keeps it in the database. session_id in the following is a reference to that database item. If you follow the methods you will recognize that it will be removed from the database later on after successful payment. You can keep this (provided you change the database name from TABLE_PAYPAL_SESSION to yours, unless you want to screw up the paypal database :yes:)

$_SESSION['ppipn_key_to_remove'] = session_id();


Well the payment gateway expects a form within an iframe, but I will modify it to process the data using curl ...
15 Mar 2010, 7:27 AM
#22
icecold avatar

icecold

Zen Follower

Join Date:
Jul 2008
Posts:
360
Plugin Contributions:
0

Re: Create a new module for International Checkout payment module

I need to use a hidden field with image location. I am trying to submit current cart data into a form using curl, I found the array $orders->products[i] where i has different product information(id, name, qty, price), but I couldn't find out from where I can get the image location to pass it as a hidden field using zen_draw_hidden_field() function, I am trying to mimic the exact display of the shopping cart, onto the processing server, so I have everything else but the image location. to display the thumbnail. Any recommendations?

Qty Product Name Description and Price are all available from the Order Class, but there is no image location in that array ...

This module will use curl to pass the cart data(Image Qty Product Name Description and Price) plus the username, it will loop through the order.

15 Mar 2010, 8:29 AM
#23
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Create a new module for International Checkout payment module

The image is not part of the available data provided during checkout. If you need that, you'll have to query for it.

.
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.

15 Mar 2010, 4:33 PM
#24
icecold avatar

icecold

Zen Follower

Join Date:
Jul 2008
Posts:
360
Plugin Contributions:
0

Re: Create a new module for International Checkout payment module

DrByte:

The image is not part of the available data provided during checkout. If you need that, you'll have to query for it.

ok, I see but then where this code is generated?

<span id="cartImage" class="back"><img src="images/isimages/DH00789BLK.jpg" ...

I couldn't find what includes are used to show this info ... any particular zen-cart function or Class I need to look?

I searched the code in shopping_cart and orders classes, to see if the values where queried from a function there, but couldn't find anything.

15 Mar 2010, 6:21 PM
#25
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Create a new module for International Checkout payment module

In v1.3.x, the shopping_cart class doesn't draw the content for the shopping cart page. The class merely manages shopping cart operations, not view activities.
The image for the shopping cart page is obtained inside the controller for that page: /includes/modules/pages/header_php.php
That code is not replicated in the shopping_cart or order classes because it is not needed there. ie: There's no need to store that info in the order records, so there's no need to process that information at that stage.

.
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.

15 Mar 2010, 6:25 PM
#26
icecold avatar

icecold

Zen Follower

Join Date:
Jul 2008
Posts:
360
Plugin Contributions:
0

Re: Create a new module for International Checkout payment module

icecold:

ok, I see but then where this code is generated?

<span id="cartImage" class="back"><img src="images/isimages/DH00789BLK.jpg" ...

I couldn't find what includes are used to show this info ... any particular zen-cart function or Class I need to look?

I searched the code in shopping_cart and orders classes, to see if the values where queried from a function there, but couldn't find anything.

ok, I found it in tpl_shopping_cart, I completely forgot, about the templates controlling html output ...

so now my question is

I noticed a foreach loop using $ProductsArray (don't know if that var is defined somewhere)

  foreach ($productArray as $product) {
?>
     <tr class="<?php echo $product['rowClass']; ?>">
       <td class="cartQuantity">
<?php
  if ($product['flagShowFixedQuantity']) {
    echo $product['showFixedQuantityAmount'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'];
  } else {
    echo $product['quantityField'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'];
  }
?>
       </td>
       <td class="cartQuantityUpdate">
<?php
  if ($product['buttonUpdate'] == '') {
    echo '' ;
  } else {
    echo $product['buttonUpdate'];
  }
?>
       </td>
       <td class="cartProductDisplay">
<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>
<br class="clearBoth" />


<?php
  echo $product['attributeHiddenField'];
  if (isset($product['attributes']) && is_array($product['attributes'])) {
  echo '<div class="cartAttribsList">';
  echo '<ul>';
    reset($product['attributes']);
    foreach ($product['attributes'] as $option => $value) {
?>

<li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']); ?></li>

<?php
    }
  echo '</ul>';
  echo '</div>';
  }
?>
       </td>
       <td class="cartUnitDisplay"><?php echo $product['productsPriceEach']; ?></td>
       <td class="cartTotalDisplay"><?php echo $product['productsPrice']; ?></td>
       <td class="cartRemoveItemDisplay"> 

So, it's ok to request $products['productsImage'] and use it as hidden field?
or I have to do a foreach ... also in my module?

15 Mar 2010, 7:11 PM
#27
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Create a new module for International Checkout payment module

The template is rendering the View portion of the controller content built in the header_php.php I talked about earlier.

.
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.

15 Mar 2010, 7:49 PM
#28
icecold avatar

icecold

Zen Follower

Join Date:
Jul 2008
Posts:
360
Plugin Contributions:
0

Re: Create a new module for International Checkout payment module

DrByte:

The template is rendering the View portion of the controller content built in the header_php.php I talked about earlier.

Yes I saw that in header:

$productArray[$i] = array('attributeHiddenField'=>$attributeHiddenField,
                            'flagStockCheck'=>$flagStockCheck,
                            'flagShowFixedQuantity'=>$showFixedQuantity,
                            'linkProductsImage'=>$linkProductsImage,
                            'linkProductsName'=>$linkProductsName,
                            'productsImage'=>$productsImage,
                            'productsName'=>$productsName,
                            'showFixedQuantity'=>$showFixedQuantity,
                            'showFixedQuantityAmount'=>$showFixedQuantityAmount,
                            'showMinUnits'=>$showMinUnits,
                            'quantityField'=>$quantityField,
                            'buttonUpdate'=>$buttonUpdate,
                            'productsPrice'=>$productsPrice,
                            'productsPriceEach'=>$productsPriceEach,
                            'rowClass'=>$rowClass,
                            'buttonDelete'=>$buttonDelete,
                            'checkBoxDelete'=>$checkBoxDelete,
                            'id'=>$products[$i]['id'],
                            'attributes'=>$attrArray);

My question was if it's ok to call the array $productArray directly (as the vars are on the same shopping cart, that page), or I have to do a foreach $productArray as $products ... again?

15 Mar 2010, 8:51 PM
#29
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Create a new module for International Checkout payment module

Well, if you're not on the shopping cart page when you're running your particular code, then that whole array won't even be available to you, so you won't be able to use the variables at all.

But, assuming you were on that page, if you think about it, the foreach is used to render each line in the shopping cart. So, unless you're already doing something as part of looping thru the array within the template, you'll have to loop thru it again if you want it to handle all products in the cart.

.
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.

16 Mar 2010, 8:36 PM
#31
icecold avatar

icecold

Zen Follower

Join Date:
Jul 2008
Posts:
360
Plugin Contributions:
0

Re: Create a new module for International Checkout payment module

DrByte:

Well, if you're not on the shopping cart page when you're running your particular code, then that whole array won't even be available to you, so you won't be able to use the variables at all.

But, assuming you were on that page, if you think about it, the foreach is used to render each line in the shopping cart. So, unless you're already doing something as part of looping thru the array within the template, you'll have to loop thru it again if you want it to handle all products in the cart.

Yes, I thought so, I have to loop through all the products ...

Thanks for the tips ...

I just made this function within the Class

function process_button() {
      global $HTTP_SERVER_VARS, $product, $customer_id;

foreach ($productArray as $product) {
	
      $process_button_string = zen_draw_hidden_field('ItemQuantity',$product['quantityField'] . 
							   zen_draw_hidden_field('ItemImage', $product['productsImage']) . 
				               zen_draw_hidden_field('ItemDescription', $product['productsName']) . 
							   zen_draw_hidden_field('ItemPrice', $product['productsPrice']);

      $process_button_string .= zen_draw_hidden_field(zen_session_name(), zen_session_id());
      return $process_button_string;
    }
}

Hope it works

16 Mar 2010, 8:41 PM
#32
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Create a new module for International Checkout payment module

I don't know why you're referencing $HTTP_SERVER_VARS, both because you're not using them in that function, and also because they're obsolete in PHP 5.3, replaced by $_SERVER instead. But, since you're not using it, you don't need it listed. Also, you're not using $customer_id, so don't need that either.
Also, since $productArray is never set inside that function, you'll just get a blank string for your output ... actually likely a null string since the variable never gets set.
I've no idea why you're doing this with process_button() ... I guess you're using that to send the data someplace along with the customer, instead of doing it all via CURL as discussed before.

.
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.

16 Mar 2010, 9:22 PM
#33
icecold avatar

icecold

Zen Follower

Join Date:
Jul 2008
Posts:
360
Plugin Contributions:
0

Re: Create a new module for International Checkout payment module

DrByte:

I don't know why you're referencing $HTTP_SERVER_VARS, both because you're not using them in that function, and also because they're obsolete in PHP 5.3, replaced by $_SERVER instead. But, since you're not using it, you don't need it listed. Also, you're not using $customer_id, so don't need that either.
Also, since $productArray is never set inside that function, you'll just get a blank string for your output ... actually likely a null string since the variable never gets set.
I've no idea why you're doing this with process_button() ... I guess you're using that to send the data someplace along with the customer, instead of doing it all via CURL as discussed before.

I will do, and I am not really familiar with PHP5 syntax so thanks for the tip ...

I am really trying to understand the logic behind the payment module Class, so I am just experimenting and testing different approaches.

Most of my functions are return false; since the only thing I need to do is to pass the info ...

Process_button uses $HTTP_SERVER because to pass the data to curl_setopt($ch, CURLOPT_POSTFIELDS, I pass a string of characters gathered in process_button(), and then
concatened in the next function, what it does is to assign each value to an element of the array ...

Here is my curl connection:

class ic {
    var $code, $title, $description, $enabled;


    function https_send($params)
    {

$test_mode=0;
    
        $ch = curl_init(); 
        curl_setopt($ch, CURLOPT_URL,"https://www.internationalcheckout.com/cart.php"); 

// Seed cURL connection options
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_FAILONERROR, 1); 
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
        curl_setopt($ch, CURLOPT_TIMEOUT, 30); 
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 
        curl_setopt($ch, CURLOPT_POST, 1); 
// Create iData packet from individual fields...
$idata=implode(",",$params["iData"]);

// Compose and send POST message
    curl_setopt($ch, CURLOPT_POSTFIELDS, 'Company=' . $params["iccompany"] . '&iData=' . $idata); 
        $result=curl_exec ($ch); 
        curl_close ($ch); 

        return $result;

and below are the 2 functions that collect data to be transmitted by POSTFIELDS:

//Prepare the data from the cart to be transmited using curl

    function process_button() {
      global $HTTP_SERVER_VARS, $product, $customer_id;

foreach ($productArray as $product) {
	
      $process_button_string = zen_draw_hidden_field('ItemQuantity',$product['quantityField'] . 
							   zen_draw_hidden_field('ItemImage', $product['productsImage']) . 
				               zen_draw_hidden_field('ItemDescription', $product['productsName']) . 
							   zen_draw_hidden_field('ItemPrice', $product['productsPrice']);

      $process_button_string .= zen_draw_hidden_field(zen_session_name(), zen_session_id());
      return $process_button_string;
    }

}
// !Functions to execute before processing the order
    function before_process() {
      global $HTTP_POST_VARS;

      $params['iccompany']= MODULE_PAYMENT_IC_COMPANY;
      $params['ItemQuantity'] = $HTTP_POST_VARS['ItemQuantity'];
	  $params['ItemImage'] = $HTTP_POST_VARS['ItemImage'];
	  $params['ItemDescription'] = $HTTP_POST_VARS['ItemDescription'];
      $params['ItemPrice'] = $HTTP_POST_VARS['ItemPrice'];
	  
      $params['iccompany'] = urlencode($params['iccompany']);
      
      $params['iData'][0] = urlencode($params['ItemQuantity']);
      $params['iData'][1] = urlencode($params['ItemImage']);  
	  $params['iData'][2] = urlencode($params['ItemDescription']);
	  $params['iData'][3] = urlencode($params['ItemPrice']); 
	  
      
         // remove params with empty values
      foreach ($params as $key => $value) {
        if (!$value) {
          unset($params[$key]);
        }
      }

What I'm trying to figure out is if how can made another loop in before_process() so it gathers all the values from process_button.

I will make the change to $_SERVER, as you suggested, but if the array $products, gets it's content in the shopping cart, why will it pass empty fields to my class? Do I need to do another db query so ProductsArray[] has data again?

16 Mar 2010, 9:48 PM
#34
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Create a new module for International Checkout payment module

icecold:

I will make the change to $_SERVER, as you suggestedYou don't need it, because you're not using it ... at least, not in that function.
icecold:

but if the array $products, gets it's content in the shopping cart, why will it pass empty fields to my class?First, because payment modules are not activated on the shopping cart page, there's no way the $productsArray will have any data in it anyway.
Second, every function starts clean, and knows nothing about any other variables outside itself. That's just how PHP has always worked. Each function is its own scope. The only way to get around that is to pass parameters to it or to global certain variables, and using global is an older convention only applicable to procedural code, whereas PHP is headed towards object-oriented code instead.> icecold:

Do I need to do another db query so ProductsArray[] has data again?Yes, as I said, unless you're ON the shopping cart page when the payment module is instantiated and called, none of the shopping cart data is available to you anyway.
If you want to mimic similar behavior you'll have to copy and duplicate the code to do that.

You're not merely writing another payment module here. It's more like you're re-architecting a whole new checkout.

.
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.

16 Mar 2010, 10:54 PM
#35
icecold avatar

icecold

Zen Follower

Join Date:
Jul 2008
Posts:
360
Plugin Contributions:
0

Re: Create a new module for International Checkout payment module

DrByte:

You don't need it, because you're not using it ... at least, not in that function.
First, because payment modules are not activated on the shopping cart page, there's no way the $productsArray will have any data in it anyway.

I thought because we were in the same session some vars might had content ... (that was just in theory).

DrByte:

Second, every function starts clean, and knows nothing about any other variables outside itself. That's just how PHP has always worked. Each function is its own scope. The only way to get around that is to pass parameters to it or to global certain variables, and using global is an older convention only applicable to procedural code, whereas PHP is headed towards object-oriented code instead.Yes, as I said, unless you're ON the shopping cart page when the payment module is instantiated and called, none of the shopping cart data is available to you anyway.
If you want to mimic similar behavior you'll have to copy and duplicate the code to do that.

ok, so the cart data is stored in tables? So I can query them and retrieve it? ...

DrByte:

You're not merely writing another payment module here. It's more like you're re-architecting a whole new checkout.

Yes, more like it, as this system overrides all the functions and takes only raw data from the cart. So in PHP OOP there is no way to 'store' an array and reuse its contents, not even in a SESSION(I am really not familiar with PHP OOP)?

16 Mar 2010, 11:53 PM
#36
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Create a new module for International Checkout payment module

icecold:

So in PHP OOP there is no way to 'store' an array and reuse its contents, not even in a SESSION(I am really not familiar with PHP OOP)?
Well, yes there is, but Zen Cart 1.x isn't OOP structured.

.
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.

17 Mar 2010, 12:29 AM
#37
icecold avatar

icecold

Zen Follower

Join Date:
Jul 2008
Posts:
360
Plugin Contributions:
0

Re: Create a new module for International Checkout payment module

DrByte:

Well, yes there is, but Zen Cart 1.x isn't OOP structured.

ok how about the cart history? I have seen the cart contents get stored there intact, what if I try to retrieve the data from those tables?

for ($i=0, $n=sizeof($products); $i<$n; $i++) {
  if (($i/2) == floor($i/2)) {

$productsImage = (IMAGE_SHOPPING_CART_STATUS == 1 ? zen_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT) : '');
$quantityField = zen_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"');
 $productsPrice = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
  $productsPriceEach = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');

// Create a smaller Array to hold just the data above

  $productArray[$i] = array( 'productsImage'=>$productsImage,
                                            'productsName'=>$productsName,
                                            'quantityField'=>$quantityField,
                                             'productsPrice'=>$productsPrice,
                                  'productsPriceEach'=>$productsPriceEach,
                            'rowClass'=>$rowClass,
                      
                            'id'=>$products[$i]['id']);
} // end FOR loop

I borrowed some of the code from header.php my question is will this work, in my class or will it have a conflict problem?

Just created a new array with the same name and populated it with the same data.

So later I can use it within my class ...

17 Mar 2010, 1:42 AM
#38
icecold avatar

icecold

Zen Follower

Join Date:
Jul 2008
Posts:
360
Plugin Contributions:
0

Re: Create a new module for International Checkout payment module

icecold:

ok how about the cart history? I have seen the cart contents get stored there intact, what if I try to retrieve the data from those tables?

for ($i=0, $n=sizeof($products); $i<$n; $i++) {
if (($i/2) == floor($i/2)) {

$productsImage = (IMAGE_SHOPPING_CART_STATUS == 1 ? zen_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT) : '');
$quantityField = zen_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"');
$productsPrice = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
$productsPriceEach = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');

// Create a smaller Array to hold just the data above

$productArray[$i] = array( 'productsImage'=>$productsImage,
'productsName'=>$productsName,
'quantityField'=>$quantityField,
'productsPrice'=>$productsPrice,
'productsPriceEach'=>$productsPriceEach,
'rowClass'=>$rowClass,

                        'id'=>$products[$i]['id']);

} // end FOR loop

> 
> I borrowed some of the code from header.php my question is will this work, in my class or will it have a conflict problem?
> 
> Just created a new array with the same name and populated it with the same data.
> 
> So later I can use it within my class ...

I think I forgot to add >>>
**> $products = $cart->get_products();** at the top
3 Apr 2010, 7:13 PM
#39
icecold avatar

icecold

Zen Follower

Join Date:
Jul 2008
Posts:
360
Plugin Contributions:
0

Re: Create a new module for International Checkout payment module

I wanted to know if there are any specific requirements to be met prior to installing and testing a module, as I want to echo some variables, and array contents, but as the data is retrieved from a live cart, in a live session, I wanted to know in advance if that is possible or I have to install this testing module first, to avoid conflicts.

3 Apr 2010, 8:28 PM
#40
icecold avatar

icecold

Zen Follower

Join Date:
Jul 2008
Posts:
360
Plugin Contributions:
0

Re: Create a new module for International Checkout payment module

Anything wrong with these code?
I am getting a not found error in admin/modules.php local server
But couldn't find why

Warning: include(C:/server/xampp/htdocs/store/includes/languages/english/modules/payment/ic.php) [function.include]: failed to open stream: No such file or directory in C:\server\xampp\htdocs\store\admin\modules.php on line 173

Warning: include() [function.include]: Failed opening 'C:/server/xampp/htdocs/store/includes/languages/english/modules/payment/ic.php' for inclusion (include_path='.;C:\server\xampp\php\pear') in C:\server\xampp\htdocs\store\admin\modules.php on line 173

// Admin mod section ---

  function check() {
    global $db;
    if (!isset($this->_check)) {
      $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_IC_STATUS'");
      $this->_check = $check_query->RecordCount();
    }
    return $this->_check;
  }

    function install() {
		global $db;
/*      zen_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow International Checkout', 'MODULE_PAYMENT_IC_STATUS', 'True', 'Do you want to accept International Checkout payments?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
      zen_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('International Checkout Company', 'MODULE_PAYMENT_IC_COMPANY', '', 'Company used for International Checkout payments', '6', '0', now())");*/
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable International Checkout Module', 'MODULE_PAYMENT_IC_STATUS', 'True', 'Do you want to accept International Checkout payments?', '6', '130', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
   $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_IC_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '131' , now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('International Checkout Company ID', 'MODULE_PAYMENT_IC_COMPANY', '', 'Company used for International Checkout payments', '6', '132', now())");
   }

    function remove() {
      zen_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }

    function keys() {
      return array('MODULE_PAYMENT_IC_STATUS', 'MODULE_PAYMENT_IC_SORT_ORDER', 'MODULE_PAYMENT_IC_COMPANY');
    }
  }