NodsDorf Posted June 7, 2012 Share Posted June 7, 2012 I'm trying to add this functionality to our product_listing page but I'm not getting the poup to actually open. So far I have Defined the filename Defined the text info in product_listing language On the product listing page I have added this Javascript function <script type="text/javascript"> function popupWindow(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150,left=150') } </script> <script type="text/javascript"> $('#helpSearch').dialog({ autoOpen: false, buttons: { Ok: function() { $(this).dialog('close'); } } }); </script> Then in the code where I want the popup functionality (product_listing.php) I added this code.. case 'PRODUCT_LIST_QUANTITY': //STOCK NOTICE CODE $stock_time_query = tep_db_query("select p.products_lead_time as lead_time FROM " . TABLE_PRODUCTS . " p where p.products_model= '" . $listing[$x]['products_model'] . "'"); while ($stock_time = tep_db_fetch_array($stock_time_query)) { if ($stock_time['lead_time']>0) { $stock_notice = sprintf(TEXT_RESTOCK_BELLOW, $stock_time['lead_time']); } } ////END STOCK NOTICE CODE ////CHECKING IF STOCK = O if ($listing[$x]['products_quantity']=='0' && substr($listing[$x]['products_model'],0,1) =='B') { $prod_list_contents .= ' <td align="right"><span><a href="' . tep_href_link(FILENAME_STOCK_HELP) . '" target="_blank" onclick="$(\'#helpSearch\').dialog(\'open\'); return false;">' . $stock_notice. '</a></span></td>'; }else if ($listing[$x]['products_quantity']=='0' && substr($listing[$x]['products_model'],0,1) !='B'){ $prod_list_contents .= ' <td align="right"><span><a href="'. tep_href_link(FILENAME_STOCK_HELP) . '" target="_blank" onclick="$(\'#helpSearch\').dialog(\'open\'); return false;">' . TEXT_RESTOCK_ORING . '</a></span></td>'; ///IF STOCK NOT = 0 THEN GIVE QUANTITY } else{ $prod_list_contents .= ' <td align="right">' . $listing[$x]['products_quantity'] . '</td>'; } break; When I view the source of the page where the popup should be it appears to be correct.. Here is how it looks in Firebug: <td align="right"> <span> <a onclick="$('#helpSearch').dialog('open'); return false;" target="_blank" href="http://www.rubberstore.com/test/catalog/popup_stock_help.php"> <b>2 Weeks*</b> </a> </span> </td> When I click the link nothing happens tested in multiple browsers and after force refershes (CRTL+F5), I can manually type in the page I created popup_stock_help.php and see its there. First thought was the function needed to be in the head, so I moved it to the header.php file ---didn't fix it. Now, I think maybe the Jquery function ($('#helpSearch').dialog('open') ;) is the problem. But no Idea how to address it Any thoughts? Link to comment Share on other sites More sharing options...
burt Posted June 7, 2012 Share Posted June 7, 2012 http://www.clubosc.com/2-3-1-design-ebook-supplement-add-some-candy.html That is images in the blog post, but you can get most of the code from them. I ask "D. Email me for the new "head cart" module (code doesn't play nicely in this blog for some reason).". You don't need that, you would use your popup_stock_help.php Link to comment Share on other sites More sharing options...
NodsDorf Posted June 7, 2012 Author Share Posted June 7, 2012 Thank you burt So I created a new <div> gave it the class of stock_contents & then included the page I made for it. Added your function and then gave my <a>'s the stock_help class then passed the onlick to the div Its not actually popping up a new page per-say but it does what I expect. I had originally just copied the popup_search_help.php and saved it as popup_stock_help.php but this was designed to create a new page and had its own include app top head body tags which needed stripped out to use your method. I ended up with this: include/modules/product_listing.php Add: <div class="stock_contents"><?php include 'popup_stock_help.php';?></div> <script type="text/javascript"> $(document).ready(function() { $('.stock_contents').dialog({ autoOpen: false, buttons: { Ok: function() { $(this).dialog('close'); } } }); $('.stock_help').click(function() { $('.stock_contents').dialog('open'); }); }); </script> Then in my modified for other stuff CASE statement for Product List Quantity I did this case 'PRODUCT_LIST_QUANTITY': //STOCK NOTICE CODE $stock_time_query = tep_db_query("select p.products_lead_time as lead_time FROM " . TABLE_PRODUCTS . " p where p.products_model= '" . $listing[$x]['products_model'] . "'"); while ($stock_time = tep_db_fetch_array($stock_time_query)) { if ($stock_time['lead_time']>0) { $stock_notice = sprintf(TEXT_RESTOCK_BELLOW, $stock_time['lead_time']); } } ////END STOCK NOTICE CODE ////CHECKING IF STOCK = O if ($listing[$x]['products_quantity']=='0' && substr($listing[$x]['products_model'],0,1) =='B') { $prod_list_contents .= ' <td align="right"><a class="stock_help" href="' . tep_href_link(FILENAME_STOCK_HELP) . '" target="_blank" onclick="$(\'stock_contents\').dialog(\'open\'); return false;">' . $stock_notice. '</a></td>'; }else if ($listing[$x]['products_quantity']=='0' && substr($listing[$x]['products_model'],0,1) !='B'){ $prod_list_contents .= ' <td align="right"><a class="stock_help" href="'. tep_href_link(FILENAME_STOCK_HELP) . '" target="_blank" onclick="$(\'stock_contents\').dialog(\'open\'); return false;">' . TEXT_RESTOCK_ORING . '</a></td>'; ///IF STOCK NOT = 0 THEN GIVE QUANTITY } else{ $prod_list_contents .= ' <td align="right">' . $listing[$x]['products_quantity'] . '</td>'; } break; End result you get a nice little window to open when you click on a product that is showing a lead time as the quantity. This is exactly what I wanted to acheive. Thank you again Burt Also I should thank Jim for helping me with part of the php Link to comment Share on other sites More sharing options...
NodsDorf Posted June 7, 2012 Author Share Posted June 7, 2012 Hey Burt If you happen to see this, do you ever see an issue where the <div> that holds the data onclick gets displayed for a few microseconds while the page is loading? Link to comment Share on other sites More sharing options...
NodsDorf Posted June 8, 2012 Author Share Posted June 8, 2012 Nevermind I just moved the div to the bottom of the page so it doesn't flash at the user. The product listing takes a second or so to completely populate having it at the bottom doesn't effect the click function so the page now looks smooth. Thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.