News:

Support the VirtueMart project and become a member

Main Menu

What bugs do you know of in stockable variants plugin

Started by OpenGlobal, May 24, 2012, 14:36:59 PM

Previous topic - Next topic

Spiros Petrakis

Quote from: vanekmichal on December 22, 2012, 22:26:49 PM
Hi,

I still have a problem with sorting a list in firefox.

In Firefox menu is not sorted correctly. (img)

http://www.tisknemekvalitne.cz/tiskneme2/index.php/letaky

Hi i have the same problem with sorting but on all browsers, even if i change the order of child's in parent nothing happens. This is big problem because it is very confusing for the clients to see the sizes out of order.
Joomla templates and extensions development
https://www.yourgeek.gr

bjc

Quote from: ouno.ujes on May 06, 2013, 23:33:07 PM
Quote from: OpenGlobal on March 18, 2013, 13:40:12 PM
Sorry, I've been out of the loop for a while with heavy work commitments but I've been able to reproduce this problem intermittently and I'm hoping to be able to work on a fix in the next few weeks.

OpenGlobal

I have the same problem. I noticed that if I refresh the page (F5 key), the price of the selected (first) variant appears. But you can't expect the user to do think of that. So I'm looking forward to the fix, too.  :)

Ouno

Has anyone found a solution to this? I suspect it's probably not a complicated bug but the code's a bit over my head.

Brad

sukhrob

Quote from: bjc on May 25, 2013, 08:30:46 AM
Quote from: ouno.ujes on May 06, 2013, 23:33:07 PM
Quote from: OpenGlobal on March 18, 2013, 13:40:12 PM
Sorry, I've been out of the loop for a while with heavy work commitments but I've been able to reproduce this problem intermittently and I'm hoping to be able to work on a fix in the next few weeks.

OpenGlobal

I have the same problem. I noticed that if I refresh the page (F5 key), the price of the selected (first) variant appears. But you can't expect the user to do think of that. So I'm looking forward to the fix, too.  :)

Ouno

Has anyone found a solution to this? I suspect it's probably not a complicated bug but the code's a bit over my head.

Brad

Nope, still waiting for the solution... All hope is in the hands of OpenGlobal :D

Florentp

Hello everybody.

Since I decided to use Vm2 for the website of the company I work for in August 2012 (So one year ago),
Stockable variants plugin doesn't work fine. There is still issues that makes my company loosing money.

One easy problem to understand :
When you use stockable variants plugin, your customers can buy you more than you have in stock.
If stock is 5 for example, client can't put more than 5 in cart. That's okay.
But he can add 5, then add 5 again.. And finally buy from you 20 when you just have 5.

Last week, we put online a product that customers was waiting for more than 5 months. (a very wanted shoe model)
During 5 months, we promoted it all over the web. We did advertising on google... Was pretty huge.
So when it was available, we sold out all our stock in less than 20 minutes.
But we had as final stock : -18. So, it's easy to understand. Some people bought more than we had in stock.
Every shoes are sold 70€. 70 x 18 = 1260€

We had to refund for 1260€, and to pay for the refund bank fees.

