#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    3
    Rep Power
    0

    Wink Embedded javascript


    Guys

    Hi hope yr well

    Time Management Calendar mods, - Oscommerce

    In order to simplfy use of this plugin I'm
    attempting to combine the logic for "remove_product"
    in application_top.php with the logic for "date delete"
    in kalender.php.

    Specifically the code fragments are:

    application_top:

    // customer removes a product from their shopping cart
    case 'remove_product' : if (isset($HTTP_GET_VARS['products_id'])) {
    $cart->remove($HTTP_GET_VARS['products_id']);
    }
    tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
    break;

    Kalender:

    <tr>
    <td class=main><?php echo ENTRY_CALENDAR_ID; ?>&nbsp;
    <input name="calendar_id" type="text" size="11" maxlength="11"></input>
    <input name="action" type="hidden" value="delete">
    </td>
    <td class=main align=right><span class="tdbLinkdel">
    <button id="del" type="submit"><?php echo IMAGE_BUTTON_DELETE; ?></button></span><script type="text/javascript">$("#del").button({icons:{primary:"ui-icon-trash"}}).addClass("ui-priority-secondary").parent().removeClass("tdbLinkdel");</script>
    </td>
    </tr>

    What I'm having difficulty with is fathoming the contents of the "button" script in kalender.php,

    ie. <script type="text/javascript">$("#del").button({icons:{primary:"ui-icon-trash"}}).addClass("ui-priority-secondary").parent().removeClass("tdbLinkdel");</script>

    I'd be really grateful if somebody could explain how this script does the booking deletion so I can dovetail it with the
    shopping cart removal and have one control do both functions.

    Thanks for your kind attention and arriba open source!

    Martin Langley
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Sep 2006
    Posts
    1,917
    Rep Power
    533
    Martin,

    Your question relates to jQuery, and should be posted in the JavaScript forum. If you want to be okay with JavaScript pretty quickly, I recommend looking into jQuery.

    Regardless, the script looks for the <button id="del" type="submit"> element, makes it pretty using jQueryUI's button method, adds the ui-priority-secondary class to it, and then removes class tdbLinkdel from the parent <span class="tdbLinkdel">.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    3
    Rep Power
    0
    Originally Posted by NotionCommotion
    Martin,

    Your question relates to jQuery, and should be posted in the JavaScript forum. If you want to be okay with JavaScript pretty quickly, I recommend looking into jQuery.

    Regardless, the script looks for the <button id="del" type="submit"> element, makes it pretty using jQueryUI's button method, adds the ui-priority-secondary class to it, and then removes class tdbLinkdel from the parent <span class="tdbLinkdel">.


    This is a great move forward for a javascript novice like me!

    Forgive me I am still unclear how the script actually does the deletion of shopping basket data, and from where, in the
    surrounding .php. There must be a reference to an external function or something which I still cannot find. Any further guidance would be much appreciated!

    Best regards

    Martin

IMN logo majestic logo threadwatch logo seochat tools logo