VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: welrachid on December 14, 2017, 23:30:24 PM

Title: preventing module display on product display
Post by: welrachid on December 14, 2017, 23:30:24 PM
Hi
i have a page that is a category layout page. This page is also the "home page".
On this page i have a front-page slider. beneath i have products listed.
When i click products i dont want the slider to be shown.
I have made it so that the slider is only visible on the "home page", but still it is displayed on the product pages.
How can i resolve this?

Thanks
Title: Re: preventing module display on product display
Post by: Studio 42 on December 16, 2017, 02:52:09 AM
The solution is to add menu link for each main categories, so you can disable module display for this menus.

Another solution is to check with PHP for view=productdetail.

The ultimate solution is to check for view="virtuemart" and option='com_vituemart', max will remove this view but it's so easy when you use  view=virtuemart as root to set a complete different render as categories because you have in other case to overrides categories and it's more work.
Title: Re: preventing module display on product display
Post by: welrachid on December 16, 2017, 14:09:09 PM
THX but the whole slider part is not part of the categories view. It's a module Position in the template itself. Therefore it's printer before we even get to the component. Doing if else etc outside of virtuemart I somehow find wrong. Maybe the solution is to make menu kinks. But that kinda breaks the idea behind mod_virtuemart_categories where I print out categories and uses their aliases as url.
Hmm... Maybe the only solution is to do that if else in the template
Title: Re: preventing module display on product display
Post by: GJC Web Design on December 16, 2017, 17:07:16 PM
If u don't want to make menu items then use something like the advanced menu module or even filter it in the template index.php
there is also  https://www.spiralscripts.co.uk/joomla-modules/vm-modcontroller-pro-detail.html
Title: Re: preventing module display on product display
Post by: Studio 42 on December 16, 2017, 17:28:21 PM
welrachid
i see under your name : "3rd party plugin developer" so i have give you the minimum explains.
You have to add a specific position(or use a old one) and filter it if you are in virtuemart productdetails.
This is the fastest and best way, because you have not to use any plugin or other tircks, only check for the view= 'productdetails'.
To get it the shortest code that always work is for eg in  templates/protostar/index.php to hide the left bar.
if(JFactory::getApplication()->input->get(view') !=='productdetails') {
if ($this->countModules('position-8')) : ?>
<!-- Begin Sidebar -->
<div id="sidebar" class="span3">
<div class="sidebar-nav">
<jdoc:include type="modules" name="position-8" style="xhtml" />
</div>
</div>
<!-- End Sidebar -->
<?php endif;
}


In protostart $view exist and is set with $view     = $app->input->getCmd('view', '');
so you can simplify it with if($view !=='productdetails') {
Title: Re: preventing module display on product display
Post by: welrachid on December 16, 2017, 23:09:58 PM
Thanks for your help.
My solution ended up being the one with if else


$app = JFactory::getApplication();
$input = $app ->input;
$current_option = $input ->get('option');
$current_view = $input ->get('view');
$current_category_id = $input->get('virtuemart_category_id');
$isFrontPageView = false;
if(
$current_option == "com_virtuemart"
&&
$current_view == "category"
&&
$current_category_id == 0
){
$isFrontPageView = true;
}




<?php if ($isFrontPageView && $this->countModules'header-img' )) : ?>
      <div class="header-img">
         <div class="container">
<jdoc:include type="modules" name="header-img" style="xhtml" />
         </div>
      </div>
<?php endif;?>


Yes i do 3rd party plugins, but not officially for sale. i make very specific plugins for clients, that needs something outside normal.
The question i put in this thread was probably a more general Joomla question, but i was hoping that VM had something included i could use.
anyway. Thanks for your guidance.
The slider is only needed on that specific page and therefore i've made the current_category_id == 0
Title: Re: preventing module display on product display
Post by: visitmontaione on November 24, 2022, 21:50:28 PM
Quote from: welrachid on December 16, 2017, 23:09:58 PM
Thanks for your help.
My solution ended up being the one with if else


<?php if ($isFrontPageView && $this->countModules'header-img' )) : ?>
      <div class="header-img">
         <div class="container">
<jdoc:include type="modules" name="header-img" style="xhtml" />
         </div>
      </div>
<?php endif;?>


Yes i do 3rd party plugins, but not officially for sale. i make very specific plugins for clients, that needs something outside normal.
The question i put in this thread was probably a more general Joomla question, but i was hoping that VM had something included i could use.
anyway. Thanks for your guidance.
The slider is only needed on that specific page and therefore i've made the current_category_id == 0


Hello welrachid I have exactly your problem.

I have a slider on the top level category (which is also the home page shop).

This slider is repeated in the product details page.

Could you please explain me where this code:


this


<?php if ($isFrontPageView && $this->countModules'header-img' )) : ?>
      <div class="header-img">
         <div class="container">
<jdoc:include type="modules" name="header-img" style="xhtml" />
         </div>
      </div>
<?php endif;?>


Will go in the template inde.php right?

Thanks for helping!



$app = JFactory::getApplication();
$input = $app ->input;
$current_option = $input ->get('option');
$current_view = $input ->get('view');
$current_category_id = $input->get('virtuemart_category_id');
$isFrontPageView = false;
if(
$current_option == "com_virtuemart"
&&
$current_view == "category"
&&
$current_category_id == 0
){
$isFrontPageView = true;
}


have to be placed?