Jump to content
Sign in to follow this  
penfold_99

[Contribution] Purchase Order V2.3

Recommended Posts

Hi,

 

Installed the contrib and mike's hide fix all really good stuff.

 

The problem is the error messages don't display.

 

 

Let say I have a £1800 remaining limit & I order £3200 worth of goods all I get is

Credit Account Error!

 

Then an empty box.

If I look at the url it contains

?payment_error=po&error=Your+current+order+value+exceeds+your+credit+limit.+Available+cred

it+%241800.00

 

I'm sure this should be in the empty box & not the url... so where have I gone wrong?

 

Many thanks

Share this post


Link to post
Share on other sites

hey there everyone...i was wondering if this thread was still active...

 

i am having a couple of problems with the contribution

Share this post


Link to post
Share on other sites

Since I upgraded to MySQL 5.1 (from 4.0), here's the error I'm having at the checkout if the customer don't use credit account:

 

1265 - Data truncated for column 'customers_credit_left' at row 1

 

insert into orders (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, date_purchased, orders_status, purchase_order_number, customers_credit_left, customers_credit_amount, currency, currency_value) values ('2', 'Patrick Dufresne', '', '1488 Sherbrooke', '', 'Montréal', 'H2L 2K8', 'Québec', 'Canada', '514-555-5555', 'nomail@hotmail.com', '2', 'Patrick Dufresne', '', '1488 Sherbrooke', '', 'Montréal', 'H2L 2K8', 'Québec', 'Canada', '2', 'Patrick Dufresne', '', '1488 Sherbrooke', '', 'Montréal', 'H2L 2K8', 'Québec', 'Canada', '2', 'Paiement comptant à la livraison', '', '', '', '', now(), '1', '', '', '', 'CAD', '1.00000000')

 

If I use the credit account, the order is correctly sent because there's a value in the customers_credit_left. I know that MySQL5 no more accept empty field but I don't know how to solve this problem. Here is the field in MySQL:

 

`customers_credit_left` decimal(9,2) NOT NULL DEFAULT '250.00'

Share this post


Link to post
Share on other sites
Since I upgraded to MySQL 5.1 (from 4.0), here's the error I'm having at the checkout if the customer don't use credit account:

 

1265 - Data truncated for column 'customers_credit_left' at row 1

 

insert into orders (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, date_purchased, orders_status, purchase_order_number, customers_credit_left, customers_credit_amount, currency, currency_value) values ('2', 'Patrick Dufresne', '', '1488 Sherbrooke', '', 'Montréal', 'H2L 2K8', 'Québec', 'Canada', '514-555-5555', 'nomail@hotmail.com', '2', 'Patrick Dufresne', '', '1488 Sherbrooke', '', 'Montréal', 'H2L 2K8', 'Québec', 'Canada', '2', 'Patrick Dufresne', '', '1488 Sherbrooke', '', 'Montréal', 'H2L 2K8', 'Québec', 'Canada', '2', 'Paiement comptant à la livraison', '', '', '', '', now(), '1', '', '', '', 'CAD', '1.00000000')

 

If I use the credit account, the order is correctly sent because there's a value in the customers_credit_left. I know that MySQL5 no more accept empty field but I don't know how to solve this problem. Here is the field in MySQL:

 

`customers_credit_left` decimal(9,2) NOT NULL DEFAULT '250.00'

 

 

Hey Bud-

Ever get to the bottom of your issue? Mine is similiar... All was well the first test order, and then this (regardless of payment type):

 

1366 - Incorrect decimal value: '' for column 'customers_credit_left' at row 1

 

insert into orders (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, date_purchased, orders_status, purchase_order_number, customers_credit_left, customers_credit_amount, currency, currency_value) values ('5', 'Greg (Spon) Sabol', 'The Nerdery', '1530 SE 24th Ave', '', 'Pompano Beach', '33062', 'Florida', 'United States', '9548059050', 'greg@nerdery.org', '2', 'Greg (Spon) Sabol', 'The Nerdery', '1530 SE 24th Ave', '', 'Pompano Beach', '33062', 'Florida', 'United States', '2', 'Greg (Spon) Sabol', 'The Nerdery', '1530 SE 24th Ave', '', 'Pompano Beach', '33062', 'Florida', 'United States', '2', 'Cash on Delivery', '', '', '', '', now(), '2', '', '', '', 'USD', '1.00')

Share this post


Link to post
Share on other sites
Hey Bud-

Ever get to the bottom of your issue? Mine is similiar... All was well the first test order, and then this (regardless of payment type):

 

1366 - Incorrect decimal value: '' for column 'customers_credit_left' at row 1

 

