Jump to content

Customers purchase order number entry and printing


peterp

Recommended Posts

Hi All,

         I have a client who has customers who require that they have the ability to enter their purchase order number when creating an order and also they need to see this in the email that they receive as well as on any printed order. I have suggested that they could use the customer delivery instructions field however the customers purchase order number is not displayed on the email the customer receives. I have search the forums for a similar requirement but unfortunately I was unable to find any thing. If somebody has come up with an idea how I can incorporate this into the order entry during checkout and how to have it printed on the order as well as the email I would be very grateful for the help.

Best Regards,

Peterp

Link to comment
Share on other sites

What version of CubeCart is being used?

The email template has available {$DATA.customer_comments} which should be what the related text-entry box contains. The admin's Order Invoice should also have {$order.customer_comments} available.

The customer_comments should already be available to the skin templates, the templates would just need to be edited to show it.

But for a distinct, searchable, sortable, dedicated column to collect and hold a customer's PO number, that can be done fairly easily.

Be back soon.

Link to comment
Share on other sites

Hi Brian,

              Thanks for this I thought that would be a way of doing it however if you come up with a way of allowing a special field for customers Purchase order number then this would be far more ideal.

Thanks again very nuch appreciated

Best Regards,

Peterp

Link to comment
Share on other sites

  • 2 weeks later...

Hi Brian,

           Have you had anymore thoughts on this subject that would use to create a specific field for the customers purchase order number if they have one (not Mandatory to be entered)

Appreciate any thoughts you may have on this subject

best Regards,

Peterp

Link to comment
Share on other sites

Here are some instructions. Keep these instructions! An upgrade will overwrite the changes you make (except the change to the database).

Execute this SQL command (be sure to prepend the table prefix if using a prefix):

ALTER TABLE `CubeCart_order_summary` ADD COLUMN purchase_order VARCHAR(100) DEFAULT NULL CHARACTER SET utf8 COLLATE utf8_unicode_ci;


In /classes/cubecart.class.php, near line 916, find:

$GLOBALS['smarty']->assign('VAL_CUSTOMER_COMMENTS', isset($this->_basket['comments']) ? $this->_basket['comments'] : '');

On the blank line following, add:

if (isset($_POST['purchase_order']) && !empty($_POST['purchase_order'])){$this->_basket['purchase_order'] = strip_tags(urldecode($_POST['purchase_order']));$GLOBALS['cart']->save();}$GLOBALS['smarty']->assign('VAL_PURCHASE_ORDER', isset($this->_basket['purchase_order']) ? $this->_basket['purchase_order'] : '');


In /classes/cubecart.class.php, near line 2431, find:

if (($paginated_orders = $GLOBALS['db']->select('CubeCart_order_summary', array('custom_oid', 'id', 'cart_order_id', 'ship_tracking', 'order_date', 'status', 'total', 'basket'), array('customer_id' => $GLOBALS['user']->get('customer_id')), array('cart_order_id' => 'DESC'), $per_page, $page, false)) !== false) {

Change to:

if (($paginated_orders = $GLOBALS['db']->select('CubeCart_order_summary', false, array('customer_id' => $GLOBALS['user']->get('customer_id')), array('cart_order_id' => 'DESC'), $per_page, $page, false)) !== false) {


In /classes/order.class.php, near line 1337-1338, find:

  'currency' => $GLOBALS['session']->get('currency', 'client')
);

On the blank line following, add:

$record['purchase_order'] = (isset($this->_basket['purchase_order'])) ? $this->_basket['purchase_order'] : null;


In the skin template content.checkout.confirm.php, find:

<label for="delivery_comments" class="return"><strong>{$LANG.basket.your_comments}</strong></label>
<textarea name="comments" id="delivery_comments">{$VAL_CUSTOMER_COMMENTS}</textarea>

On a new blank line above that, add:

<div class="row"><div class="small-12 large-8 columns"><label for="purchase_order" class="show-for-medium-up"><strong>Purchase Order Number</strong></label><input type="text" name="purchase_order" id="purchase_order" placeholder="Purchase Order" value="{$VAL_PURCHASE_ORDER}"></div></div>


In the admin template orders.index.php, find:

{if isset($DISPLAY_COMMENTS)}
<div class="note">
   <span class="actions"></span>
   <div class="note-header">{$LANG.orders.note_from} {$OVERVIEW_SUMMARY.first_name|capitalize} {$OVERVIEW_SUMMARY.last_name|capitalize}</div>
   "{$OVERVIEW_SUMMARY.customer_comments}"
</div>
{/if}

On a new blank line after, add:

{if !empty($OVERVIEW_SUMMARY.purchase_order)}
<div class="note">
   <span class="actions"></span>
   <div class="note-header">Purchase Order: {$OVERVIEW_SUMMARY.purchase_order}</div>
</div>
{/if}


In the admin template orders.print.php, find:

<div class="info">
  <span class="orderid"><strong>{$LANG.common.order_id}</strong>   {if $CONFIG.oid_mode=='i'}{$order.{$CONFIG.oid_col}}{else}{$order.cart_order_id}{/if}</span>
  <strong>{$LANG.orders.title_receipt_for}</strong> {$order.order_date}
</div>

On a new blank line after that, add:

{if !empty($order.purchase_order)}
<div class="info">
  <strong>Purchase Order:</strong>   {$order.purchase_order}
</div>
{/if}

Note: if the admin's Order Invoice has previously been customized via the Invoice Editor,
then the Invoice HTML will be databased. Thus, you will need to apply the above edits to
the version of the Invoice managed by the Invoice Editor.

Email templates will use {$DATA.purchase_order}


In the front skin template content.receipt.php, find:

<h2>{$LANG.orders.order_number}: {if $CONFIG.oid_mode=='i'}{$SUM.{$CONFIG.oid_col}}{else}{$SUM.cart_order_id}{/if}</h2>

On a new blank line after that, add:

{if !empty($SUM.purchase_order)}
<h2>Purchase Order:   {$SUM.purchase_order}</h2>
{/if}


In the front skin template content.orders.php, find:

<td>{$order.time}<br><a href="{$STORE_URL}/index.php?_a=vieworder&cart_order_id={$order.cart_order_id}" title="{$LANG.common.view_details}">{if $CONFIG.oid_mode=='i'}{$order.{$CONFIG.oid_col}}{else}{$order.cart_order_id}{/if}</a></td>

Change to:

<td>{$order.time}<br><a href="{$STORE_URL}/index.php?_a=vieworder&cart_order_id={$order.cart_order_id}" title="{$LANG.common.view_details}">{if $CONFIG.oid_mode=='i'}{$order.{$CONFIG.oid_col}}{else}{$order.cart_order_id}{/if}</a><br>{if !empty($order.purchase_order)}PO: {$order.purchase_order}{/if}</td>

 

Link to comment
Share on other sites

HI bsmither,

Do things like you have just done above for the purchase order number go into the next release or update?

With you saying an update will over write it. Why does these changes not get put into the next version automatically?

Just wondered.

Great job!

Link to comment
Share on other sites

These forums are unofficial conversations. Nothing said here can automatically be assumed will show up in the next release.

There is a bug tracker and a feature tracker (currently inoperative) to officially report your (researched and reproducible) bug, or ideas for new functionality.

The key purpose of these forums is to have a conversation about solving a difficulty, or implementing a feature that is very likely pertinent to that one individual.

If that difficulty is the result of a bug, a proper bug report is posted on the bug tracker. If the feature seems to be something that would significantly enhance the usability of CubeCart for a large number of users, then a fully-fleshed case for it is made on the feature tracker.

Otherwise, it's just us users helping other users.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...