Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Creating modul. Inserting block
 
GreenCommerce
Member
 
Total Posts:  47
Joined:  2011-03-07
 

Hii Everybody

I have been trying to create a new module to use for Piwik ecommerce tracking. This is my first modul and I’m stuck.  I have been trying to keep it simple just to get started. I want to insert a costume block at the bottom of my pages, where I can load all the different tracking codes dynamically, but I can’t get any block to show up there.  What am I doing wrong ? It should be very basic. The modul is visible and enabled in the backend, but nothing is showing up frontend.

Best Regards
app/etc/modules/experion_piwikanalytics.xml

<config>
    <
modules>
    <
Experion_PiwikAnalytics>
            <
active>true</active>
            <
codePool>local</codePool>
            <
depends>
                <
Mage_Core/>
            </
depends>
       </
Experion_PiwikAnalytics>
   </
modules>
</
config>

app/design/frontend/varmeexpres/default/layout/piwikanalytics.xml

<layout version="0.1.0">
    <default>
        <!-- 
Experion_PiwikAnalytics -->
        <
reference name="before_body_end">
            <
block type="PiwikAnalytics/Piwik" name="piwik_analytics" as="piwik_analytics" template="piwikanalytics/piwik_test.phtml" />
        </
reference>
    </default>
</
layout>

app/design/frontend/varmeexpres/default/template/piwikanalytics/piwik_test.phtml

<?php echo $this->MyFunction();?>

app/code/local/Experion/PiwikAnalytics/Block/Piwik.php

<?php
class Experion_PiwikAnalytics_Block_Piwik extends Mage_Core_Block_Template
{
    
public function MyFunction()
        
{
            
echo "Block loaded";
        

}
?>

app/code/local/Experion/PiwikAnalytics/ect/config.xml

<config>
    <
modules>
        <
Experion_PiwikAnalytics>
            <
version>1.6.0.0</version>
        </
Experion_PiwikAnalytics>
    </
modules>

   <global>
        
        <
blocks>
            <
PiwikAnalytics>
                <class>
Experion_PiwikAnalytics_Block_Piwik</class>
            </
PiwikAnalytics>
        </
blocks>
        
    </global>
    <
frontend>
        <
layout>
            <
updates>
                <
PiwikAnalytics>
                    <
file>piwikanalytics.xml</file>
                </
PiwikAnalytics>
            </
updates>
        </
layout>
    </
frontend>
 </
config>
 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

Change this in your config.xml

<PiwikAnalytics>
                <class>
Experion_PiwikAnalytics_Block_Piwik</class>
            </
PiwikAnalytics>
to this
<PiwikAnalytics>
                <class>
Experion_PiwikAnalytics_Block</class>
            </
PiwikAnalytics>

Clear the cache and give it an other go.

Cheers,
Marius,

 
Magento Community Magento Community
Magento Community
Magento Community
 
GreenCommerce
Member
 
Total Posts:  47
Joined:  2011-03-07
 

Hii Marius

Thanks for your reply. I really appreciate it. I made the changes, but still nothing shows up. I’m using Magentix_Layout Analyzer, but I can’t find find any references to my block at all in the layout generated. Very strange. It should be very basic.

Best Regards
Jacob

 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

I just found something else.
The path to your config.xml file should be

app/code/local/Experion/PiwikAnalytics/etc/config.xml
not
app/code/local/Experion/PiwikAnalytics/ect/config.xml
Maybe this is the problem.

 
Magento Community Magento Community
Magento Community
Magento Community
 
GreenCommerce
Member
 
Total Posts:  47
Joined:  2011-03-07
 
tzyganu - 02 July 2012 05:30 AM

I just found something else.
The path to your config.xml file should be

app/code/local/Experion/PiwikAnalytics/etc/config.xml
not
app/code/local/Experion/PiwikAnalytics/ect/config.xml
Maybe this is the problem.

Jesus Yes off cause ! Thanks Now the update shows up in the layout analyser, but nothing on the page.
Ok I have something to work on now.....

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top