【问题标题】:How can I sort my product attributes in excel for magento import如何在 Excel 中对我的产品属性进行排序以进行 magento 导入
【发布时间】:2015-08-29 10:29:16
【问题描述】:

基本上我经营一家 Magento 商店,销售各种服装产品。我需要以某种方式使用 excel,这样我才能输入我的产品名称、SKU 和属性,以生成 Magento csv 导入文件。

我有很多属性,例如颜色、腿围、腰围。

例如,一种产品可能具有以下潜在属性

工装裤 -

颜色:黑色、海军蓝、卡其色

腿围:31、33、35

腰围:32、34、36、38、40、42

我需要以某种方式设置一个可以获取值并按以下格式排列它们的循环

颜色|腿型|腰围|

黑色 | 31| 34|

黑色 | 31| 36|

黑色 | 31| 38|

等等

我希望我说清楚了。例如,该产品将有超过 54 种变体。

我真的希望能够输入变化并让 excel 完成艰苦的工作。

【问题讨论】:

    标签: excel magento excel-formula vlookup


    【解决方案1】:

    递归函数调用而不是循环呢?

    这是我如何构建数据来回答您的问题(我还没有足够的代表来发布图片,所以这是我使用的表格的图表:

    +----------------------------------------------------+ | |一个 |乙| C | |----------------------------------------| | 1 |工装裤 | | | |----------------------------------------| | 2 |颜色 |腿尺寸 |腰围 | |----------------------------------------| | 3 |黑色 | 31 | 32 | |----------------------------------------| | 4 |海军 | 33 | 34 | |----------------------------------------| | 5 |卡其色 | 35 | 36 | |----------------------------------------| | 6 | | | 38 | |----------------------------------------| | 7 | | | 40 | |----------------------------------------| | 8 | | | 42 | +----------------------------------------------------+

    这里有一段代码,您可以使用它来获取您想要的列表。请注意,它正在寻找空单元格,所以不要跳过。 :)

    Option Explicit
    
    Dim HomeSheet As String
    Dim NewSheet As String
    
    Function GetAllPermutations()
    
        HomeSheet = ActiveSheet.Name 'Where we start from
        NewSheet = Sheets.Add.Name 'Place to put new stuff
        Sheets(HomeSheet).Select
    
        RecursivePermutations "", 1, 0
    
    End Function
    
    Function RecursivePermutations(ByVal CurrentValue As String, ByVal SourceColumn As Long, ByRef OutputRow As Long)
    
        Dim x As Long
        Dim myText As String
    
        For x = 3 To Cells.Rows.Count
    
            'Is this row's value empty?  Then we need to exit
            If Cells(x, SourceColumn) = "" Then
                If x = 3 Then
                    'We hit a brand new blank column, time to write it out
                    OutputRow = OutputRow + 1
                    Sheets(NewSheet).Cells(OutputRow, 1) = CurrentValue
                End If
                'All done here
                Exit Function
            End If
    
            If SourceColumn = 1 Then
                'First time through loop for this base value
                myText = Trim(Cells(x, SourceColumn))
            Else
                'Add another one
                myText = "|" & Trim(Cells(x, SourceColumn))
            End If
    
            'Make recursive call to self
            RecursivePermutations CurrentValue & myText, SourceColumn + 1, OutputRow
    
        Next x
    
    End Function
    

    【讨论】:

      猜你喜欢
      • 2014-06-09
      • 1970-01-01
      • 2013-01-15
      • 1970-01-01
      • 1970-01-01
      • 2011-10-27
      • 1970-01-01
      • 1970-01-01
      • 2015-12-31
      相关资源
      最近更新 更多