add string to displayed price in magento - php

I'm trying to add a simple string to the display price in Magento. Currently the price displays as $##.## by default. I would like it to read: Price: $##.##
A simple search of the displayed prices brought me to template/catalog/product/price.phtml. This file seems to control price display when there are variables involved. IE, price including tax, excluding tax, special prices, etc...
Which file is controlling the displayed price when there are no variables involved, the default price:
<span class="price">$##.##</span>
Once I figure out where this is located, I'm confident I can append a simple string before the displayed price.
Thanks in advance.

OK. I was suggesting in the comments not to get lost in the if-else statements but I just did also for a few minutes. Finally found it.
Inside this if statement
<?php if ($_finalPrice >= $_price): ?>
there is an other if:
<?php if ($_taxHelper->displayBothPrices()): ?>
On the else statement of this last if there is the part you are looking for.
<?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 0)): // including ?>
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?>
</span>
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?>
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?>
</span>
<span class="weee">(
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
<?php echo $_weeeSeparator; ?>
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?>
<?php $_weeeSeparator = ' + '; ?>
<?php endforeach; ?>
)</span>
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?>
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?>
</span>
<span class="weee">(
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
<?php echo $_weeeSeparator; ?>
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?>
<?php $_weeeSeparator = ' + '; ?>
<?php endforeach; ?>
)</span>
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?>
<span class="regular-price"><?php echo $_coreHelper->currency($_price,true,true) ?></span><br />
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
<span class="weee">
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?>
</span>
<?php endforeach; ?>
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?>
</span>
<?php else: ?>
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php if ($_finalPrice == $_price): ?>
<?php echo $_coreHelper->currency($_price, true, true) ?>
<?php else: ?>
<?php echo $_coreHelper->currency($_finalPrice, true, true) ?>
<?php endif; ?>
</span>
<?php endif; ?>
Each part in this code shows a regular price, depending on the tax settings. Most probably you need only the last part.
<?php if ($_finalPrice == $_price): ?>
<?php echo $_coreHelper->currency($_price, true, true) ?>
<?php else: ?>
<?php echo $_coreHelper->currency($_finalPrice, true, true) ?>
<?php endif; ?>

i'm on magento 1.8, and developing on nearly plain system, when debugging, i'm on
<?php if ($_finalPrice == $_price): ?>
<?php echo $_coreHelper->currency($_price, true, true) ?>
<?php else: ?>
<?php echo $_coreHelper->currency($_finalPrice, true, true) ?>
<?php endif; ?>
round about line 201

Related

foreach PHP something wrong

I have this code in PHP
<?php foreach($this->group('filter') as $i => $fields): ?>
<?php $newField = $this->field('name#'.$i)->value(); ?>
<?php $finalvar = explode(",", $newField); ?>
<a data-filter=<?php foreach($finalvar as $fletter) : ?>".filter_<?php echo standardize($fletter); ?>">
<?php endforeach; ?>
<?php if($this->field('icon#'.$i)->value()): ?><i class="<?php echo $this->field('icon#'.$i)->value(); ?>"></i><?php endif; ?>
<span class="name"><?php if($this->field('label_items#'.$i)->value()): ?><?php echo $this->field('label_items#'.$i)->value(); ?><?php else: ?><?php echo $this->field('name#'.$i)->value(); ?><?php endif; ?>
</span>
</a>
<?php endforeach; ?>
PHP code works but I have a problem on the HTML code. The generated HTML code is this:
<a data-filter=".filter_country">
".filter_capital;
<span class="name">Australia</span>
</a>
My goal is to implement this one:
<a data-filter=".filter_country,.filter_capital"
<span class="name">Australia</span>
</a>
I know it's something in front of me but I cannot see it. Does anyone have an idea concerning the syntax?
Check your syntax:
<?php foreach ($this->group('filter') as $i => $fields) : ?>
<?php $newField = $this->field('name#' . $i)->value(); ?>
<?php $finalvar = explode(",", $newField); ?>
<a data-filter="
<?php
$i = 1;
foreach ($finalvar as $fletter) { ?>
.filter_<?php echo standardize($fletter); ?>
<?php if ($i < count($fletter)) { ?>, <?php } ?>
<?php $i++; } ?>
">
<?php if ($this->field('icon#' . $i)->value()) : ?><i class="<?php echo $this->field('icon#' . $i)->value(); ?>"></i><?php endif; ?>
<span class="name"><?php if ($this->field('label_items#' . $i)->value()) : ?><?php echo $this->field('label_items#' . $i)->value(); ?><?php else : ?><?php echo $this->field('name#' . $i)->value(); ?><?php endif; ?>
</span>
</a>
<?php endforeach; ?>

