问题标签 [mage]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
685 浏览

php - 订单入库后执行观察者 sales_order_place_after

我正在创建一个 Magento 插件,在其中我制作了一个 Observer 脚本,我获取订单信息和产品信息,以便向 magento 之外的 API 发出请求。问题是,当脚本被执行时,数据还没有被 Magento 放入数据库中。简单地将脚本休眠 x 秒并没有帮助(当然),因为整个系统都停止了。

这是我的代码:

我知道我可以使用 mage 来获取订单信息,但我不能使用它来获取产品信息(我绝对需要)。

Magento 将他的信息插入数据库后,有什么方法可以让这段代码执行?

非常感谢。

编辑:对不起,忘记添加。在 SQL 查询中,entity_id='107' 有效,但是当我使这个动态(entity_id=$_POST['entity_id'] 或类似的东西)时,它将不起作用,因为它请求的数据尚不可用。

0 投票
3 回答
59 浏览

php - 不同 PHP 设置上的 Magento 代码错误

我有以下问题。将网站从旧服务器移动到新服务器后,页面在代码的这一点停止呈现:

是否缺少 PHP 库?

0 投票
2 回答
352 浏览

php - Magento Collection Filter not working with spaces

I have the following php code (running under magento 1.7.0.2) that finds a customer group with a particular code. The code works fine for groups that have no spaces in the code value, however it will not find any groups with a space in the code value, Can you locate the reason?

I don't want to change the code to use the group ID as this is not practical in this situation, can anyone help?

For example when the variable $groupName is 'Standard' I find results, when it is 'Standard Rate' I don't get it as it, this happens for any codes with spaces in them

thanks

0 投票
2 回答
3328 浏览

php - Magento 更改“已订购商品”的排序顺序

有人可以指出我按字母顺序而不是时间顺序显示项目的正确方向吗?

我主要需要这个 pdf 发票(我已经修改了相当数量以满足我的需要,但我坚持这个)我确实意识到我可能需要完全改变发票的排序/订购方式,而不是就在pdf制作上。

通常,客户购物车和发票中的“订购物品”都是按时间顺序排列的,即它们被添加到购物篮时的时间顺序,但是我希望它们按 SKU 或描述/标题排序以帮助挑选。甚至按类别排序也是一种改进。

如果有人能帮忙解决这个问题,我会欣喜若狂,因为我在过去的两天里一直试图弄清楚这一点,但一无所获。

谢谢阅读。

哦,我使用的是 1.5 CE。再次感谢。

跟进:

我找到了在创建发票时对订单进行排序的代码:

并将其替换为:

然而,现在发票首先像它应该的那样产生例如 A,但它实际上只显示第一个项目。发票的其余部分是少项目!:(

我对在 adminhtml 中生成订单表的文件进行了非常相似的代码更改,并且运行良好!????使困惑??也许有人可以进一步帮助我?

进一步检查,很明显,剩下的单个可见项目实际上是一个简单的产品,而可配置的产品正在从发票中消失!???

_ 编辑 __

我已经解决了!

我只列出简单产品的原因是线索!而不是按 SKU 排序,我只是在上面的代码中使用 getName() 代替 getSKU 按名称对列表进行排序!!!:D

0 投票
1 回答
398 浏览

magento - Magento 可以处理大量产品价格吗

我正在使用 Magento 1.7.0.2,大约有 4,000 个产品项目和 3000 个客户帐户,最近我一直在上传大量客户价格。价格将作为团体价格与产品保持一致,客户价格将由他们所属的团体决定 - 所有标准 magento 和所有工作正常。

但是这个要求意味着我需要上传 650 个客户组,然后将产品价格与每个组相关联

这产生 650 * 4000 = 2,600,000 - 很多价格!

我知道这需要一些时间才能完成,问题是 Magento 可以处理这么多价格吗?

谢谢

0 投票
1 回答
512 浏览

magento - Magento 结合目录价格规则

我正在尝试创建一个 magento 目录价格规则,其条件结合使用“任何”而不是“全部”

以下代码创建了一个具有两个条件的规则 - 但它们使用 all 组合在一起。有谁知道如何实现这一目标?我正在使用 magento 1.7.0.2(社区版)

0 投票
1 回答
1135 浏览

php - Magento filter product gallery images by label

I have some product images that should not be displayed in the main product image gallery in magento. I have given a specific label to the images that should not be displayed in the gallery but I am unsure of how to filter the images based on the label.

In my catalog/product/view/media.phtml file I have the following code:

I would like to filter the array of images returned from the getGalleryImages() call before looping over them in the template. Is there are easy way to get the label of each of the images and then filter based on the value of the label?

Thanks in advance!

0 投票
1 回答
1242 浏览

magento - 尝试安装似乎与编译器不兼容的 Magento 模块 - Magento 1.7.0.2

尝试了一段时间如何在 magento 1.7.0.2 上安装 magento 扩展

法师专家货到付款 - http://www.magentocommerce.com/magento-connect/cash-on-delivery-6259.html

试过了

三个步骤 1)禁用缓存和编译,安装扩展并重新启用缓存和编译 2)禁用编译和缓存,安装扩展并启用编译和缓存

出现错误:致命错误:在第 546 行的 /home/bwcom/public_html/app/Mage.php 中找不到类“MSP_CashOnDelivery_Helper_Data”

请告知我应该遵循哪些步骤

0 投票
2 回答
3405 浏览

php - 使用 {{var order.getCreatedAtFormated(''short'')}} 隐藏交易邮件中的时间

我有一个小问题。我只想在我的订单邮件中显示没有时间的日期。

为此,我必须使用 {{var order.getCreatedAtFormated(''short'')}}afaik。但它仍然显示时间。当然,我搜索了 Magento 源,我想知道为什么它不起作用。

当我查看时,app/code/core/Mage/Sales/Model/Order.php我可以发现:

进一步研究/app/code/core/Mage/Core/Helper/Data.php表明:

那么它不应该隐藏我将简短参数传递给该函数的时间吗?

0 投票
1 回答
1785 浏览

php - Magento:不能改变 Mage::getSingleton('core/session') 的值?

我有一个扩展

在控制器 php 文件中,我在下面有一行

因此,我首先将值“ mobile ”设置为Mage::getSingleton('core/session') ...我想在if(is_numeric($sms_response))之后将其更改为“ code ”,但它不会更改并且仅回显“移动“!

不知道为什么,谁能帮我解决?

谢谢大家