English 中文(简体)
我如何在Magento的备选办法上积极确定/确定“需要”旗帜?
原标题:How can I dynamically set/unset "is_require" flag on options in Magento?
  • 时间:2012-01-11 16:11:23
  •  标签:
  • magento

我正在建造一座Magento仓库,该仓库拥有服装产品的习惯刺.方案。 添加刺.是任择性的(不需要)。 HOWEVER,如果你选择刺.方案,则需要一些选择,如名称、字体等。

我认为,如果对“刺roid”的检查箱不进行检查,然后在超负荷的检查中使用这一代码,那么我就能够做到这一点。

/* Options #23-40 are the embroidery details */

foreach($product->getOptions() as $_option){
    if($_option->option_id >= 23 && $_option->option_id <= 40){
        $_option->setIsRequire(false);
    }
}

然而,当我去看看一页时,这名ALMOST确实是骗局的。

“以下几种产品没有所有必要的选择。 请编辑和整理所有必要的备选办法......

某人是否建议采取不同的做法,或者至少让我知道我是否在正确的轨道上过了? 我不想购买另一个模块以实现这一目标。

感谢!

最佳回答

容易的“hack”是,不使其需要,而是将“需要”的 c类添加到 your里的投入领域。 这将使Magento在你点击“Add to cart”纽顿时提出申诉。

问题回答

暂无回答




相关问题
Magento addFieldToFilter allow NULLs

When using the Magento collection method addFieldToFilter is it possible to allow filtering by NULL values? I want to select all the products in a collection that have a custom attribute even if no ...

Get product link from Magento API

I am new to Magento and using their API. I need to be able to get the product url from the API call. I see that I can access the url_key and url_path, but unfortunately that s not necessarily what ...

magento extension installation

I want to install a Magento extension in WAMP, but not from the Magento connect system. How can I do this? I have the module (extension) code and I already installed the sample data in the Magento ...

Link to a specific step in onepage checkout

Is it possible to redirect the browser to nth step in the onepage checkout? If so, how would one go about doing it? I m working on a payment module and have a sort of "cancel" action that i would ...

How do I filter a collection by a YesNo type attribute?

I have a ‘featured’ attribute, which has a Yes/No select-list as the admin input. I presume that the values for Yes and No are 1 and 0, as they are for every other Yes/No list. However, if I try and ...

热门标签