chuntse Posted August 22, 2018 Share Posted August 22, 2018 Hi, All, I am trying to implement to transfer multiple values of checkbox from product option to shopping cart. After I tested, it seems that the core codes of oscommerce only can transfer one value of each option to the shopping cart. I read the general.php, application_top.php and the classes of shopping_cart.php, and I couldn't find the right place. Is there anyone know that? Thanks in advanced. Best regards, chuntse Link to comment Share on other sites More sharing options...
♥Tsimi Posted August 23, 2018 Share Posted August 23, 2018 I think this is one of the bigger cons by osCommerce. Not being able to pass on multiple options_values to the cart sucks when it comes to extending the attributes features. osC never needed such function because it only uses select drop downs to select options which is good but just not enough to cover all shop types especially for clothing stores and PC shops. These days multiple checkbox selections, radio buttons and input fields should have been a standard shop feature 10 years ago. Just another thing osC lags behind other carts. Therefore I am putting a $50 bounty on this. I pay $50 bugs to the person who can code this up. The only condition I have is that it will be shared with the whole community later on. If you out there are up to it speak up. Link to comment Share on other sites More sharing options...
♥Gyakutsuki Posted August 23, 2018 Share Posted August 23, 2018 @chuntse multiple checkbox selections does'nt work Inside products info, the option must be completely rewritten, because you must take in consideration the option is a checkbox or dropdown in function the options But this is the shopping cart where the most of the work must be change (big change), process, shipping (like paypal ....). Also, it's important to understand how osc works with the Db to resolve the problem For 2.4, HPDL has deleted this element, I understand that, the repercussion is too important inside osc. It must be manage by a class because there is a lot of identical code in some files inside osc. Atributes Admin must be rewritten and it's better to include a new concept like the 3.0 or like openCart and inject this element inside the product creation. The system is too old in summary or you must break lot of elements inside osc Regards ----------------------------------------- Loïc Contact me by skype for business Contact me @gyakutsuki for an answer on the forum Link to comment Share on other sites More sharing options...
chuntse Posted August 23, 2018 Author Share Posted August 23, 2018 @Tsimi @Gyakutsuki Thank you for the suggestion. I studied the core codes for three days, and I change something that multiple values can be transfered and displayed on the shopping cart. I have installed many addons to my shop and made the codes of the shop very complicate. Now the values cannot be stored into the table of customers basket attributes. I installed the multiple vendors shipping few days ago, it reported value not match when executing the SQL sentence. Hopefully I can find the resolution. Thank you again. Best regards, chuntse Link to comment Share on other sites More sharing options...
Dan Cole Posted August 24, 2018 Share Posted August 24, 2018 On 8/23/2018 at 12:29 AM, Tsimi said: I pay $50 bugs to the person who can code this up. Those must be pretty big bugs! 😁 Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
♥JcMagpie Posted August 24, 2018 Share Posted August 24, 2018 This is old and will probably need updating but its a good starting point, Product Attributes CheckBox Radio Button selection for product attri £50 Bug's not sure I would get out of bed for that 😁 Link to comment Share on other sites More sharing options...
♥Tsimi Posted August 24, 2018 Share Posted August 24, 2018 @Dan Cole 50 bugs or 50 bucks it's the same depending in which country you live. lol Some consider bugs more valuable than paper. Link to comment Share on other sites More sharing options...
♥JcMagpie Posted August 24, 2018 Share Posted August 24, 2018 It's old but still works 😊 I've not done any testing so don't assume it will work on live shop!! 2 minutes ago, Tsimi said: 50 life bugs in it Not sure what a life bug is but I'm sure someone will go for it.😂 Link to comment Share on other sites More sharing options...
♥Tsimi Posted August 24, 2018 Share Posted August 24, 2018 @JcMagpie Thanks. The checkboxes are not a big issue. The main problem when using checkboxes is you cannot pass on multiple values to the cart. For example in your screenshot let's say you tick the 16MB and 32 MB option and then click on add to cart it will only pass on 1 of those option values and not both. The osCommerce core code won't allow you to pass on multiple option values to the shopping cart. It was never necessary with stock osC features which is the select dropdown which allows you only to select one option value. That is what the TC wants to solve and that is what I am willing to pay for. It shouldn't be a big thing to re-code for an experienced osC coder the question is are 50 bugs/bucks enough? If someone else wants to pool in don't be shy. Link to comment Share on other sites More sharing options...
Dan Cole Posted August 24, 2018 Share Posted August 24, 2018 11 minutes ago, Tsimi said: Some consider bugs more valuable than paper. If they're chocolate coated I'm in. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
♥JcMagpie Posted August 24, 2018 Share Posted August 24, 2018 12 minutes ago, Tsimi said: cart it will only pass on 1 of those option values and not both Ok did not know that, I have never used attributes , I have always just made product with other products, So if machine A has 10 accessory they will all be products which are marked as add to basket with…! The only time I did use attributes was on a machine that came in 5 sizes! But then I had customers wanting size 3 but adding default to basket and then complaining why they had wrong machine delivered 😊 Also the add-on appearers to imply it will work? Or did I read it wrong. If its not possible why have several attributes per product? If only one value at a time can be passed to basket then maybe a script is required to let you go back and pick x option if x is the number of atributes on product? After all its no different to going back to pick another product or am I taking a too simplified approach 🙄 Link to comment Share on other sites More sharing options...
♥JcMagpie Posted August 24, 2018 Share Posted August 24, 2018 3 hours ago, Tsimi said: For example in your screenshot let's say you tick the 16MB and 32 MB option and then click on add to cart it will only pass on 1 of those option values Ok but that is what I would expect. A T shirt is v neck or crew its never going to be both? A PC will be 4mb or 8mb never both? You simply have as many attributes as required to make the product work! If you do need the option of having 4mb and 8mb you just make 2 attributes memory A and memory B? I would think that is a simpler way of achieving multiple inputs that redoing all the code. Link to comment Share on other sites More sharing options...
Dan Cole Posted August 24, 2018 Share Posted August 24, 2018 5 minutes ago, JcMagpie said: A T shirt is v neck or crew its never going to be both? I think he had in mind something like...size 12, color blue, v neck or whatever. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
♥JcMagpie Posted August 24, 2018 Share Posted August 24, 2018 That's what I mean, that's just 3 attributes with or without cost, you can do that. On stock CE I can pick a grphics card with 32mb and deluxe option both get added to cart with product. I set price for both atributes and both were added to total cost. Link to comment Share on other sites More sharing options...
♥JcMagpie Posted August 24, 2018 Share Posted August 24, 2018 Just tested with tick box and works as well. Link to comment Share on other sites More sharing options...
Dan Cole Posted August 24, 2018 Share Posted August 24, 2018 3 minutes ago, JcMagpie said: Just tested with tick box and works as well. Careful...you might end up with a bug! Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
♥JcMagpie Posted August 24, 2018 Share Posted August 24, 2018 😂 that's the last thing i need more life bugs! Link to comment Share on other sites More sharing options...
♥Tsimi Posted August 24, 2018 Share Posted August 24, 2018 Of course the example used above is not ideal. You wouldn't choose 16MB and 32MB RAM it would be one or the other. But what if you have a Pizza store and let's say there is an Option called toppings. Do you wanna create one separate option for each topping? Toppings: - Cheddar cheese - Mozzarella cheese - Olives - Pepper - Salami - Bacon - Bugs and so on... Customers should then be able to tick what ever they want and then all gets added to the cart in one go. What you did is add Option: Memory -> Value: 32 MB and Option: Model -> Value: Deluxe Those are two separate options and values. What needs to work is Option: Memory -> Value: 16MB and 32MB Link to comment Share on other sites More sharing options...
chuntse Posted August 25, 2018 Author Share Posted August 25, 2018 Thanks for all joined the discussion of this topic. Is this multiple selection with checkbox useful or not? I know one multiple selection with checkbox can be divided into few drop down selection menus.but it seems to be not professional. I was trying to add the option types v2 to my shop that I found the checkbox could not get two or more values when submitting the form. At the beginning I thought it was my problem with changing the code of the shop. Then I posted a reply to option type to ask for answer. Now I know it is the problem with the core codes of the oscommerce. chuntse Link to comment Share on other sites More sharing options...
♥JcMagpie Posted August 25, 2018 Share Posted August 25, 2018 8 hours ago, Tsimi said: Do you wanna create one separate option for each topping? 😁 Well that’s just semantics, you get the same results which ever method you choose. Yes I would expect separate attributes, especially as some topping are more expensive that others! Especially if the toppings can be regular or extra. So stock CE can cope with this its just a case of how you want to execute that requirement. If that is what is required then this addon https://apps.oscommerce.com/pVwy0 Picks multiple products and adds them to cart, could possibly use this to work with atributes. I don't know the code for attributes but would imaging you just need to intorduce another loop to go back and add each box one at a time to cart. Many form have tick boxes that all need to be read, Simple PHP code to read a number of tick box's <?php if(isset($_POST['submit'])){ if(!empty($_POST['check_list'])) { // Counting number of checked checkboxes. $checked_count = count($_POST['check_list']); echo "You have selected following ".$checked_count." option(s): <br/>"; // Loop to store and display values of individual checked checkbox. foreach($_POST['check_list'] as $selected) { echo "<p>".$selected ."</p>"; } echo "<br/><b>Note :</b> <span>Similarily, You Can Also Perform CRUD Operations using These Selected Values.</span>"; } else{ echo "<b>Please Select Atleast One Option.</b>"; } } ?> Link to comment Share on other sites More sharing options...
♥JcMagpie Posted August 25, 2018 Share Posted August 25, 2018 Actually I'd be surprised if the loop is not already in the code as it must be being used to check each attribute when a product has more than one. This loop just need to wrap around each attribute as well, if not something this like this should do, $NumOfCheckboxes = //The number of boxes you have on the form. for ($i=1; $i<=$NumOfCheckboxes; $i++) { // If Checkbox nr 1 is checked, insert into cart. } //Show user the cart Link to comment Share on other sites More sharing options...
chuntse Posted August 25, 2018 Author Share Posted August 25, 2018 @JcMagpie Just put [] in the function which generates the checkbox. When click the button of add to cart, the values will pass to the string of the submit. But the values cannot be shown in the shopping cart. You have to change relevant codes to show in the cart and store into the database. That is so far I learned from the study of the codes. chuntse Link to comment Share on other sites More sharing options...
MrPhil Posted August 25, 2018 Share Posted August 25, 2018 For the given example, you would have to have radio buttons so that 16MB or 32MB would be selected, one and only one. Same thing for Premium or Deluxe (is that like eggs now, no longer small/medium/large, but large/jumbo/ginormous? Those poor hens...). A radio button should come with one choice preselected (even though some customers will complain that they weren't given a choice! They simply don't understand what a radio button is -- a constant problem in UI's.). Then if the whole option group is optional (no need to select any of its subchoices), you need a checkbox on the whole thing: Memory [ ] 16MB (*) 32MB ( ) Model [ ] Premium (*) Deluxe( ) In the given example, presumably you would have to choose which memory and which model, so those checkboxes (not the radio buttons) would go away. But there might be attribute groups which can be completely omitted, and those could have a checkbox: Decoration [ ] Trump(tm) gilt edging ( ) silver plate (*) Or is that guilt edging? Of course, there could be a third choice: no decoration ( ), and no checkbox. It's a matter of style, and what layout would be least confusing. Oh, I forgot... the hens which lay ginormous size eggs are now 6 feet tall, armed with sharp, pointy teeth. Link to comment Share on other sites More sharing options...
♥JcMagpie Posted August 25, 2018 Share Posted August 25, 2018 57 minutes ago, chuntse said: But the values cannot be shown in the shopping cart. Yeah I'm clearly missing some key point in this! As I showed the current code works fine! Drop down or tick box is not an issue. If you make 10 attributes and set them as tick boxes you can make 10 selections and all get sent to shopping cart without any issue. If you insist on doing it with just one attribute ( why I just don’t understand) then you need to introduce another loop to read the array. It will simply loop round adding the state of each tick box to the cart one at a time. If it's that important that’s it's all done on one line with one attribute, well that ok too, just post in the commercial section and I'm sure a developer will be happy to price it up for you. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.