Author Topic: Price range for child items?  (Read 762 times)

Reincha

  • Jr. Member
  • **
  • Posts: 137
Price range for child items?
« on: February 08, 2011, 12:17:24 pm »
Hi!
when product(with items) flypage loads it shows parent price and only when any child is selected the price is Ajaxly changed to child's price.
I have child items with different prices and would like to show price range of them when first flypage loads, then, when selected any child item, this range could ajaxly change to selected child's price.

thanks. R.

Reincha

  • Jr. Member
  • **
  • Posts: 137
Re: Price range for child items?
« Reply #1 on: February 08, 2011, 12:59:21 pm »
I actually solved it myself :)
i found a year old post which gave me great idea - i dont need numerical price range, but all i need is suffix "from: " when parent loads.

i dont know how pros do it, but what i did is i checked how many child items does parent product have:

Code: [Select]
//how many child items this product have?
$db = new ps_DB( ) ;
$q = "SELECT product_id FROM #__{vm}_product WHERE product_parent_id=$product_id AND product_parent_id<>0 AND product_publish='Y'" ;
$db->setQuery($q) ;
$db->query() ;
$numrow = $db->num_rows();
?>

$numrow will return child count. for parent - number depending on child count, for child products - 0

now before calling for price i put statement <?php if($numrow !=0){echo 'From: ';} ?>

hope it helps.
R.

webs4travel

  • Beginner
  • *
  • Posts: 33
Re: Price range for child items?
« Reply #2 on: May 04, 2011, 11:28:24 am »
Hi Reincha,

Which page should I add the code to?  I cannot see where it might go in my flypage template...

Regards

Nicola

Reincha

  • Jr. Member
  • **
  • Posts: 137
Re: Price range for child items?
« Reply #3 on: May 29, 2011, 14:49:36 pm »
this was my flypage