我使用此扩展http://www.magentocommerce.com/magento-connect/ultimate-modulecreator.html为magento创建了我的第一个模块。在我创建了扩展后,我尝试使用magento connect manager尝试安装它,尝试上传zip文件,但它给了我CONNECT ERROR: Package file is invalid. Invalid package name, allowed: [a-zA-Z0-9_-]
错误。我尝试将文件直接复制到这些位置。但现在它显示在管理面板中的system -> advance -> advance
选项中,但未显示在菜单上。我发现在检查数据库时没有创建数据库表。我想知道如何运行该数据库文件,以便它可以创建表,我的模块可以开始工作。
我的数据库表内容是
<?php
/**
* campaigns_campaigns extension
*
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/mit-license.php
*
* @category campaigns
* @package campaigns_campaigns
* @copyright Copyright (c) 2014
* @license http://opensource.org/licenses/mit-license.php MIT License
*/
/**
* campaigns module install script
*
* @category campaigns
* @package campaigns_campaigns
* @author Ultimate Module Creator
*/
$this->startSetup();
$table = $this->getConnection()
->newTable($this->getTable('campaigns/paramcampaign'))
->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'identity' => true,
'nullable' => false,
'primary' => true,
), 'Campaign ID')
->addColumn('campaignname', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
'nullable' => false,
), 'Campaign Name')
->addColumn('campaigndesc', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
'nullable' => false,
), 'Campaign Description ')
->addColumn('campaignnameprice', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
'nullable' => false,
), 'Campaign Goal Price')
->addColumn('campaignstartdate', Varien_Db_Ddl_Table::TYPE_DATETIME, 255, array(
'nullable' => false,
), 'Campaign Start date')
->addColumn('campaignenddate', Varien_Db_Ddl_Table::TYPE_DATETIME, 255, array(
'nullable' => false,
), 'Campaign End date')
->addColumn('campaignfbgoal', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'nullable' => false,
'unsigned' => true,
), 'Campaign Facebook Shares/Likes Goal')
->addColumn('campaignpinterestgoal', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'nullable' => false,
'unsigned' => true,
), 'Campaign Pinterest Shares Goal')
->addColumn('campaignamtdonate', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'nullable' => false,
'unsigned' => true,
), 'Campaign Percentage / Amount To Donate ')
->addColumn('campaigncheckpercent', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'nullable' => false,
), 'Is The Specified Amount is Percentage ? ')
->addColumn('campaigngoalrecv', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
), 'Campaign Goal Amount Achieved')
->addColumn('campaignfbgoalrecv', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'unsigned' => true,
), 'Campaign Facebook Shares/Likes Goal Achieved ')
->addColumn('campaignpingoalrecv', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'unsigned' => true,
), 'Campaign Pinterest Shares Achieved ')
->addColumn('url_key', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
), 'URL key')
->addColumn('status', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
), 'Status')
->addColumn('in_rss', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
), 'In RSS')
->addColumn('meta_title', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
), 'Meta title')
->addColumn('meta_keywords', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
), 'Meta keywords')
->addColumn('meta_description', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
), 'Meta description')
->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
), 'Campaign Creation Time')
->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
), 'Campaign Modification Time')
->setComment('Campaign Table');
$this->getConnection()->createTable($table);
$table = $this->getConnection()
->newTable($this->getTable('campaigns/paramcampaign_store'))
->addColumn('paramcampaign_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
'nullable' => false,
'primary' => true,
), 'Campaign ID')
->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
'unsigned' => true,
'nullable' => false,
'primary' => true,
), 'Store ID')
->addIndex($this->getIdxName('campaigns/paramcampaign_store', array('store_id')), array('store_id'))
->addForeignKey($this->getFkName('campaigns/paramcampaign_store', 'paramcampaign_id', 'campaigns/paramcampaign', 'entity_id'), 'paramcampaign_id', $this->getTable('campaigns/paramcampaign'), 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
->addForeignKey($this->getFkName('campaigns/paramcampaign_store', 'store_id', 'core/store', 'store_id'), 'store_id', $this->getTable('core/store'), 'store_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
->setComment('Campaign To Store Linkage Table');
$this->getConnection()->createTable($table);
$table = $this->getConnection()
->newTable($this->getTable('campaigns/paramcampaign_product'))
->addColumn('rel_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'unsigned' => true,
'identity' => true,
'nullable' => false,
'primary' => true,
), 'Category ID')
->addColumn('paramcampaign_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'unsigned' => true,
'nullable' => false,
'default' => '0',
), 'Campaign ID')
->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'unsigned' => true,
'nullable' => false,
'default' => '0',
), 'Product ID')
->addColumn('position', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'nullable' => false,
'default' => '0',
), 'Position')
->addIndex($this->getIdxName('campaigns/paramcampaign_product', array('product_id')), array('product_id'))
->addForeignKey($this->getFkName('campaigns/paramcampaign_product', 'paramcampaign_id', 'campaigns/paramcampaign', 'entity_id'), 'paramcampaign_id', $this->getTable('campaigns/paramcampaign'), 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
->addForeignKey($this->getFkName('campaigns/paramcampaign_product', 'product_id', 'catalog/product', 'entity_id'), 'product_id', $this->getTable('catalog/product'), 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
->setComment('Campaign to Product Linkage Table');
$this->getConnection()->createTable($table);
$this->endSetup();