Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,621
    Plugin Contributions
    123

    Default Mod Authors: Please read if you are creating install.sql files

    Applies to all versions.

    Please do not do this:

    Code:
    SET @configuration_group_id=0;
    SELECT @configuration_group_id:=configuration_group_id
    FROM configuration_group
    WHERE configuration_group_title= 'My Mod Name'
    LIMIT 1;
    DELETE FROM configuration WHERE configuration_group_id = @configuration_group_id;
    DELETE FROM configuration_group WHERE configuration_group_id = @configuration_group_id;
    If the mod has never been installed before, there is no such configuration group, so you wind up deleting configuration group 0.

    This produces the problem described in this thread:
    http://www.zen-cart.com/forum/showthread.php?t=170483

    To avoid this, just have a separate "uninstall.sql" file and don't include the cleanup statements in your install.sql file.

    You can tell that configuration group 0 has been deleted by looking at a product with a text field in your catalog product info page. You'll see something like this:

    <input type="text" name="id[TEXT_PREFIX72]" size="32" maxlength="300" value="" id="attrib-72-0" />

    instead of something like this:

    <input type="text" name="id[txt_72]" size="32" maxlength="300" value="" id="attrib-72-0" />

    A better way to structure your SQL if you want to clean up before you add config entries (provided by @Numinix):

    Code:
    SELECT @configuration_group_id:=configuration_group_id
    FROM configuration_group
    WHERE configuration_group_title= 'YOUR-FEATURE-NAME'
    LIMIT 1;
    DELETE FROM configuration WHERE configuration_group_id = @configuration_group_id AND configuration_group_id != 0;
    DELETE FROM configuration_group WHERE configuration_group_id = @configuration_group_id AND configuration_group_id != 0;
    Last edited by swguy; 24 Apr 2012 at 01:59 PM.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. Installed the FEC mod and now the GiftWrap mod - files are different, do you merge?
    By pityocamptes in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 23 Mar 2012, 06:37 PM
  2. v139h Mod Authors Please Note: Smart idea if you're adding configuration entries to addons
    By swguy in forum Contribution-Writing Guidelines
    Replies: 5
    Last Post: 6 Feb 2012, 10:44 PM
  3. my download is faulty - Missing files! Please read...
    By mjmindustrial in forum Installing on a Linux/Unix Server
    Replies: 5
    Last Post: 29 Jul 2011, 10:26 AM
  4. If your attributes are adding the base price you need to read this
    By Nick1973 in forum Setting Up Categories, Products, Attributes
    Replies: 21
    Last Post: 31 Jan 2011, 01:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR