Instructions for Making Merchant Attributes Optional in StoreFront 6
By Structured Solutions

Revision: 1.1

Merchant attributes are always marked as required in StoreFront 6. This means that customers must select one of the choices before adding the item to the cart. This document has instructions for changing the source code so that merchant attributes are not required.

Before You Start

The following files will be modified. Please make a backup copy before you start. Rename your backup copies with the extension *.old or *.bak to avoid confusing the StoreFront compiler.

Installation Script

Follow these steps to implement this modification.

  1. Compile your site to make sure there are no other pending changes or errors.
  2. Open CProductDetailBase.vb in a text editor and search for these lines (they appear twice)
    ' required raise error

    RaiseEvent AttributeRequiredError(sAttName, EventArgs.Empty)
    Exit Sub
  3. Put an apostrophe ( ' ) in front of the last two lines as shown. This makes them into comments and disables their effect.
    ' required raise error

    ' RaiseEvent AttributeRequiredError(sAttName, EventArgs.Empty)
    ' Exit Sub
  4. Repeat this change for the next occurrence of the same 3 lines of code.
  5. Save your changes and close the file.
  6. Repeat steps 2-5 for CSearchResultBase.vb.
  7. Open CMultiBot.vb in a text editor and search for these lines of code:
    If objAttributes.SelectedItem Is Nothing Then
        m_bAttribute_Error = True
        Me.ErrorMessage.Text = sAttName & " Required"
        Me.ErrorMessage.Visible = True
        Exit Sub
    ElseIf CLng(objAttributes.SelectedItem.Value()) = -1 Then
    ' required raise error
        Me.ErrorMessage.Text = sAttName & " Required "
        Me.ErrorMessage.Visible = True
        m_bAttribute_Error = True
        Exit Sub
    Else
  8. Put an apostrophe ( ' ) in front of the lines shown:
    If objAttributes.SelectedItem Is Nothing Then
    '    m_bAttribute_Error = True
    '    Me.ErrorMessage.Text = sAttName & " Required"
    '    Me.ErrorMessage.Visible = True
    '    Exit Sub
    ElseIf CLng(objAttributes.SelectedItem.Value()) = -1 Then
    ' required raise error
    '    Me.ErrorMessage.Text = sAttName & " Required "
    '    Me.ErrorMessage.Visible = True
    '    m_bAttribute_Error = True
    '    Exit Sub
    Else
  9. Save your change and close the file.
  10. Compile your site and correct any errors that are displayed.
  11. Open general.js in a text editor and look for this line of code:
    {e.title="Product Attribute";
    e.required=true;}
  12. Change e.required to false as shown:
    {e.title="Product Attribute";
    e.required=false;}
  13. Now find this code:
    if(e.type == "radio")
    {
      e.title="Product Attribute";
    }
    else
    {
      e.title=e[0].text;
    }
    e.required=true;
    }
  14. Change e.required to false as shown:
    if(e.type == "radio")
    {
      e.title="Product Attribute";
    }
    else
    {
      e.title=e[0].text;
    }
    e.required=false;
    }
  15. Save your changes and close the file.
  16. Copy general.js to ssl/general.js.

This completes the installation.

Appendix

Compiling Your Site

There are two ways to re-compile a StoreFront 6.x site. The first way is built in to the StoreFront client menu for FrontPage and DreamWeaver. The feature is called "Compile Components" and it is available on the StoreFront 6.0 menu.

The second way is to load the page "CompileSite.aspx" into a browser. This page is typically located in the root of the Store directory. Loading this page will compile the site and display the results in the browser window. A successful compile will result in this output:

Compile Success

Compiler Errors

VBC Errors

Any additional or different other output suggests that an error occurred and must be corrected before the changes take effect. After compiling your site, check the modified date of bin/StoreFront.dll. It should match the date and time of the compile. If StoreFront.dll was not updated, then the compile did not work.

Support

These instructions are provided as-is without support. If you are not comfortable making changes to the source code of your store, please contact a professional developer.

Copyright © 2003 by Structured Solutions, All Rights Reserved