News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Combobox child products with price

Started by ocsalb, August 06, 2013, 18:17:54 PM

Previous topic - Next topic

ocsalb

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']) . ') ');
}

Percheron

Thank you for this posting. This is exactly what I was looking for. You helped me a great deal.

MarioP

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....

Milbo

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
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/