在 Magento 中保存大量属性选项标签的问题 [英] Problems Saving Large Number of Attribute Option Labels in Magento

查看:25
本文介绍了在 Magento 中保存大量属性选项标签的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Magento 系统中遇到了一个问题,即保存大量属性根本不起作用或仅部分起作用.这似乎是一个与 javascript 相关的问题,我希望 Stack Overflow 上的某个人有一些已知的科学"来处理这种情况,或者可以为我指明正确的方向.

I'm running into a problem in a Magento system where saving a large number of attributes either doesn't work at all, or only partially works. It appears to be a javascript related issue, and I was hoping someone on Stack Overflow had some "known science" for dealing with this situation, or could point me in the right direction.

基本问题是,有问题的 Magento 系统有超过 250 个颜色属性选项标签.如果管理员用户尝试通过执行以下操作来管理这些

The basic problem is, the Magento system in question has over 250 color attribute option labels. If an admin user attempts to manage these by doing the following

  • 导航到目录 -> 属性 -> 管理属性
  • 选择颜色属性
  • 点击管理标签/选项"标签
  • 编辑最后一个标签选项
  • 点击保存并继续编辑"

发生两件事之一.

在 OS X 上的谷歌浏览器中,按钮停留在按下"状态,一段时间后谷歌浏览器的此页面没有响应"终止对话框出现.

In Google Chrome on OS X, the button sticks in the "depressed" state, and after a period of time Google Chrome's "This page is not responsive" kill dialog comes up.

在 OS X 上基于 mozilla 的浏览器中,单击按钮会使浏览器思考"一下,但最终会提交表单.然而,只有部分属性标签列表被发布到管理控制器.这意味着用户只能编辑前 75 - 100 个标签,因为其他标签从未提交.

In a mozilla based browser on OS X, clicking the button makes the browser "think" for a bit, but it eventually submits the form. However, only a partial list of attribute labels is posted to the admin controller. This means the user can only edit the first 75 - 100 labels, since the other labels are never submitted.

我也收到了 Windows 用户的报告,描述了第二种行为(浏览器是非特定的)

I have reports from windows users describing the second behavior as well (browsers are non-specific)

显而易见的答案是要么调查性能不佳的 javascript,要么(Grouch Marx 风格)不要那样做".在我花时间分析/挖掘该页面上的 javascript 之前,我希望有一些已知的修复方法,或者关于导致问题的原因的具体知识.

The obvious answers are to either investigate the poorly performing javascript, or (Grouch Marx style) "don't do that". Before I spend the time profiling/excavating the javascript on that page, I was hoping there was some known fix for this, or specific knowledge as to what was causing the problem.

Magento CE 1.7.x,如果合适的话.

Magento CE 1.7.x, if it maters.

更新:Javascript 性能问题是一个红鲱鱼.它们是由在

Update: The Javascript performance issues are a red herring. They're caused by the massive number of input fields being iterated through in

js/prototype/validation.js

特别是在这个 try catch 块中

Specifically in this try catch block

    try {
        if(this.options.stopOnFirst) {
            result = Form.getElements(this.form).all(function(elm) {
                if (elm.hasClassName('local-validation') && !this.isElementInForm(elm, this.form)) {
                    return true;
                }
                return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback});
            }, this);
        } else {
            result = Form.getElements(this.form).collect(function(elm) {
                if (elm.hasClassName('local-validation') && !this.isElementInForm(elm, this.form)) {
                    return true;
                }
                return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback});
            }, this).all();
        }
    } catch (e) {
    }

然而,即使我将其短路并让函数返回 true,不保存所有标签的行为仍然存在.

However, even if I short circuit this and have the function return true, the behavior of not saving all the labels persists.

推荐答案

你可以试试变量 max_input_vars(在 PHP 5.3.9 中引入),默认情况下它是 1000 这样应该足够了,但也许你的配置使用了较低的数量.但我想由于您遇到的主要性能问题,该表单无法通过.

You can try the variable max_input_vars (introduced in PHP 5.3.9), by default it's 1000 so that should be enough, but maybe your configuration uses a lower amount. But I imagine the form just doesn't get through due to the major performance issues you're experiencing.

关于选项标签:他们是否有任何更改的属性图像上传器?当我们在一家拥有 300 多个制造商选项的商店(该扩展程序使用 Magento 的内置 Flash 上传程序)上安装 GoMage 高级导航扩展程序时,我们遇到了完全相同的问题.

About the option labels: do they by any change have an uploader for an attribute-image? We had the exact same problem when we installed the GoMage Advanced Navigation extension on a shop with over 300 manufacturer options (the extension uses Magento's built-in Flash-uploader).

我们没有该功能的扩展,所以我禁用了上传器,但极端的性能下降肯定是在加载 300 部 Flash 电影中.也许您可以通过插入按钮或链接而不是电影来尝试在每个选项的基础上延迟加载上传器.

We didn't have the extension for that feature so I disabled the uploader, but the extreme performance decrease was definitely in the 300 Flash-movies being loaded. Maybe you can try lazyloading the uploader on a per-option basis by inserting a button or link instead of the movie.

希望这会为您指明正确(或准确)的方向.

Hope this points you in the right (or exact) direction.

这篇关于在 Magento 中保存大量属性选项标签的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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