how to display the currency symbol? - magento

I used the following code for to display the currency symbol
<?php $_coreHelper = $this->helper('core')?>
<?php echo $_coreHelper->currency('5'); ?>
it displayed like Rs253
I want to display as Rs5
I dont know how to fix it.If anybody know, please help me guys, Thanks in advance

Maybe $this does not have access to helper()
Try
<?php echo Mage::helper('core')->currency(5); ?>

Related

Remove the HTML from renderField output

Is there any way I could strip html out of this?
<?php echo $this->form->renderField('monday'); ?>
In the back end theres a selection where you pick options that show up in a schedule but they are showing up as html and I need them to show up as plain text for the selection.
you can use php strip_tags function
<?php echo strip_tags($this->form->renderField('monday')); ?>
http://php.net/manual/en/function.strip-tags.php.
If you wanna keep some tags, look at the section allowable_tags
You should know that select and option are also html tags and will be removed if you use strip_tags. So you can allow those tags. You can modify your code like this
<?php $field = strip_tags(($this->form->renderField('monday')),'<select><option>');
echo $field;
?>

how to show all custom options in right side in product view page with magento?

I added color,size and warranty in admin in custom options.I want to show these custom options in right column of product view page but it is not showing in right side.
can you please tell me how to show custom options in right side.
If anyone knows this,please help me out.
Thanks!
try below code:
<?php if ($_product->isSaleable() && $_product->hasOptions()):?>
<?php echo $this->getBlockHtml('container1', '', true, true) ?>
<?php endif;?>
<?php if ($_product->isSaleable() && $_product->hasOptions()):?>
<?php echo $this->getBlockHtml('container2', '', true, true) ?>
<?php endif;?>
Amit's code should work. However, can you make sure that the attributes have Visible on Product View Page on Front-end set to yes.

symfony translation for phrase with embedded link_to function

How do you perform translation with an embedded link_to function in the template using Symfony 1.4?
Example:
Please click <php echo link_to('here', sfConfig::get('app_url') ?> for additional info.
I usually do something like this:
echo __("Please click "%placeholder%", array("%placeholder%" => link_to(__("here"), sfConfig::get('app_url'))))
You can also use:
Please click <?php echo __('here') ?> for additional info
Or you can use:
Please click <?php echo link_to(__('here'), sfConfig::get('app_url') ); ?>

How can I pass arguments from view to cportlet in Yii?

I want to pass some arguments from a view to the cportlet widgets called by this view, but it seems doesn't work when I do it like this:
<?php
$this->beginWidget('zii.widgets.CPortlet');
$this->widget('ProductsBrowser',
array('params'=>$params));
$this->endWidget(); ?>
How can I accomplish it succesfully? Please help me! Thanks!!
Do You read documentation?
http://www.yiiframework.com/doc/guide/1.1/en/extension.use#widget this just should work.
The Correct way is as shown
<?php $this->beginWidget('zii.widgets.CPortlet', array(
'params'=>$params)); ?>
//body content
<?php $this->endWidget(); ?>

How to internationalize metas such as title in view.yml?

I'd like to internationalize the strings of my view.yml, I can't find how to do this.
I have a solution that is bad, in my opinion:
metas:
title: <?php echo sfContext::getInstance()->getI18n()->__('TITLE'); ?>
I'd like to find a way to do it without calling "sfConfig::getInstance()". Is it possible?
Never ever use sfContext for I18n in Configuration-Files! In such a case use the setTitle function in the View (not the controller)
<?php $sf_response->setTitle(__('TITLE'));?>
Since include_title() does not translate what it finds in view.yml, I made this very simple function in my custom helper:
function include_translated_title($context)
{
$title = $context->getI18N()->__($context->getResponse()->getTitle());
echo content_tag('title', $title)."\n";
}
Then I use it in my layout.php files:
<head>
<?php include_http_metas() ?>
<?php include_metas() ?>
<?php include_translated_title($sf_context) ?>
This way, I can use translation keys in my view.yml
You can do this in your action instead:
$this->getResponse()->setTitle(sfContext::getInstance()->getI18n()->__('TITLE'));
I dont think there's a way around using sfContext. You might be able to do something like this by getting rid of the default <?php include_title() ?> in your layout/view and the using the template i18n format to internationalise it:
<title><?php echo __('TITLE') ?></title>

Resources