Author Topic: What bugs do you know of in stockable variants plugin  (Read 167646 times)

OpenGlobal

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 316
    • OpenGlobal E-commerce Web Design in Gloucester
Re: What bugs do you know of in stockable variants plugin
« Reply #315 on: November 02, 2013, 23:41:33 pm »
I'm not seeing it on that site either.

OpenGlobal E-commerce

Limonbay

  • Jr. Member
  • **
  • Posts: 54
  • Piercing life
    • Piercings
Re: What bugs do you know of in stockable variants plugin
« Reply #316 on: November 03, 2013, 19:49:43 pm »
Yes, that's correct. The sign "continue shopping - undefined" just appeared when I used your stockable.php file.

If I use 2.0.24 version as it comes in VM I get this result (not price and adding to cart more than stock) with my template and in joomla template.

So the problem is how to fix this problem or how to get a working stockable.php

Thanks!
Piercings y complementos
http://www.limonbay.com
Joomla 2.5.14
Virtuemart 2.0.24

inu2005

  • Beginner
  • *
  • Posts: 19
Re: What bugs do you know of in stockable variants plugin
« Reply #317 on: November 04, 2013, 01:32:55 am »
When using the stockable variants plugin I don't understand how I can change the sorting order/rearranging of child products in the dropdownbox.
This is a BIG PROBLEM (bug??) and I read a lot of posts from people who are struggling with this issue since more than a year ago and there has never been given a real solution.

Example:
If I have created earlier child products S/M/L in that order and I want to add XS later it will be visible in the dropdownbox like: S/M/L/XS.
It must be possible to rearrange the order to: XS/S/M/L, but I don's see how I can do this.
I see there is a child product ordering option down the Product Information Tab, but that does not seem to change the order in the dropdownbox.
New created child products also seems to be listed randomly. Who can help???

I use Virtuemart 2.0.24 / Joomla 2.5.14

maxispin

  • Jr. Member
  • **
  • Posts: 174
Re: What bugs do you know of in stockable variants plugin
« Reply #318 on: November 04, 2013, 09:57:41 am »
Quote
I thought Your last reply said "Continue shopping - Undefined"

That was if I use stockable.php proposed by OpenGlobal. If I use the original 2.0.24 version it has this price not shown and stock control problem.  :)
Thanks OpenGlobal,

I have changed my stockable.php for yours but the product doesn't get added to the cart and I get a pop up saying "Continue shopping - Undefined" and nothing happens.  :P

ver 2.0.24

479         foreach ($plgParam as $attributes)

OpenGlobal's ver

479         foreach ($plgParam as $k => $attributes)
VM 3.0.17.6 | VM 2.0.24c | VM 1.1.9

maxispin

  • Jr. Member
  • **
  • Posts: 174
Re: What bugs do you know of in stockable variants plugin
« Reply #319 on: November 04, 2013, 10:08:33 am »
When using the stockable variants plugin I don't understand how I can change the sorting order/rearranging of child products in the dropdownbox.
This is a BIG PROBLEM (bug??) and I read a lot of posts from people who are struggling with this issue since more than a year ago and there has never been given a real solution.

Example:
If I have created earlier child products S/M/L in that order and I want to add XS later it will be visible in the dropdownbox like: S/M/L/XS.
It must be possible to rearrange the order to: XS/S/M/L, but I don's see how I can do this.
I see there is a child product ordering option down the Product Information Tab, but that does not seem to change the order in the dropdownbox.
New created child products also seems to be listed randomly. Who can help???

I use Virtuemart 2.0.24 / Joomla 2.5.14

I have also found this problem: http://forum.virtuemart.net/index.php?topic=119846.msg407982#msg407982.

The ordering is missing a function doing that.  Now it seems that the options are ordered based on the id of child.

Thus, the plugins stockable variant with child products is unusable.
VM 3.0.17.6 | VM 2.0.24c | VM 1.1.9

Limonbay

  • Jr. Member
  • **
  • Posts: 54
  • Piercing life
    • Piercings
Re: What bugs do you know of in stockable variants plugin
« Reply #320 on: November 04, 2013, 19:37:37 pm »
Hi Maxispin,

Thanks for your answer.
Code: [Select]
ver 2.0.24

