In this tutorial series, today I am going explain how you can do customization in child product drop-down display in product detail page like in below screen.
Attributes are the features of a product like Color, Size.Products that have multiple sizes or colours you can manage that product by using child product option in VirtueMart.In the frontend, a Drop-down display for child product as attribute we assigned to a product to particular actual product.
Let’s see how you customize that drop-down box in the frontend.
Here, I am going to place “Sold Out” text instead of Price in drop-down if child product is out of stock
Let’s see the steps for same
Step 1
First of all,go to the folder and path is administrator/components/com_virtuemart/classes and next select ps_product_attribute.php file
Step 2
Next, find the below line of code into the file
1 2 3 | $html .= ' - ' . $CURRENCY_DISPLAY->getFullValue( $price["product_price"] ) ; |
Step 3
and place below code instead of this
1 2 3 4 5 6 7 8 9 10 11 12 | $productID = $db->f( "product_id" ); $sql = "SELECT product_in_stock FROM #__vm_product WHERE product_id=$productID" ; $db->setQuery( $sql ) ; $res = $db->loadResult(); if($res <='0'){ $html .= '- Sold Out'; }else{ $html .= ' - ' . $CURRENCY_DISPLAY->getFullValue( $price["product_price"] ) ; } |
That’s it.Now you have your own dropdown for child product in VirtueMart.
Thanks for reading and feel free to share your thoughts! Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.