Sunday, March 18, 2012

magento操作数据库


$this->getSelect()
                 ->from(array('e' => $this->getEntity()->getFlatTableName()), null)       
                 ->columns(array('status' => new Zend_Db_Expr(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)));        
            $this->addAttributeToSelect(array('entity_id', 'type_id', 'attribute_set_id'));
            if ($this->getFlatHelper()->isAddChildData()) {
                $this->getSelect()
                    ->where('e.is_child=?', 0);
                $this->addAttributeToSelect(array('child_id', 'is_child'));
            }

            $select=$this->getSelect()->from(array('e'=>$this->getEntity()->getEntityTable()));   
            $select->joinRight( array('t'=>'test_product'),  
                          'e.entity_id = t.entity_id',  
                          array() );

1 comment:

  1. Dear, again in the valentine's day.I don't know how many of you have me to your chocolate, but I see clearly...This year I can send--to reduce weight tea?
    http://www.mmomesos.com

    ReplyDelete