Jump to content
Sign in to follow this  
penfold_99

[Contribution] Purchase Order V2.3

Recommended Posts

Great contribution. Everything installed and works beautifully. I'd like to improve it a little.

 

I want to add some code so that customers can see their credit limit and what their balance is under their account information. Ultimately, I would like to give the customer an option to pay their balance through the credit card process features of the cart. Any ideas or suggetions? I don't know php...but I'm gonna run to the book store tonight and start learning.

 

Any suggestions on good php books?? I need one that's not too technical, but not too cheesy either.

 

later


---

CorradoMatt

http://www.westixonline.com - an oscommerce / creloaded site

Share this post


Link to post
Share on other sites

I have discovered a bug if you delete an order from in admin section it restocks goods but fails to recredit credit limit

Edited by moran77

Share this post


Link to post
Share on other sites

Corradomatt -

 

Those are some good suggestions. I think if I remember right you can go into account history and it should show the customers remaining credit balance there but I'll have to double check myself. I could probably help you with that if it's not in there. As far as the pay balance by credit card option I would have to mull that over some more.

 

As far as PHP books I'd suggest checking out your local library and look for books there or have the library transfer some from other branches in so you can check them out. This way you don't drop alot of cash on books and can find a good one in the mean time. But I don't have any recommendations b/c I've just learned what I know about php from Oscommerce and trial and error.

 

Moran77 -

 

Good catch on that bug penfold or I one will have to look into fixing that. For the time being you can add the customer's credit back using the payment credit field under admin/customers.

 

Great contribution. Everything installed and works beautifully. I'd like to improve it a little.

 

I want to add some code so that customers can see their credit limit and what their balance is under their account information. Ultimately, I would like to give the customer an option to pay their balance through the credit card process features of the cart. Any ideas or suggetions? I don't know php...but I'm gonna run to the book store tonight and start learning.

 

Any suggestions on good php books?? I need one that's not too technical, but not too cheesy either.

 

later

Share this post


Link to post
Share on other sites

Hello everybody,

 

I've just installed the newest release of "Purchase Order V2.3". The problem is that in admin/customers.php it doesn't save any values for Credit Account options so in checkout_payment.php it doesn't list PO as a payment option. Is there any fix for it?

 

Thanks in advance,

Irin.

Edited by Irin

Share this post


Link to post
Share on other sites

DefelRadar

 

Thanks for the tip on php books. I never thought about the library (duh)....I guess I forgot that people went there before the internet. :D

 

As far as people being able to pay their credit balance through osc....I guess the easiest way would be to add thier balance to the cart as a non-taxable, 0 lbs product. But it would be kinda cheesy to do it that way.

 

-CMatt


---

CorradoMatt

http://www.westixonline.com - an oscommerce / creloaded site

Share this post


Link to post
Share on other sites

Ok I have installed the contrib, I added it as my payment module I have the option for them to do Net 30.. but how do I make it where when they select it that they put in there PO# and then its carried throughout the process?

Share this post


Link to post
Share on other sites

Hi everybody,

 

Is there any solution to my problem above? Does anybody else who uses this contrib experience the same problem? Would anybody who got it to work mind to share how they did it? Any help would be greatly appreciated.

I've just installed the newest release of "Purchase Order V2.3". The problem is that in admin/customers.php it doesn't save any values for Credit Account options so in checkout_payment.php it doesn't list PO as a payment option. Is there any fix for it?

Thanks in advance.

Share this post


Link to post
Share on other sites

Hi all, I too have just gotten this contribution up a running in my store, and it works great so far. My only problem, besides being a complete novice at this stuff, is that I need to be able to only show the PO payment option to those customers that I've enabled it for; everyone else shouldn't see it as a payment option. Anyone figure this out before, and if so, mind pasting some of that IF-ELSE code and/or where it should go for this newbie?

 

Any help would be great!

Mike

Share this post


Link to post
Share on other sites
Hi all, I too have just gotten this contribution up a running in my store, and it works great so far. My only problem, besides being a complete novice at this stuff, is that I need to be able to only show the PO payment option to those customers that I've enabled it for; everyone else shouldn't see it as a payment option. Anyone figure this out before, and if so, mind pasting some of that IF-ELSE code and/or where it should go for this newbie?

 

Any help would be great!

Mike

 

Hello again, I figured out a way to hide/show this payment option based on each customers settings like I was after, so I thought I'd post it back here for anyone looking for a quick fix.

 

In the po.php file, I added this:

// class constructor

