0

How to create a Custom product type by default.

It like Affiliate Products.

1
0

You add below code in your etc.xml file

<catalog>
            <product>
                <type>
                    <affilated translate="label" module="affilatedproduct">
                        <label>Affilated Product</label>
                        <model>affilatedproduct/product_type</model>
                        <price_model>affilatedproduct/product_price</price_model>
                        <is_qty>0</is_qty>
                        <composite>0</composite>
                        <index_priority>20</index_priority>
                        <can_use_qty_decimals>0</can_use_qty_decimals>
                    </affilated>
                </type>
            </product>
        </catalog>

in Model_Product_Type file

class Vendor_Affilatedproduct_Model_Product_Type extends Mage_Catalog_Model_Product_Type_Abstract
{
    const TYPE_AFFILIATE          = 'affilated';
    const XML_PATH_AUTHENTICATION = 'catalog/affilated/authentication';
    protected function _prepareProduct(Varien_Object $buyRequest, $product, $processMode)
    {  
        if ($this->_isStrictProcessMode($processMode)) {
            return Mage::helper('affilatedproduct')->__(
                'Affiliate product %s cannot be added to cart. ' .
                ' On the product detail page click the "Go to parent site"'.
                ' button to access the product.',
                $product->getName()
            );
        }
        return parent::_prepareProduct($buyRequest, $product, $processMode);
    }
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.