Last active
August 29, 2015 14:01
-
-
Save msupko/d3489b2e7c1cce479df5 to your computer and use it in GitHub Desktop.
Commerce Packing Slip PDF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name = Commerce Packing Slip PDF | |
description = Provides a PDF version of a Drupal Commerce Packing Slip. | |
package = Commerce (contrib) | |
core = 7.x | |
dependencies[] = commerce_packing_slip | |
dependencies[] = PDF_using_mPDF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_menu(). | |
*/ | |
function commerce_packing_slip_pdf_menu() { | |
$items['admin/commerce/orders/%commerce_order/packing-slip/pdf'] = array( | |
'title' => 'PDF Packing slip', | |
'page callback' => 'commerce_packing_slip_pdf', | |
'page arguments' => array(3), | |
'access callback' => 'commerce_order_access', | |
'access arguments' => array('view', 3), | |
'type' => MENU_CALLBACK, | |
); | |
return $items; | |
} | |
function commerce_packing_slip_pdf($commerce_order) { | |
$html = drupal_render(commerce_packing_slip_view($commerce_order)); | |
pdf_using_mpdf_api($html, "Order-{$commerce_order->order_number}"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment