Author Topic: Critical-shop for registered users only, display products and prices to public  (Read 932 times)

stensbo

  • Jr. Member
  • **
  • Posts: 96
Using Joomla! 3.9.20,  Virtuemart 3.8.4 10335, PHP Version 7.4.14, vm overrides.
template Storefront version 3.25 - site danrider.dk

We have a shop (wholesale)- for registered users only.
Login module is assignet to a menu - for public
Virtuemart frontpage is assignet to a menu there is set for registered users only - all our vm modules is set for registered users only.
Despite that it sometimes popup with " you have to assign Virtuemart Component to a menu"
Google search on one of our products leads to a view of the product with price - that should not be possible.
 - url:https://oursite.dk/index.php/component/virtuemart/.....and the product -

Have tried to disable template overrides by renaming the virtuemart_com folder in template/html - view still display
even after I was forced to set our site offline the view still display.

Any ideas?

StefanSTS

  • Global Moderator
  • Full Member
  • *
  • Posts: 571
  • VirtueMart Version: VM 4.2 on Joomla 4.5
If you do not show prices for guest, they will not appear in Google. Some setting is wrong.

You should assign shopper groups.
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

stensbo

  • Jr. Member
  • **
  • Posts: 96
We have several shoppergroups and prices for each group.
When import product with csvi price goes in default shoppergroup - then we import prices for the other groups.

Normally when we ad a product link to a newsletter and customers click on that they get the login module

StefanSTS

  • Global Moderator
  • Full Member
  • *
  • Posts: 571
  • VirtueMart Version: VM 4.2 on Joomla 4.5
If you use the template Storefront from Gavick, you might have come the way from VirtueMart 2 and something in the core or in some extensions is not up to date.

In that case, this won't be easy to solve via forum.

--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

stensbo

  • Jr. Member
  • **
  • Posts: 96
Thanks but what do you mean by this "If you do not show prices for guest" - shopper can not register and have not access to our shop unless they have a username and passsword provided from us

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3442
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
I think Stefan means that if your prices are "accessible to everyone" it is not enough just to have login restrictions. Are your prices accessible to all user groups ?

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

stensbo

  • Jr. Member
  • **
  • Posts: 96
Okay thanks - yes we have prices available to all shoppergroups on some products.
If I add a link in browser for one such product I get the login formular and that i correct.
If I add https://oursite.dk/index.php/component/virtuemart...... I get the first category with products and prices  and that should not be possible - i think

edit: .. and it tell to add Virtuemart Component to a menu. Virtuemart frontpage is assigned to a menuitem that is for registered users only.

StefanSTS

  • Global Moderator
  • Full Member
  • *
  • Posts: 571
  • VirtueMart Version: VM 4.2 on Joomla 4.5
Thanks but what do you mean by this "If you do not show prices for guest" - shopper can not register and have not access to our shop unless they have a username and passsword provided from us

If your prices are restricted to the shopper group Standard, Google will not be able to access your prices, because Google visits your site as guest.
If a user logs in, the user will be treated as in the group Standard, only after logging in, the user will see prices.

Please check, where you have restricted the access to the prices.

Once you can do it in your product, but you can also show different prices for different shopper groups. Check the setting in each individual shopper group for that.

--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

stensbo

  • Jr. Member
  • **
  • Posts: 96
Thanks StefanSTS
Quote
Please check, where you have restricted the access to the prices.

Our shop is only for registered users - it's behind a login module - Virtuemart frontpage is assigned to a menuitem with access: registered - users are not able to register themselves -  so I think no one should be able to se anything in our shop unless we provide them with login info. Am I right ?


StefanSTS

  • Global Moderator
  • Full Member
  • *
  • Posts: 571
  • VirtueMart Version: VM 4.2 on Joomla 4.5
Restricting the VirtueMart frontpage link is not the way to deny access to VirtueMart pages or prices.
It just doesn't show a direct link to VM.

You have to disable prices for guest users. Either in every product, or for the shopper group guest.
Enable "Show shoppergroup specific prices" in the shopper groups settings.

EDIT: If you additionally want to restrict the guest so far that they cannot see any products, you could set the categories to shopper group "Standard".
Not sure, if it would be possible to get products via direct link. You might be able to set some restrictions in the menu item setting.

Otherwise you have to disable VM completely for guest via ACL, I guess. Never did that. Most people want to show the products without prices at least.

--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

stensbo

  • Jr. Member
  • **
  • Posts: 96
Quote
Otherwise you have to disable VM completely for guest via ACL, I guess.

That's what I thought we had but i found that we do not have the guest group in ACL - only Public (Public ACL settings for Virtuemart - not allowed), and I can read in Joomla forum that others, that have updated Joomla regularly from years back like us, have the guest group missing.

All modules, plugins, menus a.s.o that are used in Virtuemart are restricted to for registered users only

Have exported all our prices prices and found the prices that are available to all shoppergroups but they are convenient
when all shoppergroups have the same price for a product...so I would like to avoid to delete them but of course if necessary I will do so.

Also found that our virtuemarts 2 default shoppergroups is -anonymous- and -default- where in newer versions they are
Default Shopper Group/COM_VIRTUEMART_SHOPPERGROUP_DEFAULT and Guest Shopper Group/COM_VIRTUEMART_SHOPPERGROUP_GUEST

It seems to be something that is not being properly updated - that do you think?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4435
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
You can disable price and add to cart with PHP on checking the user is guest.
$user = JFactory::getUser();
if ($user->guest) return;
at the begin of the file you need to disable for public.
Using another method is not safe because you can access directly to your component using the non sef link index.php?option=com_virtuemart&...

stensbo

  • Jr. Member
  • **
  • Posts: 96
Thank you Studio 42
Found one of your other suggestions in another topic

Code: [Select]
<?php 
if(empty(JFactory::getUser()->id)) {
echo 
"My simple text";
return;
?>

and added it at the begin of
..templates/my_template/html/com_virtuemart/productdetails/default.php and
..templates/my_template/html/com_virtuemart/category/default.php
It seams to work:) In this way we should be able to keep prices "available to all" on some products and be sure they aren't displayed to not logged in users - right?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4435
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
If you want display price in some categories, then do a copy of default.php and remove the condition and in the category setting change the default layout with your new layout

stensbo

  • Jr. Member
  • **
  • Posts: 96
Okay - thank you but our intention is that only logged in users, with login provided by us, have access to and can see contents in our shop. I hope that we with your code have
closed the access directly to the component using the non sef link.