4

I would like to create new Type product (as Configurable, Simple, ...).

Here my code :

module.xml :

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Project_CustomType" setup_version="1.0.0">
    </module>
</config>

product_type.xml :

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/product_types.xsd">
    <type name="custom_type" label="CustomType Product" modelInstance="Project\CustomType\Model\Product\Type\CustomType" indexPriority="60" sortOrder="80" isQty="true">
    </type>
</config>

CustomType.php :

<?php
namespace Project\CustomType\Model\Product\Type;

class CustomType extends \Magento\Catalog\Model\Product\Type\AbstractType
{
    const TYPE_CODE = 'custom_type';

    /**
     * @param \Magento\Catalog\Model\Product $product
     */
    public function deleteTypeSpecificData(\Magento\Catalog\Model\Product $product)
    {

    }
}

I created new attributes that I assigned to my new product type.

But here my problem :

When I want to create a new CustomType product in my BO, I need to fill all default attributes + my custom attributes.

But I don't want to fill default attributes : I would like to fill only my custom attributes.

Where do I need to specify that I don't want to create my new CustomType product with default attributes like Enable Product, Attribute Set, Product Name, ... ?

Any idea ?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.