Josh Journey Posted June 10, 2025 at 02:15 AM Share Posted June 10, 2025 at 02:15 AM You'll need to create filter_functions.php and will need to modify the switch statement for your categories/related listings. Clickfwd\Hook\Filter::add('listing_save_pre', function($data, $params) { if (! $params['is_new']) { return $data; } else { // Get the category $category = $data["Listing"]["catid"]; switch ($category) { case "18": // Alaska $data["Field"]["Listing"]["jr_location"][0] = "172"; // North America $data["Field"]["Listing"]["jr_location"][1] = "171"; // United States $data["Field"]["Listing"]["jr_location"][2] = "47"; // Alaska break; case "21": // Alberta $data["Field"]["Listing"]["jr_location"][0] = "172"; // North America $data["Field"]["Listing"]["jr_location"][1] = "1086"; // Canada $data["Field"]["Listing"]["jr_location"][2] = "50"; // Alberta break; //case "": //break; default: return $data; } return $data; } }); Change out each case with the category id you'd like to assign related listing data to. It was helpful to create a master index list so I could quickly copy each id and would write as much code as possible without data such as $data["Field"]["Listing"]["jr_location"][] = "" so that I only had to place in the listing id's and index arrays. Alternatively could keep each full index for each listing followed by leaving the index blank for a quick copy and paste fest. You can do this for other custom fields, default locations such as coordinates. Can easily be done for multi-select variations too. n00bster 1 Link to comment
n00bster Posted June 10, 2025 at 09:20 AM Share Posted June 10, 2025 at 09:20 AM This section is only visible with a valid subscription. If you have a valid subscription, please login. Link to comment
Josh Journey Posted June 10, 2025 at 03:35 PM Author Share Posted June 10, 2025 at 03:35 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. Link to comment
Recommended Posts