VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: ocsalb on August 06, 2013, 18:17:54 PM

Title: Combobox child products with price
Post by: ocsalb on August 06, 2013, 18:17:54 PM
We need child products with price in the combobox, as vm 1.1

Making changes to the customfields.php
Not the best option. In updates customfields.php changes
Is possible to make a plugin?

but it works

Thanks!


/administrator/components/com_virtuemart/models/customfields.php
v2.0.22a line 1062:

/*foreach ($uncatChildren as $k => $child) {
   $options[] = array('value' => JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id'],FALSE), 'text' => $child['product_name']);
}*/
if (empty($calculator)) {
   if (!class_exists ('calculationHelper'))
      require(JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php');
   $calculator = calculationHelper::getInstance ();
}

foreach ($uncatChildren as $k => $child) {
   $product = $productModel->getProductSingle((int)$child['virtuemart_product_id'],false);
   $productPrices = $calculator->getProductPrices ($product);
   $options[] = array('value' => JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id'],FALSE), 'text' => $child['product_name'] . ' (' . $currency->priceDisplay ($productPrices['salesPrice']) . ') ');
}
Title: Re: Combobox child products with price
Post by: Percheron on March 26, 2014, 16:48:43 PM
Thank you for this posting. This is exactly what I was looking for. You helped me a great deal.
Title: Re: Combobox child products with price
Post by: MarioP on March 27, 2014, 13:09:18 PM
Very useful tip. Thanks ocsalb. The last thing missing in product details view are prices in related product http://forum.virtuemart.net/index.php?topic=105344.msg354393. Maybe some of VM team, other developers or users of VM will help in that matter? Is there any chance to implement that feature in the next release of VM? Maybe there's some plugin available to buy? Maybe someone of programmers will share the solution for the current release of VM? Taking into accout the amount of users asking about  that feature it's really desirable thing....
Title: Re: Combobox child products with price
Post by: Milbo on May 13, 2014, 01:33:43 AM
We have for the related products a customfield and not just an field with comma seperated values and the reason is exactly to provide these option. Will come with vm3, maybe not in the first releases, but the idea is there. Thanks for pointing