Magento translate.csv file not loading - php

I created a new package/theme/skin from scratch in Magento 1.9.1.
The theme and skin load fine. I tried adding translations and cannot get them to load. All cache settings are disabled.
I've added the CSV file here:
/app/design/frontend/{my_package}/{my_theme}/locale/en_US/translate.csv
translate.csv:
"testing123","Translation Worked"
header.phtml
<?= $this->__('testing123') ?>
I added {my_theme}, which for me is named "responsive" to the admin at the :
The result is the header displaying 'testing123' instead of the translated 'Translation Worked'. What have I missed? How do I troubleshoot this?
Update:
I've also added translate.csv to config.xml (and it still does not work). However, It DOES work if I move the translate.csv to app/locale/en_US but it DOES NOT work in app/design/frontend/{my_package}/{my_theme}/locale/en_US/translate.csv where I want it. How can I tell it to load from the theme folder?
config.xml:
<?xml version="1.0"?>
<config>
<modules>
<MyModule_Templates>
<version>0.1.0</version>
</MyModule_Templates>
</modules>
<frontend>
<translate>
<modules>
<MyModule_Templates>
<files>
<default>translate.csv</default>
</files>
</MyModule_Templates>
</modules>
</translate>
</frontend>
<global>
<page>
<layouts>
<mymodule_default translate="label">
<label>MyModule Default Layout</label>
<template>page/default.phtml</template>
<layout_handle>mymodule_default</layout_handle>
</mymodule_default>
</layouts>
</page>
</global>
</config>

Seems, You forgot to add translate.csv to your module's config.xml.
Please take a look.
http://inchoo.net/magento/how-to-add-your-own-translations-to-custom-modules/

i struggled with the same problem. Solution for me was to change the translation Source in the Admin Area.
Go to : Configuration -> select your Store view ( new Translation ) -> General -> under "options for localisation" uncheck the box and choose which translation you want to use. Afterwards, the translate.csv gets loaded and the translation works.
Cheers,
moktor

Related

Local custom module not recognized in magento 1.9.1.0

I have created three different modules for magento custom column layout, magento custom prices and magento custom file extension(this extension supposed to allow any video file) inside the code/local codepool folder.
I followed the folder structure of each module from the code/core codepool. However these modules are not recognized.
To test if my code is correct, I paste the magento custom column layout config.xml code to app/code/core/Mage/Page/etc to update it and it works.
Question:
How can my code works in code/local codepool?
This is a portion of my working magento custom column layout config.xml file.
<layouts>
<empty module="page" translate="label">
<label>Empty</label>
<template>page/empty.phtml</template>
<layout_handle>page_empty</layout_handle>
</empty>
<one_column module="page" translate="label">
<label>1 column</label>
<template>page/1column.phtml</template>
<layout_handle>page_one_column</layout_handle>
<is_default>1</is_default>
</one_column>
<full_column module="page" translate="label">
<label>Full 1 column</label>
<template>page/full1column.phtml</template>
<layout_handle>page_one_column_full</layout_handle>
<is_default>1</is_default>
</full_column>
<two_columns_left module="page" translate="label">
<label>2 columns with left bar</label>
<template>page/2columns-left.phtml</template>
<layout_handle>page_two_columns_left</layout_handle>
</two_columns_left>
<two_columns_right module="page" translate="label">
<label>2 columns with right bar</label>
<template>page/2columns-right.phtml</template>
<layout_handle>page_two_columns_right</layout_handle>
</two_columns_right>
<three_columns module="page" translate="label">
<label>3 columns</label>
<template>page/3columns.phtml</template>
<layout_handle>page_three_columns</layout_handle>
</three_columns>
</layouts>
Thanks!
Config.xml is just the configuration file of your module and it's not intended for (direct) layout updates. For this purpose you have to create one config.xml file for each module and, in this files, create the XML instructions, through XML node "updates", that say to magento "this is the path for the layout file of this module":
...
<frontend>
...
<layout>
<updates>
<(modulename)>
<file>(name_of_layout_file.xml)</
</(modulename)>
</updates>
</layout>
</frontend>
From: Frontend (Magento - Wiki - config.xml Reference)
Now, you have to create that file within the layout folder of your template, putting inside all the code you need to update the global layout.
More infos:
Adding Additional Layout XML Updates via Modules (Jan 2012; by Alan Storm)
Sorry it's been a while since I post this question. I have been in a vacation for the past weeks so I don't have time to visit this page.
I already figure out the solution for this kind of problem.
Every custom module that a developer will create should register it first to app/etc/modules folder.
Step 1: I followed the folder structure from the app/code/core and put it on the app/code/local. The structure goes like this app/code/local/Mage/Page/etc/config.xml
Step 2: To register my new modules. I Created an .xml file in app/etc/modules and name it any name I want.
Step 3: I open the .xml file I have created and add this piece of code
<?xml version="1.0"?>
<config>
<modules>
<Mage_Page><!-- <Mage_Page> tag came from two folders. Mage is my namespace from app/code/local/Mage and Page is my module name from app/code/local/Mage/Page. -->
<active>true</active>
<codePool>local</codePool>
</Mage_Page>
</modules>
</config>
Step 4: Save all the files you have created/updated.
Step 5: I refresh the admin page and checked if my work is working and yes it is working.
This took me a while due to lack of knowledge and experience in developing magento. But thanks for your help.
Thanks!

Magento: Check if product is already in cart

