Jump to content
Latest News: (loading..)
Mort-lemur

Paypal App - Incorporation of mods in new admin/orders.php

Recommended Posts

Hi

If the ncludes/languages/english/modules/payment/paypal_express.php file is on the server (regardless of contents) then it should be accessible from the orders class - it would not throw the original error that you highlighted above though.

 

I'm not au fait with the new module but there must be some way that it calls the new language file, if not then you could try a sticking plaster in the includes/languages file:

 

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright © 2014 osCommerce

  Released under the GNU General Public License
*/

// language definitions have been moved to:
// catalog/includes/apps/paypal/languages/english/modules/EC/EC.php

 

include_once(DIR_FS_CATALOG.'includes/apps/paypal/languages/english/modules/EC/EC.php');

?>

Share this post


Link to post
Share on other sites

Hi

If the ncludes/languages/english/modules/payment/paypal_express.php file is on the server (regardless of contents) then it should be accessible from the orders class - it would not throw the original error that you highlighted above though.

 

I'm not au fait with the new module but there must be some way that it calls the new language file, if not then you could try a sticking plaster in the includes/languages file:

 

<?php

/*

  $Id$

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright © 2014 osCommerce

 

  Released under the GNU General Public License

*/

 

// language definitions have been moved to:

// catalog/includes/apps/paypal/languages/english/modules/EC/EC.php

 

include_once(DIR_FS_CATALOG.'includes/apps/paypal/languages/english/modules/EC/EC.php');

?>

Thank you, Bob for your help.

 

I double checked all of the files that I loaded and had the login folder in the admin twice. So I think my problems are solved now. The only issue so far that I am running into is that PayPal won't let me login into my sandbox account to test a transaction. :(

Share this post


Link to post
Share on other sites

Thank you, Bob for your help.

 

I double checked all of the files that I loaded and had the login folder in the admin twice. So I think my problems are solved now. The only issue so far that I am running into is that PayPal won't let me login into my sandbox account to test a transaction. :(

 

I have since figured out the sandbox issue. I only had a business account setup and not a personal account. Once I set up a personal account I cold use that as the buyer account and the transaction continued.

 

Now my issue is the total amount being charged to the customer is incorrect. I have a CCGV module installed and while it works within the store, PayPal gets the correct total when a discount is applied, however the final charge to the customer is the total WITHOUT the discount. So discouraging.

 

I have captured screenshots of the PayPal account, the order total, and the PayPal logs from the admin site.

Set Express Checkout.pdf

Get Express Checkout Details.pdf

Do Express Checkout Payment.pdf

Share this post


Link to post
Share on other sites

@@Roaddoctor maybe we are better to build a new, simple query to pull the customer group - and leave the new order_query?

Sounds like the best option. Haven't tried this so just writing queries from what I remember of them :-) :

admin/classes/order.php

