WordPress.org

Ready to get started?Download WordPress

Forums

Jigoshop
Having a custom class object used in the session does not always work. (1 post)

  1. Eli
    Member
    Posted 8 months ago #

    I was help someone troubleshoot a problem with their jigoshop cart that was triggered when they started using one of my plugins. I found the cause of the conflict and fixed it by yielding to your session_start in my code but I thought you should know in case you want to make your code more compatible with other plugins that use sessions.

    Because your cart is storing a custom object in the session your custom class for that object needs to be defined before the session_start command is issued or the object type is unknown and you cannot execute any methods against it. I see you have already tried to fix this once by moving your session_start call to be executed as early as you can. Unfortunately I had done the same thing and my plugin gets included before yours so it broke your card. As I said, I have moved my conditional session_start to be executed after your classes are included and defined so that it works with my plugin installed, but other plugin developers may not be as accommodating.

    The only way for sure that I can see for you to fix this is to store the cart in the session as a simple multi-dimensional array. Then you can read the array into the custom object after it gets declared and write it back to the array in the session after it gets updated.

    I hope you take this as supportive and helpful as I mean it to be. I see that you don't reply to a lot of these forum posts so I'll understand if I don't get a response, but I'm here if you need any more details about this issue.

    Good luck!

    Aloha, Eli

    http://wordpress.org/plugins/jigoshop/

Reply

You must log in to post.

About this Plugin

About this Topic