News:

Looking for documentation? Take a look on our wiki

Main Menu

Module Visibility Control on View Cart

Started by saviB, November 01, 2012, 14:37:28 PM

Previous topic - Next topic

saviB

VM 2.0.12f , Joomla 2.5.7. Is there a way to manage module visibility on the page served up by clicking View Cart (option=com_virtuemart&view=cart) from either the pop up window after product addition or the link in the mini cart? I'm using the full width of the page to display cart contents and I need to shut off the side modules.

I have a menu item set to view cart already and can control the modules for it - but not the system generated version because there is no item ID.

PRO

You can edit your template module position to not diplay on cart page

http://www.kaizenmediaworks.com/virtuemart-template-and-module-control

<?php if (JRequest::getVar('view')!='cart') { ?>
module code here
<?php } ?>

saviB

Thanks! What file does this PHP go into? And, looking through the link you sent, I only see how to create module positions - not disable or remove them. Say I have a VM cart module, named Show Your Cart displayed in sidebar-a. How would I hide it in option=com_virtuemart&view=cart?

It would be great if each view had an ID so we could manage module display through the editor. The new Joomla display/ Hide tools are fantastic.

PRO

actually this is easier

do a template override
http://forum.virtuemart.net/index.php?topic=90935.0

of the cart module

mod_virtuemart_cart/default.php

AFTER this
defined('_JEXEC') or die('Restricted access');

past this
if (JRequest::getVar('view')!='cart') {


then at the bottom of the file
paste this
<?php } ?>

saviB

That worked. So - I'd have to do this for each module I don't want displayed in cart view. Drag! But, I appreciate the fix. Thanks.

bytelord

Hello,

You could use alternative advanced module manager or metamod ... both have a free version. The first one is easier imho. Both have a free version that can done what you want and a lot more...

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

saviB

woooo. Never used Metamod before. Looks great! A bit of a learning curve... So - I would use  if (JRequest::getVar('view')!='cart') { in Metamods PHP field?

AH

Look at the metamod recipes to help work out what to put in the PHP.
Regards
A

Joomla 3.10.11
php 8.0

Menace

Quote from: PRO on November 01, 2012, 14:41:52 PM
You can edit your template module position to not diplay on cart page

http://www.kaizenmediaworks.com/virtuemart-template-and-module-control

<?php if (JRequest::getVar('view')!='cart') { ?>
module code here
<?php } ?>

I looked through the provided codes from kaizenmediaworks.com and I find them very useful.
But like the thread opener already asked:

Where do I have to put the provided codes into?
  :-[


PRO

Quote from: Menace on December 05, 2012, 21:23:40 PM
Quote from: PRO on November 01, 2012, 14:41:52 PM
You can edit your template module position to not diplay on cart page

http://www.kaizenmediaworks.com/virtuemart-template-and-module-control

<?php if (JRequest::getVar('view')!='cart') { ?>
module code here
<?php } ?>

I looked through the provided codes from kaizenmediaworks.com and I find them very useful.
But like the thread opener already asked:

Where do I have to put the provided codes into?
  :-[



you can do this in your template

OR:

open the module/tmpl/default.php

put this at the top

<?php if (JRequest::getVar('view')!='cart') { ?>


then this at the bottom

<?php } ?>

make sure you do not have any open php tags before you put this

Menace

#10
Thx Pro for fast response,

It was a general question about the codes on kaizenmediaworks.
Perhaps I don't understand correctly what you mean by "you can do this in your template"

Let's say I want to use the function of this code:
QuoteCreate a module position for all categories
<?php if (JRequest::getVar('view')=='category') { ?>
<div id="catmod"><jdoc:include type="modules" name="categorymodule" /></div>
<?php ?>

In what file do I have to add this to?


And additionally:
Wouldn't it be the same if I just insert
<div id="catmod"><jdoc:include type="modules" name="categorymodule" /></div>
to the

template/html/com_virtuemart/category/default.php

in exactly the place I want to show a module, create new module and assign it to "categorymodule"?

PRO

Quote from: Menace on December 05, 2012, 21:45:19 PM
Thx Pro for fast response,

It was a general question about the codes on kaizenmediaworks.
Perhaps I don't understand correctly what you mean by "you can do this in your template"

Let's say I want to use the function of this code:
QuoteCreate a module position for all categories
<?php if (JRequest::getVar('view')=='category') { ?>
<div id="catmod"><jdoc:include type="modules" name="categorymodule" /></div>
<?php ?>

In what file do I have to add this to?


And additionally:
Wouldn't it be the same if I just insert
<div id="catmod"><jdoc:include type="modules" name="categorymodule" /></div>
to the

template/html/com_virtuemart/category/default.php

in exactly the place I want to show a module, create new module and assign it to "categorymodule"?


Your JOOMLA template has module positions, and creates them.

SO, to create a new module position, it has to be in the joomla
templates/Your- template/index.php

You cannot create module positions FROM template/html/com_virtuemart/category/default.php

Menace

OK, thank you.

So my problem of misunderstanding might be because I am using a JAT3 Framework based template, which means index.php of the template just loads the JAT3 Framework and has pretty much nothing else in it.

Nevertheless I can say that this:

<div id="catmod"><jdoc:include type="modules" name="categorymodule" /></div>

inserted in my /category/default.php override gives me the output of any module I assign the position "categorymodule" to.

PRO

Quote from: Menace on December 05, 2012, 23:17:24 PM
OK, thank you.

So my problem of misunderstanding might be because I am using a JAT3 Framework based template, which means index.php of the template just loads the JAT3 Framework and has pretty much nothing else in it.

Nevertheless I can say that this:

<div id="catmod"><jdoc:include type="modules" name="categorymodule" /></div>

inserted in my /category/default.php override gives me the output of any module I assign the position "categorymodule" to.

really?

Menace

#14
I hope you're not making fun of me...  :)

If not:
Yes, I use this to insert a div that displays a module with subcategories on my category pages just between the category name and the products.

<div id="catmod"><jdoc:include type="modules" name="categorymodule" /></div>

It works an several, if not all, VM views.
"categorymodule" can be replaced by anything you want as long as you assign the same name for the moduleposition manually.

And still I would much more like to use the kaizenmediaworks.com codes but it seems like I don't get that working. My knowledge is too small for that I guess.

Let's say I will one day find out where to add those codes and I create a moduleposition for all product pages. Where will those positions be? After content? before content?