Magento add custom text in prices - magento

I'm trying to write the word "+IVA" in all the product prices. Where can I change that so I can have something like the following screenshot?:

Another option is using CSS property :after
.class:after {
content:"+IVA";
color:red;
font-size:12px;
}
You can style it however you want.

If the text never changes, I'd just hard code it to the template, maybe in template/catalog/product/list.phtml after the getPriceHtml() line.

In theme's product listing file (template/catalog/product/list.phtml) after <?php echo $this->getPriceHtml($_product, true) ?> you can write '+IVA'. But you need to write it twice as there are list and grid view separate. So search for it and after that code write down '+IVA' text

Related

Processwire Add css class to page

I there a possibility to add a classname to a page?
I can't figure out how to implement such feature or if it already exists.
I'm using Processwire 3.0.42.
Put something like this in your template where the body is:
<body class="<?php echo $page->template->name; ?>">
That will give your page body tag a class equal to page template name.
You can add a page title in the same way.
<body class="<?php echo $page->name; ?>">
Don't be worried about adding a class to every page. The overhead of doing this is negligible.
If you wish to add a different class you would need to add a field to your template and append it to the code above.
As always in ProcessWire, everything is under your control. Alternatives to #ivangretsky's perfectly good answer would include-
Simply include a conditional in your template file. (This doesn't scale well if you need to add other classes to other pages using the same template.)
<?php
$bodyClass = '';
if($page->id == 1021) $bodyClass = 'my-class';
?>
<body class="<?php echo $bodyClass; ?>">
NB Using $page->id is better than $page->name, for example, as the ID doesn't change while the name could.
You could also add a field to the page template definition. Add a field called something like 'Body Class'. Then use the content of that field in your template file.
<body class="<?php echo $page->body-class; ?>">
This will scale better than my other suggestion, and there are options in the ProcessWire backend to hide or partially hide the field during normal use if you don't want users messing with its value.
One 'gotcha' from the CSS spec to be aware of is that CSS identifiers, including class names and IDs cannot start with a digit, so you cannot just use $page->id.
There are lot of options and it depends on your needs and maybe imagination :-).
You can use page name, template name, page id, or maybe combination.
<body class="<?php echo $page->template->name; ?> page-id-<?php echo $page->id; ?>">
// Output
<body class="your-template-name page-id-1234">
This way you can target template, page, or both.
Or, as mentioned by #ivangretsky, you can add custom field to page. And again, you can combine this aproach with template name, etc.
It depends on your needs and what you want to achieve.
Notice:
Using $page->id is better than $page->name, as the ID doesn't change while the name could. #DaveP

remove date from the reviews (comments) section in magento

I want to know how I can remove date from the reviews (comments) section in magento. I have tried removing the date code many time from the back-end, but still it is showing the date.
The elements you want to hide are of class .review-meta
If you're happy just to hide them rather than remove the code completely, simply add the following style to your css:
.review-meta{
display:none;
}
Alternatively, if you wish to completely remove the relevant code then copy the folder from app/design/frontend/base/default/template/review into your custom layout directory (eg. app/design/frontend/rwd/my_custom_layout/template), and then within the copy edit the file review/product/list.phtml as follows:
Remove the following code:
<span class="review-meta">
<?php echo $this->__('Review by %s', $this->escapeHtml($_review->getNickname())) ?>
/
<?php echo $this->__('(Posted on %s)',$this->formatDate($_review->getCreatedAt()), 'long') ?>
</span>

Allow HTML input in Joomla Contact input fields

By default, Joomla seems to strip and remove any HTML content entered into the Contact details.
I want to add line breaks to the address textarea box. Now, I understand I need to add filter="raw" to the XML file, which would mean hacking the core. (from this article: http://docs.joomla.org/Textarea_form_field_type)
Is there anyway to do this via an override instead?
My idea :
Make an overide of this file : "components\com_contact\views\contact\tmpl\default_address.php"
Replace <?php echo $this->contact->address .'<br/>'; ?> by <?php echo str_ireplace('-br-' ,'<br />', $this->contact->address) .'<br/>'; ?>
When you provide an adress, write "-br-" for each break line.

Display attribute image instead of text

I figure out how to show attribute in category of product list, what I need is to display an image instead of text.
Eg. I have an attribute text ASUS and a image located in media/brands/ named asus.gif or instead of Western-Digital display image located in media/brands/western-digital.gif.
I hope you understand
What you want to do is
<img src="<?php echo $this->getMediaUrl(); ?>brands/<?php echo strtolower($_product->getManufacturer()); ?>.png" />
getManufacturer may be the attribte, change it, if needed.
I found the solution:
<?php $brand=$_product->getAttributeText('manufacturer');
echo '<img style="float: right; margin: 2px;" src="/media/catalog/brands/'.str_replace(' ', '_',$brand).'.gif" alt="'.$brand.'">' ?>
If your attribute is a dropdown one you could add a new column in the table eav_attribute_option_value and in the "manage options/labels" tab of the manage attribute page in the admin panel. For each option values, next to each store traduction, you could store the name of your image and retrieve it in your templates.. it require some development but it's doable and easy to administrate.
Or the quick and dirty way : use the admin label string, lowercase it and clean to retrieve an image related filename
In the Magento 1.7.0.2 you can accomplish this in a very easy way...
All you do is create a new attribute, and select 'media image' from the 'catalog input type..' dropdown.

Magento - remove "price.phtml" from the category list of products

I want to remove the prices from the category list of products. I search exactly to remove the link to the reference template file price.phtml;
In which xml layout files can I find it exactly?
I don't think a layout XML file can be that selective. Edit the file template/catalog/product/list.phtml and remove all instances of this:
<?php echo $this->getPriceHtml($_product, true) ?>
Alternatively you could hide it with CSS, but this wouldn't hide it from search engines if that's your intention:
.category-products .price-box { display: none; }

Resources