Jump to content

Wordpress Widget modification: Pulling my hair out


Namika88

Recommended Posts

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>';
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.