我已经按照下面的链接中提到的步骤在magento 1.7中创建了一个自定义模块。http://www.webspeaks.in/2010/07/create-your-first-magento-module.html#comment-form
我没有创建Web表,而是创建了2个表Chefdetail和Chefproduct,并为同一表创建了Block和phtml文件。
我的Chefdetail块如下所示:
class TruffleStreet_Web_Block_ChefDetail extends Mage_Core_Block_Template
{
public function _prepareLayout()
{
return parent::_prepareLayout();
}
public function getChefDetail()
{
if (!$this->hasData('chefdetail')) {
$this->setData('chefdetail', Mage::registry('chefdetail'));
}
return $this->getData('chefdetail');
}
}
如何修改它以从数据库中的chefdetail表中加载所有数据?该表中有数据,但是我无法访问它。我的chefdetail.phtml文件如下所示:
$_chefblockData = $this->getLayout()->createBlock('web/chefdetail')->getChefDetail();
echo "Count Chef = " . count($_chefblockData) ;
请提出建议,我该如何解决此问题?
谢谢,尼特
这样,您将根据电子邮件获取所有客户详细信息...
collection = Mage::getModel("customer/customer")->getCollection()->addAttributeToSelect("*")
->addFieldToFilter("email",$CustomerEmail);
您也可以将电子邮件更改为客户ID。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句