沃梦达 / 编程问答 / php问题 / 正文

使用简单项目的 SKU/ID 以编程方式在 Magento 中添加

Programmatically add Bundle Products in Magento, using the SKU / ID of Simple Items(使用简单项目的 SKU/ID 以编程方式在 Magento 中添加捆绑产品)

本文介绍了使用简单项目的 SKU/ID 以编程方式在 Magento 中添加捆绑产品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Magento 中有一些简单的目录产品,所以我有它们的 SKU身份证件.现在我想使用数组元素bundle_options"& 创建一个捆绑产品.捆绑项目的bundle_selections",由 Magento Admin 在其观察者类中编码使用.

I have some simple catalog products in Magento, so I have their SKUs & IDs. Now I want to create a Bundled product using the array elements "bundle_options" & "bundle_selections" of the Bundle Items, which are used by the Magento Admin coding in its Observer Class.

同样在Observer类中,还有两个函数setBundleOptionsData()"的方法调用&setBundleSelectionsData()",我找不到任何函数定义.

Also in the Observer class, there are method calls of two functions "setBundleOptionsData()" & "setBundleSelectionsData()", for whose I am not able to find any function definition.

请在这里发布任何专业帖子,因为我需要一些正确的方法来做这件事.如果需要,覆盖模块或使用事件,我会做,但我需要非常专业的帮助.提前致谢.

Please any professional post here, because I need some proper way of doing this thing. If it needs, overriding modules or using events, I will do, but I need really professional help. Thanks in advance.

-
关于上面提到的两种方法setBundleOptionsData()"&setBundleSelectionsData()",我几乎可以肯定的是他们使用了某种PHP魔术方法,但我不知道这些魔术方法的主要逻辑在哪里写的?

-
Regarding the two methods mentioned above "setBundleOptionsData()" & "setBundleSelectionsData()", what I'm almost certain is that they are using some sort of PHP magic methods, but I don't know where the main logic of these magic methods are written?

请任何人提供一些正确的答案.非常感谢任何帮助.

Please anybody provide some correct answer. Any help is greatly appreciated.

推荐答案

为此,我没有使用任何 Web 服务.我只是使用了以下专门针对捆绑产品的方法,它们是:-

I am not using any Web Services, for this. I have simply used the following methods meant specifically for the Bundled Products, which are:-

  1. setBundleOptionsData()
  2. setBundleSelectionsData()
  3. setCanSaveBundleSelections(true)

对于第一种方法,Bundle Options 的详细信息以数组的形式作为参数提供给方法.同样,对于第二个方法setBundleSelectionsData()",我们以数组的形式将Bundle Selections的详细信息作为参数提供给该方法.

For the first method, the details of the Bundle Options are provided to the method as the parameter in the form of an array. Similarly, for the second method "setBundleSelectionsData()", we are providing the details of the Bundle Selections to this method as the parameter in the form of an array.

这是在 Magento 中添加任何捆绑产品的主要逻辑.希望这对任何新手都有帮助!!!

This is the main logic in what goes through for adding any Bundled Product in Magento. Hope this helps to any newbies!!!

请查看此链接 有关以适当方式创建捆绑产品的更多详细信息.

Please check this link for more details on Bundle Product creation in a proper way.

这篇关于使用简单项目的 SKU/ID 以编程方式在 Magento 中添加捆绑产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:使用简单项目的 SKU/ID 以编程方式在 Magento 中添加

基础教程推荐