如何使用PHPmyadmin基于制造商在Magento中导出产品SKU

时间:2016-09-11 10:41:04

标签: magento phpmyadmin

如何使用PHPmyadmin基于制造商在Magento中导出产品SKU。

我无法找到正确的表格,而且说实话,我在几年内没有编写过sql的任何帮助吗?

1 个答案:

答案 0 :(得分:0)

在magento中,也许不是直接处理SQL的最佳方式。在我看来,提取内容的最佳方法是通过magento API。因此,在您的情况下,您可以尝试这样的脚本:

<?php

// Load Up Magento Core
define('MAGENTO', realpath(''));
require_once(MAGENTO . '/app/Mage.php');
Mage::app();

$productCollection = Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToFilter('manufacturer', 4); // integer - the id of manufacturer you want to extract, you can find it in admin panel with view source code

$productCollection->load();

foreach ($productCollection as $product) {
    echo $product->getSku().'</br>';
}

?>

上述代码将根据制造商ID输出包含产品SKU的列表。

希望这有帮助!