Closed (outdated)
Project:
Commerce Product Bundle
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
21 Oct 2011 at 21:16 UTC
Updated:
14 Dec 2021 at 06:55 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
olafkarsten commentedOkay, first of all - thanks for the work. At least I will test the patch - IF ...
I know the module code is not really in good shape (intendation, comments, ... such things). But we shouldn't make it worse. Your Patch is really bad formatted. It contains dozen of dozens lines of code that doesn't change anything. Often, simply the format is changed (intendation/whitespace), not to it's best. That makes it hard to read and follow the real code changes.
Please use a actual dev version of the code, put in your changes - and only them. Don't copy and paste, move around any other code and create the patch again. Then we will test it. Please don't be disappointed and do not give up now. This is not personal. We appreciate your work.
Comment #2
olafkarsten commentedI've tried to guess what the patch should do. I stumbled here - __field_bundle_courses ?? - I guess this snippet is left from your specific use case?
I read your initial post again, and I doubt whether I understand your point. The bundle module is all about "one add to cart click" for all the subproducts in the bundle. So I don't really get it. Can you help me with that?
Comment #3
Smoocher commentedsame problem!
You have any solution?
Comment #4
ASupinski commentedSorry for the delay in my response, I wasn't online this weekend. As you have found I added the block of code you have indicated above above and put a lot of your existing code into an else block (thus changing the indentation on all of it). The purpose of this block is that it prepares the FormState on submission of this form to work with your existing submit handler and actually add all of the sub line items at once (the first foreach in commerce_product_bundle_add_to_cart_form_submit doesn't care what the id is so I just used the product_id). The only other real changes were to add the new field formatter setting and a small block of code that I added into both commerce_product_bundle_add_to_cart and commerce_product_bundle_update_cart to default to using the passed in quantity when the sub line items quantity is not specified.
I had thought I had the formatting correct earlier but here is my second attempt.
Comment #5
olafkarsten commentedNice, this one is better. Thanks! And delay? Hey, its weekend and we have to live? Congrat for a offline weekend!!!
But now have a closer look. The patch contains a part for commerce_product_bundle.rules_defaults.inc. Did you see it? It doesn't change anything. So we have to remove it from this patch. The first part now is much better readable. So I see you want to change the display formatter settings. It's fine, but that's all. After applying this patch, we will have a setting in the display formatter. But this setting actually changes nothing. The patch lacks the corresponding change in the add to cart form. (Maybe Validation/Submit functions?)
I'm afraid we need another one. And BTW, it is okay to change intendation of bigger code blocks if you insert a loop or something. But there shouldn't be tens of ... removing/add of empty rows oder removing/adding identical blocks of codes. This results in +/- lines and code blocks that change nothing, but make the patch unreadable. Compare your both patches and you will see what I mean.
Comment #6
ASupinski commentedOk, I think that I have this one cleaned up, I'm not sure how I managed to lose a bunch of my changes on the last one but third times the charm. I manually removed the indentation changes from my file to make the patch more readable... there has to be a better way, isn't there?
Thanks for your patience.
Comment #7
olafkarsten commented["{$parent_product_id}__field_bundle_courses"]this wouldn't work in general, right? You can use $id here, as we even build that in the form function some lines above.As a result a I got an add to cart form with some empty fieldsets - without the products. I'm not sure how it should look. Did you have a screenshot of you product display?
BTW: You really should test your patches on a clean install before posting in the issue queue. Otherwise it can easily happen that such "specific" code slips through. I know it costs some time, but for now its mine ;)
Comment #8
ASupinski commentedThat syntax should work just fine, see http://www.php.net/manual/en/language.types.string.php#language.types.st... under "Complex (curly) syntax"
The result should be a very simple add to cart form with no displayed drop down of products that adds all of the products in the bundle to the cart (as sub_line_items) on submission.
Sorry if I left any issues.
Comment #9
olafkarsten commented__field_bundle_coursesit is more that part, I guess courses are your specific bundle. :)Comment #10
ASupinski commentedWow I took that the wrong way! Sorry I seem to be a victim of my own automation, I can have a replica of my site running locally easily but getting a clean Drupal install for testing pure Module updates seems to need some work on my system (really I just need to get better at Simpletest) Anyway I hope this is the last of my stupid mistakes!
Comment #11
essbee commentedI'm a big fan of this patch.
Makes for a very simple bundle that will handle a lot of site's basic requirements - that is bundling a number of unique products together into the cart.
One thing to note, is that you need to have "Display the options in a fieldset." disabled otherwise you end up with an erroneous fieldset. Might be worth checking for this in the fwidget form, disabling the checkbox when the Simple Group is selected.
I'll post any further things I see in testing with this patch implemented.
Comment #12
olafkarsten commentedOkay, I does a test and I'm sure this patch isn't something I would check in, before some substantial testing. Beside the problem in #11 I've noted some others. If you put more than one reference field in the bundle product type and use different settings, you didn't get a working add to cart form anymore - the calculation rules seems broken, the form looks not useful anymore ...
If we want a simple variant like this, than we have to make sure that it works with all possible combinations of settings OR we have to prevent, that a user can choose settings that breaks the site.
Comment #13
essbee commentedPatch rerolled against latest (Jan 6th) dev .
I also fixed the indentation on the if statement. This makes the patch much longer purely because of the huge block requiring indentation.
Comment #14
olafkarsten commentedThanks essbee for your work.
The patch needs some work before we can consider it.
1) we have the issue, essbee mentioned in #11
2) If you have more than one product reference field in the bundle, and not all reference fields use the "simple grouping", the add to cart form crashes.
3) If you have more than one product reference field, all of them using "simple grouping", I get different prices in the add to cart form and the cart.
I have stopped than ...
Comment #15
mediapal commentedIs the SimpleGroupBundle working with commerce file ?
Comment #16
olafkarsten commentedClosing. No development for D7 anymore.