Installing New PayPal module (Latest API 2.0) for osCommerce Version 2.3 Manually

From osCommerce Wiki
Jump to navigation Jump to search

Although osCommerce 4.x is now available, many shop owners continue to use osCommerce 2.3. To support these systems, the new PayPal module (with Express and APM – Alternative Payment Method options) has been adapted to work with osCommerce 2.

Watch the video first for an overview of the installation process.

Read the manual below for step-by-step guidance.

1) Backup Customized Files

If you have customized any of the following files, create a backup before proceeding:

  • admin/modules.php
  • includes/classes/payments.php


For example, if you have SSH access, you can run:


tar -cpzf `date +%y%m%d%H%M`_paypal_rest_bk.tar.gz admin/modules.php includes/classes/payment.php


2) Download and Upload Module Files

1. Download the PayPal module package: https://www.oscommerce.com/pub/osc23_customized_paypal_rest.zip

Image 1045.png


2. Unzip the archive into a local folder.

Image 1046.png
Image 1047.png


3. Upload the contents of the new_to_upload folder into your website’s public_html directory using your FTP client.

4. Use the files in the to_modify folder as references. Compare them with your existing files using the included *_compare.php scripts or your preferred file comparison tool.

5. Read the installation instructions in the included install.txt file.

Image 1048.png
Image 1049.png



3) Set Permissions

Set write permissions for the following folders:

  • ext/modules/payment/runtime/logs
  • ext/modules/payment/runtime/auth.cache
Image 1050.png
Image 1051.png


Note: Direct access to these folders must be denied. An .htaccess file is included in the runtime folder. If you use a custom web server configuration, update its settings accordingly.


Now we can start editing 2 core files that were mentioned in this manual above.


4) Modify Core Files

The following modifications must be applied manually.

1. admin/modules.php

  • About line 120 Find:
echo '            <td class="smallText" align="right">' . tep_draw_button(IMAGE_MODULE_INSTALL . ' (' . $new_modules_counter . ')', 'plus', tep_href_link(FILENAME_MODULES, 'set=' . $set . '&list=new')) . '</td>';
  • Replace with:
     ///paypal_rest
 //echo '            <td class="smallText" align="right">' . tep_draw_button(IMAGE_MODULE_INSTALL . ' (' . $new_modules_counter . ')', 'plus', tep_href_link(FILENAME_MODULES, 'set=' . $set . '&list=new')) . '</td>';

 $pp_quick_setup = '';
 if ($set=='payment') {
 include_once(DIR_FS_ADMIN . 'ext' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'payment' . DIRECTORY_SEPARATOR . 'paypal_rest' . DIRECTORY_SEPARATOR . 'ppp_js.php');
 $pp_quick_setup = '<div id="installPPP" style="display:none">'
 . tep_draw_button(ADD_PAYPAL, null, 'javascript:void();', 'primary', ['type' => 'button'])
 . '</div>';
 }

    echo '            <td class="smallText" align="right">' . $pp_quick_setup . tep_draw_button(IMAGE_MODULE_INSTALL . ' (' . $new_modules_counter . ')', 'plus', tep_href_link(FILENAME_MODULES, 'set=' . $set . '&list=new')) . '</td>';

///paypal_rest eof
Image 1052.png
Image 1053.png
Image 1054.png
Image 1055.png

The other editing actions described below should be completed in the similar way as shown on the screenshots above.

2. includes/classes/payments.php

  • About line 33 Find:
$include_modules[] = array('class' => $class, 'file' => $value);
  • Insert after:
             /// paypal_rest
            if ($class == 'paypal_rest' && substr($module, 0, strlen($class)) == $class) {
                $this->selected_module = $class;
            }
            /// paypal_rest EOF

5) Configure PayPal Module

  1. Log in to the Admin area of your website.
  2. Navigate to Modules → Payment.
  3. Click the PayPal Quick Setup button to configure the new PayPal module.
Image 1056.png