479         foreach ($plgParam as $attributes)

OpenGlobal's ver

479         foreach ($plgParam as $k => $attributes)

Actually both versions gave me toubles and didn't work for me. Excuse my ignorance in php. How should I apply the info you are providing me?

Thanks!
Piercings y complementos
http://www.limonbay.com
Joomla 2.5.14
Virtuemart 2.0.24

inu2005

  • Beginner
  • *
  • Posts: 19
Re: What bugs do you know of in stockable variants plugin
« Reply #321 on: November 05, 2013, 09:32:37 am »
Quote
Thus, the plugins stockable variant with child products is unusable.

That is is BIG SHORTCOMING of Virtuemart to my opinion and a BIG PROBLEM for my website. 
If new options are added and the order is not logical, the only way to change the order is to change/remake all child items (rename, etc.). This is CRAZY !

Isn't there a developer who can can make a function that can reorder the options in the dropdownbox?
I'm willing to pay if that helps.

drukman2000

  • Jr. Member
  • **
  • Posts: 51
Re: What bugs do you know of in stockable variants plugin
« Reply #322 on: November 05, 2013, 11:47:00 am »
Here's how to get weight & dimensions for stockable variants passed into the cart! :)

Open plugins/vmcustom/stockable/stockable.php

REPLACE THIS CODE:

Code: [Select]
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;
}
}

WITH THIS CODE:

Code: [Select]
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;  // Override this even if null.

if ($child->product_weight)    $product->product_weight = $child->product_weight;
if ($child ->product_weight_uom) $product->product_weight_uom = $child->product_weight_uom;
if ($child->product_length) $product->product_length = $child->product_length;
if ($child->product_width) $product->product_width = $child->product_width;
if ($child->product_height) $product->product_height = $child->product_height;
if ($child->product_lwh_uom) $product->product_lwh_uom = $child->product_lwh_uom;
// if ($child->min_order_level) $product->min_order_level = $child->min_order_level;
// if ($child->max_order_level) $product->max_order_level = $child->max_order_level;
}
}


THEN REPLACE THIS CODE:

Code: [Select]
function getValideChild($child_id ) {
$db = JFactory::getDBO();
$q = 'SELECT `product_sku`,`product_name`,`product_in_stock`,`product_ordered`,`product_availability` FROM `#__virtuemart_products` JOIN `#__virtuemart_products_'.VMLANG.'` as l using (`virtuemart_product_id`) WHERE `published`=1 and `virtuemart_product_id` ='.(int)$child_id ;
$db->setQuery($q);
$child = $db->loadObject();
if ($child) {
if ('disableit_children' === $this->stockhandle) {
$stock = $child->product_in_stock - $child->product_ordered ;
if ($stock>0)return $child ;
else return false ;
}
else return $child ;
}
return false ;
}

WITH THIS CODE:

Code: [Select]
function getValideChild($child_id ) {
$db = JFactory::getDBO();
$q = 'SELECT `product_sku`,`product_name`,`product_in_stock`,`product_ordered`,`product_availability`,`product_weight`,`product_weight_uom`,`product_length`,`product_width`,`product_height`,`product_lwh_uom` FROM `#__virtuemart_prfoducts` JOIN `#__virtuemart_products_'.VMLANG.'` as l using (`virtuemart_product_id`) WHERE `published`=1 and `virtuemart_product_id` ='.(int)$child_id ;
$db->setQuery($q);
$child = $db->loadObject();
if ($child) {
if ('disableit_children' === $this->stockhandle) {
$stock = $child->product_in_stock - $child->product_ordered ;
if ($stock>0)return $child ;
else return false ;
}
else return $child ;
}
return false ;
}


Notice I commented out a few lines in the first edited function, but you could uncomment them and add those columns (and any others) to the db query in the second function to pull more values from the child to the product added to the cart.

I suggest this be added to the core.  However, it might be best if there were additional parameter options for the custom stockable variants plugin on the backend that lets you choose which values you would like the child to override for the parent.

After you make those changes your weight / dimension based shipping rules should work correctly for any new products added to the cart.

The modified default stockable.php is attached.  Hope this helps someone!  Took me a little while to figure it out.    :)

 :D

