Sıfırdan bir magento bileşeni oluşturma

0 Cevap php

Ben bir magento alışveriş sepeti modülü oluşturmak için çalışıyorum ama işler pek öyle değil. İşte benim adım

Ben ilk uygulaması vb bir xml oluşturmak ..

<?xml version="1.0"?>
<config>
    <modules>
        <mywebwow_AdvancedCatalog>
            <active>true</active>
            <codePool>local</codePool>
        </mywebwow_AdvancedCatalog>
    </modules>
</config>

Sonra yerel havuzda benim klasör oluşturun

/local/mywebwow/AdvancedCatalog/

Bu klasöre aşağıdaki dosyaları koymak

/Block/AdvanceCatalog.php
/controllers/indexController.php
/etc/config.xml

Ben bloğunda aşağıdaki koymak

AdvancedCatalog.php

<?php
class mywebwow_AdvancedCatalog_Block_Advancedcatalog extends Mage_Core_Block_Template
{
    public function _prepareLayout()
    {
        return parent::_prepareLayout();
    }

    public function getHelloworld()
    {
        return 'Hello world';
    }
}

indexController.php

<?php
class mywebwow_AdvancedCatalog_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }
}

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <mywebwow_AdvancedCatalog>
            <version>0.1.0</version>
        </myweboww_AdvancedCatalog>
    </modules>
    <frontend>
        <routers>
            <AdvancedCatalog>
                <use>standard</use>
                <args>
                    <module>mywebwow_AdvancedCatalog</module>
                    <frontName>advancedcatalog</frontName>
                </args>
            </AdvancedCatalog>
        </routers>
        <layout>
            <updates>
                <AdvancedCatalog>
                    <file>advancedcatalog.xml</file>
                </AdvancedCatalog>
            </updates>
        </layout>
    </frontend>
    <global>
        <blocks>
            <AdvancedCatalog>
                <class>mywebwow_AdvancedCatalog_Block</class>
            </AdvancedCatalog>
        </blocks>
        <helpers>
            <AdvancedCatalog>
                <class>mywebwow_AdvancedCatalog_Helper</class>
            </AdvancedCatalog>
        </helpers>
    </global>
</config>

i website.com / index.php / advancedcatalog / yazdığınızda

Ben bir 404 olsun. Bulunamadı sayfa.

[EDIT]

Ben MyWebwow_AdvancedCatalog_Block_AdvancedCatalog gelen MyWebwow_AdvancedCatalog_Block_Advancedcatalog için blok sınıfını değişti

Ben aşağıdaki gibi görünüyor advancedcatalog.xml eklendi ...

advancedcatalog.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <advancedcatalog_index_index>
        <reference name="content">
            <block type="advancedcatalog/advancedcatalog" name="advancedcatalog" template="advancedcatalog/helloworld.phtml" />
        </reference>
    </advancedcatalog_index_index>
</layout>

sonra ben zaten şu var

/template/advancedcatalog/helloworld.phtml

helloworld.phtml

<h2><?php echo $this->getHelloworld(); ?></h2>

0 Cevap