Is it possible to change text directly in the code - magento

I would like to know if there is a way to change text in the code instead of using the admin panel? I have Filezilla installed and can access my site/files from there.
If I use the inspect element in any browser, I can see an HTML structure, but as I have understood there is no HTML document in Magento, right? So where do I go if I want to make a change to a text element on my site and I don't want to use the admin panel?

Most of the text elements are handled by Magento's language translation system.
Quite often, you don't have to mess around hacking templates, just simply add a line to the translation CSV with the text string exactly as it appears, add a comma and then the new text string you want Magento to display.
For example, if you're working with US English, you can use the following file in your own custom template package as follows:
app/design/frontend/default/your_package/locale/en_US/translate.csv
Let's for example, change one of the window shade bar titles in the One Page Shopping Cart. Add a line to translate.csv as follows:
"Billing Information","Billing Address Information"
How this works, in the template the following line normally displays the title:
<?php echo $this->__('Billing Address') ?>
This code snippet $this->__('Billing Address') is a call to Magento's language translation system. It reads the translate.csv file finds Billing Address and changes it to Billing Address Information when it assembles the page html.
Lotta people out there have made changing text like this far harder than it has to be.
Hunting down the proper template, changing the text, finding the template got messed up, or trying to remember after the fact what was changed.
VS.
Changing a simple central file that contains all the text string translations... Often only by adding a new line to the file
Magento actually makes this very simple.

Thank you! So magento stores all text in .csv? or just the stuff that needs to be translated? I'm making a search for .csv via Filezilla but I only get two languages (the site is translated to multiple languages). Should I be looking somewhere else?

Related

Magento: change link from cart

I have Magento 1.7 installed, I have this theme called ves_gift, at the end of the Checkout (before clicking "checkout" actually) I have the terms of agreement:
The checkbox contains a link connected to the "privacy terms".
The point is that is a wrong/broken link, and I need to change its href, how do I fix it?
Also the word "Aaccetto" should be with one A only, not double. "Accetto" is the right word. Where is the translation file for that?
You need to find the template where the HTML contents of the checkbox. Then you can modify as per your wish.
Try installing Magento-Debug from magentocommerce, and find the template being used.
If you want to translate, then use the CSV file for translation in your theme, as per your language rather than hard-coding in Phtml files.
Remmeber : only Html strings echoed with $this->__('MYSAMPLETEXT'); can only be translated. So, in the CSV file you could do
MYSAMPLETEXT,MYTRANSLATEDTEXT
and then magento will translate the string for you, as simple as that.
file path:-
app\design\frontend\default\your-theme\template\checkout\onepage\agreements.phtml
if its work vote for me, and not let me know...
Thanks
Ravi

trying to find a file to edit the div information

So we have a section on our website (category menu) which was modified to include a custom menu system. in the file top.phtml i found the following code
<div >
<?php //echo $_menu;
echo $nf_menu;
?>
</div>
The code inside the div's is calling for the menu, but i need to edit the actual code of the menu as it has inline styles for z-index applied to it and i need to adjust the z-index number.
Where would i find this menu. does that php code indicate where the file may be? Our coder is gone so we are not sure how they did this.
Based on the very limited information you've provided, there are basic ways of finding out where specific code is being generated in Magento (or any other scripting/php based framework).
View the html source (output) of your menu in a browser and find a piece of the menu HTML that would be unique. An example can be a unique class name or something that will set it apart from everything else.
<ul class="nf-menu">
<li>...
Do a site-wide file search for the unique reference you found in step 1. For example, search for <ul class="nf-menu"> or just nf-menu.
Don't know how to search for text in a file? Use the resources you have available to learn how:
For Linux based machines, see Finding all files containing a text string on Linux
Or if you have the files locally, use an IDE program such as phpStorm or Dreamweaver that includes a folder search for files containing a string of text.
Once you've found the file generating the code, simply make the modifications. I'd recommend making a backup of any file you modify so that you can revert to it if you're changes don't work as intended.

CKEditor and HTML in Xpages

