【发布时间】:2019-07-22 14:35:25
【问题描述】:
我目前正在使用 SilverShop 开发商店。我想在我的产品中添加一些特定的字段,例如我的衣服是由什么面料制成的,以及一张图片。我知道我们不应该在核心 SilverShop 源代码中进行这些更改。
我是否应该在新文件中扩展 Product 类,例如 app/src/ProductPage.php?
class Product extends Page implements Buyable
{
private static $db = [
'InternalItemID' => 'Varchar(30)', //ie SKU, ProductID etc (internal / existing recognition of product)
'Model' => 'Varchar(30)',
'BasePrice' => 'Currency(19,4)', // Base retail price the item is marked at.
//physical properties
// TODO: Move these to an extension (used in Variations as well)
'Weight' => 'Decimal(12,5)',
'Height' => 'Decimal(12,5)',
'Width' => 'Decimal(12,5)',
'Depth' => 'Decimal(12,5)',
'Featured' => 'Boolean',
'AllowPurchase' => 'Boolean',
'Popularity' => 'Float' //storage for CalculateProductPopularity task
];
...
【问题讨论】: