Using module with Getlocations - Location taxonomize
After entering [country] with point, island for example "о. Маврикий".
I getting error
Notice: Trying to get property of non-object in _find_term() (line 250
+
Terms creating
na-text
--na-text
Here is fix code:
location_taxonomize.module
- // for all other terms (one parent is assumed):
- elseif (array_pop($parents)->tid == $parentid) $withparent[] = $term;
+ // For all other terms (one parent is assumed).
+ else {
+ $parent = array_pop($parents);
+ // Make sure we actually had a parent before comparing.
+ if (!empty($parent->tid) && $parent->tid == $parentid) {
+ $withparent[] = $term;
+ }
+ }
// taken from part of patch https://www.drupal.org/node/2144313
with addition code for island without country )
function _location_taxonomize_create_term_name($hlevel_name, &$location, &$settings) {
// convert this hlevel_name to an internal primary field name if necessary
$field_name = location_taxonomize_convert_field_name($hlevel_name);
switch ($field_name) {
case 'country':
if (empty($location[$hlevel_name])) {
$name = $settings['na_text'];
}
+ if (empty($location[$hlevel_name]) && !empty($location['country_name']) ) {
+ $name = $location[location_taxonomize_source_field_name('country_name')];
+ }
Hope it will help somebody.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | add-condition-country-name-2749517-2.patch | 1.25 KB | kamalrajsahu21 |
Comments
Comment #2
kamalrajsahu21 commentedHere is the patch for the solution
Comment #3
NIKS_Artreaktor commentedkamalrajsahu21
Thank for the patch, but it not correct enough.
Why lines are deleting?
This lines have to be in code I guess.
---Plus---
add and delete this lines
Comment #4
kamalrajsahu21 commented#NIKS_Artreaktor
Sorry I forgot that code. Now I added that code on patch, also i change if condition to else if
+ elseif (empty($location[$hlevel_name]) && !empty($location['country_name']) ) {
+ $name = $location[location_taxonomize_source_field_name('country_name')];
+ }
thanks
Comment #5
ptmkenny commentedThere's a more complex patch here: #2144313: Notice: Undefined index & Notice: Trying to get property of non-object. Need to decide which to adopt, since they are mutually exclusive.