Support

Home Forums Event Espresso Premium Error message 'Illegal string offset' when using Price Modifier plugin

Error message 'Illegal string offset' when using Price Modifier plugin

Posted: September 20, 2013 at 3:16 pm

Viewing 22 reply threads


Nick Putman

    September 20, 2013 at 3:16 pm

    Hi,

    I am trying out the Price Modifier plugin so that registrants can add an option to their booking, and I am getting the following error message on the registration page:

    Illegal string offset 'price' in /home/admin/domains/opendialogueapproach.co.uk/public_html/wp-content/plugins/espresso-price-modifier-pr/EE_Price_Modifier.class.php on line 543

    I am using the following text in the Answer Options field: Yes|60.00,No|0

    Any idea what the issue might be?

    Thanks,

    Nick


    Jonathan Wilson

    • Support Staff

    September 20, 2013 at 4:54 pm

    Hi Nick,

    I’m going to test this. What question type are you using? And are you using it with Multiple Event Registration add-on? The Price Modifier doesn’t currently work with MER activated.


    Nick Putman

      September 21, 2013 at 1:23 am

      Hi Jonathan,

      Yes, I am using the MER plugin, so presumably that is the issue. I want to have a way of people being able to add a lunch option to their booking for a seminar.

      Nick


      Dean

      • Support Staff

      September 23, 2013 at 1:49 am

      Hi Nick,

      I actually couldn’t recreate that error, for me it worked on normal registration and simply didnt appear on MER which is correct for as Jon mentioned it isn’t compatible.

      Where is your error showing? What sort of question did you use?

      Also, currently a value of zero (No|0) will not show as an option. We have a ticket in place to tweak that.


      Nick Putman

        September 23, 2013 at 5:06 am

        Hi Dean,

        The error message is appearing below where it says ‘Attendee 1’. Please see the following image:

        http://opendialogueapproach.co.uk/images/Screen%20Shot%202013-09-23%20at%2011.57.12.png

        As you can also see from this screenshot the ‘No’ option isn’t displaying correctly.

        If ‘Yes’ is selected the amount is added to the total, but the display on the next page isn’t quite right. See the following image:

        http://opendialogueapproach.co.uk/public_html/images/Screen%20Shot%202013-09-23%20at%2011.58.15.png

        It says ‘Total Discounts’ and then shows nothing for this, and there is a minus sign before the amount that is being added on (£60).

        Nick


        Nick Putman

          September 23, 2013 at 5:07 am

          Sorry the second link above isn’t quite right. Here is it is again:

          http://opendialogueapproach.co.uk/images/Screen%20Shot%202013-09-23%20at%2011.58.15.png


          Dean

          • Support Staff

          September 23, 2013 at 6:13 am

          Hey,

          Have you got WP_DEBUG turned on?

          It probably isnt showing it due to the fact Price Modifier doesnt work with MER. I’m a little surprised you got it to even discount in the cart.


          Nick Putman

            September 24, 2013 at 7:21 am

            No, WP_DEBUG is not turned on. Any chance of getting Price Modifier to work with MER? Alternatively is there a way of turning off MER just for one event? Finally, if I can’t get the Price Modifier working, I am presuming the only way is to use MER and offer two rates for the events, one which includes lunch and one which doesn’t. Correct?


            Sidney Harrell

            • Support Staff

            September 24, 2013 at 10:49 am

            You can turn off the cart link for a single event by modifying templates/event_list_display.php on line 151 to:

            echo isset($cart_link) && $externalURL == '' && $event_id != 42 ? $cart_link : '';

            You would put in your event id instead of the 42 above.


            Nick Putman

              September 27, 2013 at 2:33 pm

              OK, I tested without the MER plugin activated and got the following error on the registration page:

              Warning: Illegal string offset ‘price’ in /home/admin/domains/opendialogueapproach.co.uk/public_html/wp-content/plugins/espresso-price-modifier-pr/EE_Price_Modifier.class.php on line 543

              Again, the additional price was added to the total OK.


              Josh

                September 27, 2013 at 2:46 pm

                Hi Nick,

                I checked the response headers on your website and they reveal that your server is running PHP version 5.4.14. I see similar errors when I run Event Espresso on my server that has PHP 5.4.

                It’s likely that your server has error_display set to On. A production server should never have this set to on. It should be set to off.

                While we do report error notices and warnings when testing with PHP 5.4 and will eventually fix them, Event Espresso isn’t officially supporting PHP 5.4 yet, so errors like the ones you are seeing may come up from time to time.

                You can add a line to your WordPress installation’s wp-config.php file that will make it so errors do not display on the website. Right after the line that sets WP_DEBUG to true you can add:

                @ini_set( 'display_errors', 'Off' );

                Most servers will let WP change the error display setting on the fly with the above line of code. If yours does not, you can contact your host and tell them your website is in production and need to have error_display set to off.


                Nick Putman

                  September 27, 2013 at 3:05 pm

                  Thanks Josh. WP_DEBUG is set to false for some reason in my wp-config.php, but nevertheless adding

                  @ini_set( 'display_errors', 'Off' );

                  got rid of the error message – so it would appear that I have the Price Modifier plugin working with the MER plugin.

                  Whether I am using the MER plugin or not though there are still issues:

                  1. The issue that you are aware of – in the dropdown menu, the option ‘No|0’ is displayed as ‘0’, when I would like it to display ‘No’. Would it be possible to fix this soon? I am hoping to use this feature with an event that needs to go live for bookings next week.

                  2. The question that is linked to the modifier is not being displayed for additional attendees.


                  Sidney Harrell

                  • Support Staff

                  September 27, 2013 at 3:18 pm

                  looks like one of the items is a string instead of being an array like it’s supposed to be. can you uncomment the debug line on line 526?


                  Nick Putman

                    September 27, 2013 at 3:24 pm

                    Hi Sidney,

                    I have done that, and now see:

                    <code>$items  
                    /home/admin/domains/opendialogueapproach.co.uk/public_html/wp-content/plugins/espresso-price-modifier-pr/EE_Price_Modifier.class.php
                    line no: 526
                    
                    Array
                    (
                        [Yes] =&gt; Array
                            (
                                [price] =&gt; 60.00
                            )
                    
                        [0] =&gt; No
                    )
                    1</code>


                    Nick Putman

                      September 27, 2013 at 3:25 pm

                      => is actually displayed as =>


                      Nick Putman

                        September 27, 2013 at 3:26 pm

                        or I should say => is displayed as =>


                        Josh

                          September 27, 2013 at 3:37 pm

                          Hi Nick,

                          I’ll follow up with your two questions:

                          1. The issue that you are aware of – in the dropdown menu, the option ‘No|0? is displayed as ’0?, when I would like it to display ‘No’. Would it be possible to fix this soon? I am hoping to use this feature with an event that needs to go live for bookings next week.

                          The price modifier was not intended to be used with 0 options and it’s not likely it will be changed to work with 0 options any time soon.

                          2. The question that is linked to the modifier is not being displayed for additional attendees.

                          This was fixed in Event Espresso 3.1.35.P If you upgrade the modifier questions will work for addtional attendees.


                          Nick Putman

                            September 27, 2013 at 3:49 pm

                            Thanks Josh

                            1. I would have thought that 0 would have been a popular option. Essentially I am trying to just add an option for attendees to pay for catering at an event, i.e. a simple Yes/No option. Perhaps I should use a different method?

                            2. I have updated to the latest version of EE now, and still no modifier questions for additional attendees are showing (I cleared the cache to make sure I was using latest versions).

                            Nick


                            Josh

                              September 27, 2013 at 4:26 pm

                              Hi Nick,

                              Yes you can try a different way to ask the price modifier questions that do not involve giving a zero option.

                              The Price Modifier was built for one client according to their specifications and it was agreed to be open sourced and distributed as a free add-on. They didn’t need a zero price option, so that is the way it was built.

                              With the additional attendee questions not showing, please be sure that the “Full Registration Information” option is selected in Event Options where it asks “Additional Attendee Registration info?” After that, you will also need to check the boxes for the Question Groups that have the price modifier questions under “Event Questions for Additional Attendees”.


                              Nick Putman

                                September 27, 2013 at 4:43 pm

                                Thanks again Josh.

                                1. There doesn’t seem to be a suitable workaround for this, as far as I can tell. I could use a checkbox and make the question not required, so that if they don’t opt in an error isn’t generated, but would rather the user has to choose ‘Yes’ or ‘No’ – i.e. I don’t want them to miss this option.

                                2. Yes, I wasn’t using the “Full Registration Information” option. I am now, and this is working.

                                One further issue is that the additional amount added if the catering option is selected is shown as a minus amount on the Payment page:

                                http://opendialogueapproach.co.uk/images/Screen%20Shot%202013-09-27%20at%2023.41.47.png


                                Josh

                                  September 27, 2013 at 5:21 pm

                                  Nick,

                                  The price modifier add-on is not compatible with Multi Event Registration. It will only work with the standard (non-cart) registration. The screenshot you posted is from using the cart option.


                                  Nick Putman

                                    September 28, 2013 at 6:44 am

                                    Yes, OK, I get it! It’s just that everything works (when I use the checkbox method) apart from this minor display issue. It would be great if they could be made compatible, and if a drop down menu with a 0 option would work as well. If you could add these to the feature requests I would be grateful.

                                    Thanks,

                                    Nick


                                    Dean

                                    • Support Staff

                                    September 30, 2013 at 5:11 am

                                    Thanks Nick, I’ll make a note of them for you.

                                    Viewing 22 reply threads

                                    The support post ‘Error message 'Illegal string offset' when using Price Modifier plugin’ is closed to new replies.

                                    Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

                                    Event Espresso - Staging Server