WordPress.org

Ready to get started?Download WordPress

Forums

WP eCommerce
[resolved] [Plugin: WP e-Commerce] Products added to basket without selecting variations (9 posts)

  1. mikeaag
    Member
    Posted 2 years ago #

    Hey There,

    Im developing a site, but ive come into a problem im unable to solve :(

    if a product has a variation, it can be added to the cart with no variation selected. There doesn't seem to be any validation to check to see if a variable is selected.

    With the research ive done, ive found out that the validation is baked into wp e-commerce but for some reason its not being called when i add to cart.

    Here is my wpsc-single_product.php files http://pastebin.com/U2fE7QFg

    After more research, i found the default single product file for wp e-commerce, uploaded that to my server and the variation validation worked like it should do. (default file: http://pastebin.com/vSXiViUT )

    I've looked through both files line by line and nothing obvious stands out to be as being different. The main differences are with layout and styling and 1 piece of custom functionality that i added to handle price on request.

    I would be very grateful if someone could have a look at the files i link to, and let me know where im going wrong. or if anyone knows what the requirements are for the validation to run is.

    Thanks in advance

    Mike

    WordPress Version - 3.3.1

    My Plugins

    Breadcrumb NavXT - 4.0.2
    BWP Google XML Sitemaps - 1.2.0
    Comment Link Manager - 1.1
    FancyBox for WordPress -3.0.1
    Fast Secure Contact Form - 3.1.4.1
    Newsletter - 2.5.2.6
    Relevanssi - 2.9.14 [Currently Deactivated]
    Storefront Insights - 1.1
    W3 Total Cache - 0.9.2.4
    WordPress SEO - 1.1.5 [Currently Deactivated]
    WP-PageNavi - 2.82
    WP e-Commerce - 3.8.7.6.2
    WP E-Commerce Weight & Destination Shipping Modules - 4.4

    http://wordpress.org/extend/plugins/wp-e-commerce/

  2. mikeaag
    Member
    Posted 2 years ago #

    Hey there,

    Im a complete idiot :(

    After looking at the javascript code that handles the validation, i noticed that i had mis-spelled one of the selectors.

    If anyone has this problem in the future, you need to make sure that you have your add to cart button and variation drop downs within a div tag with one of the follow classes - <i>productcol, textcol, product_grid_item, wpsc-add-to-cart-button</i>

    You also need to make sure that your add to cart button has the class <i>wpsc_buy_button</i> and that your variations are held within a div with the class <i>wpsc_select_variation</i>

    As soon as i had these classes, the validation wobbled back into life :D

    Mike

  3. root3labs
    Member
    Posted 2 years ago #

    Mike,

    I'm having a similar problem, except with the "successfully added to cart" pop-up. The validation clearly determines that the Product Options have not been checked because they do a little dance, but it still creates a pop-up that says the item has been successfully added to the cart.

    WordPress 3.3.1
    WP e-Commerce 3.8.7.6.2

    Does your site prevent that pop-up from appearing?

  4. mikeaag
    Member
    Posted 2 years ago #

    Hi root3labs,

    I only get the added to cart message when the the item has had a variation selected.

    If no variation is selected, then the variation field shakes and that's it.

    Are you running any custom JavaScript on the page as well?

    If so, I would remove this, and take the page back to basics as much as possible. Once you get it working correctly, start adding your customisation again one by one, making sure to test at each change.

    I hope this helps,

    Mike

  5. root3labs
    Member
    Posted 2 years ago #

    I have determined that it is theme-related. Changing to the default twenty-eleven theme made it work correctly. So, yes, there's probably custom javascript within the theme, but I'm not familiar enough with it yet to troubleshoot. I've posted something on the theme support forum.

    Thanks.

  6. paulcham
    Member
    Posted 2 years ago #

    I've been having the same problem. I tried turning off all my Javascript and Plugins but it was still happening. Then I noticed a Javascript error on my page:

    Error: jQuery("form.product_form").livequery is not a function

    So I looked up livequery and found that it is a jQuery plugin and can be found here:

    https://github.com/brandonaaron/livequery/downloads

    I dropped it into my site and everything is working now.

    Hope this helps,
    Paul

  7. Paul Phillips
    Member
    Posted 2 years ago #

    Livequery is bundled with WP-eCommerce
    wp-e-commerce/wpsc-admin/js/jquery.livequery.js

    It should be loaded by the WP e-Commerce Plugin if it's working properly.

  8. paulcham
    Member
    Posted 2 years ago #

    Yes, turns out I hadn't properly enqueued my scripts. Rookie move (I know) but, now that they're all squared away, everything works fine.

    Useful link for those who aren't enqueuing their scripts:
    http://wpcandy.com/teaches/how-to-load-scripts-in-wordpress-themes

    -Paul

  9. Brandon Scott
    Member
    Posted 2 years ago #

    Hi guys,

    I'm still a bit new to all this.. and could really do with some help!
    Been doing an e-commerce site, etc.. basically i've sorted out the site now, but having problems with the products page.. i've got the products all in list view, which have an add to cart button at the end of each product, but some of the products have variations.. From the list view you can add the products to cart without selecting the variations, which is causing me a big problem.. it makes you select the variations if you click on the product, and it brings up the product in it's own page etc.. but now through the list view.. Hopefully this makes sense? Any help would really be appreciated!

    Many thanks,
    Brandon

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic