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

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

相关文档推荐

DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)