Announcement

Collapse
No announcement yet.

Using unique code during account set up to automatically add customer to price group

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Using unique code during account set up to automatically add customer to price group

    I have not found that MIVA has a solution as is so am posting this to see if anyone knows of a solution that currently exists. Using most recent MM9, am dangerously familiar with MIVA coding.

    DESIRED WORKFLOW: Customer receives a business card with a unique alphanumeric code. Customer opens website and is immediately prompted to sign in / create an account for access - name, email, password and unique code from card at the minimum. Customer is automatically attached to a price group according to their unique code, which would be the only way to access pricing, maybe the only way to see products.

    Thanks
    JB

    #2
    You can dynamically add a customer to a price group using this function in template code:

    Code:
     
     <mvt:do file="g.Module_Feature_PGR_DB" name="l.success" value="PriceGroupXCustomer_Insert(pgrp_id, cust_id)" />
    The steps would be on the account create confirmation page do the following:

    1. Load Price Group by name:

    <mvt:do file="g.Module_Feature_PGR_DB" name="l.success" value="PriceGroup_Load_Name('my_price_group_code', l.settings:pricegroup)" /> 2. Verify Customer is not already in the group
    3. Insert customer into the price group.

    This function in the LSK has a good example to reference:

    PRV_Action_Provision_Store_PriceGroupCustomer_Assi gn
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      First, you'd need to create a "storage" area for the codes. Typically one would want to use a database for this, but if traffic and the number of codes are reasonable, you could use a 'flat-file' for this.

      Next, you'll need to Track the entered code by capturing it on the "sign up" page, possibly saving it a custom basket field.

      Lastly, when you detect the customer login g.basket:cust_id + unique code, use the following snippet to assign them to the price group.

      Code:
      <mvt:if expr="g.Basket:cust_id GT 0">
          <mvt:do name="l.return" file="g.Module_Feature_PGR_DB" value="PriceGroup_Load_Name( 'Test', l.pricegroup )" />
      
          <mvt:if expr="l.return EQ 1">
              <mvt:do name="l.exists" file="g.Module_Feature_PGR_DB" value="PriceGroupXCustomer_Load( l.pricegroup:id, g.Basket:cust_id, l.null )" />
              <mvt:do name="l.eof" file="g.Module_Library_DB" value="Error_Is_EOF()" />
      
              <mvt:if expr="NOT l.exists AND ( l.eof )">
                  <mvt:do name="l.insert" file="g.Module_Feature_PGR_DB" value="PriceGroupXCustomer_Insert( l.pricegroup:id, g.Basket:cust_id )" />
      
                  Customer added to price group: 
                  <mvt:if expr="l.insert">
                      Success
                  <mvt:else>
                      Failed
                  </mvt:if>
              </mvt:if>
          </mvt:if>
      </mvt:if>
      Bruce Golub
      Phosphor Media - "Your Success is our Business"

      Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
      phosphormedia.com

      Comment


        #4
        Thanks for the responses will have to look into everything before I follow up. On another note, would this work for multiple price groups (depending on the variables that attach each unique code to to a set price group)?

        Seems this may be an easy(?) job for a developer if posted in the jobs thread?

        Thanks
        JB

        Comment


          #5
          I don't why not if you'd keyed the list appropriately enough. As for easy? I'd say it was straight-forward. If it was easy, even a caveman could do it.
          Bruce Golub
          Phosphor Media - "Your Success is our Business"

          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
          phosphormedia.com

          Comment


            #6
            In finally revisiting this, I am wondering if the solution would lie in a coupon - or up to 10,000 coupon codes - that would attach a customer to the price group. I would also need to attach the customer to the availability group as the website is strictly members only.

            Comment

            Working...
            X