News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

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

OpenGlobal

I'm not seeing it on that site either.

OpenGlobal E-commerce

Limonbay

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

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

Quote from: Limonbay on November 01, 2013, 14:55:46 PM
QuoteI 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.  :)
Quote from: Limonbay on October 31, 2013, 12:30:46 PM
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

#319
Quote from: inu2005 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

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

Hi Maxispin,

Thanks for your answer.

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

QuoteThus, 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

Quote from: fluidfusion on August 13, 2013, 09:14:59 AM
Quote from: Rocked on September 18, 2012, 21:39:43 PM
Here's how to get weight & dimensions for stockable variants passed into the cart! :)

Open plugins/vmcustom/stockable/stockable.php

REPLACE THIS CODE:


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:


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:


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:


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

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

Quote from: Limonbay 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!

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

OpenGlobal E-commerce

Limonbay

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

Those problems are fixed in the version that I attached. I'm talking about the "undefined" bug.

OpenGlobal E-commerce

Limonbay

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

The prices aren't showing up for any products on that site, whether they use the stockable plugin or not.

OpenGlobal E-commerce

maxispin

Quote from: drukman2000 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.

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