0
我正在嘗試使用以下查詢獲取數據:[寫在RewardPonts擴展的觀察者文件中]。從表中獲取數據,RewardsPoint擴展:Magento
public function salesOrderInvoiceSaveAfter($observer)
{
$id=$observer['invoice']->getOrder()->getRealOrderId();
echo $id;
$custom=$observer['invoice']->getOrder()->getCustomerId();
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$table = $resource->getTableName('marketplace/saleslist');
$result = $readConnection->fetchCol('SELECT mageproownerid FROM '.$table.'WHERE magerealorderid='.$id.
'AND magebuyerid='.$custom);
var_dump($result);
$invoice = $observer->getEvent()->getInvoice();
foreach ($invoice->getAllItems() as $item) {
$name = $item->getName();
$type = $item->getSku();
$id = $item->getProductId();
$qty = $item->getQty();
$price = $item->getPrice();
echo $name.",".$type.",".$id.",".$qty.",".$price;
}
但它沒有返回任何結果。我們可以在擴展中使用直接的sql查詢嗎,如果是,那麼我的查詢有什麼問題?
是的你是對的問題是「哪裏」和「和」之間的空間。 – Jinandra 2014-12-04 10:27:23