Odd output when hashing my product URLs

in Help edited March 2013
Probably a simple fix, but I'm hitting a wall guessing what it is. Here's a screenshot. Any ideas?

http://d.pr/i/aG2d/3u7reLax

Basically, the hash itself is showing up in the colorbox, but otherwise works perfectly in terms of passing the correct info to colorbox, etc.
Tagged:
Comments
  • Here's a sample of my code if it helps to visualize what's happening...
    <?php
    // setup vars
    $upc = get_sub_field('upc');
    $code = $upc;
    $price = get_sub_field('retail_price');
    $lb_test = get_sub_field('lb_test');
    $dia_inch = get_sub_field('dia_inch');
    $length = get_sub_field('length');
    
    // build our purchase button
    $button_url  = 'https://store.mydomain.com/cart?';
    $button_url .= 'code=' . urlencode($upc) . get_verification('code', $upc, $upc) . '&';
    $button_url .= 'name=' . urlencode($product_title) . get_verification('name', $product_title, $upc) . '&';
    $button_url .= 'price=' . urlencode($price) . get_verification('price', $price, $upc) . '&';
    
    // additional attributes
    $button_url .= 'lb_test=' . urlencode($lb_test) . get_verification('lb_test', $lb_test, $upc) . '&';
    $button_url .= 'dia_inch=' . urlencode($dia_inch) . get_verification('dia_inch', $dia_inch, $upc) . '&';
    $button_url .= 'product_length=' . urlencode($length) . get_verification('product_length', $length, $upc);
    ?>
    
  • I think pieces of my code were backwards, as I needed something like this...
    ?name||h98273y4ia7uyw3kuiyw3=blah&
    

    Thing is, I just changed my code to do that (in order to match FoxyCart examples), and while the code looks right, now nothing at all adds to the cart. At least before with the above code, things were being added to the cart...only with hashes. Now nothing goes in.
    <?php
    // setup vars
    $upc = get_sub_field('upc');
    $price = get_sub_field('retail_price');
    $lb_test = get_sub_field('lb_test');
    $dia_inch = get_sub_field('dia_inch');
    $length = get_sub_field('length');
    
    // build our purchase button
    $button_url  = 'https://store.mydomain.com/cart?';
    $button_url .= 'name' . get_verification('name', $product_title, $upc) . '=' . urlencode($product_title) . '&';
    $button_url .= 'code' . get_verification('code', $upc, $upc) . '=' . urlencode($upc) . '&';
    $button_url .= 'price' . get_verification('price', $price, $upc) . '=' . urlencode($price) . '&';
    
    // additional attributes
    $button_url .= 'lb_test' . get_verification('lb_test', $lb_test, $upc) . '=' . urlencode($lb_test) . '&';
    $button_url .= 'dia_inch' . get_verification('dia_inch', $dia_inch, $upc) . '=' . urlencode($dia_inch) . '&';
    $button_url .= 'product_length' . get_verification('product_length', $length, $upc) . '=' . urlencode($length);
    ?>
    
  • fc_adamfc_adam FoxyCart Team
    edited March 2013
    @bcadvertising,

    Could you link me to the store you're experiencing this with? Feel free to whisper if it's private.
  • edited March 2013
    Just enabled, thank you.

    When using the most recently posted code (above), I now see the following:

    http://d.pr/i/Mhxr/2qPs9mRf
  • fc_adamfc_adam FoxyCart Team
    edited April 2017
    @bdcadvertising,

    So now that you have link/form validation enabled, you getting those errors means that either your encryption process isn't set up correctly, or you haven't copied your stores API key properly.

    I tested your add to cart URL you whispered to me in the Sample Code section of your stores administration - and I'm getting a different encryption returned - so I'm going to guess your API key is incorrect. Make sure you copy all of the API key from the input.
  • Unless enabling hmac changed my API key LOL

    I copied it exactly earlier. I'll check that now.
  • Indeed the key changed. Not 100% sure what triggered the change.

    Working perfectly now. Thanks for your quick help, as I'm stuck here late working on this. Much appreciated!
  • fc_adamfc_adam FoxyCart Team
    @bdcadvertising,

    Glad that was all it was :)
  • Me too ;)
Sign In or Register to comment.