我在 magento 中创建了 2 个文本以及 2 个不同的表。第一个扩展将数据存储在表 1 中,而第二个扩展将数据存储在表 2 中。现在我想通过 LeftJoin 在第一个扩展中显示数据。它显示第一个表中没有 leftjoin 的数据,但不显示两个表中的 leftjoin 数据。
block.php 中的这段代码
public function methodblock()
{
$collection = Mage::getModel('test/test')->getCollection();
$returnCollection = $collection->getSelect()
->joinLeft('magento_answer', 'id_pfay_test=question_id',
array('*'), null , 'left');
return $returnCollection;
}
在布局方面。显示数据.phtml
<?php
$collection = $this->testmethodblock();
foreach($collection as $rows {
echo $rows ->getData('name');
}