I'm sorry Jerome, but this variety of "support" is utterly pointless. If you can help, then help. If you can't, or don't want to, then just say so and we can all move on. It's like when people ask a question on StackOverflow, and other people reply with "But why would you want to do that?! Do this instead!!" While I appreciate that people sometimes ask dumb questions, the real answer to that is often "Because after more careful thought than you have given about the problem, there's a good reason for my question, so either answer the question, or if you have nothing useful to add, don't answer at all."
Instead, you have:
- Told me to read documentation that doesn't help - the docs on the generate function you link to are abysmal. You may as well document it with "look through the various generator methods and try to work it out for yourself".
- Failed to respond to the direct questions I've asked, such as "when is generate() called" and "how is $quantity related to each call"
- Told me to look harder at a piece of example code... well, I did... before I posted my reply. And the code does not help in the slightest. Instead, you're referring to a chunk of "test" code that iterates through product order lines checking to see if the $pack product ID matches the order line product ID. As I've said repeatedly - in my use case - the product order lines are THE SAME product ID, but using different custom field data. Your example only works on *different* product IDs.
- Failed to read my own example code, where I'm doing pretty much what you say about processing the cart data already
- Continue to bang on about using $quantity when I've already shown in tests that this cannot be used unless you can identify explicitly which product line the generate() function is being called against
So - instead of pointing me at terrible documentation and examples that don't do what I need, what would be really helpful would be a quick sketch of some code that /does/ do what I need. For example: Generate a 'serial' from the concatenation of the "order number", one "custom field" and a (quantity) "index".
For an order (A1B2) with the following order lines (where Product A uses our generator) (NOTE Both order lines are the SAME product, but are unique because of the custom field):
Product: A, Qty 2, Custom Field: "ABCD"
Product: A, Qty 3, Custom Field: "EFGH"
So that it generates 5 serials:
A1B2-ABCD-1
A1B2-ABCD-2
A1B2-EFGH-1
A1B2-EFGH-2
A1B2-EFGH-3
Can you provide a bare bones example (just the generate function, no extra fluff) that would accomplish this?
I'm starting to think that the architecture of the serial generator simply doesn't allow for this. <sarcasm>You can find more information about my specific use case in this informative article
en.wikipedia.org/wiki/Cats_and_the_Internet
</sarcasm>
I'm sorry my reply has become so ranty, but what should have been a simple support request has turning into an experience akin to trying to get blood out of a stone.