News:

Support the VirtueMart project and become a member

Main Menu

Module swapping/hiding within the store

Started by unleash.it, December 30, 2007, 04:57:40 AM

Previous topic - Next topic

unleash.it

Just discovered the message icons...;)

I'm not exactly sure if I should be posting this in another category, but this seems to be the only 1.1 forum.

What is the best way, or IS there a way to place certain modules on certain VM pages? Ideally I would like different modules for different product categories and be able to show/hide areas during checkout. I don't think the answer is within the admin, in either Joomla or VM, but can I do it with an IF statement in the template code?

One way I've had success was testing for certain URL parameters with $_get and then showing/hiding a position:

<?php
$vmpage
=($_GET["page"]);
if(strstr($vmpage,"cart")!="" || strstr($vmpage,"checkout")!="" || strstr($vmpage,"account")!=""  {$hiderightbar=TRUE;}
?>


<?php if($this->countModules('right') and $hiderightbar!=TRUE) : ?>
  <div id="right_pos">
    <jdoc:include type="modules" name="right" style="xhtml" />
  </div>
  <?php endif; ?>


For example, this is an attempt to hide my right column during the checkout process. Sort of works, but not ideal. Right now VM URL parameters sometimes disappear (see my other post). Also, I'd like to be able to do this with SEF enabled...when that eventually comes online.

asterix

you can assign a different 'flypage' when you setup your category, which helps where the flypage is used but checkout Im pretty sure is fixed.

vm_user

This is what I use .... The easiest way would be to alter your template with


<?php if(   @$GLOBALS['page'] != "shop.cart"){ ?>

YOUR MODULE

<?php ?>


But this would turn off the whole module so any you didi want displayed would not.

You can also alter your modules directly with

if (mosgetparam($_REQUEST,'page',null) == "shop.cart"|| mosgetparam($_REQUEST,'page',null) == "checkout.index")
    return true;

At the beginning of the module, this will basically output nothing for that module. This will only work if you have turned off displaying the modules title, if not you will have a title with no content.

With modifications to Joomla core files this also can be changed but again a lot of work.
Joomla 1.5.15, VM 1.1.4

unleash.it

Thanks Asterix, I'm aware of that but it doesn't help in assigning certain modules to certain VM page views.

Thanks VM_USER, that is a step in the right direction. Is the @globals variable standard PHP or is it part of the Joomla framework? If framework, do you know the equivalent for Joomla 1.5? I like it better than what I had since this should allow SEF urls, once (if?) they become possible.

I didn't quite understand "this would turn off the whole module" since that is what I'd like to do. Did you mean module POSITION? My solution for this  is to just assign each of these modules to their own positions. That way nothing else gets affected.


KenyaHiker

I lked this way to show and handle modules inside the template flypage.tpl:

<?php if($this->countModules('right')) ?>
<div>
<jdoc:include type="modules" name="right" style="xhtml" />
</div>
<?php ?>

But, it does not work for me and get this error message:

Fatal error: Call to undefined method vmTheme::countModules() in /components/com_virtuemart/themes/default/templates/product_details/flypage.tpl.php on line 29

Can you help me to fix?