This is not the first time the problem occur, this happend every week (but often it's just a -1 just because customer added 2 times a product we had only 1 in stock).


I love Virtuemart (i started to use it when i was 16 years old, now i'm 23...) but it becomes difficult to explain to my boss why a simple function
as "stock gestion for each size of cloth/shoe" doesn't work fine ! I mean... This is a basic function. Every online shop selling clothing must be abble to have stock gestion for every sizes.
Ok we have it, but this is still not working as expected after one year using Virtuemart. My boss don't understand. And i don't know what to say him.
Some may say "Ok dude, but Virtuemart is a non-commercial project, peoples work on it when they have time...". This is not the problem.
The problem is that we all want to defend Virtuemart. I'm pretty sure that most of us love and believe on it. Actually, i'm so respectfull for the work done here...
Some of people from the Virtuemart team are professional model to me (and they'll recognize themself ^^).
But how can we defend Virtuemart VS other free solutions, well highlighted.
I want to defend Virtuemart, but it gets very complicated.
Web programmer. Passionate.
PHP, SQL, Javascript, JQuery, css.
Skype : florent.indienboutique

bjc

Quote from: sukhrob on May 25, 2013, 12:21:52 PM
Quote from: bjc on May 25, 2013, 08:30:46 AM
Quote from: ouno.ujes on May 06, 2013, 23:33:07 PM
Quote from: OpenGlobal on March 18, 2013, 13:40:12 PM
Sorry, I've been out of the loop for a while with heavy work commitments but I've been able to reproduce this problem intermittently and I'm hoping to be able to work on a fix in the next few weeks.

OpenGlobal

I have the same problem. I noticed that if I refresh the page (F5 key), the price of the selected (first) variant appears. But you can't expect the user to do think of that. So I'm looking forward to the fix, too.  :)

Ouno

Has anyone found a solution to this? I suspect it's probably not a complicated bug but the code's a bit over my head.

Brad

Nope, still waiting for the solution... All hope is in the hands of OpenGlobal :D

Really hoping someone has found a solution, or could recommend other options.

OpenGlobal

I've managed to find something in the code where jquery isn't unbinding events from some of the dropdowns. No idea why. We might make some changes to the way VirtueMart works in the area so that we can work around this.

OpenGlobal E-commerce

bjc

Quote from: OpenGlobal on July 08, 2013, 15:45:23 PM
I've managed to find something in the code where jquery isn't unbinding events from some of the dropdowns. No idea why. We might make some changes to the way VirtueMart works in the area so that we can work around this.

OpenGlobal E-commerce

I assume you're referring to the incorrect price that shows when the product page is first loaded. I can imagine it's hard to work on something that's intermittent. Would be happy to help test if it makes life easier :)

OpenGlobal

I have a possible workaround for those people experiencing the problem with the prices being updated incorrectly. This is a bit of a hack to workaround jquery not doing what it is told.

/components/com_virtuemart/asses/js/vmprices.js (line 95):


select = cart.find('select'),


Change this to:


select = cart.find('select:not(.attribute_list)'),


I'm still trying to ascertain if this is the error. It seems to have stopped the problems on my test system, so if you try this, please let me know if it does or doesn't work for you.

OpenGlobal E-commerce

OpenGlobal

For those who also want to prevent users from adding more items than you have in stock to their cart (by clicking the Add to Cart button multiple times), change the plgVmOnAddToCart() function in stockable.php (near the end of the file) to the following:


public function plgVmOnAddToCart(&$product){
$customPlugin = JRequest::getVar('customPlugin',0);

if ($customPlugin) {
$db = JFactory::getDBO();
$query = 'SELECT  C.* , field.*
FROM `#__virtuemart_customs` AS C
LEFT JOIN `#__virtuemart_product_customfields` AS field ON C.`virtuemart_custom_id` = field.`virtuemart_custom_id`
WHERE `virtuemart_product_id` =' . $product->virtuemart_product_id.' and `custom_element`="'.$this->_name.'"';
$query .=' and is_cart_attribute = 1';
$db->setQuery($query);
$productCustomsPrice = $db->loadObject();
if (!$productCustomsPrice) return null;
// if ( !in_array($this->_name,$customPlugin[$productCustomsPrice->virtuemart_custom_id]) ) return false;
$selected = $customPlugin[$productCustomsPrice->virtuemart_customfield_id]['stockable']['child_id'];

if (!$child = $this->plgVmCalculateCustomVariant($product, $productCustomsPrice,$selected) ) return false;
if ($child->product_sku)
$product->product_sku = $child->product_sku;
if ($child->product_name)
$product->product_name = $child->product_name;
$product->product_in_stock = $child->product_in_stock;

$this->stockhandle = VmConfig::get('stockhandle','none');
if ('disableit' == $this->stockhandle || 'disableit_children' == $this->stockhandle || 'disableadd' == $this->stockhandle) {
if (!class_exists ('VirtueMartCart')) {
require(JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php');
}
$cart = VirtueMartCart::getCart ();print_r($product);print_r($cart);

$orderedQuantity = $product->quantity;
foreach ($cart->products as $cartProduct) {
if ($cartProduct->virtuemart_product_id == $product->virtuemart_product_id) {
$orderedQuantity += $cartProduct->quantity;
if ($orderedQuantity > $product->product_in_stock) {
return false;
}
}
}
}
}
}


This seems to work for me.

OpenGlobal E-commerce

bjc

Quote from: OpenGlobal on July 19, 2013, 17:37:20 PM
I have a possible workaround for those people experiencing the problem with the prices being updated incorrectly. This is a bit of a hack to workaround jquery not doing what it is told.

/components/com_virtuemart/asses/js/vmprices.js (line 95):


select = cart.find('select'),


Change this to:


select = cart.find('select:not(.attribute_list)'),


I'm still trying to ascertain if this is the error. It seems to have stopped the problems on my test system, so if you try this, please let me know if it does or doesn't work for you.

OpenGlobal E-commerce

Thank you so much or working on this. Unfortunately, the error still exists for me. Interestingly though, that code is on line 108 for me, not 95. Could you have a different version of vmprices.js than I do? I'm using VM 2.0.22a

OpenGlobal

#250
I have attached a zip file containing the latest fixes to the stockable.php and vmprices.js. Extract the zip file and move stockable.php to plugins/vmcustom/stockable and move vmprices to components/com_virtuemart/assets/js and overwrite the files which are already there. These files are based on the 2.0.22a versions of those files.

This contains the fix for being able to add more products than are in stock by repeatedly clicking the Add to Cart button and (hopefully) the fix for the price display problems.

I'd appreciate any feedback on this before it goes into the next release.

OpenGlobal E-commerce

[attachment cleanup by admin]

bjc

Quote from: OpenGlobal on July 22, 2013, 22:18:05 PM
I have attached a zip file containing the latest fixes to the stockable.php and vmprices.js. Extract the zip file and move stockable.php to plugins/vmcustom/stockable and move vmprices to components/com_virtuemart/assets/js and overwrite the files which are already there. These files are based on the 2.0.22a versions of those files.

This contains the fix for being able to add more products than are in stock by repeatedly clicking the Add to Cart button and (hopefully) the fix for the price display problems.

I'd appreciate any feedback on this before it goes into the next release.

OpenGlobal E-commerce

Pricing: I've only got stockable products, but this seems to be working flawlessly on my Mac with Firefox, Chrome and Safari. You're a rockstar OpenGlobal!

klubb

I have a question about performance issue in stockable plugin. I setting up one parent product and 8 child products. While testing locally I have observed that changing (more then 5-10 times) child in dropdown list can slowdown response from server and  whole pc.

Situation: when page open one or two queries goes on, after each change of the option stockable plugin generates increased  quantity of queries – 1 – 2 – 3 -4 – 5 and so on ,so if you change dropdown selection many times you can slowdown response from server and even get flooding 403 response.
You can check this on this site http://www.flexiblewebdesign.com/virtuemart-2-template-puremart/index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=39&virtuemart_category_id=2&Itemid=475 (it's not my page but behavior is the same) it's  clearly seen if you try to change first and second dropdown list 5-10 times.

On my page I try to change dropdown list selection by click additional image through the jquery and I call change function – as a result the situation with "a lot of queries" happen very quickly. I think it happen because of recalculation, but I don't know how to deal with this.

OpenGlobal

I've only had a very brief look at this so far, but the first thing that strikes me is the error when loading the page:

TypeError: selectBox is null   
selectBox.removeAttribute('onchange');

in productUpdater.js (line 128)

I suspect that something else is interfering with the select change events.

OpenGlobal E-commerce

klubb

Hi, you can test this on my test-page http://temptutest.mywebcommunity.org/magazin/kosmetika/s-b/s-b-hi-def-39-detail. This version has not modified stockable plugin and you can watch in the console what I mean.