Jump to content

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 post
Share on other sites

Posted (edited)

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/

 

Edited by bsmither
  • Thanks 1
Link to post
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 post
Share on other sites

The snippet we will create is as follows:

Enabled: Checked
Unique ID: [email protected]+
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}.

  • Thanks 1
Link to post
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.

 

  • Thanks 1
Link to post
Share on other sites
On 10/12/2020 at 8:10 PM, bsmither said:

Order Summary page? Something printed? Or the admin screen?

 

The admin screen when you click to view the customers order before printing.

Link to post
Share on other sites

The snippet we will create is as follows:

Enabled: Checked
Unique ID: [email protected]+
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.

  • Thanks 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...