function po() {

global $order;

global $customer_id;

 

$this->code = 'po';

$this->title = MODULE_PAYMENT_PO_TEXT_TITLE;

$this->description = MODULE_PAYMENT_PO_TEXT_DESCRIPTION;

$this->email_footer = MODULE_PAYMENT_PO_TEXT_EMAIL_FOOTER;

$this->sort_order = MODULE_PAYMENT_PO_SORT_ORDER;

$this->enabled = ((MODULE_PAYMENT_PO_STATUS == 'True') ? true : false);

 

// mikey's fix for showing/hiding PO payment option :P

$check_accstat = tep_db_query("SELECT customers_credit_account_status, customers_credit_status from " . TABLE_CUSTOMERS . " where customers_id ='" . $customer_id . "'");

$accstat = tep_db_fetch_array($check_accstat);

If ($accstat['customers_credit_account_status'] =='0' ){

$this->enabled = false;

}

 

}

 

I know, it's lame cut-paste-edit stuff, but it might help out another newbie like me someday. I left the original payment enabled line there so that the admin tool still enables/disables global, and the my added check simply turns it back off if the customer's record is set to disabled.

 

No biggie, just wanted to do what I could. I'm no web guru or a programmer, but this place has been a lot of help to me, so I owe you all.

 

Thanks,

Mike

Share this post


Link to post
Share on other sites
Hello again, I figured out a way to hide/show this payment option based on each customers settings like I was after, so I thought I'd post it back here for anyone looking for a quick fix.

 

In the po.php file, I added this:

I know, it's lame cut-paste-edit stuff, but it might help out another newbie like me someday. I left the original payment enabled line there so that the admin tool still enables/disables global, and the my added check simply turns it back off if the customer's record is set to disabled.

 

No biggie, just wanted to do what I could. I'm no web guru or a programmer, but this place has been a lot of help to me, so I owe you all.

 

Thanks,

Mike

 

 

Hey Mikey,

 

Good find and thanks for the assistance on this mod. I think alot of people are looking to do the same thing you were by hiding the purchase order payment option only to credit account enabled customers. It's definitely not a lame edit. It's a great addition.

 

Thanks Again,

 

DefelRadar

Share this post


Link to post
Share on other sites

Good work Mike. I am in the process of installing this mod and didn't even realize that everyone could see the po checkout option until you posted this. Thanks!

 

I installed the code, but for some reason it's not working for me. It's still displaying the option for everyone!. hmm....

Edited by corradomatt

---

CorradoMatt

http://www.westixonline.com - an oscommerce / creloaded site

Share this post


Link to post
Share on other sites

I was wondering if this is the way the mod is suppose to run or not. I would really need some guidance in this.

 

When a customer goes through and selects to use a Purchase Order Credit account as their form of payment, does the total automatically checks their account, and deducts from their credit?

 

Or do you have to input that into the Payment Credit section, and keep track that way.

 

Is there a contribution which will do that that someone can refer me to?

 

Any help would be greatly appreciated.

 

thanks

Share this post


Link to post
Share on other sites

craschnburn

 

Yes....the mod automatically keeps track of the customers credit limit for you when they make a purchase. It does not track when they make payment. So if they call you and pay by credit card over the phone or send you a check for the balance on their account....you would have to log into their account in OSC and let the system know that they have made a payment so that they have that amount of credit available to them.

 

There are, however, a few changes that need to be made.....

 

I am having a problem (from the ealier post) of hiding the 'purchase order' payment option from those customers who don't have purchase orders enabled.

 

and

 

I would like to develop the mod to allow for customers to pay their balance through the system...like with their credit card through my payment gateway. That way they could update their account balance themselves.

 

---

CorradoMatt

"Better to do something imperfectly than to do nothing flawlessly."

-some teacher


---

CorradoMatt

http://www.westixonline.com - an oscommerce / creloaded site

Share this post


Link to post
Share on other sites
craschnburn

 

Yes....the mod automatically keeps track of the customers credit limit for you when they make a purchase. It does not track when they make payment. So if they call you and pay by credit card over the phone or send you a check for the balance on their account....you would have to log into their account in OSC and let the system know that they have made a payment so that they have that amount of credit available to them.

 

There are, however, a few changes that need to be made.....

 

I am having a problem (from the ealier post) of hiding the 'purchase order' payment option from those customers who don't have purchase orders enabled.

 

and

 

I would like to develop the mod to allow for customers to pay their balance through the system...like with their credit card through my payment gateway. That way they could update their account balance themselves.

 

---

CorradoMatt

"Better to do something imperfectly than to do nothing flawlessly."

-some teacher

 

Hey CorradoMatt

Thanks for the reply. Now I tried those scripts that Mikey posted. It works fine for me. When I uncheck the Purchase order in my admin, customers, payment section, it doesn't show.

 

maybe you're sending up the backedup po.php file. I realized thats what I was doing after awhile. maybe you're doing the same.

 

but when clients purchase something through the web, i have to enter it in manually to deduct from the purchase account.

 

