Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Oct 2006
    Posts
    170
    Plugin Contributions
    0

    Default Re: Edit 'Add to Cart' Button HTML

    Sorry if this is getting annoying, but I figured I would update you all as I go (kind of thinking out loud via the forum) - I added the following code to target only the product info page around line 359 of 'includes/functions/html_output.php':

    PHP Code:
        if (isset($_GET['main_page']) && $_GET['main_page'] == 'product_info')
        {
            
    $form .=  ' onSubmit="return confirm(\'Alert message goes here\')"';
        } 
    Now all I should need to do is add my additional IF to determine whether or not the message should be printed and Voila!

  2. #2
    Join Date
    Oct 2006
    Posts
    170
    Plugin Contributions
    0

    Default Re: Edit 'Add to Cart' Button HTML

    In the words of Borat - SUCCESS!

    Here's the final code I added to 'includes\functions\html_output.php' to get the notice working for the products I want. I also modified the 'products' table to add a 'legalnotice' field which is a TINYINT:

    PHP Code:
        // Mod to add an 18+ notice to products when field 'legalnotice'=1
        
    if (isset($_GET['main_page']) && $_GET['main_page'] == 'product_info')
        {
            
    $pid $_GET['products_id'];
            
    $sql mysql_query("SELECT products_id,legalnotice FROM products WHERE products_id='$pid' && legalnotice=1") or die(mysql_error());
            if (
    mysql_num_rows($sql) == 1)
            {
                
    $form .=  ' onSubmit="return confirm(\'You MUST be over the age of 18 to purchase this product. By clicking the 'OK' button you are effectively verifying that meet or exceed the stated age requirement.\')"';
            }
        } 
    The last hurdle - adding the 'legalnotice' as an option on the 'Add Product' page so that my client can flag these products via the admin area! Expect another out-loud brainstorm in another thread... LOL

  3. #3
    Join Date
    Oct 2006
    Posts
    170
    Plugin Contributions
    0

    Default Re: Edit 'Add to Cart' Button HTML

    Also - I do realize this code can probably be optimized and/or implemented in a more seamless manner, so if any of the mods/developers have tips on how to improve this functionality please feel free to critique my methods!

 

 

Similar Threads

  1. i want to edit action when click add to cart button
    By vetri in forum General Questions
    Replies: 2
    Last Post: 14 May 2015, 03:07 PM
  2. HTML for Add to cart button
    By Horrific_ending in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 13 Apr 2012, 12:44 AM
  3. Can I add a new button for Edit Cart.
    By glamourdolleyes in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 4 Apr 2012, 01:39 AM
  4. Edit Cart Mod - Update Cart Button Not Showing
    By ScriptJunkie in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 13 May 2011, 11:44 PM
  5. add button to launch html page
    By bettsaj in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 24 May 2009, 10:04 AM

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