Have been through all 18 pages of this very useful thread (highest regards to the OP for taking so much time on this) and was thanked for my efforts at page 14 where the shipping weights problem I am having popped up. Unfortunately this fix is not working for the version of VM (2.0.20b) that I am using.

I am selling products with Weight variants, 1kg, 5kg, 15kg and each weight costs a different amount to ship. Of course without change, the cart only calculates the shipping weight of the parent item which is useless.

When I applied the fix about I lost my dropdown box all together so I'm guessing it need re-approaching for the newer versions of VM.

Quite surprised this has not been implemented yet. Any ideas anyone?

All,

I managed to fix the weight & dimensions issue.
Now ALL Stockable Variants are passed into the cart.
Also the shipment fee is fixed & calculated correctly.
I will attach the amended stockable.php in the next message.

All the best - Drukman.

drukman2000

  • Jr. Member
  • **
  • Posts: 51
Re: What bugs do you know of in stockable variants plugin
« Reply #323 on: November 05, 2013, 12:02:54 pm »
All,

Attached is the amended stockable.php.
It solve the weight & many other dimensions issues.
Now ALL Stockable Variants are passed into the cart correctly.
As a result now for example you may charge shipment according to weight.

All the best - Drukman.

[attachment cleanup by admin]

OpenGlobal

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 316
    • OpenGlobal E-commerce Web Design in Gloucester
Re: What bugs do you know of in stockable variants plugin
« Reply #324 on: November 05, 2013, 13:28:07 pm »
Yes, that's correct. The sign "continue shopping - undefined" just appeared when I used your stockable.php file.

If I use 2.0.24 version as it comes in VM I get this result (not price and adding to cart more than stock) with my template and in joomla template.

So the problem is how to fix this problem or how to get a working stockable.php

Thanks!

If I can't see the problem, I can't fix it.

OpenGlobal E-commerce

Limonbay

  • Jr. Member
  • **
  • Posts: 54
  • Piercing life
    • Piercings
Re: What bugs do you know of in stockable variants plugin
« Reply #325 on: November 05, 2013, 13:47:19 pm »
The problem is that if you repeatedly press Add to Cart, it will add the selected products to the cart, even if they are not in stock.

Also the price is not showing up. This happens in my template and in joomla default template.

I attach my stockable.php just in case.


[attachment cleanup by admin]
Piercings y complementos
http://www.limonbay.com
Joomla 2.5.14
Virtuemart 2.0.24

OpenGlobal

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 316
    • OpenGlobal E-commerce Web Design in Gloucester
Re: What bugs do you know of in stockable variants plugin
« Reply #326 on: November 05, 2013, 14:07:01 pm »
Those problems are fixed in the version that I attached. I'm talking about the "undefined" bug.

OpenGlobal E-commerce

Limonbay

  • Jr. Member
  • **
  • Posts: 54
  • Piercing life
    • Piercings
Re: What bugs do you know of in stockable variants plugin
« Reply #327 on: November 05, 2013, 15:14:42 pm »
Hi Openglobal,

I have just put your stockable.php again. I don't get that message now. I think that I had not set the shipment and payment method, maybe that was the reason?

Now if you see this example, (with your file) prices don't show up, the same with stock left for each product and the "Show cart" sign.

Thanks!
Piercings y complementos
http://www.limonbay.com
Joomla 2.5.14
Virtuemart 2.0.24

OpenGlobal

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 316
    • OpenGlobal E-commerce Web Design in Gloucester
Re: What bugs do you know of in stockable variants plugin
« Reply #328 on: November 05, 2013, 15:26:53 pm »
The prices aren't showing up for any products on that site, whether they use the stockable plugin or not.

OpenGlobal E-commerce

maxispin

  • Jr. Member
  • **
  • Posts: 174
Re: What bugs do you know of in stockable variants plugin
« Reply #329 on: November 05, 2013, 17:32:38 pm »
All,

Attached is the amended stockable.php.
It solve the weight & many other dimensions issues.
Now ALL Stockable Variants are passed into the cart correctly.
As a result now for example you may charge shipment according to weight.

All the best - Drukman.

Thanks Drukman!
VM 3.0.17.6 | VM 2.0.24c | VM 1.1.9