Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 9 of 9

Thread: Polls and its docs

  1. #1
    Richnyc30 is offline Senior Member
    Join Date
    Mar 2009
    Posts
    340

    Default Polls and its docs

    The doc page in HELP really doesn't cover Polls in ver 8 very well.
    Does anyone have information how the categories work which I could have found out by making the (!POLL!) token work. Is there a trick to placing the token? I tried in the template file and it didn't show up.

  2. #2
    MelanieA is offline Junior Member
    Join Date
    Sep 2008
    Posts
    313

    Default

    Try to place the token (!POLL!) under this line:

    <div class="leftNav" id="helpbox">(!Topic Name="helpbox"!)</div>

    on your template.ascx file and reset your cache and IIS.

    Make sure that you have set up everything with your Poll settings, please refer to this manual

    Check if this works for you.
    Last edited by MelanieA; 07-02-2009 at 07:47 AM.

  3. #3
    Richnyc30 is offline Senior Member
    Join Date
    Mar 2009
    Posts
    340

    Default Polls and categories?

    If I have to put a token into my template, then why does the admin setup have categories to be assigned?

  4. #4
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    I don't clearly understand what you're trying to achieve here, please elaborate your request; but as far as I can see, you only want to activate the poll, then that's the only procedure. Simply, place (!POLL!) anywhere on your template.ascx and that's it.

  5. #5
    Richnyc30 is offline Senior Member
    Join Date
    Mar 2009
    Posts
    340

    Default Polls setup

    *Poll Name:
    Expires On:
    *Poll Sort Order: SELECT ONE As WrittenAscendingDescending
    *Published: Yes No
    *Anons Can Vote: Yes No
    Category(s): here there are check boxes for all the categories. Why?

  6. #6
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    In order for you to indicate where you want your poll to appear on those categories and sections.

  7. #7
    Richnyc30 is offline Senior Member
    Join Date
    Mar 2009
    Posts
    340

    Default Polls work this way

    Polls show up on the template pages when the choosen categories appear. Once the poll is answered it disappears and cannot be answered twice by the same person.
    Can polls be placed in the checkout pages? Or even the home page?
    Richard

  8. #8
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    Well, if there's really a need for such behavior you could give this procedure a shot:

    Note: This can only be done if you have the source code...

    Project: AspDotNetStorefrontCommon
    Class: Parser.cs
    Method: BuildPageDynamicTokens

    Add the highlighted part:
    Code:
                    if (AppLogic.AppConfigBool("Polls.Enabled"))
                    {
                        String PollString = String.Empty;
                        int CategoryID = CommonLogic.QueryStringUSInt("categoryid");
                        int SectionID = CommonLogic.QueryStringUSInt("sectionid");
    
                        // polls are assigned to specific categories or sections via Admin > Misc > More > Manage Polls
                        // they are not displayed on non-category or non-section pages. These include product, topic, home, and checkout pages.
    
                        if (CategoryID != 0 || SectionID != 0)
                        {
                            PollString = AppLogic.GetPollBox(ThisCustomer.CustomerID, ThisCustomer.IsRegistered, SkinID, 0, CategoryID, SectionID, false, ThisCustomer.LocaleSetting);
                        }
                        else
                        {
                            PollString = AppLogic.GetPollBoxForAllPages(ThisCustomer.CustomerID, ThisCustomer.IsRegistered, SkinID, 0, false, ThisCustomer.LocaleSetting);
                        }
                        m_DynamicTokens.Add("(!POLL!)", PollString);
    Project: AspDotNetStorefrontCommon
    Class: AppLogic
    Method (customized) :
    Code:
            public static String GetPollBoxForAllPages(int CustomerID, bool IsRegistered, int SkinID, int PollID, bool large, String LocaleSetting)
            {
                StringBuilder tmpS = new StringBuilder(10000);
                tmpS.Append(
                        "<table width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" border=\"0\" style=\"border-style: solid; border-width: 0px; border-color: #" +
                        AppConfig("HeaderBGColor") + "\">\n");
                tmpS.Append("<tr><td align=\"left\" valign=\"top\">\n");
                tmpS.Append("<img src=\"" +
                             LocateImageURL("skins/Skin_" + SkinID.ToString() + "/images/" +
                                             CommonLogic.IIF(large, "poll.gif", "todayspoll.gif")) +
                             "\" border=\"0\" /><br />");
                tmpS.Append("<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\" style=\"" +
                             AppConfig("BoxFrameStyle") + "\">\n");
                tmpS.Append("<tr><td align=\"left\" valign=\"top\">\n");
    
                if (PollID == 0)
                {
                    // try to find an active poll this user hasn't voted on yet:
                    StringBuilder sql = new StringBuilder(1024);
                       sql.AppendFormat(
                                "select PollID from poll with (NOLOCK) where AnonsCanVote in ({1}) and published=1 and ExpiresOn>=getdate() and deleted=0 and pollid not in (select distinct pollid from pollvotingrecord with (NOLOCK) where customerid={0}) order by CreatedOn desc, DisplayOrder, Name",
                                CustomerID.ToString(), CommonLogic.IIF(IsRegistered, "0,1", "0"));
    
                    using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
                    {
                        con.Open();
                        using (IDataReader rs = DB.GetRS(sql.ToString(), con))
                        {
                            if (rs.Read())
                            {
                                PollID = DB.RSFieldInt(rs, "PollID");
                            }
                        }
                    }
                }
    
                bool anyFound = false;
                if (PollID != 0)
                {
                    anyFound = true;
                    Poll p = new Poll(PollID, SkinID, LocaleSetting);
                    tmpS.Append(p.Display(CustomerID, !large));
                    p = null;
                }
    
                tmpS.Append("</td></tr>\n");
                tmpS.Append("</table>\n");
                tmpS.Append("</td></tr>\n");
                tmpS.Append("</table>\n");
                return CommonLogic.IIF(anyFound, tmpS.ToString(), String.Empty);
            }
    Comment out the following though:
    Code:
    static public String GetPollBox(int CustomerID, bool IsRegistered, int SkinID, int PollID, bool large, String LocaleSetting)
    {
        return GetPollBox(CustomerID, IsRegistered, SkinID, PollID, 0, 0, large, LocaleSetting);
    }
    See if this works for you...

  9. #9
    Richnyc30 is offline Senior Member
    Join Date
    Mar 2009
    Posts
    340

    Default Reasons for checkout poll

    I would like to ask people what was their checkout experience. I would guess that this is not really for this function the way it shows the results.

    Can the results screen not be shown? I found it preferable to have a choice to speed things up for the viewer on a quick survey.