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

Echo Child product price in category view

Started by demonswilldrown, October 02, 2012, 00:33:18 AM

Previous topic - Next topic

demonswilldrown

Is there a way to achieve this?

Basically I have a product with two children products which are not visible on their own, what I need to do is to display the name and price of my two children inside its parent product while in the category view. I gather that I need to include the info for the child products inside the $product array but I still haven't found where to modify this.

Can somebody help me please  :-\

thank you in advance

demonswilldrown

Hey, I think I got it!

This is not ideal but for the absolute begginer at php I think this is easy to understand. I put this in my category view template

<?php 
$this->db JFactory::getDBO();
$this->db->setQuery('SELECT * FROM `#__virtuemart_products` WHERE `product_parent_id` ='.$product->virtuemart_product_id);
$hijos $this->db->loadResultArray();
if(!empty($hijos)) {
//print_r($hijos);
foreach ($hijos as $hijo) {
echo '<div class="productoHijo">';
$q1 $this->db->setQuery('SELECT `product_price` FROM `#__virtuemart_product_prices` WHERE `virtuemart_product_id` ='.$hijo);
$precio round($this->db->loadResult());
?>

<div class="product-price marginbottom12">
<div style="display : block;" class="PricesalesPrice">
<span class="PricesalesPrice">$ <?php echo $precio ?></span>
</div>
</div>
<?php 
//echo $this->currency->createPriceDiv('salesPrice','COM_VIRTUEMART_PRODUCT_SALESPRICE',$precio);
$q1 $this->db->setQuery(' SELECT `product_packaging` FROM `#__virtuemart_products` WHERE `virtuemart_product_id` ='.$hijo);
$box $this->db->loadResult();
$cantidad = ($box >> 16) & 0xFFFF
?>

                        <div class="numeroPersonas">
                    <img src="<?php echo JRoute::_('templates/mytemplate/img/qt/'.$cantidad.'.png' ?>" border="0" />
                    </div>

<?
echo '</div>';}

}


?>