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

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

问题描述

我在Magento中有一些简单的目录产品,所以我有他们的SKU和ID.现在,我想使用数组元素"bundle_options"&创建一个捆绑产品.捆绑商品的"bundle_selections",由Magento Admin编码器在其Observer类中使用.

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)

对于第一种方法,捆绑选项的详细信息以数组的形式作为参数提供给该方法.同样,对于第二种方法"setBundleSelectionsData()",我们以数组的形式向此方法提供捆绑选择的详细信息作为参数.

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中添加捆绑产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