drupal-7ubercart

How to theme shopping cart in ubercart


I use drupal 7 and ubercart 3. How can I theme cart page. I used to create page--cart.tpl.php but I don't know how to get item of cart to theme it


Solution

  • The shopping cart at /cart is a form that you can theme override. In the template.php file, add the following function.

    function yourtheme_uc_cart_view_form(&$variables) {
      //$form contains the UC cart form object
      $form = &$variables['form'];
    
      //$form['items'] will contain a table object with the cart items
      $output = '<p>some test output.</p>';
      $output .= drupal_render_children($form);
      return $output
    }