it doesn't do it automatically?

 

let me know if you need anything else on the showing of purchase account fix.

Share this post


Link to post
Share on other sites

Hello everybody,

 

I tried to implement Mike's code to hide/show Purchase Order method based on each customers settings but, unfortunately, it doesn't work for me may be because my version of contribution doesn't save any values for Credit Account options in admin/customers.php. It doesn't matter if I pick Disable/Enable Credit Account, the Purchase Order method is always enabled for every customer. Is there any solution to my problem? Any help would be greatly appreciated.

 

Thanks in advance,

Irina.

Share this post


Link to post
Share on other sites
Hello everybody,

 

I tried to implement Mike's code to hide/show Purchase Order method based on each customers settings but, unfortunately, it doesn't work for me may be because my version of contribution doesn't save any values for Credit Account options in admin/customers.php. It doesn't matter if I pick Disable/Enable Credit Account, the Purchase Order method is always enabled for every customer. Is there any solution to my problem? Any help would be greatly appreciated.

 

Thanks in advance,

Irina.

 

 

man..i don't understand. it works for me, just as mikey puts it. hows about posting your po.php codes.

Share this post


Link to post
Share on other sites
man..i don't understand. it works for me, just as mikey puts it. hows about posting your po.php codes.

Here is my po.php code:

<?php

/*

$Id: cc.php,v 1.1.1.1 2004/03/04 23:41:17 ccwjr Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class po {

var $code, $title, $description, $enabled;

 

// class constructor

function po() {

global $order;

 

$this->code = 'po';

$this->title = MODULE_PAYMENT_PO_TEXT_TITLE;

$this->description = MODULE_PAYMENT_PO_TEXT_DESCRIPTION;

$this->email_footer = MODULE_PAYMENT_PO_TEXT_EMAIL_FOOTER;

$this->sort_order = MODULE_PAYMENT_PO_SORT_ORDER;

$this->enabled = ((MODULE_PAYMENT_PO_STATUS == 'True') ? true : false);

 

// mikey's fix for showing/hiding PO payment option

$check_accstat = tep_db_query("SELECT customers_credit_account_status, customers_credit_status from " . TABLE_CUSTOMERS . " where customers_id ='" . $customer_id . "'");

$accstat = tep_db_fetch_array($check_accstat);

If ($accstat['customers_credit_account_status'] =='0' ){

$this->enabled = false;

}

 

}

 

// class methods

 

function selection() {

global $order;

 

$selection = array('id' => $this->code,

'module' => $this->title,

'fields' => array(array('title' => MODULE_PAYMENT_PO_TEXT_NUMBER,

'field' => tep_draw_input_field('po_number', ''))));

 

return $selection;

}

 

 

function javascript_validation() {

/* $js = ' if (payment_value == "' . $this->code . '") {' . "\n" .

' var cc_owner = document.checkout_payment.cc_owner.value;' . "\n" .

' var cc_number = document.checkout_payment.cc_number.value;' . "\n" .

' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" .

' error_message = error_message + "' . MODULE_PAYMENT_CC_TEXT_JS_CC_OWNER . '";' . "\n" .

' error = 1;' . "\n" .

' }' . "\n" .

' if (cc_number == "" || cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "\n" .

' error_message = error_message + "' . MODULE_PAYMENT_CC_TEXT_JS_CC_NUMBER . '";' . "\n" .

' error = 1;' . "\n" .

' }' . "\n" .

' }' . "\n";

*/

return $js;

}

 

function pre_confirmation_check()

{

global $HTTP_POST_VARS;

global $order;

global $customer_id;

 

 

$error = '';

 

$check_credit = tep_db_query("SELECT customers_credit_account_status,customers_credit_status, customers_credit_left from " . TABLE_CUSTOMERS . " where customers_id ='" . $customer_id . "'");

 

$credit = tep_db_fetch_array($check_credit);

 

If ($credit['customers_credit_account_status'] =='1' )

{

If ($HTTP_POST_VARS['po_number'] == '')

{

$error = sprintf(MODULE_PAYMENT_PO_TEXT_ERROR_NO_NUMBER);

}

else

{

if ($credit['customers_credit_status'] == "1")

{

if ($order->info['total'] > $credit['customers_credit_left'])

{

$error = sprintf(MODULE_PAYMENT_PO_TEXT_ERROR_NOT_ENOUGH_CREDIT. $credit['customers_credit_left']);

}

}

else

{

$error = MODULE_PAYMENT_PO_TEXT_ERROR_CREDIT_DISABLED;

}

}

}

else

{

 

$error = sprintf(MODULE_PAYMENT_PO_TEXT_ERROR_NO_CREDIT_ACCOUNT);

}

If ($error)

{

$payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) ;

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));

}

}

 

