News:

Looking for documentation? Take a look on our wiki

Main Menu

How to show Conditional Label "Price from" and "Sales Price"

Started by goudmahendra, November 20, 2015, 09:13:45 AM

Previous topic - Next topic

goudmahendra

Hello All.
                   I am using virtuemart 3.0.9 and joomla 3.4.1. My problem is  that I need two price label one for product with child product and one for product with no child product. If the product has child product then I have to show label "Price From" insted of sales price and if product has no child then label should be default "Sales price".
        I know I have to put condition in prices.php files to check if product has child product or not. but I don't know programming.

please help me.

thanks

GJC Web Design

J3.4.1 is famously insecure..  did you not see the publicity?

VM3.0.9 is a test release .. the current stable is 3.0.12

I know I have to put condition in prices.php files to check if product has child product or not. but I don't know programming.

if($product->product_parent_id > 0 ) {
//do something
}

will tell you if it is a child
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

goudmahendra

Hello GJC,
 
                             Thanks for your reply but I dont want to check procduct is child or not. i need to check one product has child or not.

thanks

GJC Web Design

there is a function in products.php

* @return bool True if there are child products, false if there are no child products
    */
   public function checkChildProducts ($product_ids) {

so something like

$productmodel = VmModel::getModel ('product');
         $haschild = $productmodel->checkChildProducts ($this->product->virtuemart_product_id);

might work
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