Jump to content

Changing Invoice Layout


WSD

Recommended Posts

Hi guys

 

I have tried searching for the answers to my questions but cant seem to find the answer.

 

I want to make a couple of small changes to the invoice layout in my cubecart 6 store but cant seem to find the correct file to make them work.

 

1st - I would like to get the 'Thanks for shopping with us' footer to move to the bottom of the page rather than just at the end of the product info which leaves it floating around the middle of the page

 

2nd - is there a way i can set the customers postcode to show on the next line down rather than beside their county?

 

As always all help much appreciated.

 

Thanks

Wil

Link to comment
Share on other sites

There are two "invoice" pages (more like "receipts:), one is shown to the customer when the customer is reviewing past orders, and the other is for the admin to use as a kind of shipping list.

In admin, Documents, Invoice Editor tab, CubeCart takes the content from the admin template orders.print.php and offers it to be edited. The edited version is then databased (which means it survives upgrades).

The editor starts in Source mode because the other mode shows nothing but a few dozen blue squares. Each blue square is a Smarty variable or command.

Getting the footer to be at the bottom of the page would be a matter for CSS to solve, and how/if the browser incorporates the page dimensions as reported by the printer driver -- I have no experience in doing this. The basic problem is that HTML and CSS are developed for a display viewport of arbitrary width and unlimited length.

Sure, there are workarounds, but getting a browser to do layout work for print media is hit or miss. See:
https://stackoverflow.com/questions/1360869/
https://stackoverflow.com/questions/21032137/

 

Link to comment
Share on other sites

  • 3 months later...

Hi guys me again.

Does anyone know how i can add the MPN code to the invoice? i would like it to sit at the start of the item that has sold. 

This will make it more simple when it comes to picking my orders.

 

Thanks

Wil

mpn template.png

Link to comment
Share on other sites

The snippet we will create is as follows:

Enabled: Checked
Unique ID: addmpn2invoice@cc62+
Execution Order: 1
Description: Adds the MPN code from Inventory to the Admin Invoice at Orders Print
Trigger: admin.order.index.print
Version: 1.0
Author: https://forums.cubecart.com/topic/56026-changing-invoice-layout/
PHP Code:
<?php
  /* Adds the MPN code to the data made available to the admin's Order Invoice template
   * Uses hook admin.order.index.print
   */
  $snippet_addmpn2invoice_list_of_orders = $smarty_data['list_orders'];
  foreach($snippet_addmpn2invoice_list_of_orders as &$snippet_addmpn2invoice_order){
      foreach($snippet_addmpn2invoice_order['items'] as &$snippet_addmpn2invoice_item){
          $snippet_addmpn2invoice_item['mpn'] = $GLOBALS['db']->select('CubeCart_inventory','mpn',array('product_id'=>$snippet_addmpn2invoice_item['product_id']))[0]['mpn'];
      }
  }
  $smarty_data['list_orders'] = $snippet_addmpn2invoice_list_of_orders;
  $GLOBALS['smarty']->assign('ORDER_LIST', $smarty_data['list_orders']);

You will now have {$item.mpn} available for use. You indicated you will want it placed before {$item.quantity}.

Link to comment
Share on other sites

In the admin's template orders.print.php.

However, if you have used CubeCart's capability to edit the Order Invoice (admin, Documents, Invoice Editor tab), then CubeCart will use this because it has thus been databased (surviving upgrades). Give some thought to using the editor and Save to the database this version of the Invoice.

 

Link to comment
Share on other sites

The snippet we will create is as follows:

Enabled: Checked
Unique ID: addmpn2summary@cc62+
Execution Order: 1
Description: Adds the MPN code to the data made available to Order Summary
Trigger: admin.order.index.display
Version: 1.0
Author: https://forums.cubecart.com/topic/56026-changing-invoice-layout/
PHP Code:
<?php
  /* Adds the MPN code to the data made available to the admin's Order Index template, Order Summary (Overview tab).
   * Uses hook admin.order.index.display
   */
  $snippet_addmpn2summary_list_of_items = $smarty_data['products'];
  foreach($snippet_addmpn2summary_list_of_items as &$snippet_addmpn2summary_item){
      $snippet_addmpn2summary_item['mpn'] = $GLOBALS['db']->select('CubeCart_inventory','mpn',array('product_id'=>$snippet_addmpn2summary_item['product_id']))[0]['mpn'];
  }
  $GLOBALS['smarty']->assign('PRODUCTS', $snippet_addmpn2summary_list_of_items);

You will now have {$product.mpn} available for use on the Overview tab and the Inventory tab.

Link to comment
Share on other sites

  • 4 months later...

I'm also looking to add to the Invoice (when the customer reviews the invoice,  prints the invoice, gets the email and from the admin side when we receive the order email and review the order/change status). I would like to see the Category associated with the product displayed in all those areas. Any help is appreciated - Thanks.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...