最近,我们进行了一次magento审计,其中一项建议如下:
位置:
app/design/frontend/enterprise/mytheme/template/catalog/product/list.phtml:59,
Type: Maintainability
Name: Hardcoded Value
Priority: Low
Description: Hardcoding values like product type code, store id, file name, credentials, etc. may cause serious issues during future upgrades or porting.
Recommendation: Such values can be stored in class constants or in the system configuration for the best flexibility.示例:
Mage::getConfig()->getOptions()->getSomeSku()如果我们在自定义主题中添加自定义代码,这会在升级期间产生影响吗?
发布于 2014-09-12 09:22:07
自定义与硬编码
这里的问题不是代码是自定义的。这是因为代码并不是升级安全的。
为什么硬编码不好?
硬编码的值很难用于将来的更改。更新可能会执行意想不到的操作,因此可能会导致页面损坏。
如果升级过程重新创建一个对象(删除和保存),并且对象ID因此发生变化,那么这些值本身就会变得过时。
升级路径
审计团队讨论的主题旨在帮助您实现自动升级路径。这意味着如果你尊重他们提出的所有建议,你的升级应该是干净的和没有错误的。否则,调试的日子就到了。
https://stackoverflow.com/questions/25804342
复制相似问题