News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

preventing module display on product display

Started by welrachid, December 14, 2017, 23:30:24 PM

Previous topic - Next topic

welrachid

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
Best regards,
Wel

Studio 42

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.

welrachid

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
Best regards,
Wel

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Studio 42

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') {

welrachid

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
Best regards,
Wel

visitmontaione

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?