Magento model to interact with db table
In this post I will show you how to write a basic magento model to do AMD activities to a db table. Under package “Mypackage” & module “Mymod” we will create model Test so that we can do AMD with table named “test”. 1.Here we first create a table test in db. 1 CREATE TABLE `test` ( 2 `test_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , 3 `name` VARCHAR( 25 ) NOT NULL ......
magento datetime
Are you using date-time functions (date(), time(),now(), etc) directly inside magento ??? Think twice man !!! Even though time is set properly in you server or you set right timezone in your php.ini file, you might be surprised to see the result of the following code :- 1 //This time will not match your server time 2 $now = time(); 3 echo date('m/d/y h:i:s', time()); This is because wha......
add product to cart
/** * Action list where need check enabled cookie * * @var array */ protected $_cookieCheckActions = array('add'); /** * Retrieve shopping cart model object * * @return Mage_Checkout_Model_Cart */ protected function _getCart() { return Ma......
magento api example
public function indexAction() { $apiUer = 'aland'; $apiKey = '123456'; $apiPath = 'catalog_product.list'; $null = ''; $catNeedle=0; $filters = array( 'sku' => array('like'=>'nba'), &nb......
magento db select on limit
$collection = $this->getProductCollection($storeId); $select = $collection->getSelect(); $select->join(array('cat_index'=>'catalog_category_product_index'),"cat_index.product_id=e.entity_id and cat_index.store_id='$storeId' AND cat_index.category_id in ('10','17')",array('*')); $select->where("cat_index.product_id>35") ->orWhere("cat_index.product_id<135"); $select->limit(7,2);//first param is the rows num......
magento join
$collection = Mage::getModel('catalog/product')->getCollection()->setStoreId($storeId) ->addAttributeToSelect("*"); $collection->getSelect()->join(array('cat_index'=>'catalog_category_product_index'),"cat_index.product_id=e.entity_id and cat_index.store_id='$storeId' AND cat_index.category_id in ($catsString)",array('*')); more details :http://stackoverflow.com/questions/3949470/how-to-select-specific-......
Magento folder structure
Here’s short overview: / app - is where the application resides / app / etc - is global configuration den / app / code - is where modules have installed their models and controllers / app / code / core - are core team developed or certified modules / app / code / community - are community contributed modules / app / code / local - are local customizations / app / code / core / Mage - magento default namespace / app / code / core / Mage / {Module} - module root / app / code / core / Mage / {Module} / etc - module configuration / app / code / cor......
Magento Architecture
Page request flow Preliminary core modules dependency diagram ......
Basic Magento Directory Overview
Important Paths / -Directory Root /app - This is where all the php code for the application resides /lib - The external code library. /skin - This is where css and other images reside Thats the quick overview. /app /code - Where all modules reside /design - Contains both layout xml files and template .phtml files /etc - Global configuration Mage.php - Static class Mage, where everything is held together. Before I move on to the other two directories (/lib, /skin) I’ll explain the directories......
- Page:8/26 258 Blogs
周日 | 周一 | 周二 | 周三 | 周四 | 周五 | 周六 |
文章分类
- 默认(751)
- 日志(47)
- 感悟(15)
- testIT(4)
- PHP_XML(5)
- PHP(78)
- 明星(1)
- 笑话(31)
- 毕业论文(2)
- 生活(60)
- HTML(11)
- CSS(6)
- 考研(3)
- JS(21)
- 简历(6)
- svn(3)
- 音乐(1)
- 学习(7)
- jQuery(9)
- 英语口语(9)
- 书籍(2)
- magento(258)
- apache(12)
- 创意(4)
- 设计(4)
- 休闲(1)
- IT咨询(11)
- 工作(23)
- ubuntu(21)
- bysoft(1)
- zend(1)
- web(2)
- software(1)
- sql(5)
- 娱乐(5)
- photoshop(3)
- zend framework(2)
- nginx(3)
- 小说(1)
- 名言(1)
- 牛人(1)
- Mysql(6)
- vim(2)
- wordpress(8)
- drupal(1)