News:

Support the VirtueMart project and become a member

Main Menu

No "notify me" - out of stock with Child variant

Started by Daniel Sjöstrand, March 13, 2015, 00:35:39 AM

Previous topic - Next topic

lindapowers

Quote from: nub on May 01, 2015, 18:04:14 PM
again:

I see you have added the echo line - what are the results?

If the shown stock quantitys for all variants are right, this workaround will not help you.
If they are wrong, move the echo line to the bottom of the workaround code. Now they should be right...

Sorry I have no clue on where to see those results.

nub

Quote from: lindapowers on May 03, 2015, 17:39:59 PM
Sorry I have no clue on where to see those results.

They should appear very near to the add to cart button.
If they dont appear check your overrides again please.

J 3.4.1 | VM 3.0.8 | PHP 5.5

GJC Web Design

I think this is the same problem I came across with the child stock getting over written in the product model

as a dirty hack around line 796 in the getProduct() function of administrator/components/com_virtuemart/models/product.php

//GJC  fix for child stock
   $child->child_stock = $child->product_in_stock;
//GJC

then in templates etc the correct stock for the child is available as $this->product->child_stock
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

nub

Ahh, thanks again!

Your dirty hack looks much cooler than my DB request, but i can make it in an override... Hmm 
J 3.4.1 | VM 3.0.8 | PHP 5.5

GJC Web Design

indeed - would need to be replaced every up grade - but pretty sure I told Max about this so maybe fixed in 3.0.10
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

lindapowers

#20
Quote from: GJC Web Design on May 03, 2015, 22:54:17 PM
I think this is the same problem I came across with the child stock getting over written in the product model

as a dirty hack around line 796 in the getProduct() function of administrator/components/com_virtuemart/models/product.php

//GJC  fix for child stock
   $child->child_stock = $child->product_in_stock;

Hi

I tried adding it but dont know if in the correct place since I copied you from http://forum.virtuemart.net/index.php?topic=127500.45:

if (!$child->published && $onlyPublished) {
self::$_products[$productKey] = false;
return FALSE;
}
//GJC  fix for child stock
$child->child_stock = $child->product_in_stock;
//GJC

if(!isset($child->orderable)){
$child->orderable = TRUE;



Quote from: GJC Web Design on May 03, 2015, 22:54:17 PM

then in templates etc the correct stock for the child is available as $this->product->child_stock

I don't understand what you mean here? Is there another file to modify apart from product.php

I added the code but still get the add to cart button :(

Regards




nub

@lindapowers: Try it below this line:
$child = $this->getProductSingle ($virtuemart_product_id, $front,$quantity,true,$virtuemart_shoppergroup_ids);


Btw. The bug has gone for me  :o I have removed my DB request and am not using the GJC fix - but it works, the stock values are ok and the button appears when it should... The only thing i have changed is the default editor (JCE now). Switched back to Tiny MCE - but the bug is still away  :o
J 3.4.1 | VM 3.0.8 | PHP 5.5

lindapowers

Quote from: nub on May 04, 2015, 23:42:38 PM
@lindapowers: Try it below this line:
$child = $this->getProductSingle ($virtuemart_product_id, $front,$quantity,true,$virtuemart_shoppergroup_ids);


Btw. The bug has gone for me  :o I have removed my DB request and am not using the GJC fix - but it works, the stock values are ok and the button appears when it should... The only thing i have changed is the default editor (JCE now). Switched back to Tiny MCE - but the bug is still away  :o

lol

Well in my case this is driving me mad, check this product: http://comenaranjas.com/en/shop/seasonal-fruits/yellow-plums-kg-detail.html

Has stock 0 in backend but when I enable "show stock" in template settings is showing the stock of the other child in the dropdown.

And as you can see the "add to cart" is showing also.

Strange

nub

And for each product all variants shows the same stock - its definitively  the same problem i have had.
So its strange that my workaround and the GJC fix didn't help you... 

J 3.4.1 | VM 3.0.8 | PHP 5.5

lindapowers

Quote from: nub on May 05, 2015, 12:48:28 PM
And for each product all variants shows the same stock - its definitively  the same problem i have had.
So its strange that my workaround and the GJC fix didn't help you... 



I contacted the template providers (yagendoo). They use their own nasty plugin/framework which caused issues in the past but im sure they will reply this is a vm core issue...

What I would like to know is if the rest of users with setting:

vm/configuration/shopfront/Action when a Product is Out of Stock/Displays 'Notify Me' instead of 'Add To Cart' button

Have this working or have issues like us.

This only happens with child products... but there must be more users out there with this combination...

Regards


GJC Web Design

What my hack did for me was to correct the child product stock level as the $product->product_in_stock and $this->product->product_in_stock in the templates was wrong

From memory it was showing the parent

with the hack you now also have in the the templates

$product->child_stock and $this->product->child_stock  which I could use where needed (add to cart button logic, stock display etc)
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

nub

Quote from: GJC Web Design on May 06, 2015, 10:55:51 AM
What my hack did for me was to correct the child product stock level as the $product->product_in_stock and $this->product->product_in_stock in the templates was wrong

From memory it was showing the parent

No it shows the selected childs stock.
In the case of lindapowers the template was the problem, it makes a lot of own stuff, other filenames and variables etc.
J 3.4.1 | VM 3.0.8 | PHP 5.5

lindapowers

Quote from: nub on May 06, 2015, 15:45:32 PM
Quote from: GJC Web Design on May 06, 2015, 10:55:51 AM
What my hack did for me was to correct the child product stock level as the $product->product_in_stock and $this->product->product_in_stock in the templates was wrong

From memory it was showing the parent

No it shows the selected childs stock.
In the case of lindapowers the template was the problem, it makes a lot of own stuff, other filenames and variables etc.


Yep once more the templater providers driving me crazy ;) thanks for the fix nub!

GJC Web Design

when in doubt use http://www.virtuemarttemplates.eu/   :P

no bloated script kiddie - "Gee Mum - look what this JS can do!"  - just good clean well supported, easy to adapt templates with enthusiastic support

Just my 2 cents
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

lindapowers

Quote from: GJC Web Design on May 06, 2015, 19:11:52 PM
when in doubt use http://www.virtuemarttemplates.eu/   :P

no bloated script kiddie - "Gee Mum - look what this JS can do!"  - just good clean well supported, easy to adapt templates with enthusiastic support

Just my 2 cents

Thanks for link, good to know.