Jump to content

All in One Shipping Module Gets It's Zones Edited


bsmither
 Share

Recommended Posts

It is not inconceivable that shipping zones may have many dozens of methods. Although not excruciatingly onerous to click each row's Edit icon for the entire table, perhaps a "one click to click them all" button will make working major zone updates just a teensy bit better.

In the All in One Shipping module, make these edits:

In module.definitions.xml, find:

<string name="edit_row"><![CDATA[Edit Row]]></string>

Add after:

<string name="edit_table"><![CDATA[Edit Table]]></string>


In shipping_rates.tpl, find:

          <td colspan="7">
            <a href="#" class="aios-add"><img src="{$SKIN_VARS.admin_folder}/skins/{$SKIN_VARS.skin_folder}/images/add.png" alt="{$LANG.all_in_one_shipping.add_rows}" title="{$LANG.all_in_one_shipping.add_rows}" width="16" height="16" border="0" style="padding:0 5px;" />{$LANG.all_in_one_shipping.add_new_shipping_rates}</a>
          </td>
        </tr>
        {for $offset=0; $offset<5; $offset++}

Change to:

          <td colspan="4">
            <a href="#" class="aios-add"><img src="{$SKIN_VARS.admin_folder}/skins/{$SKIN_VARS.skin_folder}/images/add.png" alt="{$LANG.all_in_one_shipping.add_rows}" title="{$LANG.all_in_one_shipping.add_rows}" width="16" height="16" border="0" style="padding:0 5px;" />{$LANG.all_in_one_shipping.add_new_shipping_rates}</a>
          </td>
          <td align="right">{$LANG.all_in_one_shipping.edit_table} >></td>
          <td colspan="2">
            <input type="hidden" name="update_rates_all" value="0" size="1" />
            <a href="#" class="aios-edit-all" rel="update_rates_all"><img src="{$SKIN_VARS.admin_folder}/skins/{$SKIN_VARS.skin_folder}/images/edit.png" alt="{$LANG.all_in_one_shipping.edit_table}" title="{$LANG.all_in_one_shipping.edit_table}" width="16" height="16" border="0" style="padding:0 5px;" /></a>
          </td>
        </tr>
        {for $offset=0; $offset<5; $offset++}

The next edit is to add some new javascript that powers the "Edit All" button. Unfortunately, the AIOS javascript file is 'minimized'. Everything is on one line. Fortunately, the new code can be placed very near the beginning.

In all_in_one_shipping.min.js, at about the 85th character, find:

$(".chzn-select").chosen({width:"300px"})

Just in front of the dollar sign, insert the following:

$("a.aios-edit-all").on("click",function(){var t=$(this).parents("table:first").find("span.aios-editable");$(t).click();var t=$(this).parents("table:first").find("input.aios-editable");return $(t).data("original",$(t).val()),!1}),

The new javascript was copied and adapted from the code that powers the individual rows' Edit button. I don't understand the return statement. But it seems to work.

Be sure to force your browser to reload page resources because the copy in the browser's cache is obsolete.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...