Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 未找到Magento列:1054未知列';销售订单_Php_Mysql_Magento_Zend Framework_Magento 1.9 - Fatal编程技术网

Php 未找到Magento列:1054未知列';销售订单

Php 未找到Magento列:1054未知列';销售订单,php,mysql,magento,zend-framework,magento-1.9,Php,Mysql,Magento,Zend Framework,Magento 1.9,我创建了一个自定义模块,允许预先订购产品 这是我的安装脚本 <?php $this->startSetup(); $this->addAttribute('catalog_product', 'pre_order', array( 'group' => 'General', 'type' => 'int', // can

我创建了一个自定义模块,允许预先订购产品

这是我的安装脚本

<?php

                $this->startSetup();
                $this->addAttribute('catalog_product', 'pre_order', array(
                    'group' => 'General',
                    'type' => 'int', // can be int, varchar, decimal, text, datetime
                    'backend' => '', // If you're making an image attribute you'll need to add : catalog/category_attribute_backend_image
                    'frontend_input' => '',
                    'frontend' => '',
                    'label' => 'Is Pre Order',
                    'input' => 'boolean', //text, textarea, select, file, image, multiselect
                    'class' => '',
                    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, // Scope can be SCOPE_STORE, SCOPE_GLOBAL or SCOPE_WEBSITE
                    'visible' => true,
                    'frontend_class' => '',
                    'required' => false, // or true
                    'user_defined' => true, // or false
                    'used_in_product_listing' => '1',
                    'default' => '',
                    'apply_to' => 'simple,configurable,virtual,bundle,downloadable',
                ));
                $this->addAttribute('catalog_product', 'pre_order_note', array(
                    'group' => 'General',
                    'type' => 'varchar', // can be int, varchar, decimal, text, datetime
                    'backend' => '', // If you're making an image attribute you'll need to add : catalog/category_attribute_backend_image
                    'frontend_input' => '',
                    'frontend' => '',
                    'label' => 'Pre Order Note',
                    'input' => 'text', //text, textarea, select, file, image, multiselect
                    'class' => '',
                    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, // Scope can be SCOPE_STORE, SCOPE_GLOBAL or SCOPE_WEBSITE
                    'visible' => true,
                    'frontend_class' => '',
                    'required' => false, // or true
                    'user_defined' => true, // or false
                    'used_in_product_listing' => '1',
                    'default' => '',
                    'apply_to' => 'simple,configurable,virtual,bundle,downloadable',
                ));
                $this->endSetup();

                $installer = new Mage_Sales_Model_Resource_Setup('core_setup');
                /**
                * Add 'custom_attribute' attribute for entities
                */
                $entities = array(
                    'quote',
                    'quote_item',
                    'order',
                    'order_item'
                );
                $entitiesnew = array(
                    'quote_item',
                    'order_item'
                );
                $options = array(
                    'type'     => Varien_Db_Ddl_Table::TYPE_BOOLEAN,
                    'visible'  => true,
                    'required' => false,
                    'default' => 0
                );
                $options2 = array(
                    'type'     => Varien_Db_Ddl_Table::TYPE_VARCHAR,
                    'visible'  => true,
                    'required' => false
                );
                foreach ($entities as $entity) {
                    $installer->addAttribute($entity, 'pre_order', $options);   
                }
                foreach ($entitiesnew as $entitynew) {
                    $installer->addAttribute($entitynew, 'pre_order_note', $options2);
                }
                $installer->endSetup();
                ?>
你能指出问题所在吗


谢谢,

对我来说,这看起来不是一个有效的安装脚本,我认为这实际上不会起任何作用。。。检查数据库以查看是否已创建列。然而,如果@CD001我错误地发布了错误的安装脚本,这个问题可能会更好。我更新了我的问题。请你现在看一下,告诉我有什么问题吗?
<?php

