Greetings

Got quite issue this moment. When using search form and this is auto booking but bookable unit doesn't show in cart.
First message on booking page:

Notice: Undefined index: und in agres_categories_block_view() (line 1072 of /home/....../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).

Then secondly:
When i make search i got this

Notice: Undefined index: und in agres_categories_block_view() (line 1072 of /home/......../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).
Notice: Undefined index: und in agres_categories_search_result() (line 1224 of /home/......../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).
Notice: Undefined index: und in agres_categories_get_form() (line 242 of /home/......../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).
Warning: Illegal offset type in isset or empty in _agres_categories_form_standard() (line 323 of /home/......../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).
Notice: Undefined index: und in _agres_categories_form_standard() (line 331 of /home/......../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).
Notice: Undefined index: und in _agres_categories_form_standard() (line 331 of /home/......../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).
Notice: Undefined index: und in _agres_categories_form_standard() (line 353 of /home/......../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).
Notice: Undefined index: und in _agres_categories_form_standard() (line 368 of /home/......../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).
Notice: Undefined index: und in _agres_categories_form_standard() (line 376 of /home/......../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).
Notice: Undefined index: und in _agres_categories_form_standard() (line 383 of /home/......../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).
Notice: Undefined index: und in _agres_categories_form_standard() (line 383 of /home/......../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).
Notice: Undefined index: und in _agres_categories_form_standard() (line 410 of /home/......../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).
Notice: Undefined index: und in _agres_categories_form_standard() (line 413 of /home/......../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).

And third i get these addition messages when i choose unit and press booking next button:

Warning: Missing argument 8 for _agres_bookings_reserve_and_fillcart(), called in /home/....../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module on line 579 and defined in _agres_bookings_reserve_and_fillcart() (line 1091 of /home/....../public_html/sites/all/modules/agreservations/agres_bookings/agres_bookings.module).
Notice: Trying to get property of non-object in _agres_bookings_reserve_and_fillcart() (line 1230 of /home/....../public_html/sites/all/modules/agreservations/agres_bookings/agres_bookings.module).
Notice: Undefined index: und in _agres_bookings_reserve_and_fillcart() (line 1237 of /home/....../public_html/sites/all/modules/agreservations/agres_bookings/agres_bookings.module).
Notice: Undefined index: und in _agres_bookings_reserve_and_fillcart() (line 1238 of /home/....../public_html/sites/all/modules/agreservations/agres_bookings/agres_bookings.module).
Warning: array_pop() [function.array-pop]: The argument should be an array in _agres_bookings_reserve_and_fillcart() (line 1252 of /home/....../public_html/sites/all/modules/agreservations/agres_bookings/agres_bookings.module).
Notice: Undefined index: und in _agres_bookings_reserve_and_fillcart() (line 1306 of /home/....../public_html/sites/all/modules/agreservations/agres_bookings/agres_bookings.module).
Notice: Undefined index: und in _agres_bookings_reserve_and_fillcart() (line 1307 of /home/....../public_html/sites/all/modules/agreservations/agres_bookings/agres_bookings.module).
Warning: array_pop() [function.array-pop]: The argument should be an array in _agres_get_products_for_reservation() (line 37 of /home/....../public_html/sites/all/modules/agreservations/agres_rate/agres_rate.module).
Warning: array_flip() [function.array-flip]: The argument should be an array in _agres_get_products_for_reservation() (line 40 of /home/....../public_html/sites/all/modules/agreservations/agres_rate/agres_rate.module).
Warning: Invalid argument supplied for foreach() in _agres_get_products_for_reservation() (line 41 of /home/....../public_html/sites/all/modules/agreservations/agres_rate/agres_rate.module).
Warning: array_count_values() [function.array-count-values]: The argument should be an array in _agres_bookings_reserve_and_fillcart() (line 1355 of /home/....../public_html/sites/all/modules/agreservations/agres_bookings/agres_bookings.module).
Warning: Invalid argument supplied for foreach() in _agres_bookings_reserve_and_fillcart() (line 1356 of /home/....../public_html/sites/all/modules/agreservations/agres_bookings/agres_bookings.module).

Getting littlebit frustrated now. I have reinstalled both ubercart and agreservations many times now also other modules. Is this i18n module related? I have tested also dev version of Agreservation.
Ubercart normal product is working when add cart button is used. Is there some easy fix on this?

Comments

agill’s picture

Notice: Undefined index: und in agres_categories_block_view() (line 1072 of /home/....../public_html/sites/all/modules/agreservations/agres_categories/agres_categories.module).

Hello,
in the version 7.x-2.0-beta2 in the file
agres_categories.module
these are the lines
1070: function agres_categories_block_info() {
1071: static $cats;
1072: $blocks = array();
1073: if (is_null($cats)) {

in the dev version from August 14th the lines are as follows:
1071: $_SESSION['availableunittypes'] = $availableunittypes;
1072:
1073: $userrequest['checkintime'] = $checkintime;

... as you can see the notice "Undefined index: und" can not come from the line 1072 unless you have a different version. There was an issue when using drush to optain a dev version
the version was not the newest version.

agill’s picture

ok forget my last post, i did some seriously stupid programming
regarding multilingual aspect, due to lack of knowledge about the fields api.

until now i was using:

    $langcode = i18n_langcode();
    if (!isset($category->field_agres_titleresform[$langcode])) {
      $langcode = language_default('language');
      if (!isset($category->field_agres_titleresform[$langcode])) {
        $langcode = 'und';
      }
    }

to make sure i get the right language code to access the field data. which is normally working
and on my local installations where i experiment with field level translations it works....but i18n_langcode()
returns only the code for the pages current language...which is not necessarily the fields language.
so the right way to handle this is the following:

$lang = field_language('node', $category, 'field_agres_titleresform' );

or

$valuess = field_get_items('node', $category, 'field_agres_titleresform');

i will have to refactor agreservations using the field_language function.
hopefully i will have a fixed release ready in a couple of days.

juhav75’s picture

Thanks alot for your fast response and help.
I goin to test this soon or gettin newest dev version.

PN1’s picture

Version: 7.x-2.0-beta2 » 7.x-2.0-beta3

Hello AGill,

I am facing the same issue.
Error message:

Notice: Undefined index: und in agres_categories_block_view() (line 1072 of /home/ftponly/usr/gtestujt/web/sites/all/modules/agreservations/agres_categories/agres_categories.module).

Does your advice means?:
Delete code in "sites/all/modules/agreservations/agres_categories/agres_categories.module" from row 1064:

<?php
    $langcode = i18n_langcode();
    if (!isset($category->field_agres_titleresform[$langcode])) {
      $langcode = language_default('language');
      if (!isset($category->field_agres_titleresform[$langcode])) {
        $langcode = 'und';
      }
    }
?>

and use instead:

<?php
$lang = field_language('node', $category, 'field_agres_titleresform' );
?>

or

<?php
$valuess = field_get_items('node', $category, 'field_agres_titleresform');
?>

I tried above steps and haven´t fix the problem.
They cause :
Parse error: syntax error, unexpected T_ELSE in /home/ftponly/usr/gtestujt/web/sites/all/modules/agreservations/agres_categories/agres_categories.module on line 1070

Thanks for reaction in forward.

PN1’s picture

Hello juhav75,

does the code implementation above works on your web. site?
Thank for reply in forward.

nsputnik’s picture

I am getting the same error when clicking Add to Cart on a unit type.