How To Show "Shop By" left sidebar attribute list in "Dropdown" like as "Sort By" Toolbar?

How To Show "Shop By" left sidebar attribute list in "Dropdown" like as "Sort By" Toolbar?
I want to show attribute list same as "Sort By" Toolbar as Dropdown list.
my toolbar.phtml code is
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license#magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* #category design
* #package base_default
* #copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* #license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
<?php
/**
* Product list toolbar
*
* #see Mage_Catalog_Block_Product_List_Toolbar
*/
?>
<?php
/**
* - Pager moved after sorter. Show pager only if there are pages.
* - Amount and limiter moved inside sorter
* - Changed order of the main elements
*/
?>
<?php if($this->getCollection()->getSize()): ?>
<div class="toolbar">
<?php if( $this->isExpanded() ): ?>
<div class="sorter">
<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="sort-by">
<label><?php echo $this->__('Sort By') ?></label>
<select onchange="setLocation(this.value)">
<?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
<option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
<?php echo $this->__($_order) ?>
</option>
<?php endforeach; ?>
</select>
<?php if($this->getCurrentDirection() == 'desc'): ?>
<a class="category-desc ic ic-arrow-up" href="<?php echo $this->getOrderUrl(null, 'asc') ?>" title="<?php echo $this->__('Set Ascending Direction') ?>"></a>
<?php else: ?>
<a class="category-asc ic ic-arrow-down" href="<?php echo $this->getOrderUrl(null, 'desc') ?>" title="<?php echo $this->__('Set Descending Direction') ?>"></a>
<?php endif; ?>
</div>
<div class="sort-by">
<label><?php echo $this->__('Sort By') ?></label>
<select onchange="setLocation(this.value)">
<?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
<option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
<?php echo $this->__($_order) ?>
</option>
<?php endforeach; ?>
</select>
<?php if($this->getCurrentDirection() == 'desc'): ?>
<a class="category-desc ic ic-arrow-up" href="<?php echo $this->getOrderUrl(null, 'asc') ?>" title="<?php echo $this->__('Set Ascending Direction') ?>"></a>
<?php else: ?>
<a class="category-asc ic ic-arrow-down" href="<?php echo $this->getOrderUrl(null, 'desc') ?>" title="<?php echo $this->__('Set Descending Direction') ?>"></a>
<?php endif; ?>
</div>
<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><span class="per-page"> <?php echo $this->__('per page'); ?></span>
</div>
<?php if( $this->isEnabledViewSwitcher() ): ?>
<p class="view-mode">
<?php $_modes = $this->getModes(); ?>
<?php if($_modes && count($_modes)>1): ?>
<label><?php echo $this->__('View as') ?>:</label>
<?php //Removed spaces from the foreach loop to improve layout of the buttons ?>
<?php foreach ($this->getModes() as $_code=>$_label): ?><?php $codeToLower = strtolower($_code); if($this->isModeActive($_code)): ?><span title="<?php echo $_label ?>" class="<?php echo $codeToLower; ?> ic ic-<?php echo $codeToLower; ?>"></span><?php else: ?><?php endif; ?><?php endforeach; ?>
<?php endif; ?>
</p>
<?php endif; ?>
</div> <!-- end: sorter -->
<?php endif; ?>
<?php //Show pager only if there are pages ?>
<?php if ($pagerHtml = trim($this->getPagerHtml())): ?>
<div class="pager">
<?php echo $pagerHtml; ?>
</div>
<?php endif; ?>
</div>
<?php endif ?>
list.phtml code is
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license#magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* #category design
* #package base_default
* #copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
* #license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
<?php
/**
* Product list template
*
* #see Mage_Catalog_Block_Product_List
*/
?>
<?php
$_productCollection=$this->getLoadedProductCollection();
$_collectionSize = $_productCollection->count();
?>
<?php if ($_collectionSize && $tmpHtml = $this->getChildHtml('block_category_above_collection')): ?>
<div class="block_category_above_collection std"><?php echo $tmpHtml; ?></div>
<?php endif; ?>
<?php if(!$_collectionSize): ?>
<?php if ($tmpHtml = $this->getChildHtml('block_category_above_empty_collection')): ?>
<div class="block_category_above_empty_collection std"><?php echo $tmpHtml; ?></div>
<?php else: ?>
<p class="note-msg empty-catalog"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php endif; ?>
<?php else: ?>
<?php
$_helper = $this->helper('catalog/output');
$theme = $this->helper('ultimo');
$helpLabels = $this->helper('ultimo/labels');
$helpTemplate = $this->helper('ultimo/template');
$helpImg = $this->helper('infortis/image');
//Default image size
$imgWidth = 295;
$imgHeight = 295;
//Aspect ratio settings
if ($theme->getCfg('category/aspect_ratio'))
$imgHeight = 0; //Height will be computed automatically (based on width) to keep the aspect ratio
//Hide toolbar
$hideToolbar = false;
if ($this->getHideToolbar())
{
$hideToolbar = true;
}
?>
<div class="category-products">
<?php if (!$hideToolbar): ?>
<?php echo $this->getToolbarHtml() ?>
<?php endif; ?>
<?php if($this->getMode()!='grid'): //List mode ?>
<?php
//Get list configuration array
$lc = $theme->getCfgGroup('category_list');
//List classes
$listClasses = '';
if ($lc['hover_effect'])
$listClasses = ' hover-effect';
?>
<?php $_iterator = 0; ?>
<ul class="products-list<?php if($listClasses) echo $listClasses; ?>" id="products-list">
<?php foreach ($_productCollection as $_product): ?>
<li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
<?php //Product Image ?>
<div class="product-image-wrapper grid12-4 mobile-grid-half">
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image" style="max-width:<?php echo $imgWidth; ?>px;">
<img src="<?php echo $helpImg->getImg($_product, $imgWidth, $imgHeight, 'small_image'); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
<?php if ($theme->getCfg('category/alt_image')): ?>
<?php echo $theme->getAltImgHtml($_product, $imgWidth, $imgHeight); ?>
<?php endif; ?>
<?php echo $helpLabels->getLabels($_product); //Product labels ?>
</a>
</div> <!-- end: product-image-wrapper -->
<?php //Product description ?>
<div class="product-shop grid12-5 mobile-grid-half">
<div class="product-shop-inner">
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
<h2 class="product-name"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></h2>
<?php if($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
<?php endif; ?>
<div class="desc std">
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
<?php echo $this->__('Learn More') ?>
</div>
</div>
</div>
<div class="right-column grid12-3 mobile-grid-half">
<?php echo $this->getPriceHtml($_product, true) ?>
<?php if($_product->isSaleable()): ?>
<p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<?php
if ($lc['addtolinks_simple'])
echo $helpTemplate->getCategoryAddtoLinks($_product, $this->getAddToCompareUrl($_product), 'addto-gaps-right');
else
echo $helpTemplate->getCategoryAddtoLinksComplex($_product, $this->getAddToCompareUrl($_product), 'addto-gaps-right');
?>
</div>
</li>
<?php endforeach; ?>
</ul>
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
<?php else: //Grid mode ?>
<?php
//Get grid configuration array
$gc = $theme->getCfgGroup('category_grid');
//Get number of columns (from parameter or from theme config)
$columnCount = 3;
if ($this->getGridColumnCount())
{
$columnCount = $this->getGridColumnCount();
}
else
{
$columnCount = $gc['column_count'];
}
//Grid classes
$gridClasses = '';
$productNameClasses = '';
if ($gc['display_name'] == 2 && $gc['display_name_single_line'] == true)
$gridClasses .= ' single-line-name';
if ($gc['display_name'] == 1)
$productNameClasses .= ' display-onhover';
if ($gc['centered'])
$gridClasses .= ' centered';
if ($gc['hover_effect'])
$gridClasses .= ' hover-effect';
if ($gc['equal_height'])
$gridClasses .= ' equal-height';
//Size of grid elements
if ($gc['elements_size'])
{
$gridClasses .= ' size-' . $gc['elements_size'];
}
else
{
//Calculate size based on number of columns
if ($columnCount >= 6)
{
$gridClasses .= ' size-xs';
}
elseif ($columnCount >= 4)
{
$gridClasses .= ' size-s';
}
}
//Container "actions" at the bottom of the grid item stores button and add-to links
//If at least one of those elements was set as "Display on hover" but no element was set as "Display":
//apply appropriate classes to the container.
$actionsClasses = '';
if ($gc['display_addtocart'] == 1 || ($gc['display_addtolinks'] == 1 && !$gc['addtolinks_simple']))
{
$actionsClasses = ' display-onhover';
}
if ($gc['display_addtocart'] == 2 || ($gc['display_addtolinks'] == 2 && !$gc['addtolinks_simple']))
{
$actionsClasses = '';
}
?>
<ul class="products-grid category-products-grid itemgrid itemgrid-adaptive itemgrid-<?php echo $columnCount; ?>col<?php if($gridClasses) echo $gridClasses; ?>">
<?php foreach ($_productCollection as $_product): ?>
<li class="item">
<div class="product-image-wrapper" style="max-width:<?php echo $imgWidth; ?>px;">
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true); ?>" class="product-image">
<img src="<?php echo $helpImg->getImg($_product, $imgWidth, $imgHeight, 'small_image'); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true); ?>" />
<?php if ($theme->getCfg('category/alt_image')): ?>
<?php echo $theme->getAltImgHtml($_product, $imgWidth, $imgHeight); ?>
<?php endif; ?>
<?php echo $helpLabels->getLabels($_product); //Product labels ?>
</a>
<?php //Add-to links
if ($gc['display_addtolinks'] != 0 && $gc['addtolinks_simple'])
{
if ($gc['display_addtolinks'] == 1) //Display on hover
echo $helpTemplate->getCategoryAddtoLinksIcons($_product, $this->getAddToCompareUrl($_product), 'addto-links-icons addto-onimage display-onhover');
else //Always display
echo $helpTemplate->getCategoryAddtoLinksIcons($_product, $this->getAddToCompareUrl($_product), 'addto-links-icons addto-onimage');
}
?>
</div> <!-- end: product-image-wrapper -->
<?php if ($gc['display_name'] != 0): ?>
<h2 class="product-name<?php echo $productNameClasses; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h2>
<?php endif; ?>
<?php if ($_product->getRatingSummary()): ?>
<?php if ($gc['display_rating'] == 1): //Display on hover ?>
<div class="display-onhover ratings-wrapper"><?php echo $this->getReviewsSummaryHtml($_product, 'short') ?></div>
<?php elseif ($gc['display_rating'] == 2): //Always display ?>
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($gc['display_price'] == 1): //Display on hover ?>
<div class="display-onhover"><?php echo $this->getPriceHtml($_product, true); ?></div>
<?php elseif ($gc['display_price'] == 2): //Always display ?>
<?php echo $this->getPriceHtml($_product, true); ?>
<?php endif; ?>
<?php
//If at least one element was set as "Display on hover" but no element was set as "Display":
//aggregate classes from those elements and apply them to the "actions" container.
$actionsClasses = '';
if ($gc['display_addtocart'] == 1 || ($gc['display_addtolinks'] == 1 && !$gc['addtolinks_simple']))
{
$actionsClasses = ' display-onhover';
}
if ($gc['display_addtocart'] == 2 || ($gc['display_addtolinks'] == 2 && !$gc['addtolinks_simple']))
{
$actionsClasses = '';
}
?>
<div class="actions clearer<?php echo $actionsClasses; ?>">
<?php //Cart button ?>
<?php if ($gc['display_addtocart'] != 0): ?>
<?php if ($_product->isSaleable()): ?>
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<?php endif; ?>
<?php //Add-to links
if ($gc['display_addtolinks'] != 0 && !$gc['addtolinks_simple'])
{
echo $helpTemplate->getCategoryAddtoLinks($_product, $this->getAddToCompareUrl($_product), 'addto-gaps-right');
}
?>
</div> <!-- end: actions -->
</li>
<?php endforeach; ?>
</ul>
<?php endif; //end: if grid mode ?>
<?php if (!$hideToolbar): ?>
<div class="toolbar-bottom">
<?php echo $this->getToolbarHtml() ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($_collectionSize && $tmpHtml = $this->getChildHtml('block_category_below_collection')): ?>
<div class="block_category_below_collection std"><?php echo $tmpHtml; ?></div>
<?php endif; ?>

