Linebreak in magento product description when NOT using wysiwyg - magento

I have a Magento webshop with over 17.000 products. Products and their description are imported from CSV files. The descriptions have linebreaks in them - but these are not translated to the frontend view due to the fact the Wysiwyg editor isn't used.
I have found tons of ways to remove extra linebreaks when the wysiwyg editor is used, but none that would help me to add linebreaks when the text editor is used.
Is it possible to automatically add these linebreaks or paragraphs to the content in the normal / standard text editor automatically? And if so, how do I best proceed?

It may be that your theme overrides the default behaviour in Magento with regard to applying line breaks via php. In the file;
app\design\frontend\base\default\template\catalog\product\view\description.html
You'll see it outputs the description like;
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description') ?>
It may be that the easiest thing to do is use the same technique used with the short description in the base package and apply the php function nl2br to it to get your imported line breaks;
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), nl2br($_description), 'description') ?>

Related

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>

Magento add custom text in prices

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

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.

HTML Purifier is breaking SyntaxHighlighter

I'm using the SyntaxHighlighter plugin for CKEditor to insert code into my pages. The plugin uses <pre> tags to contain the code whilst making use of "brush" classes to define the programming language. My problem is that upon submission of the page HTML Purifier is stripping the class attribute from the pre tags, which effectively prevents the syntax highlighting from occurring.
The source code goes from:
<pre class="brush:php;">
<?php echo '<p>Hello World</p>'; ?>
</pre>
to:
<pre>
<?php echo '<p>Hello World</p>'; ?>
</pre>
I'm hoping there is some magical setting to stop HTML Purifier from doing this.
The reason is brush:php is not a valid class name per the HTML4 specification. I guess you could write your own class name validator and override the builtin using http://htmlpurifier.org/docs/enduser-customize.html
But a better solution might be to run the syntax highlighting before you run HTML Purifier!

Remove Trailing Slash from Magento URL

I understand there are many answered questions on this particular issue but I haven't found anything specific to Magento, and I was wondering if changing the .htaccess file will have repercussions in my Magento store.
Basically I have links in my navigation that go straight to a filtered category page so they look as follows..
Example.com/hairproducts.html?manufacturer=412
However when I click these links they end up navigating to the URL with a trailing slash...
Example.com/hairproducts.html?manufacturer=412/
which then ignores the filter and takes them to the category page.
Cheers for any help.
I assume you have the urls generated in a phtml file like this:
<?php echo $this->getUrl('hairproducts.html?manufacturer=412'); ?>
or in a block/page content like this
{{store url="hairproducts.html?manufacturer=412"}}
Change them to this:
In a phtml file:
<?php echo $this->getUrl('', array('_direct'=>'hairproducts.html', '_query'=>'manufacturer=412'); ?>
or in a block/page content
{{store _direct="hairproducts.html" _query="manufacturer=412"}}
If I assumed wrong then post the way you are generating the urls.

Resources