No replies
bounce's picture
Offline
Joined: 05/31/2009
Juice: 15
Was this information Helpful?

I am close! I've been learning about ubercart/drupal module creation and have downloaded javascript to extend printing into my dymo label printer.

I want to print the shipping address onto the label.

Here's what I've been using

<?
drupal_add_js(drupal_get_path('module', 'uc_dymo') . '/PrintLabel.js');
drupal_add_js(drupal_get_path('module', 'uc_dymo') . '/DYMO.Label.Framework.latest.js');

function uc_dymo_menu() {
$items = array();
/*
$items['examples/form-example'] = array( //this creates a URL that will call this form at "examples/form-example"
'title' => 'Example Form', //page title
'description' => 'A form to mess around with.',
'page callback' => 'drupal_get_form', //this is the function that will be called when the page is accessed. for a form, use drupal_get_form
'page arguments' => array('uc_dymo_form'), //put the name of the form here
'access callback' => TRUE
); */
$items['admin/store/orders/%uc_order/dymo'] = array(
'title' => 'Dymo Print',
'page arguments' => array(3, TRUE),
'access arguments' => array('view all orders'),
'type' => MENU_LOCAL_TASK,
'weight' => 5,
);
return $items;
}

function uc_dymo_actions($order, $icon_html = FALSE) {

}

function uc_dymo_form($form, &$form_state) {
$form['some_text'] = array(
'#markup' => 'Label text:
Print'
);

$form['submit_button'] = array(
'#type' => 'submit',
'#value' => t('Print!'),
);

return $form;
}

function uc_dymo_form_validate($form, &$form_state) {
drupal_set_message(t('Printing to Dymo.'), 'status');

}

function uc_dymo_form_submit($form, &$form_state) {
}
/*
$items2['admin/store/orders/%uc_order/invoice/dymo'] = array(
'title' => 'Dymo Print',
'page arguments' => array(3, TRUE),
'access arguments' => array('view all orders'),
'type' => MENU_LOCAL_TASK,
'weight' => -3,
);
hook_menu($items2)
*/

?>

I'm on the right track, I have the tab, have verified my page will print the demo. Now I just want it to execute a print on button press. Furthermore I want it to pass the address information from the order.

Here is the framework from Dymo with a sample page.
http://developers.dymo.com/2010/06/02/dymo-label-framework-javascript-li...