VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: PostHistorie.nl on September 27, 2017, 12:07:57 PM

Title: Only show out of stock products for Adminstrator in frontend
Post by: PostHistorie.nl on September 27, 2017, 12:07:57 PM
Hello,

I notice there are several out-of-stock options available under configuration, what I'm looking for is a way to show sold/out of stock products in the frontends but only for logged in adminstrators.

Now I can add a Notify and more, but we would like not to confuse our customers and just not display unorderable products (since all items we sell are unique). But the adminstrators would need this feature for catalogue reasons.

Is such a thing possible?

Cheers,
Jan
Title: Re: Only show out of stock products for Adminstrator in frontend
Post by: PostHistorie.nl on October 02, 2017, 13:18:21 PM
I'm sorry, I totally forgot to mention my setup: VirtueMart 3.2.4 / Joomla! 3.7.5 Stable / PHP 5.6.30-0+deb8u1
Title: Re: Only show out of stock products for Adminstrator in frontend
Post by: hellorain on October 02, 2017, 16:29:26 PM
Hello,

It can achieve By Access level feature of joomla along with Notify me button virtumart.

Best Regards,
hellorain.

Title: Re: Only show out of stock products for Adminstrator in frontend
Post by: PostHistorie.nl on October 03, 2017, 13:03:46 PM
Interesting approach!
This could indeed prevent non-adminstrative users from seeing the notify button, HOWEVER I want to completely hide the out-of-stock products for non-administrators (not just the button).
Title: Re: Only show out of stock products for Adminstrator in frontend
Post by: hellorain on October 03, 2017, 13:14:12 PM
Hi,

Then you can apply that access level filtering to whole product column/visibility. This may need some changes in layout file of VirtueMart.

Best Regards,
Title: Re: Only show out of stock products for Adminstrator in frontend
Post by: PostHistorie.nl on October 03, 2017, 13:33:19 PM
Hmm yeah, I'm just curious why this was a feature in old vmart but has disappeared from the newer/latest version.
Title: Re: Only show out of stock products for Adminstrator in frontend
Post by: jenkinhill on October 03, 2017, 15:47:30 PM
If you have ACL set correctly store admins can log into the frontend and access the product inventory.   /index.php?option=com_virtuemart&view=inventory

Selecting the "Product not in stock!" allows them to view the out of stock items.   A superadmin can do this at any time.
Title: Re: Only show out of stock products for Adminstrator in frontend
Post by: PostHistorie.nl on October 04, 2017, 13:33:27 PM
Ok this is getting somewhere. However under Global Configuration -> Component -> VirtueMart I can see the SuperUser is Allowed to everything (including Inventory access).

So I am not sure how to use this ACL setting to view out-of-stock products in the frontend.
Because how do I access  /index.php?option=com_virtuemart&view=inventory (from the frontend) when it gets rewritten immediately to index.php?option=com_virtuemart&view=virtuemart? This only seems to work for the backend.

Or what setting I need under Virtuemart->Configuration->Shopfront->Action when a Product is Out of Stock ?
Title: Re: Only show out of stock products for Adminstrator in frontend
Post by: PostHistorie.nl on October 04, 2017, 15:03:30 PM
I think I know what you mean jenkinhill however this is just making the inventory list available. Which is a list of items (text).

What I would like / need is just the regular site (with pictures etc.) as a catalogue where I can browse freely as Administrator without worrying that my users see out of stock products. Because only the admin sees those.
I think this was a default in old virtuemart.
Title: Re: Only show out of stock products for Adminstrator in frontend
Post by: Studio 42 on October 12, 2017, 13:56:32 PM
If you really need this, then you can write a vmextended plugin only for Admins to show the catalog.
And if you want, in vmextended plugin, you can change the render, if the plugin is right coded and permit overrides.
The plugin have then total control of all and you can write own code, filters ... and for eg permit a CSV export for admins only.
Title: Re: Only show out of stock products for Adminstrator in frontend
Post by: PostHistorie.nl on October 12, 2017, 14:02:02 PM
Ok... I have a little bit of programming experience but I don't know what vmextended is.

I found this: https://open-tools.net/documentation/tutorial-extending-vm-with-custom-views.html (seems helpful).

Can you point me in the right direction a little bit more if I would want to implement this catalogue function?
Title: Re: Only show out of stock products for Adminstrator in frontend
Post by: Studio 42 on October 12, 2017, 14:34:10 PM
vmextend is a Joomla plugin called by Vm if no view/controller is found

else {
// try plugins
JPluginHelper::importPlugin('vmextended');
$dispatcher = JDispatcher::getInstance();
$rets = $dispatcher->trigger($trigger, array($_controller));


If you know how Joomla plugin system plugin work, then you can do it.
Else you need to read the doc for Joomla plugins and vmextend plugins.
If you need to overide views, then you  need to know how to add it.

I don't said, it's easy to do, but how you can do it.
Of course a more generic solution, is to write a Joomla system plugin(or a full component). In this case you can write it exactly as you want and add any function you need.