function confirmation() {

global $HTTP_POST_VARS;

 

$confirmation = array('title' => $this->title,

'fields' => array(array('title' => MODULE_PAYMENT_PO_TEXT_NUMBER,

'field' => $HTTP_POST_VARS['po_number'])));

return $confirmation;

}

 

function process_button() {

global $HTTP_POST_VARS;

 

$process_button_string = tep_draw_hidden_field('po_number', $HTTP_POST_VARS['po_number']);

return $process_button_string;

}

 

function before_process() {

global $HTTP_POST_VARS, $order;

 

$order ->info['po_number'] = $HTTP_POST_VARS['po_number'];

}

 

function after_process()

{

return false;

}

 

function get_error() {

global $HTTP_GET_VARS;

 

$error = array('title' => MODULE_PAYMENT_PO_TEXT_ERROR,

'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));

 

return $error;

}

 

function check() {

if (!isset($this->check)) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PO_STATUS'");

$this->check = tep_db_num_rows($check_query);

}

return $this->check;

}

 

function install() {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable credit account Module', 'MODULE_PAYMENT_PO_STATUS', 'True', 'Do you want to accept payments by credit account?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

tep_db_query("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_PO_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0' , now())");

}

 

function remove() {

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");

}

 

function keys() {

return array('MODULE_PAYMENT_PO_STATUS', 'MODULE_PAYMENT_PO_SORT_ORDER');

}

}

?>

Thanks.

Share this post


Link to post
Share on other sites
Here is my po.php code:

 

Thanks.

 

 

Hey Irin-

 

On line 18 - 19 after the following line of code:

 

// class constructor

function po() {

global $order;

 

I believe you're missing a line of code

global $customer_id;

 

Check out hawgwired's code again. I think you're missing that line of code there. But don't take my word for the true resolution, I'm just trying to put in my two cents. Try it out. If it works, then we got it. If not, remove it. Its just one line of code.

Share this post


Link to post
Share on other sites
Hey Irin-

 

On line 18 - 19 after the following line of code:

 

// class constructor

function po() {

global $order;

 

I believe you're missing a line of code

global $customer_id;

 

Check out hawgwired's code again. I think you're missing that line of code there. But don't take my word for the true resolution, I'm just trying to put in my two cents. Try it out. If it works, then we got it. If not, remove it. Its just one line of code.

Hi craschnburn,

 

You're right, that's exactly what was missing. Thanks for pointing this out for me. Everything works fine now. Your two cents worked. I appreciate it :thumbsup:

 

Irina.

Edited by Irin

Share this post


Link to post
Share on other sites

HA hA!!!!

YO! YO! YO! YO!

 

You just de-virginized me. You are my first I have to say. Hopefully this is a start of many more to come.

thanks

Share this post


Link to post
Share on other sites
HA hA!!!!

YO! YO! YO! YO!

 

You just de-virginized me. You are my first I have to say. Hopefully this is a start of many more to come.

thanks

Way to go!!! :D

Share this post


Link to post
Share on other sites

Hi Guys,

 

I havent install, but i had an question to ask about this contribute. because it infor not clear ..

 

after install will this contribute convert my osc

 

1.) credit term for COMPANY? how about my other end user client?

 

2.) do i had a choice that let which customer have credit n which not? and set differently?

 

3.) is it company have to fill in their PO numbers?

 

4.) will it convert all for only company credit use?

 

i know nothing about php. Please help.. thanks

Share this post


Link to post
Share on other sites

I was wondering if someone can help me with my problem with Purchase Order v.2.3.3 running under

OSC 2.2 ms 2.

 

I've installed this contrib three times. It installs perfect with nothing wrong. But my problem is that the total of the orders are not being charged to the credit account.

 

for example. when i process an order for $40 by loggin into the client's account with a $500 credit limit, the $40 is not changing the balance.

 

is there something I'm doing wrong. Well evidently, since it's not working.

 

i've already installed it, and enabled it through the customer's account.

 

If someone could please help me out.

 

thank you.

Share this post


Link to post
Share on other sites

I'll take a crack at these...

 

1.) credit term for COMPANY? how about my other end user client?

2.) do i had a choice that let which customer have credit n which not? and set differently?

 

Yes, you can select which customer can use PO as the payment method.

 

3.) is it company have to fill in their PO numbers?

 

Yes, your customer must enter a PO number. The format is not checked though, so anything entered will be accepted as valid.

 

4.) will it convert all for only company credit use?

 

No, it's just a payment module, just like a credit card module or a PayPal module. You can turn it off/on globally in your admin panel just like other payment modules, and once it's turned on, you can still disable/enable per customer.

 

Hope that helps you,

Mike

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  

×