Why aren't Session Variables available in GridMarket, but works fine in SimpleMarket and FrameM

Hi,

I have some PHP code within a MarketPress Product Page which sets a $_SESSION variable for later use (for when clicking on Add to Cart) which works absolutely fine with SimpleMarket and FrameMarket, but it will not work with GridMarket.

Does anyone have any ideas?

The only thing I can think of is that it is a Child Theme which calls PHP Scripts from within other PHP Scripts. Is this a common thing for not being able to access $_SESSION variables under this circumstance?

Regards,
Chrystopher

  • MELONPUP

    Hi Jack,

    Thank you for your reply, I am just using session start, not a database/cookie.

    The current process is that a customer fills in some form fields on a Standard WordPress Page, which when submitted, sends the data to the MarketPress Store Page which has the PHP inside it to display those values back to the Customer along with a Custom Calculated Price.

    This step works fine with SimpleMarket, FrameMarket and GridMarket.

    The custom code, adapted from Sean Johnson's script from on here, hooks in to MarketPress, so that if a $_SESSION variable is set, then it will kick in and Duplicate the Product, changes the Title, Description and Price and returns the New Product ID when you click on Add to Cart.

    This works in SimpleMarket and FrameMarket, but there are issues with GridMarket.

    It duplicates the product ok and adds it to the cart, so it must be seeing the $_SESSION, it changes the Title (but not with the values from the $_SESSION), it then runs through the new product and changes the Description field.

    So in principle, it looks like it is working, but without any of the custom data contained within the $_SESSION variables (two of them, one for Title, one for Price).

    Any ideas why this one Theme would be different, or maybe something to do with PHP Echo of the mp_product_data() ?

    Or any other suggestions on how to pass the values through through a different method maybe?

    Regards,
    Chrystopher

  • MELONPUP

    Hi,

    I'm still battling with this issue, but based on a process of elimination I have narrowed it down to the GridMarket header.php file.

    Still unsure why this is happening, but at least it's not due to it being a Child Theme, FrameMarket, MarketPress or the Custom Code.

    Any suggestions would be greatly appreciated.

    There is a bit more background in this post and in this post.

    Regards,
    Chrystopher

  • MELONPUP

    Ok, after comparing the HTML of what is outputted by wp_head(), I'm left with the below.

    FrameMarket (which works) has this extra line:

    <link rel='stylesheet' id='framemarket-default-css' href='http://test.acefoam.co.uk/wp-content/themes/framemarket/css/basicstyles.css?ver=1.4' type='text/css' media='all' />

    GridMarket (which does not work) has these extra lines:

    <link href='http://fonts.googleapis.com/css?family=Copse' rel='stylesheet' type='text/css'/>
    		<link href='http://fonts.googleapis.com/css?family=Corben:bold' rel='stylesheet' type='text/css'/>
    			<style type="text/css" media="screen">
    			    #site-logo{ font-family: 'Corben', arial, serif; letter-spacing: 1px; font-weight: normal;}
    				h1, h2, h3, h4, h5, h6{ font-family: 'Copse', arial, serif; letter-spacing: 1px; font-weight: normal;}
    			</style>
    					<style type="text/css" media="screen">
    </style>
  • Alexander

    Hi @SEOSMC,

    If you're having issues with session_start, usually this is because headers have already been sent, and the output has started. Can you try enabling WP_DEBUG mode? To do this, just go to wp-config.php and set WP_DEBUG to true. For example:

    define('WP_DEBUG',true);

    If you'd like to prevent messages from showing to your users, you can enable debug logging. Here's a code snippet to assist with this: http://git.io/gJANNQ

    I suspect you'll see some some warning messages about session_start not being able to work. It should also point you to the line of code where the output began.

    Hopefully this helps! Let me know if you find out anything after checking for errors.

    Best regards,

  • MELONPUP

    Hi Jack and Alexander,

    As it took over a week to receive a reply, I decided to use a different Theme and I am now using Scholar successfully.

    This issue is only happening with GridMarket, so as soon as I get time, I will clone my WP installation and try the Debug to see if it returns anything.

    I will then of course let you know the output, but for now, the website is working with Scholar.

    Regards,
    Chrystopher

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.