Skip to content

Instantly share code, notes, and snippets.

@access3000
access3000 / createProductsProcedure.sql
Last active August 29, 2015 14:16 — forked from ryaan-anthony/gist:6290973
Create products procedure
# @author ryaan-anthony
# https://gist.github.com/ryaan-anthony/6290973
# Usage:
# For 9 categories and 99.999 products, run the code:
# mysql > call build_catalog(10,100000);
delimiter ;;
drop procedure if exists build_catalog;;
create procedure build_catalog(IN categories INT, IN products INT)
begin
<?php
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
if (!$installer->getAttributeId(Mage_Catalog_Model_Product::ENTITY, 'attribute_name')) {
$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'attribute_name', array( // TABLE.COLUMN: DESCRIPTION:
'label' => 'Label', // eav_attribute.frontend_label admin input label
'group' => 'General', // (not a column) tab in product edit screen
'sort_order' => 0 // eav_entity_attribute.sort_order sort order in group
'backend' => 'module/class_name', // eav_attribute.backend_model backend class