around line 30:


    function query($order_id) {
      global $languages_id;

      $order_id = tep_db_prepare_input($order_id);

      $order_query = tep_db_query("select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
      $order = tep_db_fetch_array($order_query);
      
// BOF SPPC
      $customer_group_query = tep_db_query("select cg.customers_group_name from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_GROUPS . " cg on c.customers_group_id = cg. customers_group_id where c.customers_id = " . $order['customers_id'] . " ");
      $customer_group_info = tep_db_fetch_array($customer_group_query);
// EOF SPPC
and then later (around line 71 now):

 

      $this->customer = array('id' => $order['customers_id'],
                              'name' => $order['customers_name'],
                              'company' => $order['customers_company'],
                              'street_address' => $order['customers_street_address'],
                              'suburb' => $order['customers_suburb'],
                              'city' => $order['customers_city'],
                              'postcode' => $order['customers_postcode'],
                              'state' => $order['customers_state'],
                              'country' => array('title' => $order['customers_country']),
                              'format_id' => $order['customers_address_format_id'],
                              // BOF SPPC
                              'customers_group_name' => $customer_group_info['customers_group_name'],
                              // EOF SPPC

                              'telephone' => $order['customers_telephone'],
                              'email_address' => $order['customers_email_address']);

Share this post


Link to post
Share on other sites

Thank you so much @@Jan Zonjee. this give me something to work with at least.

 

@@Roaddoctor, I'm trying not to work much these week... but I'll give this a go soon. Let me know if you give it a try and can get something working.

 

I not sure if these lines in admin/orders.php needs to change as well?

            <p><strong><?php echo TABLE_HEADING_CUSTOMERS_GROUPS .":" ; ?></strong>
            <?php echo $order->customer['customers_group_name']; ?></p>
	         <!-- // EOF Separate Pricing Per Customer -->

Share this post


Link to post
Share on other sites

I not sure if these lines in admin/orders.php needs to change as well?

            <p><strong><?php echo TABLE_HEADING_CUSTOMERS_GROUPS .":" ; ?></strong>
            <?php echo $order->customer['customers_group_name']; ?></p>
	         <!-- // EOF Separate Pricing Per Customer -->

 

Yes, that would need to be changed. Would this work? :

 

<?php echo $this->customer['customers_group_name']; ?></p>
instead of:

 

<?php echo $order->customer['customers_group_name']; ?></p>

Share this post


Link to post
Share on other sites

@@Jan Zonjee thank you so much for the assistance - greatly appreciated. When trying this

// BOF SPPC - by Jan Zonjee 12/29/2014
      $customer_group_query = tep_db_query("select cg.customers_group_name from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_GROUPS . " cg on c.customers_group_id = cg.customers_group_id where c.customers_id = " . $order['customers_id'] . " ");
      $customer_group_info = tep_db_fetch_array($customer_group_query);
// EOF SPPC

I am getting the error:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'on c.customers_group_id = cg.customers_group_id where c.customers_id = 54' at line 1

select cg.customers_group_name from customers c, customers_groups cg on c.customers_group_id = cg.customers_group_id where c.customers_id = 54 

Any idea whats wrong?


-Dave

Share this post


Link to post
Share on other sites

@@greasemonkey

 

give this a try, seems to be working for me

 

in /admin/includes/classes/order.php

// BOF SPPC extra query
      $customer_group_query = tep_db_query("select cg.customers_group_name from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_GROUPS . " cg where c.customers_group_id = cg.customers_group_id and c.customers_id = " . $order['customers_id'] . " ");
      $customer_group_info = tep_db_fetch_array($customer_group_query);
// EOF SPPC

so the whole section reads as

  class order {
    var $info, $totals, $products, $customer, $delivery;

    function order($order_id) {
      $this->info = array();
      $this->totals = array();
      $this->products = array();
      $this->customer = array();
      $this->delivery = array();

      $this->query($order_id);
    }

    function query($order_id) {
      global $languages_id;

      $order_query = tep_db_query("select o.*, s.orders_status_name from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS . " s where o.orders_id = '" . (int)$order_id . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "'");

      $order = tep_db_fetch_array($order_query);

// BOF SPPC extra query
      $customer_group_query = tep_db_query("select cg.customers_group_name from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_GROUPS . " cg where c.customers_group_id = cg.customers_group_id and c.customers_id = " . $order['customers_id'] . " ");
      $customer_group_info = tep_db_fetch_array($customer_group_query);
// EOF SPPC

      $totals_query = tep_db_query("select title, text, class from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' order by sort_order");
      while ($totals = tep_db_fetch_array($totals_query)) {
        $this->totals[] = array('title' => $totals['title'],
                                'text' => $totals['text'],
                                'class' => $totals['class']);
      }

further down make the change

                              // BOF SPPC
//                              'customers_group_name' => $order['customers_group_name'],
                              'customers_group_name' => $customer_group_info['customers_group_name'],
                              // EOF SPPC

no need to make any change in /admin/orders.php, this should work as is

     <!-- // BOF Separate Pricing Per Customer -->
            <p><strong><?php echo TABLE_HEADING_CUSTOMERS_GROUPS .":" ; ?></strong> . <?php echo $order->customer['customers_group_name']; ?></p>
     <!-- // EOF Separate Pricing Per Customer -->

please test and let me know - thx!!


-Dave

Share this post


Link to post
Share on other sites

@@Roaddoctor Just one VERY small issue. You have a stray "." in admin/orders.php

 

This;

     <!-- // BOF Separate Pricing Per Customer -->
            <p><strong><?php echo TABLE_HEADING_CUSTOMERS_GROUPS .":" ; ?></strong> . <?php echo $order->customer['customers_group_name']; ?></p>
     <!-- // EOF Separate Pricing Per Customer -->

Should be;

     <!-- // BOF Separate Pricing Per Customer -->
            <p><strong><?php echo TABLE_HEADING_CUSTOMERS_GROUPS .":" ; ?></strong> <?php echo $order->customer['customers_group_name']; ?></p>
     <!-- // EOF Separate Pricing Per Customer -->

Share this post


Link to post
Share on other sites

I am having the same issues as Lucsangel (Barbara)

 

Fatal error on line 15 of the admin/includes/orders.php file.

 

Here are the errors:

 

Fatal error: Call to a member function register() on a non-object in /srv/disk2/951263/www/admiralredbeard.com/catalog/admin/orders.php on line 15

 

 

Line 15 has this code:

 

$OSCOM_Hooks->register('orders');

 

Is there anyone out there that can help with this error?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×