根据值的id获取Magento选项实体值(Get Magento option entity value based on the value's id)

编程入门 行业动态 更新时间:2024-10-28 18:32:33
根据值的id获取Magento选项实体值(Get Magento option entity value based on the value's id)

以下是特定于magento基本安装的方案。 我希望能够在选择制造商过滤器时更改我的类别页面上的某些内容。

我看到的是http://www.myurl.com/path/to/cat.html?manufacturer=777

从这里我可以通过以下方式获得制造商ID:

$request->getParam('manufacturer');

我希望能够做的是跳转到eav_attribute_option_value并根据value_id (在我的情况下为8404)和制造商ID获取制造商名称以返回制造商的名称。

我相信还有其他用例,这也会变得很方便。 对于我的情况,我将基于其他一些逻辑将品牌添加到类别标题标签。 这将创建新的高品牌类别页面,应该在谷歌排名很好。

所以您的基本类别标题标签可能如下所示:'洗衣机'

然后Maytag的制造商品牌过滤页面看起来像:'Maytag洗衣机'

Here is the scenario specific to a base installation of magento. I would like to be able to change some content on my category pages when a manufacturer filter has been chosen.

What I see is http://www.myurl.com/path/to/cat.html?manufacturer=777

From this I can get the manufacturers id by doing something like:

$request->getParam('manufacturer');

What I would like to be able to do is jump into eav_attribute_option_value and get the manufacturers name based on the value_id (8404 in my case) and the manufacturer id to return the name of the manufacturer.

I am sure there are other use cases where this would become handy too. For my case I will be prepending the brand to the category title tag based on some other logic. This will create new highly branded category pages that should rank well on google.

So your base category title tag might look like: 'Washing Machines'

And then the manufacturer brand filter page for Maytag would look like: 'Maytag Washing Machines'

最满意答案

我能找到一种肮脏的方式来做到这一点。 $ query =“SELECT * FROM mg_eav_attribute_option_value WHERE option_id =”。 $ request_params ['制造商']。 “限制0,30”; $ read = Mage :: getSingleton('core / resource') - > getConnection('core_read'); $ manufacturer = $ read-> fetchAll($ query);

I was able to find a dirty way to do this. $query = "SELECT * FROM mg_eav_attribute_option_value WHERE option_id =" . $request_params['manufacturer'] . " LIMIT 0 , 30"; $read = Mage::getSingleton('core/resource')->getConnection('core_read'); $manufacturer = $read->fetchAll($query);

更多推荐

本文发布于:2023-07-05 15:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1039180.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:实体   选项   Magento   id   entity

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!