0
我試圖列出我的一些產品從一個PHP腳本,我需要得到一些屬性的值。對於爲例我想是這樣的,從產品集合店::magento:加入具有屬性值的產品
Mage::app();
Mage::app()->setCurrentStore(1);
$collection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('computer_type')
->joinAttribute('computer_type_value', 'eav/entity_attribute_option', "computer_type", null, 'left', 0)
"computer_type"
這是在eav_attribute_option_value
表option_id
領域找到一個id:
+----------+-----------+----------+--------+
| value_id | option_id | store_id | value |
+----------+-----------+----------+--------+
| 3738 | 14 | 0 | server |
+----------+-----------+----------+--------+
我想加盟此表與我的集合的結果,以便顯示值「服務器」而不是ID「3738」,但我這樣做的方式是行不通的,儘管我所有的搜索。
我沒有找到如何在只有一個查詢中實現。可能嗎 ?
你是如何_using_的數據? Magento有一種特殊的方式,使用屬性模型的「前端」渲染器訪問前端模板中的選擇屬性值。如果這是你正在做的事情,那麼你應該效仿。如果是用於數據饋送或其他/自定義邏輯,請繼續:D –
@RobbieAverill:感謝您的評論,它確實在前端實例之外使用,這就是爲什麼我使用純php庫 – ehretf