So i have this site here http://www.taranmarlowjewelry.com and when you first goto the site you will notice that the top right is blank, if you refresh the page the shopping cart appears in the top right corner.
I believe the reason why it doesnt show up when you first goto the site is because a cookie is not set or something.
If I delete cookie name PHPSESSID
with the value fd9lshsp92opvo9aotvoljajj0
(value changes everytime you delete the cookie and create a new one) the shopping cart in the top right corner disappears again.
It seems like the cookie is not being properly...but then again I dont know much about cookies.
How would I set this cookie properly?
I have not idea where PHPSESSID
is set in wordpress, so I cant find the code for it...but here is the code for the shopping cart, not sure if it will do any good.
<div style="float:right;" class="taranShoppingCart"><?php echo wpsc_shopping_cart(); ?></div>
which spits out....
<div class="shoppingcart">
<table style="color:#F69F8E;">
<tfoot>
<tr class="cart-widget-total">
<td class="cart-widget-count" style="text-align:right; padding-right:25px; padding-bottom:5px;" colspan="3">
<a href="?page_id=15">Shopping Bag 6 item(s)</a>
</td>
</tr>
<tr>
<td style="padding-right:15px;">
<a href="?page_id=15">Hello admin</a>
</td>
<td style="padding-right:15px;">
<a href="http://www.taranmarlowjewelry.com/wp-login.php?action=logout&_wpnonce=f26aa87ea3">Logout</a>
</td>
<td>
<div class="live_search_form">
<form class="product_search" action="http://www.taranmarlowjewelry.com/?page_id=14/" method="GET" style="font-size:0px !important;">
<input id="wpsc_search_autocomplete" class="wpsc_product_search wpsc_live_search_embed .wpsc_live_search" style="padding:0px !important; height:25px !important; vertical-align:top;" autocomplete="off" name="product_search">
<script type="text/javascript">
/* <![CDATA[ */
jQuery('#wpsc_search_autocomplete').keypress( function(e){
if ( e.keyCode == 13 ) {
var url = 'http://www.taranmarlowjewelry.com/?page_id=14'+'?product_search='+jQuery(this).val();
url = encodeURI(url);
jQuery(window.location).attr('href', url);
}
});
/* ]]> */
</script>
<input id="button" class="searchBtn" type="submit" value="GO" name="button">
</form>
</div>
</td>
</tr>
</tfoot>
</table>
</div>
Any help would greatly appreciated, thanks for your time.
Thanks, J
I did start writing this as a comment but it got lengthy, so here we go:
What's probably happening is when the user first hits your website the session gets initialised and the cookie created. However the cookie will not be obtained until the refresh as it gets passed with the headers (might be wrong here but I think that's how cookies work). So basically on the first request its not present.
What your code needs to do is catch when the cookie is not present and pass through whatever data it stores in the cookie to whatever triggers the basket display. Then once the cookie is present it can just read the cookie.
As I mentioned I'm not totally sure on the Cookie headers thing, so if someone could confirm when Cookie information is loaded that would be helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With