Joomla module visible in article but not in category - php

I have a problem with Joomla!. Is there a way to set a module visible in certain category but not in the articles? (so it will display on the category page, but not in the articles of that category or in subcategories)
I had the oposite problem on previous works and fixed it with some cat id's and php in the index.php, but I don't know how to achieve this effect, is someone there that had the same problem and fixed it?
Regards

create a override of the category view in template/your_template/html/ folder and use the following code inside the override file :
<?php
$document = JFactory::getDocument();
$renderer = $document->loadRenderer('modules');
$position = "YOURPOSITIONNAME";
$options = array('style' => 'raw');
echo $renderer->render($position, $options, null);
?>

Is this useful ?
I don't develop on Joomla, but i found this link.
http://www.inmotionhosting.com/support/edu/joomla-25/extensions/modules-on-homepage

Why not use Advanced Module Manager which has several advanced options that will suit your requirement https://www.regularlabs.com/extensions/advancedmodulemanager#free-vs-pro .

Related

How to get all categories and subcategories name in Virtuemart

i created a HTML module and loaded in virtuemart category layout but i need to show all category and subcategory name list so that when user added new category in future , it will updated automatically . no need to hardcode every time. please help on this topic. you can load these categories name by using while loops in PHP. please reply fast.
Try this,
If you are doing with module then in your module file(mod_yourmodule.php) add the following codes.
if (!class_exists( 'VmConfig' )) require(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'config.php');
$categoryModel = VmModel::getModel('Category');
$cats = $categoryModel->getCategoryTree();//Params $parentId=0, $level = 0, $onlyPublished = true,$keyword = ''
echo "<pre/>";
print_r($cats);
Hope its helps..
As VirtueMart don't provide this hierarchical structure at front-end you have to build your own method. Though at back-end you can use #Jobin's answer. I have implement and tested it for the front-end, it works with ease. Check the answer here
https://webkul.com/blog/get-parent-child-categories-hierarchical-tree-joomla-virtuemart/

Joomla module, get menu id (ItemID) from article ID

So i've been searching and testing for a couple days and can't seem to figure this out.
I'm using the K2 content module and I need to add "?Itemid=111" to the end of the URL's it generates for the "Read More" link on pages.
This is not done by default and i've found where I can add it, but i'm having problems getting the Itemid (menu id) from the article id.
All the examples i've found use
$app = JFactory::getApplication();
$menu = $app->getMenu();
$activeId = $menu->getActive()->id;
And that works, whenever you're on that page, and it does add the correct ID. But for the articles I display on the homepage it does not work correctly as it adds the Itemid (menu id) of the homepage, and not the menu id of that specific article.
Before when using Joomla 1.5 I would use the built-in function
getItemid($articleid)
That doesn't seem to work for me anymore.
Does anybody have any suggestions or can anybody point me in the right direction on how I could solve this and "Get menu id (Itemid) from the article id"?
Thanks!!!
You can get menu id of an article using the below code-
$link = 'index.php?option=com_content&view=article&id='.(int)$articleId ;
$menu = JSite::getMenu();
$menuItem = $menu->getItems( 'link', $link, true );
$Itemid = $menuItem->id;
Hope this will help.

Custom Taxonomy Term page in Drupal 7

I'm trying to make a custom Taxonomy Term page in Drupal 7. I've created a page--taxonomy.tpl.php file in my templates folder. The file only prints out a message. I now try to force the template file by adding
function template_preprocess_page($variables) {
if (arg(0) == 'taxonomy') {
$variables['template_file'] = 'page--taxonomy-tpl';
}
}
in my template.php, but it won't work. Can you help me? And if I get the custom page working, how do I fetch the nodes with this term (in page--taxonomy.tpl.php)? Thanks in advance.
Try using this in your template.php:
function template_preprocess_page(&$variables) {
if (arg(0) == 'taxonomy') {
$variables['theme_hook_suggestions'][] = 'page__taxonomy';
}
}
You need to pass $variables by reference, so add a & before it
template_file has changed to theme_hook_suggestions in Drupal 7
You don't need the -tpl in the template suggestion unless you want it to be a part of the filename like "page--taxonomy-tpl.tpl.php" which I don't think is what you want.
For more information, check out template_preprocess_page(), theme_get_suggestions() and Working with template suggestions
Not sure if this would meet your requirements, but one of default D7 views - Taxonomy term - emulates Drupal core's handling of taxonomy/term pages. You could just enable it (it would automatically replace Drupal's core taxonomy URLs), and then do whatever you want with it, keeping original page structure, all blocks etc, using Views' page templates (see "Theming information" in "Advanced") and all other bells and whistles...
Since you are using Drupal 7, you could also create a file name "taxnomy-term.tpl.php" and edit according to your needs.
See taxonomy-term.tpl.php
Full control over the taxonomy term page can be obtained using hook_menu_alter() . See https://drupal.stackexchange.com/questions/48420/theming-and-overriding-taxonomy-term-vocabulary-page/111194#111194

virtumart in joomla

I have made a site site in joomla & in this i use Virtuemart.
In virtumart when user purchse the item then there is a thank page. In this thank page i want to add one module which contain text so that user can change it later. But i am not be able to show it on thanks page. I want to show this module in thanks page data means in between the data not at bottom of thanks page.means in between the lines of thanks page. how can i include my custom module in thanks page of virtuemart.
You need to do some programming for something like this...
Check this out http://docs.joomla.org/JModuleHelper/renderModule
You can install JUMI, modify the Thank You article and add following php script to the article:
jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule( 'yourmodule', 'You Module Title' );
$attribs['style'] = 'xhtml'; // this is optional, if set template XHTML style will be used
echo JModuleHelper::renderModule( $module, $attribs );

Joomla breadcrumbs only shows "Home"

I'm using the built-in Joomla! breadcrumb module, but nothing shows up but "Home" on all my pages.
I looked # the internals of the module, and inside /modules/mod_breadcrumbs/helper.php
$pathway = &$mainframe->getPathway();
$items = $pathway->getPathWay();
When I do a print_r on $items, the only thing in the array is "Home". My menus and sub-menus work fine, my urls show up as http://foobar.com/foo/bar
I failed to set a default menu, this caused all the problems.
I think you need to check your menu structure. I don't remember exactly how the breadcrumbs work, but it should run off the main menu. Do you need to make your menu items sub-menu items of "Home"?
EDIT: on second thoughts, I'm pretty sure it runs off the Section/Category listings. So you'd need to categorise all your articles.
This is joomla 1.5 breadcrumbs concept
$pathway =& $mainframe->getPathway();
$pathway->addItem( JText::_( 'Your Uploads' ),'index.php?option=com_useruploads');
$pathway->addItem('Edit Product');

Categories