Joomla List All Categories - view

I use for a menu-item the style "List All Categories".
I want to edit the code, however I cannot find this file anywhere!
I supposed it should be in components/com_content/views/category but no file I find there seems to be related to the html output.
This is an example of the HTML output:
<div class="categories-list">
<div class="category-item first">
<h3 class="page-header item-title"><a
href="/joomla/index.php/browse/8-eat-meet">
EAT&MEET</a>
</h3>
<img src="/joomla/images/cat1.jpg"/>
</div>
<div class="category-item">
<h3 class="page-header item-title"><a
href="/joomla/index.php/browse/9-dreaming">
DREAMING</a>
</h3>
<img src="/joomla/images/cat2.jpg"/>
</div>
Does anyone know where I can find this file?
Thank you.

That's because categories are generally attached to existing extensions, the majority use case being articles. My assumption here is these are the categories you are referring to. If you selected the "List all categories" menu option from the Articles sub-group, then the assumption is correct. The path is:
components/com_content/views/categories/tmpl
If you would like to change these files, I HIGHLY recommend not editing the core files but using template overrides to customize. See link below for specifics.
http://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core

If it is the categorIES layout that you want that will be in the components/com_content/views/categories/tmpl categories folder (I'm assuming you are talking about in the front end).
The layout files are in the tmpl folder.
In Joomla 3.2 you will find that these files reference the files layouts/content/categories_default.php and layouts/content/categories_default_items.php.
This is because the core layouts are the same for all categories (and they can be used by any component that uses categories).
You can override both the tmpl files and the layouts in the html folder of your template.
Update
Here is the code block in the categories_default_items layout that produces the title, image and description HTML
<h3 class="page-header item-title">
<a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($item->id));?>">
<?php echo $this->escape($item->title); ?></a>
<?php if ($this->params->get('show_cat_num_articles_cat') == 1) :?>
<span class="badge badge-info tip hasTooltip" title="<?php echo JHtml::tooltipText('COM_CONTENT_NUM_ITEMS'); ?>">
<?php echo $item->numitems; ?>
</span>
<?php endif; ?>
<?php if (count($item->getChildren()) > 0) : ?>
<span class="icon-plus"></span>
<?php endif;?>
</h3>
<?php if ($this->params->get('show_description_image') && $item->getParams()->get('image')) : ?>
<img src="<?php echo $item->getParams()->get('image'); ?>"/>
<?php endif; ?>
<?php if ($this->params->get('show_subcat_desc_cat') == 1) :?>
<?php if ($item->description) : ?>
<div class="category-desc">
<?php echo JHtml::_('content.prepare', $item->description, '', 'com_content.categories'); ?>
</div>
<?php endif; ?>
<?php endif; ?>

Related

How to add search box in welcome mesaage bar in Magento 1.9?

I am working on Magento 1.9 . I need to display search box in welcome message bar. It can be managed by hacking CSS but that is not proper way.
Can anybody help me with this situation?
Thanks in advance.
Display hide the search box or remove that by xml and go to app\design\frontend\yourtheme\default\template\page\html open header.phtml and place the below code where you want to show that. now play with css to fix style.
<?php echo $this->getChildHtml('topSearch') ?>
for example
<div class="header-language-background">
<div class="header-language-container">
<div class="store-language-container">
<?php echo $this->getChildHtml('store_language') ?>
</div>
<?php echo $this->getChildHtml('currency_switcher') ?>
<p class="welcome-msg"><?php echo $this->getChildHtml('welcome') ?> <?php echo $this->getChildHtml('accountLinks') ?></p>
<?php echo $this->getChildHtml('topSearch') ?>
</div>
</div>

Magento Export Search Terms and Synonyms

Is there a way to export to csv Search Terms and Synonyms from a current Magento site? I need to then be able to upload to a new Magento site. I am very new to Magento and at this point I have not been able to find anything in the Admin. Other than I was able to export the Search Terms from the reports section of the Admin.
We are using Magento Connect
Thank you in advance.
please have a look at magento commerce guideline for this:
http://www.magentocommerce.com/knowledge-base/entry/popular-search-terms
then to disaply you can use following code as a start point
<h3><?php echo $this->__('Popular Search Terms') ?></h3>
<?php if( sizeof($this->getTerms()) > 0 ): ?>
<div class="box base-mini mini-product-tags">
<div class="content">
<ul class="bare-list">
<?php foreach ($this->getTerms() as $_term): ?>
<li><?php echo $this->htmlEscape($_term->getName()) ?></li>
<?php endforeach; ?>
</ul>
</div>
</div>
<?php else: ?>
<div class="note-msg">
<?php echo $this->__('There are no search terms available.'); ?>
</div>
<?php endif ?>
Hope this helps
Also you might need to use following
$searchCollectino=Mage::getModel('catalogsearch/query')->getCollection()
->setPopularQueryFilter()
->setPageSize($limit);

