• <tfoot id='Pf679'></tfoot>
  • <legend id='Pf679'><style id='Pf679'><dir id='Pf679'><q id='Pf679'></q></dir></style></legend>
    <i id='Pf679'><tr id='Pf679'><dt id='Pf679'><q id='Pf679'><span id='Pf679'><b id='Pf679'><form id='Pf679'><ins id='Pf679'></ins><ul id='Pf679'></ul><sub id='Pf679'></sub></form><legend id='Pf679'></legend><bdo id='Pf679'><pre id='Pf679'><center id='Pf679'></center></pre></bdo></b><th id='Pf679'></th></span></q></dt></tr></i><div id='Pf679'><tfoot id='Pf679'></tfoot><dl id='Pf679'><fieldset id='Pf679'></fieldset></dl></div>

    <small id='Pf679'></small><noframes id='Pf679'>

      <bdo id='Pf679'></bdo><ul id='Pf679'></ul>

      1. 如何仅使用 mysql 在 magento 中提取所有产品 id、skus、产品名称、描述?

        How to pull all the product id, skus, product names, description in magento using only mysql?(如何仅使用 mysql 在 magento 中提取所有产品 id、skus、产品名称、描述?)
        • <bdo id='iKDKC'></bdo><ul id='iKDKC'></ul>
          <i id='iKDKC'><tr id='iKDKC'><dt id='iKDKC'><q id='iKDKC'><span id='iKDKC'><b id='iKDKC'><form id='iKDKC'><ins id='iKDKC'></ins><ul id='iKDKC'></ul><sub id='iKDKC'></sub></form><legend id='iKDKC'></legend><bdo id='iKDKC'><pre id='iKDKC'><center id='iKDKC'></center></pre></bdo></b><th id='iKDKC'></th></span></q></dt></tr></i><div id='iKDKC'><tfoot id='iKDKC'></tfoot><dl id='iKDKC'><fieldset id='iKDKC'></fieldset></dl></div>

          <legend id='iKDKC'><style id='iKDKC'><dir id='iKDKC'><q id='iKDKC'></q></dir></style></legend>
          • <tfoot id='iKDKC'></tfoot>

            <small id='iKDKC'></small><noframes id='iKDKC'>

                  <tbody id='iKDKC'></tbody>
                  本文介绍了如何仅使用 mysql 在 magento 中提取所有产品 id、skus、产品名称、描述?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我将如何使用 Magento 数据库中的 mysql 提取所有产品 ir、skus、产品名称(标题)和 desxription?我使用了以下查询并获得了除产品名称之外的所有属性.

                  How i will pull all the prduct ir, skus , product name (titles) and desxription using mysql from Magento database? I used following query and got all the attributes except product names.

                  SELECT e.entity_id, e.sku, eav.value AS 'description'
                  FROM catalog_product_entity e
                  JOIN catalog_product_entity_text eav
                    ON e.entity_id = eav.entity_id
                  JOIN eav_attribute ea
                    ON eav.attribute_id = ea.attribute_id
                  WHERE ea.attribute_code = 'description'
                  

                  推荐答案

                  标题可以从一个商店视图到另一个不同.描述也是如此.此外,某些商店视图可以使用在后端设置的默认值.

                  The title can be different from one store view to an other. Same goes for the description. Also, some store views can use the default values set in the backend.

                  这是关于如何为特定商店视图 (id 1) 的所有产品获取所需数据(sku、名称、描述)的完整查询.

                  Here is a full query on how to get the data you need (sku, name, description) for all the products for a specific store view (id 1).

                  SELECT 
                      `e`.`sku`, 
                      IF(at_name.value_id > 0, at_name.value, at_name_default.value) AS `name`,
                      IF(at_description.value_id > 0, at_description.value, at_description_default.value) AS `description`
                  
                  FROM 
                     `catalog_product_entity` AS `e` 
                      INNER JOIN 
                           `catalog_product_entity_varchar` AS `at_name_default` 
                                 ON (`at_name_default`.`entity_id` = `e`.`entity_id`) AND 
                                    (`at_name_default`.`attribute_id` = (SELECT attribute_id FROM `eav_attribute` ea LEFT JOIN `eav_entity_type` et ON ea.entity_type_id = et.entity_type_id  WHERE `ea`.`attribute_code` = 'name' AND et.entity_type_code = 'catalog_product')) AND 
                                    `at_name_default`.`store_id` = 0 
                      LEFT JOIN 
                            `catalog_product_entity_varchar` AS `at_name` 
                                 ON (`at_name`.`entity_id` = `e`.`entity_id`) AND 
                                    (`at_name`.`attribute_id` = (SELECT attribute_id FROM `eav_attribute` ea LEFT JOIN `eav_entity_type` et ON ea.entity_type_id = et.entity_type_id  WHERE `ea`.`attribute_code` = 'name' AND et.entity_type_code = 'catalog_product')) AND 
                                    (`at_name`.`store_id` = 1) 
                      INNER JOIN 
                           `catalog_product_entity_text` AS `at_description_default` 
                                 ON (`at_description_default`.`entity_id` = `e`.`entity_id`) AND 
                                    (`at_description_default`.`attribute_id` = (SELECT attribute_id FROM `eav_attribute` ea LEFT JOIN `eav_entity_type` et ON ea.entity_type_id = et.entity_type_id  WHERE `ea`.`attribute_code` = 'description' AND et.entity_type_code = 'catalog_product')) AND 
                                    `at_description_default`.`store_id` = 0 
                      LEFT JOIN 
                            `catalog_product_entity_text` AS `at_description` 
                                 ON (`at_description`.`entity_id` = `e`.`entity_id`) AND 
                                    (`at_description`.`attribute_id` = (SELECT attribute_id FROM `eav_attribute` ea LEFT JOIN `eav_entity_type` et ON ea.entity_type_id = et.entity_type_id  WHERE `ea`.`attribute_code` = 'description' AND et.entity_type_code = 'catalog_product')) AND 
                                    (`at_description`.`store_id` = 1) 
                  

                  如果您希望将其用于其他商店视图,只需在以下几行将值 1 替换为您想要的 id

                  If you want it for an other store view, just replace the value 1 with your desired id at the following lines

                  (`at_name`.`store_id` = 1) 
                  

                  (`at_description`.`store_id` = 1)
                  

                  我不知道你为什么需要 sql 格式的这个.这是一个奇怪而大的错误源.可以通过代码轻松搞定:

                  I don't know why you need this in an sql format. This is a strange and a big error source. You can easily get it through code:

                  $collection = Mage::getResourceModel('catalog/product_collection')
                          ->addAttributeToSelect(array('sku', 'name', 'description'));
                  foreach ($collection as $item) {
                      $sku = $item->getSku();
                      $name = $item->getName();
                      $description = $item->getDescription(); 
                      //do something with $sku, $name & $description
                  }
                  

                  这篇关于如何仅使用 mysql 在 magento 中提取所有产品 id、skus、产品名称、描述?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Building a comma separated list?(建立一个逗号分隔的列表?)
                  Errors in SQL Server while importing CSV file despite varchar(MAX) being used for each column(尽管每列都使用了 varchar(MAX),但在导入 CSV 文件时 SQL Server 中出现错误)
                  How to update a record using sequelize for node?(如何使用节点的 sequelize 更新记录?)
                  How to provide a mysql database connection in single file in nodejs(如何在 nodejs 中的单个文件中提供 mysql 数据库连接)
                  Defining a one-to-one relationship in SQL Server(在 SQL Server 中定义一对一关系)
                  Looping Over Result Sets in MySQL(在 MySQL 中循环结果集)

                    <tbody id='1kwqX'></tbody>
                1. <legend id='1kwqX'><style id='1kwqX'><dir id='1kwqX'><q id='1kwqX'></q></dir></style></legend>
                2. <tfoot id='1kwqX'></tfoot>

                  <small id='1kwqX'></small><noframes id='1kwqX'>

                    <i id='1kwqX'><tr id='1kwqX'><dt id='1kwqX'><q id='1kwqX'><span id='1kwqX'><b id='1kwqX'><form id='1kwqX'><ins id='1kwqX'></ins><ul id='1kwqX'></ul><sub id='1kwqX'></sub></form><legend id='1kwqX'></legend><bdo id='1kwqX'><pre id='1kwqX'><center id='1kwqX'></center></pre></bdo></b><th id='1kwqX'></th></span></q></dt></tr></i><div id='1kwqX'><tfoot id='1kwqX'></tfoot><dl id='1kwqX'><fieldset id='1kwqX'></fieldset></dl></div>
                      <bdo id='1kwqX'></bdo><ul id='1kwqX'></ul>