Child Product handling on VM3.0.10

If you are runnig Joomla 3.x and Virtuemart 3.x please post to this forum your questions or support tickets about One Page Checkout

Child Product handling on VM3.0.10

Postby admin » Fri Nov 06, 2015 7:19 pm

Hello friends, we would like to share a fix for child product stock handling on VM3.

Our configuration:

Custom field: Generic child variant (cart input yes / cart attribute yes, position addtocart)
Products:

Parent product: has price 100 + has a category + has NO STOCK + has custom field "Generic Child Variant Associated"
for this parent, we created two child products:

Product 200 In Stock: Stock 100pcs, has price, no category selected
Product 300 Out of stock: Stock 0pcs, has price set, no category selected

VM config:
- display "notify me for products out of stock"

When you land at Parent product, the "notify me" is correctly displayed, when you select the product "In Stock" the add to cart is properly displayed

BUT

when you select product "Out of stock" you still see the add-to-cart on default VM template.


FIX (this is done on pre-release vm3.0.12 but previous versions are most probably affected the same way):

\components\com_virtuemart\sublayouts\customfield.php

find this (here on line 305 to 315:
Code: Select all

if($customfield->parentOrderable==0){
                  if($product->virtuemart_product_id==$customfield->virtuemart_product_id){
                     $product->orderable = false;
                  } else {
                     $product->product_in_stock = $parentStock;
                  }

               } else {


               }



and replace with this:
Code: Select all
               if($customfield->parentOrderable==0){
                  
                  if($product->virtuemart_product_id==$customfield->virtuemart_product_id){
                     $product->orderable = false;
                  }
               } else {
                     $product->product_in_stock = $parentStock;
                     
               
                     
               }



Image

expected result after the fix:
- parent product: Notify me link
- In Stock product: Add to cart displayed
- Out of Stock product: Notify me link

best regards, stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm

Return to One Page Checkout for Virtuemart 3 on Joomla 3.x