VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Doggiefield on April 09, 2013, 02:29:16 AM

Title: Problem with showing childproducts after upgrading from 2.0.18 - 2.0.20b
Post by: Doggiefield on April 09, 2013, 02:29:16 AM
After upgrading to 2.0.20b this code in my template (category view) doesn't show any results.

$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);


What is changed in the latest update that this doesn't work anymore?
Title: Re: Problem with showing childproducts after upgrading from 2.0.18 - 2.0.20b
Post by: jjk on April 09, 2013, 09:22:55 AM
I suppose one of your own changes isn't compatible with version 2.0.20b, because it is working for everybody else. However, you could compare the current files listed here:
http://dev.virtuemart.net/projects/virtuemart/repository/show/branches/com_virtuemart2.0.14mp/components/com_virtuemart/views/category
with your old version 2.0.18 backup with the 'compare' feature available in tools like WinMerge or Notepad++. Click on 'View' in the link above after selecting one of the changed files to see the current version.
Title: Re: Problem with showing childproducts after upgrading from 2.0.18 - 2.0.20b
Post by: Doggiefield on April 10, 2013, 12:34:50 PM
Hi jjk,

Thanks for your answer.
I placed this code in my template for viewing the prices of childproducts.

I have used Beyond Compare to see the differences, but I don't know what to look for. I changed as much as I could for the category view according to the latest version, but no result.

Maybe someone can point me in the right direction and see what I have to change in order to get results.
Title: Re: Problem with showing childproducts after upgrading from 2.0.18 - 2.0.20b
Post by: jjk on April 10, 2013, 13:29:39 PM
Quote from: Doggiefield on April 10, 2013, 12:34:50 PM
I placed this code in my template for viewing the prices of childproducts.
From your description I'm not shure for which reason you've added your code to the template. Are the child products not displaying at all or are you missing the price tag for the child products only? (In case of the latter, it's might be a simple configuation issue - if you are talking about 'generic child variants').
Title: Re: Problem with showing childproducts after upgrading from 2.0.18 - 2.0.20b
Post by: Doggiefield on April 10, 2013, 14:08:00 PM
Nope it's not only for showing the prices.
The products are wires that has different diameters and prices. So I use a main product (not orderable) and subproducts. It is possible to get the products in a dropdown list in the product details, but I need to see alle of the possible diameters with prices in the category view.

The code that I use is for showing all of the subproducts with it's prices. I used a piece of code found on this forum and modified it to my wishes. I worked all just fine, but after updating to 2.0.20 it only showed a empty div

But I found the problem with try and error I changed the following line:

$this->db->setQuery('SELECT * FROM `#__virtuemart_products` WHERE `product_parent_id` ='.$product->virtuemart_product_id );

into:

$this->db->setQuery('SELECT virtuemart_product_id FROM `#__virtuemart_products` WHERE `product_parent_id` ='.$product->virtuemart_product_id );

I don't know why it changed in 2.0.20, but I'm glad to have a solution.

Thanks jjk