I’m not sure that you’re asking for. Please understand that we cannot provide free support for eShop hacks. Nor can we help you troubleshoot your hacks. We simply don’t have the time. The plugin is free but we have to spend most of our time trying to earn a living.
If you are a coder, all we can suggest is that you refer to the code & its comments.
Thread Starter
Ewout
(@pomegranate)
I’m not asking for support, at all! Just a heads up for this bug… Thinking my contribution to improving this free plugin would be appreciated. I’m not hacking anything but creating a plugin that makes use of the eShop cart data.
I’m not convinced that this is a bug.
What exactly is it that you are trying to do with this new plugin?
Thread Starter
Ewout
(@pomegranate)
Expected scenario would be:
1. Add Product X (€10) to the cart, $_SESSION[‘final_price’] = 10
2. Add Product X (€10) again, $_SESSION[‘final_price’] = 20
2a. browse further, $_SESSION[‘final_price’] = 20
3. Add Product X (€10) again, $_SESSION[‘final_price’] = 30
3a. browse further, $_SESSION[‘final_price’] = 30
4. Add Product Y (€10) again, $_SESSION[‘final_price’] = 40
4a. browse further, $_SESSION[‘final_price’] = 40
5. Add Product Y (€10) again, $_SESSION[‘final_price’] = 50
5a. browse further, $_SESSION[‘final_price’] = 50
currently the following happens (on multiple installs without any previous session issues):
1. Add Product X (€10) to the cart, $_SESSION[‘final_price’] = 10
2. Add Product X (€10) again, $_SESSION[‘final_price’] = 10
2a. browse further, $_SESSION[‘final_price’] = 20
3. Add Product X (€10) again, $_SESSION[‘final_price’] = 10
3a. browse further, $_SESSION[‘final_price’] = 30
4. Add Product Y (€10) again, $_SESSION[‘final_price’] = 20
4a. browse further, $_SESSION[‘final_price’] = 40
5. Add Product Y (€10) again, $_SESSION[‘final_price’] = 20
5a. browse further, $_SESSION[‘final_price’] = 50
as you can see it’s not that the session is not working, it’s just not multplying the quantities. We are extending the functionality of this plugin to eshop: http://wordpress.org/extend/plugins/woocommerce-menu-bar-cart/
You still haven’t told me what you are trying to do with the new plugin.
Thread Starter
Ewout
(@pomegranate)
(it’s in the last line) We are displaying the contents of the cart in a menu.
Thread Starter
Ewout
(@pomegranate)
Thanks! As I said, we have a working solution. I was just pointing out a bug.
if(isset($_SESSION['eshopcart'.$blog_id])) {
$eshopsize=sizeof($_SESSION['eshopcart'.$blog_id]);
foreach($_SESSION['eshopcart'.$blog_id] as $eshopdo=>$eshopwop){
$eshopqty+=$eshopwop['qty'];
}
}
if(isset($_SESSION['final_price'.$blog_id]) && isset($_SESSION['eshopcart'.$blog_id])) {
//should be working but there seems to be an eShop bug in storing the final_price value (doesn't multiply with quantity)
//$thetotal=$_SESSION['final_price'.$blog_id];
$eshopcart = $_SESSION['eshopcart'.$blog_id];
foreach ($eshopcart as $eshopcart_item) {
$thetotal += $eshopcart_item['qty'] * $eshopcart_item['price'];
}
$eshoptotal=sprintf( __('%1$s%2$s','eshop'), $currsymbol, number_format_i18n($thetotal,__('2','eshop')));
}
It’s not a bug. eShop, by design, doesn’t store the totals in the session. It calculates the total value in its code.
Thread Starter
Ewout
(@pomegranate)
ah sorry, I must have misunderstood the function of $_SESSION['final_price']
.
It does contain a value that is the same as the total price. The only moment it doesn’t correspond is the first page after the a product is added to the cart. Browsing further, it always corresponds to the cart totals.