cancel
Showing results for 
Search instead for 
Did you mean: 

Check if Purchase Order Number field was left blank

SOLVED

Check if Purchase Order Number field was left blank

For payment options, I have Purchase Order as optional.

 

I want to check if the purchase order field was left blank after checkout, so that I can remove Purchase Order Number [blank] from the print order page.

 

I've searched and can't find any reference to how to find this. There doesn't seem to be a getPoNumber() or anything like it.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Check if Purchase Order Number field was left blank

Here's the solution:

The template I was working in is:

design/frontend/default/[your-theme]/template/sales/order/print.phtml

 

At the top of this is the $_order variable:

 

<?php $_order = $this->getOrder() ?>

To get the PO Number and use it:

 

<?php
$po_number = $_order->getPayment()->getPoNumber();
if($po_number) {
	//This is the default:
	echo $this->getPaymentInfoHtml();
}
else {
       //Add custom stuff here:
	echo 'No PO number entered';
}
?>

 

View solution in original post

3 REPLIES 3

Re: Check if Purchase Order Number field was left blank

Hi @Green18

 

I'm sorry but i'm not getting your question. Can you please elaborate? So I may help you out.

Was my answer helpful? You can Click Kudos/Accept As Solution.
200+ professional extensions for M1 & M2 with free lifetime updates!

Re: Check if Purchase Order Number field was left blank

This is a site where there's no credit card or other payment options, because the customers are wholesalers who will be sent a bill later.

 

During one page checkout, the customer has the option of entering a purchase order number.

 

After checkout is complete, the customer can click on the "print" link so they can print out their "order confirmation".

 

On the print order confirmation, there's a part for "Payment Method". It says "Purchase order number:" even if the customer didn't enter a purchase order number.

 

I'd like to check to see if the purchase order number field was left blank, so I can remove that from the print order confirmation (and perhaps replace it with something else).

 

 

Re: Check if Purchase Order Number field was left blank

Here's the solution:

The template I was working in is:

design/frontend/default/[your-theme]/template/sales/order/print.phtml

 

At the top of this is the $_order variable:

 

<?php $_order = $this->getOrder() ?>

To get the PO Number and use it:

 

<?php
$po_number = $_order->getPayment()->getPoNumber();
if($po_number) {
	//This is the default:
	echo $this->getPaymentInfoHtml();
}
else {
       //Add custom stuff here:
	echo 'No PO number entered';
}
?>