Created
June 8, 2012 00:05
-
-
Save webaware/2892517 to your computer and use it in GitHub Desktop.
When wp-e-commerce products are shown in an iframe, this will hopefully update the cart widget in the parent page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // example of JavaScript for somewhere on the page | |
| <script> | |
| function myReloadCart() { | |
| form_values = "ajax=true&my_plugin_no_force_load=1" | |
| jQuery.post( 'index.php?wpsc_ajax_action=get_cart', form_values, function(returned_data) { | |
| eval(returned_data); | |
| }); | |
| } | |
| </script> | |
| <?php | |
| // example of hook code for wpsc_alternate_cart_html action hook | |
| function theme_cart_update() { | |
| $my_plugin_no_force_load = isset($_POST['my_plugin_no_force_load']) ? $_POST['my_plugin_no_force_load'] : 0; | |
| if ($my_plugin_no_force_load == 0) | |
| echo "if (window.parent) window.parent.myReloadCart();\n"; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment