Magento2 magento 2.3当产品出口;消息已添加到队列中,请等待尽快获取您的文件”;

Magento2 magento 2.3当产品出口;消息已添加到队列中,请等待尽快获取您的文件”;,magento2,Magento2,我在导出产品时出错 可能是因为您的cron没有运行,所以您需要运行:bin/magento cron:run 如果不使用该行,请手动尝试使用bin/magento队列:使用者:启动exportProcessor 祝你好运,我迟到了一点,很高兴你把问题解决了 我不久前发现了这篇文章,但在magento的导出方面还有其他问题,所以将我的解决方案发布在这里供其他读者阅读。我被Magento的愚蠢的出口(如果你有20k+的产品有100个属性,那就更糟糕了(它完全崩溃了)) 因此,我为自己的导出创建了一个

我在导出产品时出错


可能是因为您的cron没有运行,所以您需要运行:
bin/magento cron:run

如果不使用该行,请手动尝试使用
bin/magento队列:使用者:启动exportProcessor


祝你好运,我迟到了一点,很高兴你把问题解决了

我不久前发现了这篇文章,但在magento的导出方面还有其他问题,所以将我的解决方案发布在这里供其他读者阅读。我被Magento的愚蠢的出口(如果你有20k+的产品有100个属性,那就更糟糕了(它完全崩溃了))

因此,我为自己的导出创建了一个独立的php脚本。欢迎任何人使用它,但必须对其进行编辑以满足其需要(和db)。但如果他们开了一家大型商店,这将是一个巨大的时间(和头痛)节约

    <?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

$connect = mysqli_connect("your","db","details","here") OR die ('Could not connect to MySQL');
$brandlist = "SELECT `value` FROM `eav_attribute_option_value` LEFT JOIN `eav_attribute_option` ON `eav_attribute_option`.`option_id` = `eav_attribute_option_value` . `option_id` WHERE `eav_attribute_option_value`.`store_id` = 0 AND `eav_attribute_option`.`attribute_id` = 165 ORDER BY `value` ASC";

if ($_SERVER["REQUEST_METHOD"] != "POST") {
?>

<form method="post" action="<?php /* @escapeNotVerified */ ?>" enctype="multipart/form-data">
  Brand: <select name="brand" id="brand">
  <?php
  foreach (($connect->query($brandlist)) as $row){
echo '<option value="'  . $row['value'] . '">' . $row['value'] . '</option>';
}
?>
</select>
<input class="button" type="submit" name="submit" value="Submit"> 
</form>

<?php
}

