J 1.7
VM2 RC 3 K
I'm having trouble getting a module to show up ONLY on my homepage.
My homepage is the VM Default Layout, assigned to a joomla menu item as the default page.
When I use a module's Menu Assignment parameter, and I set it to show only on homepage, the module still shows up on all Virtuemart pages including product detail pages.
(but when I navigate to any page outside of VM, the module does not show up as desired.)
I've tried this code in my template:
$menu = JSite::getMenu();
if ($menu->getActive() == $menu->getDefault()) {
echo '<div id="pathway"><jdoc:include type="modules" name="position4" /></div>'; }
But it still sees the homepage as EVERY virtuemart page, and places the module on every VM page.
I've also tried the old code for $option = 'com_virtuemart' but it gives an error because I believe VM2 doesn't use the $option variable anymore:
if($option=='com_virtuemart') {}else{
echo '<div id="pathway"><jdoc:include type="modules" name="position4" /></div>';}
Can anyone help me with what I'm doing wrong? Or perhaps someone knows the new varible that replaced $option
Thanks
I use metamod for advanced module control. http://extensions.joomla.org/search?q=metamod
This will work
<?php if (JRequest::getVar('view')=='virtuemart') { ?>
<jdoc:include type="modules" name="module" />
<?php } ?>
extra, create a module position for each category
<?php if (JRequest::getVar('view')=='category') { ?>
<jdoc:include type="modules" name="catfoot<?php echo JRequest::getInt('virtuemart_category_id',0); ?>" />
<?php } ?>
This will create a module position name catfoot(categoryid)
You could do the same with each product
<?php if (JRequest::getVar('view')=='productdetails') { ?>
<jdoc:include type="modules" name="productfooter<?php echo JRequest::getInt('virtuemart_product_id',0); ?>" />
<?php } ?>
http://www.kaizenmediaworks.com/virtuemart-template-and-module-control
Awesome! Thanks guys
I'm just trying to test VM2 and have the same issue. Thanks for the tips.
Quote
This will work
<?php if (JRequest::getVar('view')=='category') { ?>
<jdoc:include type="modules" name="module" />
<?php } ?>
Thats it what I was searching for! It works, but not perfect for me.
It just works i if i click to an category in the mainmenu.
The URL: http://localhost/cvbpaderborn/index.php?option=com_virtuemart&view=category&virtuemart_category_id=6
&Itemid=105If i go that way: Frontpage (top products, latest... etc.) -> Product -> Use Breadcrumbs to go into the product category -> it dont show the moduleposition
The URL: http://localhost/cvbpaderborn/index.php?option=com_virtuemart&view=category&virtuemart_category_id=6 (no itemid)
So, the itemid is the solution. It would be nice if someone tell me how to fix it? :-\
Thx.
Tobi
Quote from: tobisagt on January 06, 2012, 00:37:05 AM
So, the itemid is the solution. It would be nice if someone tell me how to fix it? :-\
Thx.
Tobi
this code
<?php if (JRequest::getVar('view')=='category') { ?>
<jdoc:include type="modules" name="module" />
<?php } ?>
will show the module anytime this &view=category
is in the url. with or without the itemid.
- In my index page i got the Mod Featured Product active with some products.
If i click to go to Virtuemart Area Main Categorie ( index.php?option=com_virtuemart ) or if i click in the 1st Categorie (index.php?option=com_virtuemart&view=category&virtuemart_category_id=1) I cant see any left module (that i had applied ( assigned to all pages )
BUT If i click on the Menu item that i've assined for some Categorie Name item ( index.php?option=com_virtuemart&view=category&virtuemart_category_id=1&Itemid=135 ) NOW i can see the module VM Categorie on the left side, and the SubCategories Images on the Right side ..
- If i click on any product in Index page i cant see any module on left side too (in product area)...
<?php $menu = &JSite::getMenu();
if ($menu->getActive() != $menu->getDefault()) { ?>
<div class="lateral"><jdoc:include type="modules" name="lateral" /></div>
<?php } ?>
with this code i can have the module in left side.. but it displays in all joomla articles, etc... and i just wanna to apply this left module in Virtuemart Area ...
I also tryed to add the code {module 170} of Modules Anywhere in some VM default.php files..
components\com_virtuemart\views\virtuemart\tmpl
components\com_virtuemart\views\productdetails\tmpl
\components\com_virtuemart\views\category\tmpl
\components\com_virtuemart\views\categories\tmpl
but without sucess... :/
There is any way to hide the module from index.php and add it only in VM area ?
Thanks
update: solved by done some experiences .. lol but i dont understant nothing of php, this works for now (hope this could help many members..)
<?php if(!($_GET['view'] !== 'frontpage' ) or JRequest::getCmd( 'option' )=='com_virtuemart'): ?><div class="lateral"><jdoc:include type="modules" name="lateral" /></div><?php endif; ?>
Quote from: lipes on March 30, 2012, 03:11:29 AM
<?php if(!($_GET['view'] !== 'frontpage' ) or JRequest::getCmd( 'option' )=='com_virtuemart'): ?><div class="lateral"><jdoc:include type="modules" name="lateral" /></div><?php endif; ?>
$_GET is NOT what you want.
JRequest is Joomla's API for protection.
Modules an ALL virtuemart pages
<?php if (JRequest::getCmd('option')=='com_virtuemart') { ?>
<div class="lateral"><jdoc:include type="modules" name="lateral" /></div>
<?php } ?>
BanquetTables.pro, thanks for your explanation and correction. I changed the code right now.
Unfortunately I did not want the module at all Virtuemart Areas... but its the better that we can do, right?
I dont want that left side Module (VM categories) on the User Registration page, and in the VM Manufacturer Module, or in the Checkout page.... :S
but its the better that we can do/have, correct?
Tks
Quote from: lipes on March 30, 2012, 15:02:07 PM
BanquetTables.pro, thanks for your explanation and correction. I changed the code right now.
Unfortunately I did not want the module at all Virtuemart Areas... but its the better that we can do, right?
I dont want that left side Module (VM categories) on the User Registration page, and in the VM Manufacturer Module, or in the Checkout page.... :S
but its the better that we can do/have, correct?
Tks
what pages do you want it on?
for vmart frontpage the 'view'=virtuemart
I want to apply in all VM Product Categories (or Category) and in all VM Products Details.. not in joomla articles, etc, or in the joomla index page.
(for me) displaying the Mod VM Categories in places like joomla articles, index, Cart, VM Manufacturer Logos Page, Registration area, etc.. doesnt make any sense, because my top Main menu already display that principal categories items too.
Yes I've got the joomla frontpage active not the virtuemart index in default :)
Quote from: lipes on March 30, 2012, 16:11:42 PM
I want to apply in all VM Product Categories (or Category) and in all VM Products Details.. not in joomla articles, etc, or in the joomla index page.
(for me) displaying the Mod VM Categories in places like joomla articles, index, Cart, VM Manufacturer Logos Page, Registration area, etc.. doesnt make any sense, because my top Main menu already display that principal categories items too.
Yes I've got the joomla frontpage active not the virtuemart index in default :)
They are all right here.
http://www.kaizenmediaworks.com/virtuemart-template-and-module-control
You can always go like this
<?php if (JRequest::getVar('view')=='productdetails') Or (JRequest::getVar('view')=='categories') Or (JRequest::getVar('view')=='category') { ?>
<jdoc:include type="modules" name="module-name" />
<?php } ?>
I THINK thats the right syntax
update: <?php if (JRequest::getVar('view')=='productdetails') Or (JRequest::getVar('view')=='categories') Or (JRequest::getVar('view')=='category') { ?>
<div class="lateral"><jdoc:include type="modules" name="lateral" /></div>
<?php } ?>
give me this: Parse error: syntax error, unexpected T_LOGICAL_OR
update: with this works fine
<?php if (JRequest::getCmd('option')=='com_virtuemart') if (JRequest::getVar('view')=='productdetails') if (JRequest::getVar('view')=='categories') if (JRequest::getVar('view')=='category') { ?>
<div class="lateral"><jdoc:include type="modules" name="lateral" /></div>
<?php } ?>
i've changed the word 'or' to 'if' ...
new update from last update: now i've clean the cache and dont work.. argh!
new update from the many others updates (lol): :)
<?php if (JRequest::getVar('view')=='category' or JRequest::getVar('view')=='productdetails' or JRequest::getVar('view')=='categories') { ?>
<div class="lateral"><jdoc:include type="modules" name="lateral" /></div>
<?php } ?>
Many thanks
Now i've found one problem....
JRequest::getVar('view')=='category'
works for blog area Joomla Category and Virtuemart Product category too ... the module is displayed (at left side) in this two areas. :-X
Try the Advanced Module Manager
It will do the trick smoothly
http://www.nonumber.nl/extensions/advancedmodulemanager
humm.... tks Balay :)
But if think it could be more easy and nice in trying to discover the code to do something like:
<?php if
(!( $mod_articles_category == 'hide'
and JRequest::getVar('view')=='category' or JRequest::getVar('view')=='productdetails' or JRequest::getVar('view')=='categories'): { ?>
or
$com_virtuemart == 'view' and JRequest::getVar('hide') == 'com_content' ? lol .. 8)
maybe this could be related with com_content too... I'm yet dont know the diference between categories and category .. lol its only a singular and plural word?! ::)
i dont know the right code to apply in bold zone.. so i'm trying to discover in google too...
lipes, U need to wrap it in a J;;request to check for the component = virtuemart
<?php if (JRequest::getVar('option') == 'com_virtuemart') {
Then execute more ifs
}
OR:
&& (JRequest::getVar('option') == 'com_virtuemart')
Grade A++ to Tampa Bay hero member :P
<?php if (JRequest::getVar('option') == 'com_virtuemart') {?> <?php if (JRequest::getVar('view')=='category' or JRequest::getVar('view')=='productdetails' or JRequest::getVar('view')=='categories') { ?>
<div class="lateral"><jdoc:include type="modules" name="lateral" /></div><?php } ?>
<?php } ?>
begin to understand a little of php @ joomla .. (I think ::) ) .. lol :) it's solved.. uff!
Thanks one more time BanquetTables.pro aka Kaizen Media Works !!
Now the next step is to try to understand what is happening with the VM2 Manufacturer Module (Backend) in vm2 (front end) ..
Quote from: BanquetTables.pro on January 06, 2012, 14:06:34 PM
Quote from: tobisagt on January 06, 2012, 00:37:05 AM
So, the itemid is the solution. It would be nice if someone tell me how to fix it? :-\
Thx.
Tobi
this code
<?php if (JRequest::getVar('view')=='category') { ?>
<jdoc:include type="modules" name="module" />
<?php } ?>
will show the module anytime this &view=category
is in the url. with or without the itemid.
Hi, this is very useful and where exactly have to paste this code?
Thanks
in the index file
Hi, index of template? ???