Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript" charset="utf-8">
- jQuery(function($) {
- var open_price_field_class = "variation-enter-your-price"; //If you change your field name, put the new class here
- var product_id = <?php echo $product['id']; ?>;
- var default_price = $("#fs_price_" + product_id).val(); // set to nothing if you don't want default price
- //Add a x: to the front of the open price field so it doesn't show up in cart as a product attribute
- $("#foxyshop_product_form_" + product_id + " input." + open_price_field_class)
- .attr("name", "x:" + $("#foxyshop_product_form_" + product_id + " input." + open_price_field_class)
- .attr("name")).val(default_price);
- //Hide Display Price
- if ($("#foxyshop_product_form_" + product_id + " input." + open_price_field_class).length > 0) {
- $("#foxyshop_product_form_" + product_id + " .foxyshop_price").hide();
- $("#fs_price_" + product_id + "").attr("name", "price<?php echo foxyshop_get_verification('price', '--OPEN--'); ?>");
- //$("#fs_price_" + product_id).val(""); //Uncomment line if you want to set default price to nothing
- }
- //Runs every time a key is pressed in the open price field
- $("#foxyshop_product_form_" + product_id + " input." + open_price_field_class).keyup(function() {
- //Set the new price in the hidden form field
- $("#fs_price_" + product_id + "").val($(this).val());
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement