Nerloggz Posted August 15, 2014 Share Posted August 15, 2014 (edited) Hey, I'm starting customizing my online japanese shop for a client and I really need a feature which is not included by default : When ordering a menu, the customer would be able to choose a certain amount of free dishes between a few choices (exemple : For a 12$ menu, you can choose one soup and one rice bowl OR two soups, etc...). I've been looking for modules and the closest of what I want is this : http://addons.prestashop.com/en/merchandising-prestashop-modules/442-gift-on-order-add-gifts-to-customer-cart.html Unfortunately, it is still not updated for 1.6 and is quite expensive for what I want to do. I'm open to doing development myself (I'll have to learn it anyway, I can't always rely on paid modules) but I'm just lost. I've been reading the official doc but I just don't get how I can do that. In my mind it would be quite simple : add a input on the product page, get the value of the input, store it in the bdd and then display it in the back-office in the order. But is it harder than I think ? What do I need to learn to achieve that ? Do I need to create a new module, override ? I'm kind of lost I have to say... I don't know where to begin. Thanks to anyone that can help me ! Edited August 23, 2014 by Nerloggz (see edit history) Link to comment Share on other sites More sharing options...
Nerloggz Posted August 19, 2014 Author Share Posted August 19, 2014 No one can help ? I really don't know where to begin... Link to comment Share on other sites More sharing options...
PascalVG Posted August 21, 2014 Share Posted August 21, 2014 Hi Nerloggz, You might want to have a look at 'attributes'. You could make some possible combinations for the meals, like: main product: Spicy chicken. and add the following Attributes: - rice dishes, with maybe values of none, fried rice, steamed rice, bami - soup:, with maybe values of none, chicken soup, vegetable soup or, alternatively, one attribute: side dishes, with al values combined under this attribute Add those attributes to the main product. More info on attributes: http://doc.prestashop.com/display/PS16/Managing+Product+Attributes Not sure if that would work? Give it a thought. Pascal. Link to comment Share on other sites More sharing options...
Nerloggz Posted August 21, 2014 Author Share Posted August 21, 2014 That's a nice idea, though if the user has to choose 8 side dishes, I'm afraid it'll be annoying to have to change all height select boxes... That's why I wanted to do my own development to have in my database : Number of Rice : 2 Number of Salad : 6 Number of Soup : 0 And on the front office it would simply be 3 number input. Thanks for the help ! Link to comment Share on other sites More sharing options...
PascalVG Posted August 22, 2014 Share Posted August 22, 2014 Ner, Can you describe the process in a little more detail? Does the user have the chance to get, say 8, DIFFERENT side dishes if they wanted to, or do you only offer say two or three types, but he/she is allowed to choose more of the same type, up to in total eight 'dishes'? So, if I read you well, there is a problem to limit the number of side dishes the user can choose (in my example, you just offer the amount of drop down boxes equal to the amount of allowed side dishes, but in your case, you should store somewhere the amount allowed, and check the amounts the customer chose already. You could probably still use the attributes, but maybe use values like drop down 1: - no rice - 1 rice - 2 rice - 3 rice etc. and a 2nd drop down with values: - no salad - 1 salad - 2 salads - 3 salads etc. and with some javascript check which onces are chosen. For example,there are 2 side dishes allowed, 1 rice is chosen as side dish 1, then only 'no salad' or '1 salad' is allowed. As the items are fixed, it shouldn't be too difficult to make some javascript that limits the items in the drop down items, depending on the first choice. Only thing left to do is thn add in one of the product detail fields the amount of side dishes allowed. You could add a new field to the database, or 'misuse' a field that you don't use, of maybe add the number as a feature (then it will be mentioned as a feature in the feature list) and get the allowed amount from here to use in the javascript. So in short, I would add some javascript ot the product detail page (themes/<your theme folder>/product.tpl that checks the input of the attributes using the 'onchange' event and that changes the drop down items of the other attribute fields accordingly. Just my thoughts, pascal. Link to comment Share on other sites More sharing options...
Nerloggz Posted August 22, 2014 Author Share Posted August 22, 2014 That's a really nice idea ! I'm going to try that out. Thanks ! Link to comment Share on other sites More sharing options...
Nerloggz Posted August 23, 2014 Author Share Posted August 23, 2014 Worked out really well, thanks a lot ! Just a little summary of what I did in case someone else needs it : - Added three attributes (rice, soup, salad) with values : None, 1, 2, 3, etc... as select input - Added a caracteristic to products which is the number of additionnal dishes allowed - Displayed on the product page the number of dishes allowed, using the above caracteristic - In Jquery, on change of any select, I get the value of the caracteristic and the total value of the selects. Then I compare the two. - If the total is inferior to the dishes allowed, I tell the customer that he can choose more plates by precising the exact number of plates missing (using Jquery to modify content of paragraph). - Same if the total is superior. Thanks for the help, hope this will be useful for anyone else ! Link to comment Share on other sites More sharing options...
PascalVG Posted August 23, 2014 Share Posted August 23, 2014 Sounds perfect! Thanks for the update/summary. Happy selling, pascal Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now