PHP loop interject

Consider the following loop:
<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
<?php if($extraField->value != ''): ?>
<div class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
</div>
<?php endif; ?>
<?php endforeach; ?>
I wanted to wrap the first 12 items in a div and then the last 2 items in a div. The problem is there are not always 12 items exactly in the first div. There can be between 2 AND 12 items.
How would I manipulate this loop to achieve such? Many thanks
Just use a counter inside the loop to see how many times you've been through it.
<?php $count = 1; ?>
<?php $break= count($this->item->extra_fields) - 2; ?>
<?php echo "<div>"; ?>
<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
<?php if($extraField->value != ''): ?>
<div class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
</div>
<?php $count++; ?>
<?php endif; ?>
<?php if ($count == $break) : ?>
<?php echo "</div><div>"; $count ==0; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php echo '</div>'; ?>

Error in template(SJ Financial Joomla) in sj_financial/html/com_content/category/blog_item.php

i installed SJ Financial Template joomla on my website caindiagroup.com,
but when i open article blog on my website, it show an error on sj_financial/html/com_content/category/blog_item.php file..
Fatal error: Class 'JLayoutHelper' not found in /home/caind126/public_html/templates/sj_financial/html/com_content/category/blog_item.php on line 25
Fatal error: Class 'JLayoutHelper' not found in /home/caind126/public_html/templates/sj_financial/html/com_content/category/blog_item.php on line 27
Fatal error: Class 'JLayoutFile' not found in /home/caind126/public_html/templates/sj_financial/html/com_content/category/blog_item.php on line 103
Fatal error: Call to a member function render() on a non-object in /home/caind126/public_html/templates/sj_financial/html/com_content/category/blog_item.php on line 104
My file Code is
`<?php
/**
* #package Joomla.Site
* #subpackage Layout
*
* #copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* #license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;?>
<?php
// Create a shortcut for params.
$params = $this->item->params;
$images = json_decode($this->item->images);
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
$canEdit = $this->item->params->get('access-edit');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.framework');
?>
<?php if ($this->item->state == 0) : ?>
<span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
<?php //intro images ?>
<?php echo JLayoutHelper::render('joomla.content.intro_image', $this->item); ?>
<div class="article-text">
<?php echo JLayoutHelper::render('joomla.content.blog_style_default_item_title, $this->item'); ?>
<?php if (!$params->get('show_intro')) : ?>
<?php echo $this->item->event->afterDisplayTitle; ?>
<?php endif; ?>
<?php echo $this->item->event->beforeDisplayContent; ?>
<?php if ($params->get('show_intro')) : ?>
<?php echo $this->item->introtext; ?>
<?php endif; ?>
<div class="item-headinfo">
<?php if (!$params->get('show_intro')) : ?>
<?php echo $this->item->event->afterDisplayTitle; ?>
<?php endif; ?>
<?php echo $this->item->event->beforeDisplayContent; ?>
<?php // to do not that elegant would be nice to group the params ?>
<?php if (($params->get('show_author')) or ($params->get('show_category')) or ($params->get('show_create_date')) or ($params->get('show_modify_date')) or ($params->get('show_publish_date')) or ($params->get('show_parent_category')) or ($params->get('show_hits'))) : ?>
<dl class="article-info muted">
<!--<dt class="article-info-term"><?php //echo JText::_('COM_CONTENT_ARTICLE_INFO'); ?></dt>-->
<?php endif; ?>
<?php if ($params->get('show_parent_category')) : ?>
<dd class="parent-category-name">
<?php $title = $this->escape($this->item->parent_title);
$url = '' . $title . ''; ?>
<?php if ($params->get('link_parent_category')) : ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT', $title); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_create_date')) : ?>
<dd class="create">
<i class="icon-calendar"></i>
<?php echo JText::sprintf( JHTML::_('date',$this->item->created, JText::_('DATE_FORMAT_LC'))); ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_modify_date')) : ?>
<dd class="modified">
<i class="icon-calendar"></i>
<?php echo JText::sprintf('COM_CONTENT_LAST_UPDATED', JHTML::_('date',$this->item->modified, JText::_('DATE_FORMAT_LC'))); ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_publish_date')) : ?>
<dd class="published">
<i class="icon-calendar"></i>
<?php echo JText::sprintf('COM_CONTENT_PUBLISHED_DATE', JHTML::_('date',$this->item->publish_up, JText::_('DATE_FORMAT_LC'))); ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
<dd class="createdby">
<?php $author = $this->item->author; ?>
<?php $author = ($this->item->created_by_alias ? $this->item->created_by_alias : $author);?>
<?php if (!empty($this->item->contactid ) && $params->get('link_author') == true):?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY' ,
JHTML::_('link',JRoute::_('index.php?option=com_contact&view=contact&id='.$this->item->contactid),$author)); ?>
<?php else :?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_hits')) : ?>
<dd class="hits">
<?php echo JText::sprintf('COM_CONTENT_ARTICLE_HITS', $this->item->hits); ?>
</dd>
<?php endif; ?>
<?php if ($this->params->get('show_tags', 1)) : ?>
<dd class="item-tags">
<?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
<?php echo $this->item->tagLayout->render($this->item->tags->itemTags); ?>
</dd>
<?php endif; ?>
<?php if (($params->get('show_author')) or ($params->get('show_category')) or ($params->get('show_create_date')) or ($params->get('show_modify_date')) or ($params->get('show_publish_date')) or ($params->get('show_parent_category')) or ($params->get('show_hits'))) :?>
</dl>
<?php endif; ?>
</div>
<?php if ($params->get('show_readmore') && $this->item->readmore) :
if ($params->get('access-view')) :
$link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));
else :
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
$link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
$returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));
$link = new JURI($link1);
$link->setVar('return', base64_encode($returnURL));
endif; ?>
<a class="readmore" href="<?php echo $link; ?>">
<?php if (!$params->get('access-view')) :
echo JText::_('COM_CONTENT_REGISTER_TO_READ_MORE');
elseif ($readmore = $this->item->alternative_readmore) :
echo $readmore;
if ($params->get('show_readmore_title', 0) != 0) :
echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
endif;
elseif ($params->get('show_readmore_title', 0) == 0) :
echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE');
else :
echo JText::_('COM_CONTENT_READ_MORE');
echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
endif; ?>
<i class="ico-arrow-right"></i>
</a>
<?php endif; ?>
</div>
<?php if ($this->item->state == 0) : ?>
</div>
<?php endif; ?>
<?php echo $this->item->event->afterDisplayContent; ?>`
Plz help me..
I'm not sure if it helps, but you can try to add following line just after defined('_JEXEC') or die;
require_once(JPATH_ROOT . '/libraries/cms/layout/helper.php');