Dynamic Magento Top-Level Category Pages

I'm redesigning a client's top-level category pages and I would like to future-proof the design by making it dynamic. To further clarify, I want it so whenever the client adds, edits or removes a category below the current level, it would reflect that on the frontend without the need of editing code.
Now, I have come across some blog posts on the topic and even a Stack forum post:
http://www.templatemonster.com/help/magento-listing-sub-categories-on-a-category-page.html
how to display thumbnail from category using getThumbnailUrl() in Magento
However, these are both handling it differently. The Stack post also lead me to:
http://www.douglasradburn.co.uk/getting-category-thumbnail-images-with-magento/
Which I found out I needed to add the functionality for pulling the Thumbnail Image (way to go Magento). BUT, this is what I need! The end goal here is to use the Thumbnail Image on the backend of the Category, NOT the Image. We're using the Image elsewhere, as intended. I also would like to be able to pull in the category description from the backend to the frontend for the purpose of adding some extra information such as links, a true description, etc.
If there anyone who can help me? I went through the above examples and links and still, the Thumbnail images were not pulling to the frontend and overall, I'm just getting some weird behaviour. Any tips would be appreciated as I research this further myself.
Thank you!
Please Try below code. I have implemented the same with this
<?php $category_path = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."catalog/category/"; ?>
<?php if (!Mage::registry('current_category')) return ?>
<?php $_categories = $this->getCurrentChildCategories() ?>
<?php $_count = is_array($_categories)?count($_categories):$_categories->count(); ?>
<?php if($_count): ?>
<div class="static-page-listing static-page-listing1">
<ul class="products-grid">
<?php $num = 0; ?>
<?php foreach ($_categories as $_category): ?>
<?php if($_category->getIsActive()):
$num++;
$selImage = "SELECT value FROM catalog_category_entity_varchar WHERE attribute_id = '126' AND entity_id = '".$_category->getId()."'";
$catImage = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchOne($selImage);
if(!$catImage) $catImage = "no_image.jpg"; ?>
<li class="category-item <?php if($num%2==0) echo 'item-right'?>">
<a href="<?php echo $this->getCategoryUrl($_category) ?>">
<div style="float:left; width:100%;">
<img src="<?php echo $category_path.$catImage?>">
</div>
<div>
<h3><?php echo $this->htmlEscape($_category->getName()) ?></h3>
<h6 style = "color:red;">VIEW ALL</h6>
</div>
</a>
</li>
<?php endif; ?>
<?php endforeach ?>
</ul>
</div>
<?php endif; ?>
NEW UPDATE:
The below code works:
<?php echo $cur_category->getDescription(); ?>
However, you need to be sure to check your Scopes! Not realizing my individual Store Scopes were not checked off to follow the "All Scopes" default, I fixed that and the above code worked for me when added to the "DESCRIPTION" area!
Thanks Stack!
PREVIOUS UPDATE:
I now have code working that I found online, it involved me adding a function to pull the category thumbnail image. It works! Here is the mark-up for the template:
<div class="category-products">
<ul class="products-grid">
<?php
$_categories=$this->getCurrentChildCategories();
if($_categories->count()):
$categorycount = 0;
foreach ($_categories as $_category):
if($_category->getIsActive()):
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
$catName = $this->getCurrentCategory()->getName();
if ($categorycount == 0){
$class = "first";
}
elseif ($categorycount == 3){
$class = "last";
}
else{
$class = "";
}
?>
<li class="item <?=$class?>">
<a href="<?php echo $cur_category->getURL() ?>" title="<?php echo $this->htmlEscape($cur_category->getName()) ?>">
<img src="<?php echo $cur_category->getThumbnailUrl() ?>" width="100" alt="<?php echo $this->htmlEscape($cur_category->getName()) ?>" />
</a>
<h2>
<a href="<?php echo $cur_category->getURL() ?>" title="<?php echo $this->htmlEscape($cur_category->getName()) ?>">
<?php echo $this->htmlEscape($cur_category->getName()) ?>
</a>
</h2>
<p>
DESCRIPTION
</p>
</li>
<?php
endif;
if($categorycount == 3){
$categorycount = 0;
echo "</ul>\n\n<ul class=\"products-grid\">";
}
else{
$categorycount++;
}
endforeach;
endif;
?>
</ul>
Now, where you see "DESCRIPTION," I would like to pull the category description data from the backend and have it output there. Basically, allowing dynamic creation/revision of top-level category pages.
How can I pull the description though? I'm not an expert in Magento, maybe I'm missing something basic but I can't get it working.
Thank you!

magento show tab if content exists

i'm using the tab.phtml from the modern theme to create product tabs, however i've switched this to using jquery and jquery-ui as i needed to link to a tab directly.
So in a nut shell the code is pretty much the same as the one found in the modern theme.
<div id="tabs">
<ul>
<?php foreach ($this->getTabs() as $_index => $_tab): ?>
<?php if($this->getChildHtml($_tab['alias'])): ?>
<li class="<?php echo !$_index?' active first':(($_index==count($this->getTabs())-1)?' last':'')?>"><?php echo $_tab['title']?></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<div class="clearer"></div>
<?php foreach ($this->getTabs() as $_index => $_tab): ?>
<?php if($this->getChildHtml($_tab['alias'])): ?>
<div class="product-tabs-content" id="<?php echo $_tab['alias'] ?>"><?php echo $this->getChildHtml($_tab['alias']) ?></div>
<?php endif; ?>
<?php endforeach; ?>
</div>
and i'm adding the custom tabs using the same method under catalog.xml:
<action method="addTab" translate="title" module="catalog"><alias>how-to-use</alias><title>How to Use</title><block>catalog/product_view</block><template>catalog/product/view/how-to-use.phtml</template></action>
however i've noticed that the tab 'upsells' only appears when there are upsell products assigned. I'm wanting to use this same functionality to display a custom product attribute if there is content to display.
So what i'm asking is how does the upsell detect that there are no products assigned so no tab is displayed so i can do this for my custom tab. my custom tab phtml file looks like this:
<?php $_howtouse = $this->getProduct()->getHowToUse(); ?>
<?php if ($_howtouse): ?>
<div class="std">
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_howtouse, 'howtouse') ?>
</div>
any help greaty received thanks :)
The first line of code in upsell.phtml controls the appearance:
<?php if(count($this->getItemCollection()->getItems())): ?>
I am speculating your code is simply evaluating to true and always showing that section. What is your output from $this->getProduct()->getHowToUse() ?
It turned out i had 1 line above my:
<?php $_howtouse = $this->getProduct()->getHowToUse(); ?>
which meant it registered as there being some content all be it white space.
got rid of the whitespace it now works.

Magento Add url link to open a specific product tab

Magento 1.7.0.0
ok i'm using the product tabs that are available in the modern theme. I've added a custom tab to add reviews as a tab [sucess].
Now where it says:
'Be the first to review this product'
i want this link to go to the tab on that page and not go off to the reviews page.
i realise i need to some javascript but it's just i can't work out how to call a tab.
any ideas?
thanks.
Andy.
if you already using jQuery... you could just simply "hack" it out like this
jQuery(document).ready(function($){
$("#addreview").attr("href", "#review-form");
$("#addreview").click(function(){
$(".product-tabs").children("li").removeClass("active");
$("#product_tabs_reviews").addClass("active");
$(".product-tabs-content").css("display", "none");
$("#product_tabs_reviews_contents").css("display", "block");
});
});
be aware to change the selector according to your own markup
My code looks like this in tabs.phtml:
<div id="tabs">
<ul>
<?php foreach ($this->getTabs() as $_index => $_tab): ?>
<?php if($this->getChildHtml($_tab['alias'])): ?>
<li class="<?php echo !$_index?' active first':(($_index==count($this->getTabs())-1)?' last':'')?>"><?php echo $_tab['title']?></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<div class="clearer"></div>
<?php foreach ($this->getTabs() as $_index => $_tab): ?>
<?php if($this->getChildHtml($_tab['alias'])): ?>
<div class="product-tabs-content" id="<?php echo $_tab['alias'] ?>"><?php echo $this->getChildHtml($_tab['alias']) ?></div>
<?php endif; ?>
<?php endforeach; ?>
</div>
and then adding:
jquery-ui-tabs.js and the relevant .css

Resources