I am attempting to theme the 'Continue Shopping,' 'Update Cart' and 'Checkout' buttons and having a problem. The buttons are showing up as images now, but they are not triggering the right actions on submit. I modified the uc_imgsubmit module to do the following:
<?php
/**
* @file
* Replaces the default Add to Cart button with an image button
* @author Will Vincent (tcindie) <tcindie at gmail dot com>
*/
/**
* Implementation of hook_form_alter().
*/
function uc_imgsubmit_form_alter(&$form, $form_state, $form_id) {
$form_nid = $form['nid']['#value'];
if ($form_id == 'uc_product_add_to_cart_form_'.$form_nid) {
global $theme;
$form['submit'] = array(
'#type' => 'image_button',
'#value' => t('Add to Cart'),
'#src' => drupal_get_path('module', 'uc_imgsubmit').'/images/addtocartbutton.gif',
'#attributes' => array(
'class' => 'node-add-to-cart'
)
);
}
if ($form_id == 'uc_cart_view_form') {
global $theme;
$form['continue_shopping']['#type'] = 'image_button';
$form['continue_shopping']['#src'] = drupal_get_path('module', 'uc_imgsubmit') .'/images/continue-shopping.gif';
$form['continue_shopping']['#attributes']['op'] = 'Continue shopping';
$form['update']['#type'] = 'image_button';
$form['update']['#src'] = drupal_get_path('module', 'uc_imgsubmit') .'/images/update-cart.gif';
$form['update']['#attributes']['op'] = 'Update cart';
$form['checkout']['#type'] = 'image_button';
$form['checkout']['#src'] = drupal_get_path('module', 'uc_imgsubmit') .'/images/check-out.gif';
$form['checkout']['#attributes']['op'] = 'Checkout';
}
if ($form_id == 'uc_cart_pane_quotes') {
global $theme;
$form['get_quote']['#type'] = 'image_button';
$form['get_quote']['#src'] = drupal_get_path('module', 'uc_imgsubmit') .'/images/calculate-shipping.gif';
}
}
The quotes tweak works, and in general the update cart one works. But Continue Shopping and Checkout just bring you back to the cart. It looked to me like the submit action is checking for an 'op' attribute, so I attempted to add those to trigger the right actions, but to no avail. Help!?