insert into orders (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, date_purchased, orders_status, purchase_order_number, customers_credit_left, customers_credit_amount, currency, currency_value) values ('5', 'Greg (Spon) Sabol', 'The Nerdery', '1530 SE 24th Ave', '', 'Pompano Beach', '33062', 'Florida', 'United States', '9548059050', 'greg@nerdery.org', '2', 'Greg (Spon) Sabol', 'The Nerdery', '1530 SE 24th Ave', '', 'Pompano Beach', '33062', 'Florida', 'United States', '2', 'Greg (Spon) Sabol', 'The Nerdery', '1530 SE 24th Ave', '', 'Pompano Beach', '33062', 'Florida', 'United States', '2', 'Cash on Delivery', '', '', '', '', now(), '2', '', '', '', 'USD', '1.00')

 

I solved my problem by changing my sql-mode in my.ini

 

sql-mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

 

Give me a feedback by PM with your sql-mode before if it's working for you too!

Share this post


Link to post
Share on other sites
I solved my problem by changing my sql-mode in my.ini

 

sql-mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

 

Give me a feedback by PM with your sql-mode before if it's working for you too!

 

Hi Duff,

Thanks for the response!

 

I fixed one issue (the main issue) with this:

 

CODE

define('MODULE_PAYMENT_PO_TEXT_TITLE', 'Purchase Order Account');

 

to

 

CODE

define('MODULE_PAYMENT_PO_TEXT_TITLE', 'Invoiced Credit Account');

 

 

I fixed it by changing the checkout_process.php file to match

Original:

 

CODE

if ($order->info['payment_method'] == 'Purchase Order Account')

 

Changed to:

 

CODE

if ($order->info['payment_method'] == 'Invoiced Credit Account')

 

However, now only the PO works (no other payment options). I am guessing that it is barfing because nothing is being passed by choosing any of those other payment options...

 

