小编MSD*_*MSD的帖子

需要帮助了解productAttribute()产品页面的方法

我需要帮助熟悉帮助者,他们的方法和产品属性.特别:$_helper->productAttribute($product, $attributeHtml, $attributeName)

以下是我正在使用/审核的文件:

app\code\core\Mage\catalog\helper\output.php  
app\design\frontend\[theme name]\template\catalog\product\view\media.phtml
Run Code Online (Sandbox Code Playgroud)

以下代码行生成产品图像的html.

echo $_helper->productAttribute($_product, $_img, 'image');
Run Code Online (Sandbox Code Playgroud)

辅助类代码描述了以下代码段中的方法.返回什么,步骤是什么,为什么我会使用这种方法而不是简单地回显模板文件前一行中描述的img html?

public function getHandlers($method)
{
    $method = strtolower($method);
    return isset($this->_handlers[$method]) ? $this->_handlers[$method] : array();
}

public function process($method, $result, $params)
{
    foreach ($this->getHandlers($method) as $handler) {
        if (method_exists($handler, $method)) {
            $result = $handler->$method($this, $result, $params);
        }
    }
    return $result;
}

public function productAttribute($product, $attributeHtml, $attributeName)
{
    /* Code that is not relevant to this example */

    $attributeHtml = $this->process('productAttribute', $attributeHtml, array(
        'product'   => $product,
        'attribute' => …
Run Code Online (Sandbox Code Playgroud)

php methods helper magento

16
推荐指数
1
解决办法
6850
查看次数

如何使用 Normalizr 在 Redux 状态中展平多对多关系?

设想

我们有一个映射以下关系的数据库:

  • Atag有很多campaigns
  • Acampaign有很多tags
  • campaigns和之间的关系tags由一个称为 a 的关联实体表示campaign_tag
  • campaign_tag实体拥有priority属性

当我们的关联实体没有唯一的 ID/值时,我们如何实现normalizr(或任何类似的库)来生成一个扁平化的应用程序状态来解释我们的关联实体?

笔记/杂念

我见过的其他例子只绘制了原始实体,似乎更适合一对多或一对一的关系。他们通常产生这样的状态树:

{
  entities: {
    campaigns: {
      '1': { id: 1, name: 'Ace', tags: [1, 2, 3] },
      ...
    },
    tags: {
      '1': { id: 1, name: 'Example Tag', campaigns: [1, 2, 3] },
      ...
    }
  },
  ...
}
Run Code Online (Sandbox Code Playgroud)

我们的关联实体会进入那个entities组吗?我们应该只添加唯一的 ID 吗?这似乎适得其反。扁平化这种关系是否合适?

任何帮助表示赞赏,谢谢。

reactjs redux normalizr

5
推荐指数
1
解决办法
1003
查看次数

How do I use JSON_SEARCH() to find the path of a number in a MySQL JSON array?

Note: This is for MySQL 5.7.

When I attempt to use JSON_SEARCH to find the path to a number value within a JSON array, I get NULL. But when I use JSON_SEARCH to look for a string, I actually get the path.

# String Search Example

SET @json = '[1, 2, 3, "abc"]';
SELECT JSON_SEARCH(@json, 'one', 'abc');

----------
| "$[3]" |
----------
Run Code Online (Sandbox Code Playgroud)

...but when I explicitly search for a number value, I get NULL?

# Number Search …
Run Code Online (Sandbox Code Playgroud)

mysql arrays json

5
推荐指数
1
解决办法
4567
查看次数

如何在Chrome开发工具中使用其他行断点标记?

我为Chrome开发工具中的断点选择了以下行

行断点

我不知道其他标记的含义,也不知道如何使用它们。

这些仅针对同一行上的多个箭头功能显示吗?是否可以停止在这些标记上执行代码?如果是这样,怎么办?

任何帮助表示赞赏!

javascript google-chrome google-chrome-devtools

2
推荐指数
1
解决办法
256
查看次数