Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Posts
    609
    Plugin Contributions
    0

    Default Product page, execute code on out of stock

    Would it be possible to write some code so that when a visitor visits a product page, if it is out of stock the site will pop a lightbox up that will display some links?

    I already use a lightbox for product images, so I presume I can use the same light box .js code?

    Would anyone be able to help me and give me an idea where I should start?

    Aim - If out of stock lightbox pop up displaying some links and text

  2. #2
    Join Date
    Mar 2009
    Posts
    609
    Plugin Contributions
    0

    Default Re: Product page, execute code on out of stock

    Code:
    <?php
    echo '<script type="text/javascript">';
    echo 'function myFunction(){ window.location = "http://www.someurl.co.uk/" };';
    echo '</script>';
    
    if ($products_quantity == 0) {
        echo '<BODY onLoad="myFunction()">';
    }
    ?>
    right, all i need now is for someone to help me write the code to go in my function :)

    nothing much

  3. #3
    Join Date
    Mar 2009
    Posts
    609
    Plugin Contributions
    0

    Default Re: Product page, execute code on out of stock

    Code:
    <script language="JavaScript">
    function loadalert () 
    
            {alert("Text here")
    
    }
    </script>
    
    <?php if ($products_quantity == 0) {
        echo '<body onLoad="loadalert()">';
    }
    ?>

    at the moment I'm using that

    URL's can't be placed in alert boxes, perhaps a high z placed div would work better

 

 

Similar Threads

  1. Move Out of Stock to top of product page
    By jasmel in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 11 Dec 2012, 06:56 PM
  2. Replies: 5
    Last Post: 3 Aug 2011, 08:15 AM
  3. Stock by Attribute setup and product has stock when added to card says out of stock
    By kwrosenzweig in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 9 Jun 2011, 06:18 PM
  4. How can I execute PHP code in a page?
    By zirconx in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 6 Dec 2006, 03:36 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