magento #1 - mvc - template - workflow vida. mvc mage_model mage_model_resource mage_model...

19
MAGENTO #1 - MVC - TEMPLATE - WORKFLOW VIDA

Upload: merilyn-simpson

Post on 29-Dec-2015

223 views

Category:

Documents


1 download

TRANSCRIPT

MAGENTO #1- MVC

- TEMPLATE

- WORKFLOW

VIDA

MVC

M

VC

• Mage_Model• Mage_Model_Resour

ce

• Mage_Controller_Front• Mage_Events

• Mage_Block• Mage_Helper

Class naming conversionZend-styleFormat

◦Mage_Catalog_Model◦<Namespace>_<Module-

name>_Model_Notes:

◦Case sensitive◦Camelcase

Likipe_Demo_Model_CustomerService

◦Subfolder for each “dash”

Class naming conversionNaming conversionOverride class

app/local/Mage/

app/core/Mage/

ControllerRouting

◦Front controller◦URL Rewrite◦HTACCESS

Verify routingMage::app()->getFrontController()->getRequest()->getRouteName()

ModelE.A.V (Entity–Attribute–Value)Use

◦Mage::getModel()◦Mage::getSingleton()

Resources◦DB layer to work with MySQL◦= table in MySQL

ViewBlocksTheme

Block

.phtml

.css .js.xm

l

BlockTemplate:

“A Block is a box (or any other form) where your module is shown”

BlockDevelop:

“A Block is a class that includes all functions which helps to display data in view”

Block - Types• Mage_Catalog_Block_Category_Navigati

on• Mage_Catalog_Block_Product• …

#1. “Built-in”

• Mage_Core_Block_Template• XXX_YYY_Block_ZZZ

#2: “Dynamic

data”

• Mage_CMS_Block#3: “Static

data”

Block – How to call• echo $this->getLayout()

->createBlock('letter/subscribe')->setTemplate('newsletter/subscribe.phtml')->toHtml();

.phtml

• <block type="cms/block" name="cms_site_info“ before="-" as="my_site_info“ />

• $this->getChildHtml(‘cms_site_info’)

.xml• {{block type="tag/popular"

name="tags_popular" template="tag/popular_index.phtml" }}

cms

Template - theme

ThemeConcept

theme

css

images

js

layout

template

locale

skin app

Template - themeLayouts : XML files, define block

structure(module layout) , in which you decide to put some box in some page as a module function.

Templates : phtml files, in which you do the coding with xhtml and PHP.

Locale: language translations in .csv file format.

Skins : css, images, javascript, where u do the beautifications.

Theme fallback

Theme development

Theme development

Init • Empty folders

XML • local.xml

PHTML • *.phtml

Workflow – Theme development

Page• page/1column.phtml• page/2-column-left.phtml• …

Header/Footer

• page/html/head.phtml• page/html/header.phtml• page/html/footer.phtml

Content• *.pht

ml

Workflow – Theme development

Use local.xml◦Remove/add blocks◦Change template file

Copy xml files:◦Layout change (modify on many blocks)

Copy phtml files◦Keep the PHP codes (correct data)◦HTML changes only

Translate via /locale/sv_SE/translate.csv

Workflow Requirement

Minimum

template files

Layout via XML

Fallback process