Rool
Total Posts: 29
Joined: 2008-09-03
Hi,
i would like to create a new product type for some special reasons.
in the
code/core/Mage/Catalog/etc/config.xml
the different types are configured under:
<global>
<catalog>
<product>
<type>
now i created my own module with my own config:
<global>
<catalog>
<product>
<type>
<newone translate="label" module="my_mod">
<label>New Product Type</label>
<model>catalog/product_type_mytype</model>
<index_priority>0</index_priority>
</newone>
</type>
</product>
</catalog>
</global>
the config is read correctly and the type is shown in the admin, when creating a new product. i can select the type, but when clicking “Next”, i get the error:
Warning: include(Mage/Catalog/Model/Product/Type/Mytype.php) [function.include]: failed to open stream: No such file or directory
how can i tell magento to use my own module-directory not the “Mage”?
i want put the Mytype.php in my module-dir…
thanks!
Posted: January 7 2009
| top
retif
Total Posts: 163
Joined: 2008-08-16
Odessa, Ukraine
<model>catalog/product_type_mytype</model>
here you pointing magento to “Mage” folder, becouse “catalog” module is there(in xml configs).
use your own module instead of “catalog”
Posted: January 7 2009
| top
| # 1
Rool
Total Posts: 29
Joined: 2008-09-03
but i want to use catalog, because it belongs to this module. usually i can override the modules, but how tell him to look in “mycompany/catalog” ?
Posted: January 7 2009
| top
| # 2
Rool
Total Posts: 29
Joined: 2008-09-03
no way? normal modules i override also in this way…
Posted: January 12 2009
| top
| # 3
egabbud
Total Posts: 9
Joined: 2008-07-16
You may have figured this out since then, but what you’re missing is a rewrite rule to say where your implementation class is:
in your_module/etc/config.xml:
<global> < models > < catalog > < rewrite > < product_type_mytype > MyCompany_Catalog_Model_Product_Type_MyType </ product_type_mytype > </ rewrite > </ catalog > </ models > </global>
And then create in your module local code pool the following class:
class MyCompany_Catalog_Model_Product_Type_MyType extends Mage_Catalog_Model_Product_Type_Abstract
Posted: March 16 2009
| top
| # 4
Davide Fiorello
Total Posts: 3
Joined: 2009-03-20
I try to follow your suggestion to make a costom product type but the rewrite rule don’t’ work.
<?xml version = "1.0" ?> < config > < modules > < BH_Rentable > < version > 0.1.0 </ version > </ BH_Rentable > </ modules > <global> < catalog > < product > < type > < rentable translate = "label" module = "rentable" > < label > Rentable Product </ label > < model > rentable / product_type </ model > < composite > 0 </ composite > </ rentable > </ type > </ product > </ catalog > < models > < BH_rentable > < rewrite > < product_type_rentable > BH_Rentable_Model_Product_Type </ product_type_rentable > </ rewrite > </ BH_rentable > </ models > </global> </ config >
This is the error
Warning: include(Mage\Rentable\Model\Product\Type.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\magento\app\code\core\Mage\Core\functions.php on line 70
Trace:
#0 C:\xampp\htdocs\magento\app\code\core\Mage\Core\functions.php(70): mageCoreErrorHandler(2, ‘include(Mage\Re...’, ‘C:\xampp\htdocs...’, 70, Array)
#1 C:\xampp\htdocs\magento\app\code\core\Mage\Core\functions.php(70): __autoload()
#2 [internal function]: __autoload(’Mage_Rentable_M...’)
#3 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Config.php(970): class_exists(’Mage_Rentable_M...’)
#4 C:\xampp\htdocs\magento\app\Mage.php(317): Mage_Core_Model_Config->getModelInstance(’rentable/produc...’, Array)
#5 C:\xampp\htdocs\magento\app\Mage.php(331): Mage::getModel(’rentable/produc...’, Array)
I put the module in the community folder.
Wath’is wrong??
Thanks
Posted: April 26 2009
| top
| # 5
Davide Fiorello
Total Posts: 3
Joined: 2009-03-20
This to don’t work
< models > < catalog > < rewrite > < product_type_rentable > BH_Rentable_Model_Product_Type </ product_type_rentable > </ rewrite > </ catalog > </ models >
Posted: April 26 2009
| top
| # 6
CollinsHarper
Total Posts: 12
Joined: 2008-08-14
Vancouver, BC
We’ve been working on a module to add an additional product type as well and we’re running into the same issue:
Warning: include(Mage\Rentable\Model\Product\Type.php)
You need to have the XML setup like:
<global> < catalog > < product > < type > < yourtype translate = "label" module = "yourcompany_yourmodule" > < label > your product type label </ label > < model > yourcompany_yourmodule / path_to_your_model </ model > < composite > 0 </ composite > </ type > </ product > </ catalog > ...
Entering the above gets you a menu selection in the drop down menu when you add a product; which obviously is key, but when you try to use that menu item, it will try to load:
Mage / yourcompany / yourmodule / model / path / to / your / model . php
All this is fine except the Mage/ part.
So how do configure the XML so that you get both a menu item AND a correct path to your file all while keeping your files outside the mage name space?
Signature
---
Collins Harper
http://www.collinsharper.com
Posted: October 21 2009
| top
| # 10
moesian
Total Posts: 14
Joined: 2009-10-05
Hi,
I’ve followed all your great help for creating a new product type, but I’m having quite a serious issue.
I’m basically trying to create a new product type based on grouped products so I’m using the grouped product model and overiding it. I can get the new product type to display in the backend, however when it comes to saving the product I get the following error
Data retreiver for ‘multi’ is not defined
Anyone else experienced this, I’m guessing I’ll have to create/override some additional files to get this working but I have no idea where to begin on this.
Any help much appreciated.
Posted: November 8 2009
| top
| # 11