So, hopefully I can come up with some clever fix, or just give up and change the SQL mode. ;(

Share this post


Link to post
Share on other sites

Hi guys !

Is someone know why I am now having the issue of the total of the order not subtracting from thier credit.

 

Please tell me why !!!!! PLEASE !!!! I NEED this great contrib ! ( by the way thanks a lot for that ! )

Share this post


Link to post
Share on other sites

Hello,

I am working now to install this add-on, but I have a problem.

I need to change the file orders.php in admin/includes/classes, but I have only a file name order.php, in that place....I search for the line It was indicate to search for but no mach. here is my order.php code:

 

<?php

/*

$Id: order.php,v 1.7 2003/06/20 16:23:08 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

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) {

$order_query = tep_db_query("select 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);

 

$totals_query = tep_db_query("select title, text 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']);

}

 

$this->info = array('currency' => $order['currency'],

'currency_value' => $order['currency_value'],

'payment_method' => $order['payment_method'],

'cc_type' => $order['cc_type'],

'cc_owner' => $order['cc_owner'],

'cc_number' => $order['cc_number'],

'cc_expires' => $order['cc_expires'],

'date_purchased' => $order['date_purchased'],

'orders_status' => $order['orders_status'],

'last_modified' => $order['last_modified']);

 

$this->customer = array('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' => $order['customers_country'],

'format_id' => $order['customers_address_format_id'],

'telephone' => $order['customers_telephone'],

'email_address' => $order['customers_email_address']);

 

$this->delivery = array('name' => $order['delivery_name'],

'company' => $order['delivery_company'],

'street_address' => $order['delivery_street_address'],

'suburb' => $order['delivery_suburb'],

'city' => $order['delivery_city'],

'postcode' => $order['delivery_postcode'],

'state' => $order['delivery_state'],

'country' => $order['delivery_country'],

'format_id' => $order['delivery_address_format_id']);

 

$this->billing = array('name' => $order['billing_name'],

'company' => $order['billing_company'],

'street_address' => $order['billing_street_address'],

'suburb' => $order['billing_suburb'],

'city' => $order['billing_city'],

'postcode' => $order['billing_postcode'],

'state' => $order['billing_state'],

'country' => $order['billing_country'],

'format_id' => $order['billing_address_format_id']);

 

$index = 0;

$orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");

while ($orders_products = tep_db_fetch_array($orders_products_query)) {

$this->products[$index] = array('qty' => $orders_products['products_quantity'],

'name' => $orders_products['products_name'],

'model' => $orders_products['products_model'],

'tax' => $orders_products['products_tax'],

'price' => $orders_products['products_price'],

'final_price' => $orders_products['final_price']);

 

$subindex = 0;

$attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");

if (tep_db_num_rows($attributes_query)) {

while ($attributes = tep_db_fetch_array($attributes_query)) {

$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],

'value' => $attributes['products_options_values'],

'prefix' => $attributes['price_prefix'],

'price' => $attributes['options_values_price']);

 

$subindex++;

}

}

$index++;

}

}

}

?>

 

Now where to insert this:

in catalog/admin/includes/classes/orders.php

 

find

 

$order = tep_db_fetch_array($order_query);

 

$totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . tep_db_input($order_id) . "' order by sort_order");

 

ABOVE it add

 

// Company PO Account start

// Added purchase_order_number to query.

$order_query = tep_db_query("select 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, purchase_order_number, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($order_id) . "'");

// Company PO Account end

Share this post


Link to post
Share on other sites

Not sure if anyone is still watching this topic for errors, but,

 

I have everything installed and I am missing the box or ability to enter purchase order number by customer. I place an order choose shipping method at next page where I should choose payment method there is no where to put the purchase order number or select credit account. I am not sure if it as something to do with this:

 

find

 

'cc_number' => $GLOBALS['cc_number'],

'cc_expires' => $GLOBALS['cc_expires'],

 

after it add

 

// Company PO Account start

'purchase_order_number' => (isset($GLOBALS['purchase_order_number']) ? $GLOBALS['purchase_order_number'] : ''),

'customer_credit_left' => (isset($GLOBALS['customer_credit_left']) ? $GLOBALS['customer_credit_left'] : ''),

'customer_credit_amount' => (isset($GLOBALS['customer_credit_amount']) ? $GLOBALS['customer_credit_amount'] : ''),

 

 

I do not have this, mine looks like this:

 

$this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,

'currency' => $currency,

'currency_value' => $currencies->currencies[$currency]['value'],

'payment_method' => $payment,

'cc_type' => '',

'cc_owner' => '',

'cc_number' => '',

'cc_expires' => '',

'purchase_order_number' => (isset($GLOBALS['purchase_order_number']) ? $GLOBALS['purchase_order_number'] : ''),

'customer_credit_left' => (isset($GLOBALS['customer_credit_left']) ? $GLOBALS['customer_credit_left'] : ''),

'customer_credit_amount' => (isset($GLOBALS['customer_credit_amount']) ? $GLOBALS['customer_credit_amount'] : ''),

'shipping_method' => $shipping['title'],

'shipping_cost' => $shipping['cost'],

'subtotal' => 0,

'tax' => 0,

'tax_groups' => array(),

'comments' => (tep_session_is_registered('comments') && !empty($comments) ? $comments : ''));

 

if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {

if (isset($GLOBALS[$payment]->public_title)) {

$this->info['payment_method'] = $GLOBALS[$payment]->public_title;

} else {

$this->info['payment_method'] = $GLOBALS[$payment]->title;

}

 

if ( isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && ($GLOBALS[$payment]->order_status > 0) ) {

$this->info['order_status'] = $GLOBALS[$payment]->order_status;

}

}

// Company PO Account end

 

 

I don't even no if this is the problem. If someone could help. I would greatly appreciate. Thanks in advance.

Share this post


Link to post
Share on other sites

I found my problem.

 

 

 

Not sure if anyone is still watching this topic for errors, but,

 

I have everything installed and I am missing the box or ability to enter purchase order number by customer. I place an order choose shipping method at next page where I should choose payment method there is no where to put the purchase order number or select credit account. I am not sure if it as something to do with this:

 

find

 

'cc_number' => $GLOBALS['cc_number'],

'cc_expires' => $GLOBALS['cc_expires'],

 

after it add

 

// Company PO Account start

'purchase_order_number' => (isset($GLOBALS['purchase_order_number']) ? $GLOBALS['purchase_order_number'] : ''),

'customer_credit_left' => (isset($GLOBALS['customer_credit_left']) ? $GLOBALS['customer_credit_left'] : ''),

'customer_credit_amount' => (isset($GLOBALS['customer_credit_amount']) ? $GLOBALS['customer_credit_amount'] : ''),

 

 

I do not have this, mine looks like this:

 

$this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,

'currency' => $currency,

'currency_value' => $currencies->currencies[$currency]['value'],

'payment_method' => $payment,

'cc_type' => '',

'cc_owner' => '',

'cc_number' => '',

'cc_expires' => '',

'purchase_order_number' => (isset($GLOBALS['purchase_order_number']) ? $GLOBALS['purchase_order_number'] : ''),

'customer_credit_left' => (isset($GLOBALS['customer_credit_left']) ? $GLOBALS['customer_credit_left'] : ''),

'customer_credit_amount' => (isset($GLOBALS['customer_credit_amount']) ? $GLOBALS['customer_credit_amount'] : ''),

'shipping_method' => $shipping['title'],

'shipping_cost' => $shipping['cost'],

'subtotal' => 0,

'tax' => 0,

'tax_groups' => array(),

'comments' => (tep_session_is_registered('comments') && !empty($comments) ? $comments : ''));

 

if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {

if (isset($GLOBALS[$payment]->public_title)) {

$this->info['payment_method'] = $GLOBALS[$payment]->public_title;

} else {

$this->info['payment_method'] = $GLOBALS[$payment]->title;

}

 

if ( isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && ($GLOBALS[$payment]->order_status > 0) ) {

$this->info['order_status'] = $GLOBALS[$payment]->order_status;

}

}

// Company PO Account end

 

 

I don't even no if this is the problem. If someone could help. I would greatly appreciate. Thanks in advance.

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
Sign in to follow this  

×