2
A
回答
7
擴展Shopware核心模型本身是不可能的。根據你想擴展會有一些解決方法兩種不同的方式是什麼具體型號:
如果你想擴展您可以使用自定義物品本身屬性字段說明如下:http://community.shopware.com/Anlegen,-Anpassen-und-Ausgabe-von-Artikel-Attributen_detail_1208.html
另一種方法是編寫一個插件,通過plugin install()上的代碼創建屬性字段。這僅適用於具有屬於實體本身的屬性表的實體。例如s_order和s_order_attributes
對於第二種方式在你的插件的bootstrap.php中的插件的安裝()方法創建一個方法類似下面,並調用方法:
public function installOrderAttributes()
{
Shopware()->Models()->addAttribute(
's_order_attributes',
'ordermod',
'Random1',
'DECIMAL(12,4)',
false,
0.0000);
Shopware()->Models()->addAttribute(
's_order_attributes',
'ordermod',
'Random2',
'DECIMAL(12,4)',
false,
0.0000);
$metaDataCacheDoctrine = Shopware()->Models()->getConfiguration()->getMetadataCacheImpl();
$metaDataCacheDoctrine->deleteAll();
Shopware()->Models()->generateAttributeModels(array('s_order_attributes'));
}
中的addAttribute(在/engine/Shopware/Components/Model/ModelManager.php)函數具有以下特徵:
/**
* Shopware helper function to extend an attribute table.
*
* @param string $table Full table name. Example: "s_user_attributes"
* @param string $prefix Column prefix. The prefix and column parameter will be the column name. Example: "swag".
* @param string $column The column name
* @param string $type Full type declaration. Example: "VARCHAR(5)"/"DECIMAL(10, 2)"
* @param bool $nullable Allow null property
* @param null $default Default value of the column
* @throws \InvalidArgumentException
*/
public function addAttribute($table, $prefix, $column, $type, $nullable = true, $default = null);
希望這會有所幫助。
親切的問候!
相關問題
- 1. 如何擴展Shopware客戶
- 2. Shopware 5.2.20。無法通過插件擴展模板
- 3. Shopware CSS(LESS)
- 4. 子域與Shopware
- 5. Building Custom Extentable Models
- 6. 擴展Laravel包
- 7. 把應用程序中的基本模型擴展分類/ models文件夾
- 8. Models/IdentityModel.cs missing
- 9. 擴展擴展類型
- 10. Chrome擴展圖標://擴展/
- 11. 擴展擴展管理器
- 12. 擴展擴展類Zend_Db_Table_Row_Abstract
- 13. jQuery:如何擴展擴展?
- 14. 訪問擴展://擴展
- 15. 滾動時擴展擴展
- 16. 擴展SuperTest
- 17. div不擴展表擴展,或div不擴展當它擴大
- 18. 作曲更新 - 無法加載包shopware/shopware在http://packagist.org:
- 19. 擴展Android擴展ListView展開
- 20. 擴展在Django 1.7
- 21. 擴展字段OctoberCMS
- 22. 擴展包模型
- 23. 擴展模型:從孩子
- 24. 從擴展運行方法擴展運行擴展運行
- 25. 創建一個擴展另一個PHP擴展的PHP擴展?
- 26. 我如何在html中擴展視頻以擴展Chrome擴展
- 27. 擴展
- 28. 擴展
- 29. 擴展
- 30. 擴展