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

No product details ine category browse if user is logged in

Started by bardius, January 04, 2012, 16:57:55 PM

Previous topic - Next topic

bardius

I have 1.5.25 Joomla with Virtuemart 2.0.0.

All work fine if no user is logged in. When i log in the products do not appear at the category browse page. However if i log while viewing a product details page I can see the details just fine.

Problem appears only at category browse product listing.

Any ideas?
George Bardis
Team Leader / Senior Web Developer
http://www.bardis.info

PRO

you do not see products that are NOT in your language.

Its got to do with your user language, and the product and category language

bardius

Nop, that is not the case.

I have a Joomla 1.5.25 installation with 2 languages products are translated in both languages. On top of that products appear just fine when I am on products details page. They just wont appear on the category listing.

The product count in the listing is correct however the product details object is empty.

If you could please guide me to the file where the details for the products of the category listing are created so I can fix that.
George Bardis
Team Leader / Senior Web Developer
http://www.bardis.info

bardius

okz.....I think I got it.

I had no shopper group selected in the product details. Thus no shopper group id was associated to that product id.

I selected only the default group and now i see the required products as I should.

However.......since I only selected the default group shouldn't only the default group users see that product? Why users that are not logged in see it? Could this be a logical error or I am missing a point here?

I run trough the queries on the database and I am concerned as i see that the join that is used in models/product.php is set here as

if(is_array($virtuemart_shoppergroup_ids)){
     foreach ($virtuemart_shoppergroup_ids as $key => $virtuemart_shoppergroup_id){
   $where[] .= '(s.`virtuemart_shoppergroup_id`= "' . (int) $virtuemart_shoppergroup_id . '" OR' . ' ISNULL(s.`virtuemart_shoppergroup_id`) )';
    }
    $joinShopper = true;
}

$virtuemart_shoppergroup_ids is an array only if a user is logged. Else it is the string value "2". Shouldn't there be a check for that case too?

I guess that this value should be "1" (as this is the id of the anonymous shopper group) and there should be an else clause for this. Something like

if(is_array($virtuemart_shoppergroup_ids)){   
            
   foreach ($virtuemart_shoppergroup_ids as $key => $virtuemart_shoppergroup_id){
      $where[] .= '(s.`virtuemart_shoppergroup_id`= "1" OR s.`virtuemart_shoppergroup_id`= "' . (int) $virtuemart_shoppergroup_id . '" OR' . ' ISNULL(s.`virtuemart_shoppergroup_id`) )';
   }
}
else
{   
   $where[] .= '(s.`virtuemart_shoppergroup_id`= "1" OR' . ' ISNULL(s.`virtuemart_shoppergroup_id`) )';
}
$joinShopper = true;

I guess hardcoding s.`virtuemart_shoppergroup_id`= "1" is not the way to go as "1" should be the id of the default shopper group but haven't figure out a way to do that yet.

Could someone from the development team verify if this is an issue please?
George Bardis
Team Leader / Senior Web Developer
http://www.bardis.info

PRO


bardius

yes it is. however there is no check if smn is not logged in. thus you cannot hide a product from non logged in users.
George Bardis
Team Leader / Senior Web Developer
http://www.bardis.info