Model. Accedir al model

config.xml

  <global>
        <models>
            <pharmacy>
                <class>Nommodul_Pharmacy_Model</class>
            </pharmacy>
        </models>
    </global>

model/Pharmacy.php

<?php

class Nommodul_Pharmacy_Model_Pharmacy extends Mage_Core_Model_Abstract
{
    public function _construct()
    {
        parent::_construct();
        $this->_init('pharmacy/pharmacy');
    }

    public function getPharmacy()
    {
        Mage::log( "My controller was called");
    }
}

Cridar el mòdul:

$pharmacy = Mage::getModel('pharmacy/pharmacy')->getPharmacy();
 
magento/develop/model.txt · Darrera modificació: 2010/04/19 12:36 per resteve
 
Copyright: Zikzakmedia Llicència Creative Commons By-NC-SA
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki