Responsive tables for Commerce Cart & Checkout

Making responsives table using ngResponsiveTable jquery script for Drupal Commerce cart & checkout pages.

1. We got next nice Bootstrap themed cart or checkout table:

 

2. In mobile we'll got next image:

Not so bad (table was wrapped by table-responsive class), but not so useful, since I need swipe left-right by finger for viewing other details, instead of continuously swiping down.

3. So we remake our tables to responsive tables by next steps:

3.1. Download ngResponsiveTables and extract to YOURTHEME_folder/js/ngtables/

3.2. Add next code to your template.php (or add inner code to if exists in hook_preprocess_page function):

/**
 * Override or insert variables into the page templates.
 */
function YOURTHEME_preprocess_page(&$vars, $hook) {
  $arg = arg();
  // ...
  if (($arg[0] == 'cart') || ($arg[0] == 'checkout')) {
    drupal_add_js(drupal_get_path('theme', 'YOURTHEME') . '/js/ngtables/ng_responsive_tables.js');
    // if you want to use own custom script (if one exists), change next to yours:
    drupal_add_js(drupal_get_path('theme', 'YOURTHEME') . '/js/script.js');
    drupal_add_css(drupal_get_path('theme', 'YOURTHEME') . '/js/ngtables/ng_responsive_tables.css');
  }
  // ...
}

 

3.3. Add script.js to YOURTHEME_folder/js (or use own js file) next code:

(function ($, Drupal, window, document, undefined) {

Drupal.behaviors.my_custom_behavior = {
  attach: function(context, settings) {
    if (jQuery().ngResponsiveTables) {
      $('table').once("ngtable", function() {
        $('table').ngResponsiveTables({
          smallPaddingCharNo: 13,
          mediumPaddingCharNo: 18,
          largePaddingCharNo: 30
        });
      });
    }
  }
};

})(jQuery, Drupal, this, this.document);

3.4. Some styles (depend on theme that you will use):
 

@media (max-width: 768px) {
  .commerce-order-handler-area-order-total .commerce-price-formatted-components {
     width: 100%;
  }

  table.checkout-review .pane-title td,
  .field-name-commerce-order-total .component-title,
  .checkout_review td {
    &:before {
      display: none;
    }
  }
}

4. Refresh drupal and browser caches, and we got next:

p.s. Using StackTable isn't recommend, since it duplicate tables to real table and hidden responsive table, so for our cart or checkout forms it willn't applicable and got count of bugs.

p.p.s I don't like using CSS solutions, since want to make responsive for all tables, not only one customized.

Comments

Hi guys!

Let's introduce ourselves!

<font color="#FF1493"><b>My name is Angela.</b></font>

<a href=http://alextraf.ru/dating/xr><img src="http://daterar.com/wp-content/uploads/images/girl/47327398_548628648986…;

I want to meet a good guy to 60 years.

<i><b><a href=http://daterar.com/>Write me here</a></b></i>

<a href=http://alextraf.ru/dating/xr><img src="https://t4.ftcdn.net/jpg/00/32/40/33/240_F_32403356_C5A80wAG5GmaeTEu72J…;

Anonym dejting good two night stand dating site what is carbon 14 dating formula activity ukraina dating scams signs dating app android nederland 100 free ukraine dating dating naked de briun helsinki-vantaa-airport knulla sex dating dating muggy mike catfish dating story steven free sex dating sites no sign up interactive dating games dating my daughter v0 dejt f¶r personer med psykisk oh¤lsa list of australian dating sites zoosk dating login christian online dating reviews dejting app logga in harry potter and hermione dating ron angry fanfiction free online dating sites canada mandy moore dating best dating apps for women single muslim dating sites reddit aspergers dating dating website for good looking dating site for free no payment real sex dating mate1 dating site speed dejt alla hj¤rtans dag present till pojkv¤nnen dating tips for teens adult friends dating b¤sta dejting sverige dating naked porn who is justin bieber dating right now shemail dating matri dating uk girls dating international online dating sites mixed dating uk temmie dating soundcoud hockup dating dating app iphone 4 b¤sta dejting frgorna shark dating simulator f95zone free dating sim mac mixed race dating sites uk penguin dating site dating naked tv4 spiritual dating sites india dating sites for singles over 50 legitimate russian dating websites dating and friendship sites kuramochi asuka dating emmy rossum dating quadriplegic dating hater dating app review dejting f¶r tonringar svt plus dejtingsajter birthday gift dating for 2 months dejt app 2018 online dejting f¶r tjocka japanese online dating dejtingsidor polens best free dating sim games margin of error radio carbon dating top dating sites reviews 100 free russian dating asian black interracial dating dream daddy a dad dating simulator rich and beautiful dating dating behaviour name free bisexual dating sverige the sims dating game free dating websites russell brand dating millionaire matchmaker online dating avoidant attachment disorganized attachment dating naked dating show jada fire dating dating a guy both have cats svt plus dejtingsajter muslim dating websites usa harley from dating naked lucky dating site lena sj¶ stora enso dejting dejting v¤rnamo jesse cox dodger dating adult dating websites damon albarn dating top dating shows speed dating 3 b¤sta dejting app who is madison beer dating 2017 slow dating 2 june stockholm gratis dejtingsidor f¶r ¤ldre married dating sites australia bhm dejting british muslim dating dejtingtips f¶r m¤n most popular online dating sites in australia interracial marriage dating sites dating quiz lisa ann dating dejtingrnen uppsala inge de bruijn dating naked white girl dating mexican meme dejting gaming best dating profile examples www dating com happy dejting se russian dating pictures fail online dating tips for women elvan cola dating anonym kurdisk dejting naughty dating websites dejting telefonnummer greek speed dating dating website ratings dating japanese women rachel riley dating when does casual dating become a relationship milo ventimiglia dating dating sites sweden free tr¤ffa milf dejting dating sites all over the world abdl dating sim number one dating app for iphone dating sites for chubby people dating sites 16 hater dating app adult dating senior dating agency reviews dating websites are a waste of time dating naked s2e7 sex dating dk

Add new comment

Простой текст

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.