Total Posts: 186
Done, just to keep the naming conventions, changed event names:
What are you adding in there?
User submitted sizes…
I have been seeing a great need from people to modify the products somehow, adding every single thing you want to sell as a simple product doesn’t seem to work for some cases, especially manufacturers who make their own stuff. We can make any size of most of our products. One filter in particular, is available from 6 to 74 inches wide, and 6 to 48 inches tall, at any 1/8th inch interval. This is about 182,000 combinations, and that doesn’t include the ability to add “Velcro (r)” pieces to the front, back, or any 4 sides of the filters, that’s 182,000 * 6 * 5 * 4 * 3 * 2 *1, right? 131 million combinations for just 1 product?
So, what I’ve been doing is using some product attributes just as place holders. There’s an attribute called “line_item_details”, that allows user input to be shoved into it, then passed along to the order. The only problems I had were the fact that the sales_quote auto-loads the products in it by product ID and overwrites the customized attributes with fresh blank ones from the DB, and having to change the way the cart compares two products, right now it’s only an if the product id’s match.
What I want to do with the events is make some methods that can read the input from the request and then format/shove the data into the product just before it goes into the cart. This is more desirable than simply modifying the cart with its own attribute, or just saving a customer session variable since it has prefect affinity with the product in question and requires very little code changes. Right now, those small code changes to right into Checkout/controllers/CartController.php, but, I feel that it is a perfect candidate for events, since we’re not actually *changing* the behavior of that controller.
What I would like to see as well is some sort of $salesQuote.isSameAs($product);, so I can override it with my own product/cart logic. getItemByProduct decides if the $product that I’m currently adding is the same as anything already in my cart. But once you start modifying products as they get into the cart, it doesn’t work they way you’d like it to. I know that this is completely not the way that MC is designed to be used, but I think that a lot of people who feel the need to customize MC want to go in this sort of direction. I think modifying product attributes is the way that makes the most sense immediately.