0

Why does it work on local but does not work on server ?

<?php
namespace AcountS\AcountStatus\Setup;

use Magento\Customer\Model\Customer;
use Magento\Customer\Setup\CustomerSetupFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;


class InstallData implements InstallDataInterface

{

    private $customerSetupFactory;

    public function __construct(
       CustomerSetupFactory $customerSetupFactory
) {
      $this->customerSetupFactory = $customerSetupFactory;
}

    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)

    {

        $setup->startSetup();
        /** @var CustomerSetup $customerSetup */
        $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);

        $customerSetup->addAttribute(Customer::ENTITY, 'account_status', [
            'label' => 'Customer Account Status',
            'input' => 'select',
            'required' => false,
            'sort_order' => 100,
            'visible' => true,
            'system' => false,
            'type' => 'int',
            'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Table',
            'is_used_in_grid' => true,
            'is_visible_in_grid' => true,
            'is_filterable_in_grid' => true,
            'is_searchable_in_grid' => true,
            'option' => ['values' => ['Active', 'Suspend', 'Vacations']],
        ]);

        $setup->endSetup();
    }
}
0

See if the namespace is correct AcountS_AcountStatus (you have a "S" on the AcountS ,not sure if your module is called that way)

Check if the table AcountS_AcountStatus is in database by running .

Select * from setup_module;

If it isnt there . Check if your module is enable

php bin/magento module:status

If it is enabled than disable temporarly the cache run a

php bin/magento cache:disable
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy.

If it is there

DELETE from setup_module where module = "AcountS_AcountStatus";
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy.

Check if it works.

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.