I am understanding this better but still not there yet.
I have a notes document with a rich text field. I want to edit it in Xpages, so that the user can enter text for an email that an agent will generate. The idea is that the user should be able to enter styled text, hopefully including pasted graphics, and this is saved to the rich text field in such a way that a later agent can copy that field to the body of an email.
On the form I have checked the field "Store contents as HTML and MIME.
In the Xpage I have bound the CKEditor directly to the field (can bind it to a scope variable if necessary).
The code in my agent is as follows:
Set rtItmFrm = emlDoc.getFirstItem("Body")
Set rtItmTo = New NotesRichTextItem(mail,"Body")
Set rtItmTo = rtItmFrm.Copyitemtodocument(mail,"Body")
Any further suggestions on reading up on MIME/CKEditor etc would also be much appreciated.
Bryan
=========================================================================
I just discovered how to modify the CKEditor in Xpages (the Rich Text Control). I have the full menu and one or two more things turned out. However, I am really puzzled by how it treats HTML. I would like to put a template for a nice HTML email (like a newsletter). Anything even a little complicated it munges and the output is messed up.
I read enough online to understand that it is not supposed to be a HTML editor, but I am really having trouble getting the results I want. I would love to put some basic skeleton HTML in there, but everything but the simplest code doesn't work.
Is there anyway to import HTML and it not get messed up using this editor?
as Per and Stephan said, Have a look at ACF filtering that is 'server side' (This is not related to CKEditor itself, but it is related to XPages).
If you have a look at the inputRichText control you will see 2 properties.
htmlFilter
htmlFilterIn
These properties determine how to filter Html on the way in to your data, and also on the way out.
This can be used to strip styling out, and also to prevent dangerous tags like some bad code here etc.
By Default the htmlFilter is set ACF (Active Content Filtering) if you look at the default rules, you will see it strips things like 'margin' out.
see /properties/acf-config.xml-sample
There is a filter called 'identity' which means don't filter anything, however beware if you use this you are not protected from and maliciously entered html.
You should look into defining your own set of rules for your ACF filter, this way you can choose which elements to remove. There is a section in Mastering XPages book about this.
If you still have any trouble, then there are some settings in CKEditor config which also control ACF (totally separate to XPages server side)
I don't think CKE changes the HTML, it is the writing back to a RT field.
Try and bind your RichText Editor to a scoped variable instead of a RichText field. This way you have access to the raw HTML and can use that to generate a MIME email. You might want to have a look at Mustache for mail merge.
Use this article series as starter how to prepare CK editor to make this possible.
And as Per mentioned: check the filtering.

How to change HTML of "Shipping & Handling" line on cart page

In the shopping cart page of my magento store, there is a line item for Shipping & Handling. I am trying to change the HTML output of this line. I have figured out how to change the actual text "Shipping & Handling - Method" , but I would like to change the actual HTML output. I looked through all of my theme files and could not figure out where to access this. I simply need to add a CSS class for that line so I can style it. Any ideas?
Thank you.
An easier solution to take if you are not a developer is to update the translation of that line of text in your translation file /app/locale/en_US/Mage_Checkout.csv if it isn't already in there just add a line at the end. The first part is what the text currently is and the second is what you want it to read.
tread lightly, it effects that line of text anywhere on your site.
If you just need to style some text add the html of that section and I can help you with a selector.
The file you are looking for is app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php you will
$title = Mage::helper('sales')->__('Shipping & Handling');
Under fetch(Mage_Sales_Model_Quote_Address $address) function and around 20th line. There you can change but editing magento core file is not recommended. So you have two solutions
Copy Shipping.php file in to local code pool and edit there
This is the best way create your own module for override Shipping.php file by extending Mage_Sales_Model_Quote_Address_Total_Shipping class you can find a tutorial of creating module at steve perrys' blog

Multi-language store- Changing custom menu's language dynamically

I am doing Multi-language store in magento. i have some custom menu in header section like how to order, Help etc. .
now currently these menu i have given direct link like
<li>Help</li>
<li>how to order</li>
i am not sure how multi-language feature will work with this menu.. How can i write these top menu as if It will change with language change.
any suggestions will be helpful for me.
thanks
Any text that is hard-coded into your template needs to be wrapped in the translation helper.
echo $this->__('Help');
But make sure the block it applies to has a helper declared, otherwise you'll need to load the generic helper.
Mage::helper('core')->__('Help')
Then, you can edit the relevant translation CSV file. By putting "Help" in the first column, and the translation in the second column.
Although, you'll be able to use translate in-line once you are using the above PHP.

Resources