1

I'm trying to update a custom customer attribute (required = false) but i am having difficulty solving the problem as my developer skills are limited..

I created a custom module/attribute using: http://www.silksoftware.com/magento-module-creator/ which i uploaded and deployed into my magento root folder.

The field now appears on the back end, however I made the mistake of installing the module as required = true. I'm trying to update this to required = false or is_required = 0

<?php

$installer = $this;


$installer->startSetup();
$installer->updateAttribute('customer', 'business_name', 'required', false);
$installer->updateAttribute('customer', 'business_abn', 'required', false); 
$installer->endSetup();

I've also tried 'is_required' 0 and haven't noticed any change after flushing cacches

This is my config file

<?xml version="1.0"?>
<config>
  <modules>
    <SAS_BusinessInfo>
      <version>0.1.0</version>
    </SAS_BusinessInfo>
  </modules>
  <global>
    <helpers>
      <businessinfo>
        <class>SAS_BusinessInfo_Helper</class>
      </businessinfo>
    </helpers>
    <models>
      <businessinfo>
        <class>SAS_BusinessInfo_Model</class>
        <resourceModel>businessinfo_mysql4</resourceModel>
      </businessinfo>
    </models>
    <resources>
      <customerattribute1438050443_setup>
        <setup>
          <module>SAS_BusinessInfo</module>
          <class>Mage_Customer_Model_Entity_Setup</class>
        </setup>
        <connection>
          <use>core_setup</use>
        </connection>
      </customerattribute1438050443_setup>
      <customerattribute1438050443_write>
        <connection>
          <use>core_write</use>
        </connection>
      </customerattribute1438050443_write>
      <customerattribute1438050443_read>
        <connection>
          <use>core_read</use>
        </connection>
      </customerattribute1438050443_read>
    </resources>
  </global>
</config> 

Am i missing anything in my update or config file?

Is the update php file meant to be uploaded to the same folder as the install php file? the magento root folder?

is my config file calling on my update php file correctly?

The install file is named mysql4-install-0.1.0.php , does the update.php filename matter?

0

hi you can install this extension, it create backend interface for you. So you can just edit customer attribute from backend like product attribute. I am not promoting this extension it's just for help.

  • Thank you so much.. that worked perfectly! I've been trying to figure this out for hours and this extension makes it so much easier by giving backend GUI functionality. – sasmarketing Aug 13 '15 at 9:04

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.