Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2006
    Location
    Netherlands
    Posts
    48
    Plugin Contributions
    0

    Default How to get the shopping cart open the numeric keypad on mobile when changing quantity

    I managed to change the input type="text" to "number" on the product page and category listing, so that - only on mobile- it automatically opens a numeric keypad when changing the quantity.

    But I do not succeed to change it on the shopping cart. I got as far as fiddling with line 148 on includes/modules/pages/shopping_cart/header_php.php, but I can not get it right.

    Line 148:
    $quantityField = zen_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4" class="cart_input_'.$products[$i]['id'].'"');

    Anyone knows the proper way to achieve it?

    Any help highly apreciated!

  2. #2
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: How to get the shopping cart open the numeric keypad on mobile when changing quan

    Note: Be aware that not all devices support all the options, so even adding markup hints for it doesn't guarantee the device will do what you hoped.

    Two options exist:
    1. use "inputmode" instead of "type".
    This is simpler, since it can be done for "just this page".
    Code:
    size="4" inputmode="numeric" class="cart_input_
    or instead of "numeric" you could use "decimal" if you support fractional quantities.

    2. To use 'type="number"' requires changing the zen_draw_input_field() function, which affects EVERYWHERE any input field is provided.
    And since Zen Cart supports fractional quantities, and each product can be set to require varying increments of decimals and/or whole-numbers, setting type="number" would be problematic since it only supports integers and therefore the function would also require calculating the correct intervals to add additional values to the type parameters. Thus I'd suggest not using type="number".
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jan 2006
    Location
    Netherlands
    Posts
    48
    Plugin Contributions
    0

    Default Re: How to get the shopping cart open the numeric keypad on mobile when changing quan

    Thanks, I will try the first option.

    I found the zen_draw_input_field() function in the html_output.php, but was hesistant to make changes there, understanding changes there had a sitewide impact.

  4. #4
    Join Date
    Jan 2006
    Location
    Netherlands
    Posts
    48
    Plugin Contributions
    0

    Default Re: How to get the shopping cart open the numeric keypad on mobile when changing quan

    Great, first options works fine!
    Thanks for your help!

  5. #5
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: How to get the shopping cart open the numeric keypad on mobile when changing quan

    Note that moving forwards, some sort of "off-line" version of your site should be where things are tried. Once identified as successful, the changes can be quickly duplicated on your live site. Best part? You can make mistakes and not miss out on that sale happening while trying to fix a mistake.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Jan 2006
    Location
    Netherlands
    Posts
    48
    Plugin Contributions
    0

    Default Re: How to get the shopping cart open the numeric keypad on mobile when changing quan

    Noted!
    I always fiddle around in a test shop, before applying fixes in the live shop.
    And as always a wise thing to do is: back up, back up, back up!

 

 

Similar Threads

  1. v154 How to get product IDs in the shopping cart in the shipping selection page?
    By smallpotato in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 8 Dec 2018, 11:23 PM
  2. Replies: 1
    Last Post: 23 Jan 2010, 09:54 PM
  3. shopping cart - hide the Cart Quantity Update button when not needed
    By dause in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 1 Oct 2009, 04:28 AM
  4. How do I delete the Max:1 quantity from the shopping cart?
    By KismetDesign in forum Basic Configuration
    Replies: 1
    Last Post: 16 Jul 2009, 05:09 PM
  5. Show quantity in cart only when the product is already in shopping cart
    By e81ny in forum Templates, Stylesheets, Page Layout
    Replies: 15
    Last Post: 8 Sep 2007, 03:34 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR