In opencart 2.0.x on category page last child of breadcrumb text font is need to set as a bold.
Any one please help me.
Thanks
<div class="breadcrumb">
<?php $count = count($breadcrumbs);?>
<?php $i=0; ?>
<?php foreach ($breadcrumbs as $breadcrumb) { ?>
<?php echo $breadcrumb['separator']; ?>
<?php if( $i == $count-1){ ?>
<?php echo '<b>'.$breadcrumb['text'].'</b>'; ?>
<?php }else{ ?>
<?php echo $breadcrumb['text']; ?>
<?php } ?>
<?php $i++; ?>
<?php } ?>
</div>
Go to your front end theme folder category tpl change the breadcrumb div portion with this this code
Related
I'm wondering if anyone can help, I have categories displaying on the left sidebar however it shows all the categories and subcategories. Is there any way to only display the subcategories of the active parent category and hide all the rest?
For instance, If I go to laptops / computers I only want it to show all those subcategories and not all the other categories like cameras etc...
I've tried looking for an extension but am unable to find anything, any advice would be appreciated!
Thanks
<div class="box">
<div class="box-heading"><?php echo $heading_title; ?></div>
<div class="box-content">
<div class="box-category">
<ul>
<?php foreach ($categories as $category) { ?>
<li>
<?php if ($category['category_id'] == $category_id) { ?>
<?php echo $category['name']; ?><span>-</span>
<?php } else { ?>
<?php echo $category['name']; ?><span>+</span>
<?php } ?>
<?php if ($category['children']) { ?>
<ul>
<?php foreach ($category['children'] as $child) { ?>
<li>
<?php if ($child['category_id'] == $child_id) { ?>
- <?php echo $child['name']; ?>
<?php } else { ?>
- <?php echo $child['name']; ?>
<?php } ?>
</li>
<?php } ?>
</ul>
<?php } ?>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
<script type="text/javascript"><!--
$(function(){
$('.box-category a > span').each(function(){
if (!$('+ ul', $(this).parent()).length) {
$(this).hide();
}
});
$('.box-category a > span').click(function(e){
e.preventDefault();
$('+ ul', $(this).parent()).slideToggle();
$(this).parent().toggleClass('active');
$(this).html($(this).parent().hasClass('active') ? "-" : "+");
return false;
});
$('.filter-active span').click();
});
//--></script>
Try to use alternative category module like CR2 SubCategory
In my magento store i have the following code to list out all subcategories as links. I only want to show categories that have Include in Navigation Menu - Yes in the category admin setting though.
<?php $_subcategories = $_category->getChildrenCategories() ?>
<?php if (count($_subcategories) > 0): ?>
<ul>
<?php foreach($_subcategories as $_subcategory): ?>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
<?php echo $_subcategory->getName() ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
I know getIncludeInMenu() can be used to get this setting but when i try and add it into the above it shows no categories?
<?php $_subcategories = $_category->getChildrenCategories() ?>
<?php if (count($_subcategories) > 0): ?>
<ul>
<?php foreach($_subcategories as $_subcategory): ?>
<!-- this makes no categories show -->
<?php if (!$_subcategory->getIncludeInMenu()){} else { ?>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
<?php echo $_subcategory->getName() ?>
</a>
</li>
<?php } ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
UPDATE
With the code above it looks like the recommended getIncludeMenu() function is not working on $_subcategory but it is working if i use it on $_category
Am i missing something on this line to pull in the subcategories/ child categories perhaps?
$_subcategories = $_category->getChildrenCategories()
You can try:
<?php if ($_subcategory->getIncludeInMenu()) { ?>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
<?php echo $_subcategory->getName() ?>
</a>
</li>
<?php } ?>
So I cam across this solution, after your foreach loop for the sub categories reload your sub categories in a variable, hope this makes sense :
<?php foreach($_subcategories as $_subcategory): ?>
<?php $subcat = Mage::getModel('catalog/category')->load($_subcategory->getId()); ?>
<?php if($subcat->getIncludeInMenu()): ?>
<li>
<?php echo $_subcategory->getName() ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$categoryCollection = $objectManager->get('\Magento\Catalog\Model\ResourceModel\Category\CollectionFactory');
$categories = $categoryCollection->create();
$categories->addAttributeToSelect('*');
$categories->addAttributeToFilter('level', array('eq'=>2));
$categories->load();
?>
<?php
foreach($categories as $category):
$catId = $category->getId();
$subcategory = $objectManager->create('Magento\Catalog\Model\Category')->load($catId);
$subcats = $subcategory->getChildrenCategories();
$_helper = $this->helper('Magento\Catalog\Helper\Output');
foreach ($subcats as $subcat) {
$_category = $objectManager->create('Magento\Catalog\Model\Category')->load($subcat->getId());
$_outputhelper = $this->helper('Magento\Catalog\Helper\Output');
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$sitebaseurl = $storeManager->getStore()->getBaseUrl();
$subcaturl = $subcat->getUrl();
if (!$_category->getData('include_in_menu')) {
continue;
}
?>
<a href="<?php echo $subcat->getUrl(); ?>" id="sub_<?php echo $subcat->getId();?>" class="<?php if($subcat->getChildrenCategories()->count()):?>child_sub<?php else:?> no-child<?php endif;?>">
<?php echo $subcat->getName(); ?>
</a>
<?php } ?>
<?php endforeach; ?>
Ive uploaded images to a page in wordpress using the ACF Repeater plugin. The slide transition is working fine but my are not showing. Can anyone help with this ...
The custom field is called 'slides' and there are three images attached to the my home.php page.
Here is my code.
<div id="flexslider_main" class="flexslider">
<ul class="slides">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php $slides = get_field('slides');
$i = 1;
foreach ($slides as $slide){?>
<li>
<img src="<?php echo $slide['image']; ?>" class="slide_image img<?php echo slides; ?>"/>
</li>
<?php $i++;
} ?>
<?php endwhile; else: echo 'No slide images found'; ?>
<?php endif; ?>
</ul>
</div>
<!--Flex Slider-->
From what I can see, you aren't calling the sub-fields, and you removed the "rows" and changed everything to read to "slides"... this is the code I commonly use on the sliders.
<?php
$rows = get_field('slides';
if($rows) {
foreach($rows as $row)
{
?>
<li><img src="<?=$row['image']?>" alt=""></li>
<?
}
}
?>
The area that says 'image' is replaced by the sub-field name. Also make sure that you're setting your "Return Value" on the field options to Image URL.
i want to add additional information under the description for every product in the product page. At the moment i have added custom tab for the additional information, but i want it to be right after the description. I guess i have to edit some code in the product.tpl?
If You have created Your own tab for that additional informaation You already had to edit the product.tpl template file, hadn't You?
Now the only difference between displaying the information in additional tab and after the description part is where You echo Your piece of data... So probably what You have so far is something like:
<div id="tabs" class="htabs">
<?php echo $tab_description; ?>
<?php if ($attribute_groups) { ?>
<?php echo $tab_attribute; ?>
<?php } ?>
<?php if ($review_status) { ?>
<?php echo $tab_review; ?>
<?php } ?>
<?php if ($products) { ?>
<?php echo $tab_related; ?> (<?php echo count($products); ?>)
<?php } ?>
<!-- YOUR OWN TAB -->
<?php echo $tab_mytab; ?>
</div>
<div id="tab-description" class="tab-content"><?php echo $description; ?></div>
<?php if ($attribute_groups) { ?>
<div id="tab-attribute" class="tab-content">
<!-- ... -->
</div>
<?php } ?>
<?php if ($review_status) { ?>
<div id="tab-review" class="tab-content">
<!-- ... -->
</div>
<?php } ?>
<?php if ($products) { ?>
<div id="tab-related" class="tab-content">
<!-- ... -->
</div>
<?php } ?>
<!-- YOUR OWN TAB -->
<div id="tab-mytab" class="tab-content">
<?php echo $my_tab_content; ?>
</div>
Now what You only need to do is to move that <?php echo $my_tab_content; ?> right after the description (description tab):
<div id="tabs" class="htabs">
<?php echo $tab_description; ?>
<?php if ($attribute_groups) { ?>
<?php echo $tab_attribute; ?>
<?php } ?>
<?php if ($review_status) { ?>
<?php echo $tab_review; ?>
<?php } ?>
<?php if ($products) { ?>
<?php echo $tab_related; ?> (<?php echo count($products); ?>)
<?php } ?>
</div>
<div id="tab-description" class="tab-content">
<?php echo $description; ?>
<!-- YOUR OWN CONTENT HERE -->
<?php echo $my_tab_content; ?>
</div>
<!-- ... -->
If you need to add the same text on every product page, you can add it with 'welcome module'. Just put <?php echo $content_bottom; ?> in custom tab you added. Then create new welcome module in admin panel and place it at the bottom of product layout.
How do I insert only the pager in the bottom of product list?
At the top of the product list I want: "Sort by relevance/bestselers/etc" and the "Sort item by: Table/list", this I was able to do.
At the bottom of the product list I only want the pager, I've tried to insert the following code in list.phtml
<?php echo $this->getPagerHtml() ?>
but this php code doesn't work directly on the product list.
How can I make the pager work on the product list and appear at the bottom?
Hello you create new toolbar-bottom.phtml file with following code
i.e app/design/frontend/(base or default)/(default or yourtheme)/template/catalog/product/list/toolbar-bottom.phtml
<?php if ($this->getCollection()->getSize()): ?>
<div class="toolbar">
<div class="pager">
<p class="amount">
<?php if ($this->getLastPageNum() > 1): ?>
<?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
<?php else: ?>
<strong>
<?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?>
</strong>
<?php endif; ?> </p>
<div class="limiter">
<label><?php echo $this->__('Show') ?></label>
<select onchange="setLocation(this.value)">
<?php foreach ($this->getAvailableLimit() as $_key => $_limit): ?>
<option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if ($this->isLimitCurrent($_key)): ?> selected="selected"
<?php endif ?>
<?php echo $_limit ?>
</option>
<?php endforeach; ?>
</select>
<?php echo $this->__('per page') ?> </div> <?php
echo
$this->getPagerHtml()
?>
</div>
</div>
<?php endif ?>
call into bottom of line in app/design/frontend/(base or default)/(default or yourtheme)/template/catalog/product/list.phtml
getToolbarBlock()->setTemplate('catalog/product/list/toolbar-bottom.phtml')->toHtml();
You can do this one of two ways.
1) Using CSS
<div class="category-products">
<div class='top-toolbar'><?php echo $this->getToolbarHtml() ?></div>
...
<div class='bottom-toolbar'><?php echo $this->getToolbarHtml() ?></div>
</div>
In css
.bottom-toolbar .xyz{
display:none;
}
2) Using a Custom module to overwrite getToolbarHtml and
$this->getToolbarHtml('top-toolbar');
$this->getToolbarHtml('bottom-toolbar');
public function getToolbarHtml($toolbar_position)
{
$this->toolbar_position = $toolbar_position;
return $this->getChildHtml('toolbar');
}
Then try to pass $this->toolbar_position to each block to show the section you need
I think this is what you want.
$toolbar = $this->getToolbarBlock();
$toolbar->setCollection($_productCollection);
if($toolbar->getCollection()->getSize() > 0):
echo $toolbar->getPagerHtml(); //Pager
echo $toolbar-> __('Items %s to %s of %s total', $toolbar->getFirstNum(), $toolbar->getLastNum(),
$toolbar ->getTotalNum());
endif;
font:
http://mayankpatel104.blogspot.com.br/2012/07/magento-pagination-without-toolbar.html