How to display VAT after price in magento

Im struggling a bit here. Basically, out client want the prices on the listing and product page to exclude VAT which is fine. But they she wan't written after the price '+VAT (£0.00)'.
Obviously the £0.00 will be the exact amount of VAT that will be added onto the product. So if its £20, it will need to say:
£20.00 +VAT (£3.40)
Does anyone know of a way to do this?
thanks.
You need to override price.phtml. Create copy of price.phtml to new_price.phml and call it from catalog.xml file for product listing page. Also enable System->Configuration->Tax->Price Display Settings->Display Product Prices In Catalog : Including and Excluding Tax
Then, in new_price.phtml do some changes as below:
<span class="price-excluding-tax">
<span class="label"><?php echo $this->helper('tax')->__('Price:') ?></span>
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php if ($_finalPrice == $_price): ?>
<?php echo $_coreHelper->currency($_price, true, false) ?>
<?php else: ?>
<?php echo $_coreHelper->currency($_finalPrice, true, false) ?>
<?php endif; ?>
</span>
</span>
<span class="price-including-tax">
<span class="label"><?php echo $this->helper('tax')->__('Vat:') ?></span>
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php //echo $_coreHelper->currency($_finalPriceInclTax, true, false) ?>
<?php if ($_finalPrice == $_price): ?>
<?php echo $_coreHelper->currency($_finalPriceInclTax - $_price, true, false) ?>
<?php else: ?>
<?php echo $_coreHelper->currency($_finalPriceInclTax - $_finalPrice, true, false) ?>
<?php endif; ?>
</span>
</span>
Hope it will help!

Categories