if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $brand = $_POST["brand"];
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
$result = mysqli_query($connect, "SELECT
       e.sku,
       v1.value AS 'name',
       v3.value AS 'product_online',
       d1.value AS 'price',
       v7.value AS 'url_key',
       v10.value AS 'special_price',
       v8.`value` AS 'special_to',
       v9.value AS 'special_from'
FROM catalog_product_entity e
LEFT JOIN catalog_product_entity_varchar v1 ON e.entity_id = v1.entity_id
AND v1.store_id = 0
AND v1.attribute_id =
  (SELECT attribute_id
   FROM eav_attribute
   WHERE attribute_code = 'name'
     AND entity_type_id =
       (SELECT entity_type_id
        FROM eav_entity_type
        WHERE entity_type_code = 'catalog_product'))
LEFT JOIN catalog_product_entity_decimal d1 ON e.entity_id = d1.entity_id
AND d1.store_id = 0
AND d1.attribute_id =
  (SELECT attribute_id
   FROM eav_attribute
   WHERE attribute_code = 'price'
     AND entity_type_id =
       (SELECT entity_type_id
        FROM eav_entity_type
        WHERE entity_type_code = 'catalog_product'))
        LEFT JOIN catalog_product_entity_int v3 ON e.entity_id = v3.entity_id
AND v3.store_id = 0
AND v3.attribute_id =
  (SELECT attribute_id
   FROM eav_attribute
   WHERE attribute_code = 'status'
     AND entity_type_id =
       (SELECT entity_type_id
        FROM eav_entity_type
        WHERE entity_type_code = 'catalog_product'))
                LEFT JOIN catalog_product_entity_int v4 ON e.entity_id = v4.entity_id
AND v4.store_id = 0
AND v4.attribute_id =
  (SELECT attribute_id
   FROM eav_attribute
   WHERE attribute_code = 'manufacturer'
     AND entity_type_id =
       (SELECT entity_type_id
        FROM eav_entity_type
        WHERE entity_type_code = 'catalog_product'))
                        LEFT JOIN eav_attribute_option_value v5 ON v4.value = v5.option_id
AND v5.store_id = 0
AND v5.option_id = v4.value
LEFT JOIN catalog_product_entity v6 ON e.entity_id = v6.entity_id
LEFT JOIN catalog_product_entity_varchar v7 ON e.entity_id = v7.entity_id AND v7.store_id = 0 AND v7.attribute_id =
  (SELECT attribute_id
   FROM eav_attribute
   WHERE attribute_code = 'url_key'
     AND entity_type_id =
       (SELECT entity_type_id
        FROM eav_entity_type
        WHERE entity_type_code = 'catalog_product'))
LEFT JOIN
  (SELECT product_id,
          GROUP_CONCAT(c.category_id SEPARATOR ',') AS category_ids,
          GROUP_CONCAT(cv.value SEPARATOR ',') AS category_names
   FROM catalog_category_product c
   INNER JOIN catalog_category_entity_varchar cv ON c.category_id = cv.entity_id
   AND cv.store_id = 0
   AND cv.attribute_id =
     (SELECT attribute_id
      FROM eav_attribute
      WHERE attribute_code = 'name'
        AND entity_type_id =
          (SELECT entity_type_id
           FROM eav_entity_type
           WHERE entity_type_code = 'catalog_category'))
   GROUP BY product_id) cids ON e.entity_id = cids.product_id
      LEFT JOIN catalog_product_entity_datetime v8 ON e.entity_id = v8.entity_id AND v8.attribute_id = 159 AND (DATE_FORMAT(v8.`value`, '%Y-%m-%d') >= CURDATE())
        LEFT JOIN catalog_product_entity_datetime v9 ON e.entity_id = v9.entity_id AND v9.attribute_id = 157 AND (DATE_FORMAT(v9.`value`, '%Y-%m-%d') <= CURDATE()) AND (DATE_FORMAT(v8.`value`, '%Y-%m-%d') >= CURDATE())
            LEFT JOIN catalog_product_entity_decimal v10 ON e.entity_id = v10.entity_id AND v10.attribute_id = 155 AND v9.attribute_id = 157 AND (DATE_FORMAT(v9.`value`, '%Y-%m-%d') <= CURDATE()) AND (DATE_FORMAT(v8.`value`, '%Y-%m-%d') >= CURDATE())
   WHERE v3.value = 1
   AND v5.value = '$brand'
   AND NOT v6.attribute_set_id = 39
   AND NOT v1.value LIKE '%(EOL)%' AND NOT v1.value LIKE '%Discontinued%' AND NOT v1.value LIKE 'Product Not For Sale' AND NOT d1.value = 0 AND NOT v6.attribute_set_id = 37;");
   if ($connect->query($result) === TRUE) {
  echo "db connect pass";}
      else {
    echo $connect->error;
}

   function setExcelContentType() {
    if(headers_sent())
        return false;

    header('Content-type: application/vnd.ms-excel');
    return true;
}

function setDownloadAsHeader($filename) {
    if(headers_sent())
        return false;

    header('Content-disposition: attachment; filename=' . $filename);
    return true;
}

function csvFromResult($stream, $result, $showColumnHeaders = true) {
    if($showColumnHeaders) {
        $columnHeaders = array();
        $nfields = mysqli_num_fields($result);
        for($i = 0; $i < $nfields; $i++) {
            $field = mysqli_fetch_field($result);
            $columnHeaders[] = $field->name;
        }
        fputcsv($stream, $columnHeaders);
    }

    $nrows = 0;
    while($row = mysqli_fetch_row($result)) {
        fputcsv($stream, $row);
        $nrows++;
    }

    return $nrows;
}

function csvFileFromResult($filename, $result, $showColumnHeaders = true) {
    $fp = fopen($filename, 'w');
    $rc = csvFromResult($fp, $result, $showColumnHeaders);
    fclose($fp);
    return $rc;
}

function csvToExcelDownloadFromResult($result, $showColumnHeaders = true, $asFilename = 'product-export.csv') {
    $asFilename = 'product-export-' . date('m-d-Y-His') . '.csv';
    setExcelContentType();
    setDownloadAsHeader($asFilename);
    return csvFileFromResult('php://output', $result, $showColumnHeaders);
}
csvToExcelDownloadFromResult($result);
}
?>

我找到了解决方案。我们需要运行cron-commandbin/magento-cron:run--group-index