Namika88 Posted January 12, 2018 Share Posted January 12, 2018 Hi all, i wonder if you can help me. Basically, from the code that im pasting in here, i want to add a separate 'pickup' list, as at the moment it shows the destination list in both the pickup and destination location. If anyone could please help it would be greatly appreciated. Thanks in advance. Adrian $select_destination_options = '<option value="">' . esc_html__('Select pickup location', 'transfers') . '</option>'; $select_destination_options .= Transfers_Plugin_Utils::build_destination_select_recursively(null, $destination1_from_id); $select_pickup_location1 = '<select id="pickup1" name="p1">' . $select_destination_options . '</select>'; $select_destination_options = '<option value="">' . esc_html__('Select drop-off location', 'transfers') . '</option>'; $select_destination_options .= Transfers_Plugin_Utils::build_destination_select_recursively(null, $destination1_to_id, 0, false); $select_drop_off_location1 = '<select id="dropoff1" name="d1">' . $select_destination_options . '</select>'; $select_destination_options = '<option value="">' . esc_html__('Select pickup location', 'transfers') . '</option>'; $select_destination_options .= Transfers_Plugin_Utils::build_destination_select_recursively(null, $destination2_from_id); $select_pickup_location2 = '<select' . ($trip != 2 ? " disabled" : "") . ' id="pickup2" name="p2">' . $select_destination_options . '</select>'; $select_destination_options = '<option value="">' . esc_html__('Select drop-off location', 'transfers') . '</option>'; $select_destination_options .= Transfers_Plugin_Utils::build_destination_select_recursively(null, $destination2_to_id, 0, false); $select_drop_off_location2 = '<select' . ($trip != 2 ? " disabled" : "") . ' id="dropoff2" name="d2">' . $select_destination_options . '</select>'; 1 Quote Link to comment https://forums.phpfreaks.com/topic/306158-wordpress-widget-modification-pulling-my-hair-out/ Share on other sites More sharing options...
gizmola Posted January 12, 2018 Share Posted January 12, 2018 A good start would be to provide information about what App you are using here, and if there is a specific plugin or plugins to that App this code involves, you should explain that as well. Quote Link to comment https://forums.phpfreaks.com/topic/306158-wordpress-widget-modification-pulling-my-hair-out/#findComment-1555276 Share on other sites More sharing options...
Namika88 Posted January 12, 2018 Author Share Posted January 12, 2018 This is for an advanced search tool, i have attached the files that are required (i think) for the search to work, this is a widget done in php. Basically, you select a destination and a pickup point for the relevant day, select how many people are going and search. At the moment both the destination list and pickup list appear in the same sections. see http://lc.compton-computers.co.uk and the 'widget' i am talking about you should beable to identify. Upon asking the author for help, they told me that i would need to edit lines 124 to 138 in the file widget-advanced-search.php which is attached. widget-advanced-search - original.php widget-featured-services.php search javascript file.txt 1 Quote Link to comment https://forums.phpfreaks.com/topic/306158-wordpress-widget-modification-pulling-my-hair-out/#findComment-1555277 Share on other sites More sharing options...
gizmola Posted January 15, 2018 Share Posted January 15, 2018 Where is the code for Transfers_Plugin_Utils? Quote Link to comment https://forums.phpfreaks.com/topic/306158-wordpress-widget-modification-pulling-my-hair-out/#findComment-1555369 Share on other sites More sharing options...
Namika88 Posted January 16, 2018 Author Share Posted January 16, 2018 this one? this was in the transfers folder. plugin_utils.php Quote Link to comment https://forums.phpfreaks.com/topic/306158-wordpress-widget-modification-pulling-my-hair-out/#findComment-1555392 Share on other sites More sharing options...
gizmola Posted January 17, 2018 Share Posted January 17, 2018 In that class the method Transfers_Plugin_Utils::build_destination_select_recursively that builds the list, there is this call: $transfers_destination = new transfers_destination($destination_id); Whatever this transfers_destination class does is what drives the building of the select list. Obviously there is database code in that class that is important to understand if you want to get a different list. Candidly, I have had to intuit a lot of this information by looking at your site, rather than you providing the details needed in your question. You would need to explicitly describe what different information needs to be in the pickup list. Quote Link to comment https://forums.phpfreaks.com/topic/306158-wordpress-widget-modification-pulling-my-hair-out/#findComment-1555437 Share on other sites More sharing options...
Namika88 Posted January 17, 2018 Author Share Posted January 17, 2018 Hi gizmola, Thanks for getting back to me. That is probably why i could not find where or what to edit as suggested by the author. Basically i want 2 separate lists, one with the pickup locations and one with the destinations. At the moment the list that is used shows both pickup locations and destinations in one list. I dont want the destinations to be visible in the pickup locations and dont want the pickup locations to be visible in the destinations list. If necessary i'll email you the entire theme as i dont know what else i can supply you with. Quote Link to comment https://forums.phpfreaks.com/topic/306158-wordpress-widget-modification-pulling-my-hair-out/#findComment-1555442 Share on other sites More sharing options...
gizmola Posted January 17, 2018 Share Posted January 17, 2018 I get the idea, and clearly what drives the list is the parameter that is passed to $select_destination_options .= Transfers_Plugin_Utils::build_destination_select_recursively(null, $destination1_from_id); $destination1_from_id is a parameter that then drives what the build_destination_select_recursively method does. I went into that for you and provided the line above, where the data gets returned through a class: transfers_destination($destination_id); Typically there will be a class named transfers_destination, and the best practice is to put a class into its own file. So you should be looking for transfers_destination.php. I'm going to assume that this package also came with at least one database table, or perhaps a few that are loaded with the data used to populate the lists. You need to understand how the database is being queried in order to understand what the ID is that would be required to make what you want happen. With that said, I'm going to assume that if you have the right database information, all you really need is a different id variable/# to be passed to each dropdown. You also really need to try and understand what is going on, and fix some of this yourself. It seems to me that at this point you could have paid someone for an hour of their time and had this working, and if you aren't really able to follow along, we are fast approaching the point where your problem has no particular value to the world at large. Quote Link to comment https://forums.phpfreaks.com/topic/306158-wordpress-widget-modification-pulling-my-hair-out/#findComment-1555459 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.