Using magento for my shopping cart system. I have mini cart on top menu, when I added product it will show product title with price in mini cart. Currently have product quantity edit link but I need quantity box in mini cart to update quantity with ajax. I have followed this link http://ceckoslab.com/magento/magento-check-if-product-is-in-cart/, but getting following error
Fatal error: Class 'Mage_Smartview_Helper_Data' not found in /app/Mage.php on line 547
can anyone help me to resolve above error ?
When Magento is trying to look to Mage_Somemodule_ instead of your own module, it does means that it did not found your own file or your own module.
Three possible reasons :
Your module is not recognized at all, maybe something is wrong in your module definition
Something is wrong/mistyped in your config.xml
Something is wrong/mistyped in your class name
Be sure you have everything right from the tutorial and/or copy paste your code here so we can help further
In this case the two xml are wrong in the way that it should not ignore case sensitivity
CeckosLab_SmartView.xml
<?xml version="1.0"?>
<config>
<modules>
<CeckosLab_SmartView>
<active>true</active>
<codePool>local</codePool>
</CeckosLab_SmartView >
</modules>
</config>
config.xml
<?xml version="1.0"?>
<config>
<modules>
<CeckosLab_SmartView>
<version>1.0.0</version>
</CeckosLab_SmartView>
</modules>
<global>
<helpers>
<smartview>
<class>CeckosLab_SmartView_Helper</class>
</smartview>
</helpers>
</global>
</config>
please check it the Answer of stackoverflow
Click Here
In this link check this answer with 20 votes
Please check the releasenotes:
It will help you guide how to solve this issue
If your helper error contains Mage_ before your module, it means your helper is either not defined or defined incorrectly in your module's xml or you are calling it incorrectly.
If it is defined correctly this should work:
Mage::helper('smartview')->doSomething();
or try:
Mage::helper('ceckoslab_smartview')->doSomething();
Also, make sure you clear the cache as xml is cached heavily.
Hope this helps
Make enrty in config.xml
<global>
......
<helpers>
<test>
<class>Module_Test_Helper</class>
</test>
</helpers>
......
</global>
Create a Data.php file inside Helper folder and write following code
<?php
class Module_Test_Helper_Data extends Mage_Core_Helper_Abstract
{
}
Thats it you need to do now if you call this code it will not throw any error:
<?php Mage::helper("test")->actionname(); ?>

Magento Custom filter approch

I am implementing a custom refine search functionality on product list page in magento
There are 4 attributes which will be using like color,size etc.
for this i have created a custom module which has a block.
I want to use this block on product list catalog page.
I am trying to put following in catalog.xml in my custom theme
<block type="filter/form" name="filter.form" template="catalog/navigation/filter.phtml" />
Where filter is my custom module, but somehow it is not working.
Am i going with wrong approch , if yes, Please suggest me the steps to implement custom filtering on product list page.
blocks parts in config.xml
<global>
<blocks>
<Webonise_Filter>
<class>Webonise_Filter_Block</class>
</Webonise_Filter>
</blocks>
<helpers>
<Webonise_Filter>
<class>Webonise_Filter_Helper</class>
</Webonise_Filter>
</helpers>
</global>
I advise you to change your config to :
<global>
<blocks>
<webonisefilter>
<class>Webonise_Filter_Block</class>
</webonisefilter>
</blocks>
<helpers>
<webonisefilter>
<class>Webonise_Filter_Helper</class>
</webonisefilter>
</helpers>
</global>
And then you can call your block with :
<block type="webonisefilter/form" name="filter.form" template="catalog/navigation/filter.phtml" />
The underscore is not always correctly interpreted. The idea is to get the shortcut from you config.xml and use it in your layout.xml. You need to have a block called Webonise_Filter_Block_Form to match webonisefilter/form.

Magento: How to include a php call in the CMS pages

Following the instructions from this page:
http://www.magento.cc/how-to-use-php-on-a-cms-page.html
1) i declared the module in the app/etc/modules :
<?xml version="1.0"?>
<config>
<modules>
<Stock_status>
<active>true</active>
<codePool>local</codePool>
</Stock_status>
</modules>
</config>
2) Then i created the config.xml in app\code\local\Stock\status\Custom\etc with these contents in it:
<?xml version="1.0"?>
<config>
<global>
<blocks>
<Stock_status>
<class>Stock_status_Block</class>
</Stock_status>
</blocks>
</global>
</config>
3) afterwards i created a test.php in app/code/local/Stock/status/Custom/Block file with these contents in it:
<?php
class Stock_status_Block_Test extends Mage_Core_Block_Abstract
{
protected function _toHtml()
{
.Mage::helper('customstockstatus')->getListStatus($_product->getId()).
return $html;
}
}
and finally
4) i went in a cms page to see if it works by putting this value in:
{{block type="Stock_status_Custom/test" ListStatus="02"}}
This line of code should return me the stock status of a specific product (in this example, the product with the ID 02)
BUT it doesn't work. What have i done incorrectly? Can someone please help me?
These are an unnecessary works, you can simply call the php file by adding the following line into that cms page content
{{block type="core/template" template="page/urfile.phtml"}}
Then create file under the page directory
go to Magento Admin->CMS->Pages
Click Add New Page
Input Page Title
Input URL Key
Right Content inside (body)
paste your code.
Hope this help

config.xml override results in cart not visible?

I am building a second add to cart button with a different redirect on a magento platform.
The tutorial I've used is self explainatory. See here
It works okey as the redirect is in place.
The thing is: The cart itself doesnt show its page (cart.phtml) anymore.
Any idea how to fix this? Or where the problem exists?
If I remove the code underneath the cart is back again, as the redirect isn't working anymore.
File : config.xml
<global>
<routers>
<checkout>
<rewrite>
<cart>
<to>mycheckout/cart</to>
<override_actions>true</override_actions>
<actions>
<add>
<to>mycheckout/cart/add</to>
</add>
</actions>
</cart>
</rewrite>
</checkout>
</routers>
</global>
Seems like your extension does not extend the cart controller that you are overwriting making it impossible to display the methods from original controller

Categories