Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,589
    Plugin Contributions
    30

    Default admin includes/orders.php: some minor html errors, corrections for future html5

    The only real "bugs" are a few table errors...so this post is really intended for future code improvement.

    Before I add my mods to a page I usually fix any existing table errors and minor validation errors so it's easier to spot my new errors.
    I had a lot of tweaks to add into this page but fixing the existing errors was harder than usual given the crazy number of tables in it.

    For ZC155 a number of html5 tags were added to many elements but (inexplicably to me) the invalid doctype has remained in place.
    I was just going to feed back the <table> errors based in the html5 doctype but then went the whole hog, clearing out the legacy obsolete (border, cellspacing, cellpadding, valign, width) tags which in the main were completely unneeded, and then adding my own fixes for the couple of real errors that still existed.

    So, instead of detailing each and every fix I have included the entire page for your comparison pleasure. Differences or comments should be self-explanatory.

    My extra code:

    1) attribute "maxlength" not allowed on type number.
    This is used in a couple of places.
    eg.
    PHP Code:
    <?php
                    
    echo zen_draw_input_field('oID''''size="11" maxlength="11" id="orderSearch" class="form-control" placeholder="' HEADING_TITLE_SEARCH '"''''number');
    Both maxlength and size get ignored for type number!

    I removed them and had a go at using the min and max tags which works as expected.

    PHP Code:
    //steve added to set input limits for form search
                     
    $orders_limits $db->Execute("SELECT min(orders_id) AS orders_min, max(orders_id) AS orders_max FROM " TABLE_ORDERS);
                     if (
    $orders_limits->RecordCount()) {
                         
    $param_orders_min ' min="' $orders_limits->fields['orders_min'] . '"';
                         
    $param_orders_max ' max="' $orders_limits->fields['orders_max'] . '"';
                     }
                      echo 
    zen_draw_input_field('oID''''class="form-control" placeholder="' SELECT_ORDER_LIST '"' $param_orders_min $param_orders_max'''number');//steve maxlength and size removed 
    --------------------------

    2) tel: anchor attribute is used "as is". This should be cleaned/spaces removed at least: invalid to have spaces.

    PHP Code:
    <td class="main"><a href="tel:<?php echo $order->customer['telephone']; ?>"><?php echo $order->customer['telephone']; ?></a></td>
    this works for me, turns "+ 123 456#sss" into "tel:+123456"

    PHP Code:
    <td class="main"><a href="tel:<?php echo filter_var($order->customer['telephone'],FILTER_SANITIZE_NUMBER_INT); ?>"><?php echo $order->customer['telephone']; ?></a></td>
    4) the ip lookup does not produce a result, just the front page of dnsstuff
    PHP Code:
    <td class="main"><a href="http://www.dnsstuff.com/tools#whois&brvbar;type=ipv4&value=<?php echo $lookup_ip?>" target="_blank"><?php echo $order->info['ip_address']; //steve pipe replaced with html entity and extra space before target removed ?></a></td>
    5) The other 80+ html5 errors all were due to obsolete tags on the <table>s. Some tables still required width=100% so some css has been added in the page which of course could be put in the main css as this stuff will need to be done on all the admin pages.

    6) The rhs infoBox on the orders listing page seemed to take up more space than necessary so I have compacted that somewhat.

    7) a common admin trait is
    <tr>
    <form....
    which is invalid
    So, this has gone to
    <tr>
    <td><form....><table> etc.

    My personal mods not included in this file:
    a) Quick Status Update in the infoBox: allows status change/send email and shows language mismatch/prevents order update if admin lang!=order lang. This of course requires the shop lang in use to be stored with the order details at order completion time.
    Similarly, language info on the details page.
    I intend to submit this at some point as a plugin.

    b) A tooltip popup showing the products orders when hovering over the order total on the listing page.

    c) Email and Country column added to orders listing.

    d) Shipping telephone number to order details

    Enjoy.
    Attached Files Attached Files
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  2. #2
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: admin includes/orders.php: some minor html errors, corrections for future html5

    Why not start a PR and submit through github?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,589
    Plugin Contributions
    30

    Default Re: admin includes/orders.php: some minor html errors, corrections for future html5

    Why not start a PR and submit through github?
    Whenever I have attempted to use GIthub I have not been comfortable with understanding what is actually going on/get a bit of brain freeze so have avoided it, luddite and part-time/emergency coder that I am.
    An idiots-guide/wiki specific to the best way to use github in windows for your own zen cart development and enabling feedback/PRs would be a good thread for all who wish to contribute more efficiently.

    I also feel that a PR is like "here is my code to use" when I don't consider my hacklets to be to such a high standard. I prefer to start the idea and let others standardise it.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  4. #4
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,846
    Plugin Contributions
    25

    Default Re: admin includes/orders.php: some minor html errors, corrections for future html5

    That's the beauty of tools like github. If you do a PR people can comment on your code, and give advice. If needed you can change and resubmit. It may take some learning, but is not that hard.
    Quote Originally Posted by torvista View Post
    Whenever I have attempted to use GIthub I have not been comfortable with understanding what is actually going on/get a bit of brain freeze so have avoided it, luddite and part-time/emergency coder that I am.
    An idiots-guide/wiki specific to the best way to use github in windows for your own zen cart development and enabling feedback/PRs would be a good thread for all who wish to contribute more efficiently.

    I also feel that a PR is like "here is my code to use" when I don't consider my hacklets to be to such a high standard. I prefer to start the idea and let others standardise it.

  5. #5
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,589
    Plugin Contributions
    30

    Default Re: admin includes/orders.php: some minor html errors, corrections for future html5

    It may take some learning, but is not that hard.
    I see there is a guide now...there wasn't last time I attempted. I've set it up now.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

 

 

Similar Threads

  1. Replies: 0
    Last Post: 7 Jan 2015, 12:57 AM
  2. Replies: 3
    Last Post: 12 Sep 2012, 10:51 PM
  3. Replies: 0
    Last Post: 4 Jan 2007, 10:17 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