class Vishwasnature_Preorder_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid {

public function __construct()
{
    parent::__construct();
    $this->setId('sales_order_grid');
    $this->setUseAjax(true);
    $this->setDefaultSort('created_at');
    $this->setDefaultDir('DESC');
    $this->setSaveParametersInSession(true);
}

/**
 * Retrieve collection class
 *
 * @return string
 */
protected function _getCollectionClass()
{ 
    return 'sales/order_grid_collection';
}

protected function _prepareCollection()
{
 $tablePrefix = (string) Mage::getConfig()->getTablePrefix();
    $collection = Mage::getResourceModel($this->_getCollectionClass());
    $collection->getSelect()->joinleft(array('salesorder'=> $tablePrefix . 'sales_flat_order'),'salesorder.entity_id =' .$tablePrefix . 'main_table.entity_id',array('pre_order' => 'salesorder.pre_order'));
    $this->setCollection($collection);
    return parent::_prepareCollection();
}

protected function _prepareColumns()
{


    $this->addColumn('pre_order', array(
        'header' => Mage::helper('sales')->__('Order Type'),
        'index' => 'pre_order',
        'filter_index' => 'salesorder.pre_order',
        'type'  => 'options',
        'width' => '70px',
        'options' => Mage::getSingleton('preorder/observer')->getOrderTypes(),
    ));

    $this->addColumn('status', array(
        'header' => Mage::helper('sales')->__('Status'),
        'index' => 'status',
        'type'  => 'options',
        'width' => '70px',
        'filter_index' => 'main_table.status',
        'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
    ));

    if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
        $this->addColumn('action',
            array(
                'header'    => Mage::helper('sales')->__('Action'),
                'width'     => '50px',
                'type'      => 'action',
                'getter'     => 'getId',
                'actions'   => array(
                    array(
                        'caption' => Mage::helper('sales')->__('View'),
                        'url'     => array('base'=>'*/sales_order/view'),
                        'field'   => 'order_id'
                    )
                ),
                'filter'    => false,
                'sortable'  => false,
                'index'     => 'stores',
                'is_system' => true,
        ));
    }
    $this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));

    $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
    $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));

    return parent::_prepareColumns();
}

protected function _prepareMassaction()
{
    $this->setMassactionIdField('entity_id');
    $this->getMassactionBlock()->setFormFieldName('order_ids');
    $this->getMassactionBlock()->setUseSelectAll(false);

    if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
        $this->getMassactionBlock()->addItem('cancel_order', array(
             'label'=> Mage::helper('sales')->__('Cancel'),
             'url'  => $this->getUrl('*/sales_order/massCancel'),
        ));
    }

    if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
        $this->getMassactionBlock()->addItem('hold_order', array(
             'label'=> Mage::helper('sales')->__('Hold'),
             'url'  => $this->getUrl('*/sales_order/massHold'),
        ));
    }

    if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
        $this->getMassactionBlock()->addItem('unhold_order', array(
             'label'=> Mage::helper('sales')->__('Unhold'),
             'url'  => $this->getUrl('*/sales_order/massUnhold'),
        ));
    }

    $this->getMassactionBlock()->addItem('pdfinvoices_order', array(
         'label'=> Mage::helper('sales')->__('Print Invoices'),
         'url'  => $this->getUrl('*/sales_order/pdfinvoices'),
    ));

    $this->getMassactionBlock()->addItem('pdfshipments_order', array(
         'label'=> Mage::helper('sales')->__('Print Packingslips'),
         'url'  => $this->getUrl('*/sales_order/pdfshipments'),
    ));

    $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
         'label'=> Mage::helper('sales')->__('Print Credit Memos'),
         'url'  => $this->getUrl('*/sales_order/pdfcreditmemos'),
    ));

    $this->getMassactionBlock()->addItem('pdfdocs_order', array(
         'label'=> Mage::helper('sales')->__('Print All'),
         'url'  => $this->getUrl('*/sales_order/pdfdocs'),
    ));

    $this->getMassactionBlock()->addItem('print_shipping_label', array(
         'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
         'url'  => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
    ));

    return $this;
}

public function getRowUrl($row)
{
    if (Mage::getSingleton('admin/session')->isAllowed        ('sales/order/actions/view')) {
        return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
    }
    return false;
}

public function getGridUrl()
{
    return $this->getUrl('*/*/grid', array('_current'=>true));
}

}

 ?>