-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After migration to 3.7.2, subscription doesn't work #64
Comments
@sawangupta92 Can someone look at this and respond. |
@mjuneja sure, we will looking into it |
@hardreggaecafe You are working with an older version of this extension. We had upgraded this extension a while back, here is the PR for the same https://github.com/vinsol-spree-contrib/spree_product_subscriptions/pull/58/files. Please try this branch. You will need to do some changes in the "Appraisals" file to accommodate it for Spree 3.7. But there shouldn't be any big challenge there. Please let us know if you get into any other issue. |
@sawangupta92 Oops! I didn't know that. I'll check it later. |
@sawangupta92 I applied what you suggested earlier. Here's the one. |
@hardreggaecafe We have reproduced the issue and unfortunately this extension is only working fine for spree versions up to 3.5. Spree 3.7 is using the latest V2 API for adding the line items to an order, which is not supported in this extension as of now. We do plan to upgrade this extension in the future. Meanwhile, if you have already fixed the issues in upgrades, you can raise a pull request and we will review and merge it. For pointers, you can check the OrdersController in the extension. That should help you in debugging & fixing the issue. |
@sawangupta92 Oh, I knew it. Every time I press 'subscribe' button, spree calls '/api/v2/storefront/cart/add_item' API. I felt bit strange and confused why this could happen in this gem.
|
@hardreggaecafe Yes, this should be the starting point. I think that updating the params[:options] as per the #add_subscription_fields and permitting the params, should be the first step to solve the issue. |
@hardreggaecafe Assuming you haven't figured out the solution yet, I was looking into the fix for this and I could see the spree now uses an ajax request to add an item to cart. You are right in adding the subscription creation logic to "add_item". But you will need to pass the params to add_item action before you use them to actually create Spree::Subscription. The starting point for this will be overwriting the behaviour of "product.js" in "spree_frontend" to allow it to get the subscription form elements and passing them as params to "SpreeAPI.Storefront.addToCart" method which is defined in "cart.js" in spree_api. Once you have the subscription params there you can either pass them to "Spree.routes.api_v2_storefront_cart_add_item"(add_item method of cart controller) or can even create you own action in "app/controllers/spree/api/v2/storefront/cart_controller.rb" to handle this. And then the logic of creation of Spree::Subscription should work fine based on the value you have received in the params. |
@rajneeshsharma9 Thank you for the comment. Actually, I modified add_item and product.js. Also I'm fixing those file you mentioned above. api/v2/storefront/cart_controller.rb
Is it right modification of params? And I can't figure out how to fix this.
I'd appreciate if you give some comment. |
I applied some modifications on my forked brunch. Here's the one. |
Hi @hardreggaecafe! Just bumped into the same issue. So I thought I'd try your branch while I'm at it. However, there seems to be a problem, so I thought I'd might as well drop you a line.. BR Showing ..../spree_product_subscriptions-spree_v3.7/app/views/spree/shared/_taxonomies.html.erb where line #4 raised: My gemfile is
|
I have a question. I modified spree_product_subscriptions for spree 3.7.2 by folking below.
https://github.com/hardreggaecafe/spree_product_subscriptions/tree/migrate_for_3.7.2
Some of feature is working, but when I add subscribed products to cart, subscription doesn't work correctly(see below).
How should I fix this problems? Tell me please.
The text was updated successfully, but these errors were encountered: