0

Alright, this is pretty embarrassing. Setup scripts are supposed to be no problem, but I am having an awful time executing my install script.

config.xml

<config>
  <modules>
    <Redacted_Tsc>
      <version>1.0.0</version>
    </Redacted_Tsc>
  </modules>
  <global>
    <resources>
      <tsc_setup>
        <setup>
          <module>Redacted_Tsc</module>
        </setup>
        <connection>
          <use>core_setup</use>
        </connection>
      </tsc_setup>
    </resources>
  </global>
</config>

mysql4-install-1.0.0.php

$installer = $this;
$installer->startSetup();

$tscRoot = Mage::getModel('catalog/category')
    ->setName('Redacted TSC')
    ->setUrlKey('tsc')
    ->setIsActive(1)
    ->setIsAnchor(0)
    ->save()
    ;
$site = Mage::getModel('core/website')->getCollection()
    ->addFieldToFilter('code', 'redacted')
    ->getFirstItem()
    ;

$storeGroup = Mage::getModel('core/store_group')
    ->setWebsiteId($site->getId())
    ->setName('TSC')
    ->setRootCategoryId($tscRoot->getId())
    ->save()
    ;

$store = Mage::getModel('core/store')
    ->setWebsiteId($site->getId())
    ->setGroupId($storeGroup->getId())
    ->setName('TSC Store')
    ->setIsActive(0)
    ->save()
    ;
$installer->endSetup();

Couple of notes about the installer: I decided that it would be nice to have automated site/store group/store/root category creation so that I can be certain that the developed product is the same as what's in production. Figured an installer would be a handy way to go. If I'm crazy, let me know!

Redacted_Tsc.xml

<config>
  <modules>
    <Redacted_Tsc>
      <active>true</active>
      <codePool>local></codePool>
    </Redacted_Tsc>
  </modules>
</config>

Checklist:

  • There's no entry in the core_resource table
  • Caches are 100% off
5
  • 1
    What is the error you are receiving? Commented May 8, 2013 at 16:16
  • 2
    Semi-canonical setup resource debugging scripts here: stackoverflow.com/questions/4717535/… Commented May 8, 2013 at 16:57
  • A) Not getting any errors. B) I attempted using your recommendations (at least the ones from the answer on StackOverflow), but somehow missed the full article. I'll give that a try, thanks!
    – mpw
    Commented May 8, 2013 at 17:14
  • Are you getting any errors? Or is it simply not running the install script? What does your file-structure look like?
    – davidalger
    Commented May 9, 2013 at 13:34
  • There was a typo in my etc/modules entry: local> when I needed local. It's odd, the module was showing up properly in the admin panel (under config/advanced/advanced). Benmarks' answer below is the correct one.
    – mpw
    Commented May 9, 2013 at 14:07

2 Answers 2

2

I'd take a pretty good look at that extra > in your <codePool> text node ("local>").

2
  • oh damn :/ I hate such errors, so hard to debug :( Commented May 10, 2013 at 14:04
  • This one comes up regularly in the Magento U Fundamentals of Dev class - it's very, very hard to spot.
    – benmarks
    Commented May 10, 2013 at 14:40
3

My standard error is a missing tsc_setup folder inside the sql:

app/(local|community)/Namespace/ModuleName/sql/(setup_name)/install-1.0.0.php

in your case:

app/local/Redacted/Tsc/sql/tsc_setup/install-1.0.0.php

There is no need for mysql4 if you are implementing for magento 1.6+

2
  • It's good to know that mysql4 is unnecessary. It seemed to be one of Magento's more arbitrary requirements.
    – mpw
    Commented May 10, 2013 at 14:02
  • 1
    long story short: in later days it was necessary, today you can have more than one install script install- for general purposes and mysql-install or pgsql-install (later maybe) to address special RDBMSs Commented May 10, 2013 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.