Upsell at Checkout

nicolesauknicolesauk Member
in Help edited January 2012
Hello all,

I'm trying to add upsell options to my checkout. I'm following this wiki example: http://wiki.foxycart.com/snippets/misc_cart_and_checkout/product_upselling

Here is my store: http://www.leatherexpressonline.com/newsite/

In the wiki example, it was making it to only show the upsell if nothing was added in a specific category. So I created a warranty category, and thought I changed all the ids correctly, but the upsell still won't show up in my checkout. I know it's pretty advanced javascript, and I'm not incredibly comfortable with it, so it very well might be something very easy I'm just missing. Anyone have any idea what I'm doing wrong?

Thanks so much for the help!
Comments
  • Oops... forgot to show my code: http://pastie.org/3220995
  • fc_adamfc_adam FoxyCart Team
    @nicolesauk,

    That's actually my fault - I had got the example code wrong on the snippet page. Instead of addUpSell it should be showUpSell.

    Sorry for the mixup
  • Ok, I got that fixed. But the upsell still isn't showing for me.
  • fc_adamfc_adam FoxyCart Team
    @nicolesauk,

    A couple things:
    * Firstly, I'd suggest removing the jquery-latest you've included in your checkout template. The cart, checkout and receipt templates automatically include jQuery for you, so you don't need that.
    * I'd also suggest ensuring that in your template all CSS style blocks are included before any javascript blocks or includes.
    * Lastly, you have a little error with your upsell logic, take away the else in the line else if (!hasMerch && total_upsell == 0) { - Sorry I didn't see that earlier.
  • nicolesauknicolesauk Member
    edited January 2012
    @fc_adam

    Ok, I removed the link to jquery-latest, put all my css before my javascript in the head tag, and removed the else. Still not coming up.

    All my code is attached on a pastie here: http://pastie.org/3239187

    Thanks so much again for all your help.
  • fc_adamfc_adam FoxyCart Team
    @nicolesauk,

    I'm really sorry - another bug by my doing (I obviously didn't test this very well!), update your upsell code to this:
    var hasMerch = false;
    for (p in fc_json.products) {
    if (fc_json.products[p].category == "Warranty") {
    hasMerch = true;
    }
    }
    if (!hasMerch && total_upsell == 0) {
    showUpSell("warranty");
    }
  • @fc_adam No worries, it just makes me feel less bad having to ask for help :)

    And that works, perfect. Thanks so much!
  • webmovementllcwebmovementllc Member, Integration Developer, FoxyPress
    If it helps anyone, I wrote an upsell/add ons tutorial for some ways to do it with FoxyPress. http://www.foxy-press.com/blog/2011/12/12/product-add-ons-with-foxypress/
Sign In or Register to comment.