Is there a way to skip category view with only one corresponding product inside?

Started by hohogy, January 30, 2017, 14:31:53 PM

Previous topic - Next topic

hohogy

Hi,
Title is self explanatory: There are several cateories with only one corresponding product. User must click first the Category_View then the Product_View in order to go into the product details page. Is there a way to skip the first Category_View and jump directly the Product_View?
Thanks in advance for any suggestion.

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

hohogy


jenkinhill

Quote from: hohogy on January 31, 2017, 10:19:32 AM
Joomla! 3.4.8

Did you miss the vital security releases?
https://www.joomla.org/announcements/release-news/5678-joomla-3-6-4-released.html
https://www.joomla.org/announcements/release-news/5693-joomla-3-6-5-released.html
http://forum.virtuemart.net/index.php?topic=118683.0

As for the category issue I have previously set up a joomla menu for all categories on a client site. For those with just a single product the menu link goes directly to the product details view.

I'm sure it can also be done by some programming.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Studio 42

YOu can count the product and redirect at begin of your tmpl file YOURSITE\components\com_virtuemart\views\category\tmpl\default.php
if(!empty($this->products[0]) && count($this->products[0]) === 1) {
$app =JFactory::getApplication();
$app->redirect($this->products[0][0]->link);
}

best is to do an override in your template of course
Note : $this->products[0] is only used in latest VM releases

Milbo

Quote from: Studio 42 on January 31, 2017, 17:46:08 PM
Note : $this->products[0] is only used in latest VM releases

yeh and renamed to "products". $this->products['products']
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

hohogy

Thank you Studio 42! I have written what you told, but without success, still I have to select the category, then the only product inside, in order to see its child-products. Maybe it is because I am using VM 3.0.16 with Joomla! 3.4.8? what should I write then?

I have a question about Joomla upgrade (to jenkinhill). I would like to updgrade, but could you pls send me a link, how to do it properly? (as you see I am a newbie). Is there a way to figure out which files have been overridden?

My problem is, that I am trying to fix a Joomla site made by someone, who has already left us.

Studio 42

@hohogy : virtuemart 3.0.18 can be update using Joomla extensions update tool.
Here a way to do it https://docs.joomla.org/Help36:Extensions_Extension_Manager_Update or video https://www.youtube.com/watch?v=qwGeNCHfEPM
If you want try last Virtuemart get file http://dev.virtuemart.net/attachments/download/1054/com_virtuemart.3.0.19.6_extract_first.zip and extract and use the standard Joomla install with the 2 extracted files

jenkinhill

Quote from: hohogy on February 06, 2017, 14:50:11 PM
I have a question about Joomla upgrade (to jenkinhill). I would like to updgrade, but could you pls send me a link, how to do it properly? (as you see I am a newbie). Is there a way to figure out which files have been overridden?

Joomla can be automatically updated. I Joomla backend go to Components/Joomla! Update and follow the prompt.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum