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

查看:74
本文介绍了在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上的Google Chrome浏览器中,该按钮停留在按下状态",并在一段时间后出现了Google Chrome浏览器的此页面无响应"终止对话框.

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,或者(格鲁什·马克思风格)不要那样做".在我花时间剖析/挖掘该页面上的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多家制造商选择的商店上安装GoMage Advanced Navigation扩展程序时,我们遇到了完全相同的问题(该扩展程序使用了Magento的内置Flash-uploader).

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天全站免登陆