VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: hohogy on January 30, 2017, 14:31:53 PM

Title: Is there a way to skip category view with only one corresponding product inside?
Post by: hohogy on January 30, 2017, 14:31:53 PM
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.
Title: Re: Is there a way to skip category view with only one corresponding product inside?
Post by: jenkinhill on January 30, 2017, 14:54:50 PM
http://forum.virtuemart.net/index.php?topic=79799.0
Title: Re: Is there a way to skip category view with only one corresponding product inside?
Post by: hohogy on January 31, 2017, 10:19:32 AM
Sorry: VM 3.0.16 - Joomla! 3.4.8 (Platform 13.1.0)
Title: Re: Is there a way to skip category view with only one corresponding product inside?
Post by: jenkinhill on January 31, 2017, 10:38:49 AM
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.
Title: Re: Is there a way to skip category view with only one corresponding product inside?
Post by: Studio 42 on January 31, 2017, 17:46:08 PM
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
Title: Re: Is there a way to skip category view with only one corresponding product inside?
Post by: Milbo on February 06, 2017, 14:38:33 PM
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']
Title: Re: Is there a way to skip category view with only one corresponding product inside?
Post by: hohogy on February 06, 2017, 14:50:11 PM
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.
Title: Re: Is there a way to skip category view with only one corresponding product inside?
Post by: Studio 42 on February 06, 2017, 15:25:37 PM
@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
Title: Re: Is there a way to skip category view with only one corresponding product inside?
Post by: jenkinhill on February 06, 2017, 17:50:16 PM
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.