Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter lukem15

    (@lukem15)

    Unfortunately, it didn’t work – no items are removed and the original quantity that was submitted first is added to the total. I think it maybe a problem with AJAX? When I view ?wc-ajax=add_to_cart in developer tools the form data quantity always remains the same value, even tho I’ve inputted a different value and click add to cart.

    The code I posted above did remove the item from the cart, and it added the correct quantity but after the first add the old item quantity was always added (it didn’t change)

    I need so many shortcodes because they’re in table columns

    Thread Starter lukem15

    (@lukem15)

    Sorry to be such a newbie, but where do I add this code? I’ve added to my function.php but didn’t seem to make any difference.

    Here is a link to all my customised files – Click here. My “shop” is a page with multiple [add_to_cart id=”1193″] shortcodes for around 100+ products. The items are added to the cart via AJAX. Hopefully this info will help.

    Thank you very much for your help!

    I’m looking for the same thing, I’m able to set the default value to 0 but the item is still added to cart with a quantity of 1. I’ve tried to fix this issue but had not luck!

    Surely there is a fix?

    Thread Starter lukem15

    (@lukem15)

    I’ve fixed the problem, thanks to your direction.

    Instead of trying to use $_GET or $_POST I’ve added an extra dropdown menu, which contains the users. When search is pressed Ajax grabs it and send it to the query.

    Thank so much for your help Tijmen, do send me your paypal. I will also look forward to the release of 2.0 & premium.

    Thread Starter lukem15

    (@lukem15)

    Thank you for such a speedy reply.

    I’ve changed the location of $tester but the results are not being filtered and is only showing results with the value of 0 – instead of 1.

    When I use $wpdb->last_query it returns /wp-admin/admin-ajax.php?action=store_search&lat=xxxxx&lng=xxxxx&max_results=25&radius=50 – I’m guessing this is where the problem is since myvar is not listed?

    P.S. do you accept donations? I would like to donate to you for your help and your great plugin.

    Thread Starter lukem15

    (@lukem15)

    Thank you Tijmen for you reply. Something like this? – still not working.

    } else {
            $max_results = ( isset( $_GET['max_results'] ) ) ? $_GET['max_results'] : '';
            if ( ( $max_results == 'NaN' ) || ( !$max_results ) ) {
                $max_results = get_default_list_value( $type = 'max_results' );
            }
                    $tester = $_GET['myvar'];
    
            $sql_part = ' WHERE user = %s HAVING distance < %d ORDER BY distance LIMIT 0, %d';
            $placeholders = array(
            $tester,
                $_GET["lat"],
                $_GET["lng"],
                $_GET["lat"],
                $_GET["radius"],
                $max_results
            );  
    
        }
    
        $result = $wpdb->get_results(
                        $wpdb->prepare( "
                                        SELECT *, ( $distance_unit * acos( cos( radians( %s ) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians( %s ) ) + sin( radians( %s ) ) * sin( radians( lat ) ) ) )
                                        AS distance FROM $wpdb->wpsl_stores
                                        $sql_part
                                        ",
                                        $placeholders  
    
                        )
                    );
    Thread Starter lukem15

    (@lukem15)

    I beginning to think this isn’t possible? I’ve been trying to think of ways to make it work but nothing is working correctly.

    I’m guessing there is something overwriting my $_POST – I’ve also tried using $_GET but still doesn’t work.

    Can anyone help please?

    Thread Starter lukem15

    (@lukem15)

    Hi Tijmen, thank you for your reply. I spent all yesterday and today trying to figure this out – it’s driving me crazy! What you suggested works great. However, generally they’re not logged in. Instead I want them to be able to filter the results by clicking a button.

    For example in the default template I’ve added a form with a hidden text field with value 1 and a submit button. If submit is pressed then that will filter all the results with the database value of 1. To filter the results I’ve added a simple modification to wpsl-ajax-functions.php:

    $tester = $_POST['listing-filter'];
    
         SELECT *, ( $distance_unit * acos( cos( radians( %s ) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians( %s ) ) + sin( radians( %s ) ) * sin( radians( lat ) ) ) )
                                        AS distance FROM $wpdb->wpsl_stores       WHERE active = 1 && user = '$tester'
                                        $sql_part
                                        ",
                                        $placeholders

    But this does not work, I cannot figure out why – this is where I’ve spent several hours trying to make this work! I’d highly appreciate your help?

    Thread Starter lukem15

    (@lukem15)

    Thank you for your reply Tijmen. If I was just to put the duration to the store on the info window then would the api still need to make a request for every store? or just the ones that I clicked “more info” on?

    Again thank you for your help with this.

    Thread Starter lukem15

    (@lukem15)

    Hey Tijmen, would you please help me with this or at least guide me in the right direction?

    Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)