VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: goudmahendra on November 20, 2015, 09:13:45 AM

Title: How to show Conditional Label "Price from" and "Sales Price"
Post by: goudmahendra on November 20, 2015, 09:13:45 AM
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
Title: Re: How to show Conditional Label "Price from" and "Sales Price"
Post by: GJC Web Design on November 20, 2015, 11:19:15 AM
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
Title: Re: How to show Conditional Label "Price from" and "Sales Price"
Post by: goudmahendra on November 23, 2015, 14:43:45 PM
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
Title: Re: How to show Conditional Label "Price from" and "Sales Price"
Post by: GJC Web Design on November 23, 2015, 15:03:32 PM
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