Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Apr 2010
    Posts
    7
    Plugin Contributions
    0

    Default I want user with company name automatically assigned to specific group

    Hi,

    Really struggling with this - been searching forever and can't find out how to do this. If I have missed a thread with relevant info then sorry - please point me in the right direction.

    But what I want is that IF a customer adds a company name when registering, they automatically get put into the 'Trade' group that I created, which will give them an immediate discount.

    I realise that anyone could enter a company name in the hope of getting a discount but this isn't a problem because while the order is being processed, which takes a few days, I will be contacting them for further details.

    So all I want is for them to automatically be assigned to my 'Trade' group so that they can order immediately at the discounted price.

    Here's my version info:

    Zen Cart 1.3.8a
    Patch: 1::
    Database Patch Level: 1.3.8

    Can anyone help me figure this out. I'm tearing hair out in clumps now! :-)

    Jon.

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

    Default Re: I want user with company name automatically assigned to specific group

    Nothing is built in to do this. You would have to customize the signup process by writing code.
    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.

  3. #3
    Join Date
    Apr 2010
    Posts
    7
    Plugin Contributions
    0

    Default Re: I want user with company name automatically assigned to specific group

    Yes, thanks - I realised there would be some editing to do. But I have no clue what to edit or what changes to make. That's the part I need the help with.

    I know how to edit the files as I have already done a few mods so all I need is the name of the file to edit and the changes that need to be made. I have looked at some of the files but I can't figure it out.

  4. #4
    Join Date
    Apr 2010
    Posts
    7
    Plugin Contributions
    0

    Default Re: I want user with company name automatically assigned to specific group

    In includes/functions/functions_customers.php I did find this code:

    if ( (ACCOUNT_COMPANY == 'true') && (zen_not_null($company)) ) {

    $address_out = $company . $cr . $address_out;

    *****

    }

    The stars are not in there but I added them here because I'm wondering if this is a place where I could insert code to put the customer into a group? I'm assuming that at this point a company name is in use.

    Please can someone let me know if I'm in the right area. Thanks.

  5. #5
    Join Date
    Apr 2010
    Posts
    7
    Plugin Contributions
    0

    Default Re: I want user with company name automatically assigned to specific group

    Mmmm - having thought about this, maybe not. Obviously, I only need to set this up once at registration and I assume adding code here would keep on assigning to the group each time this function is called...

    Looks like I might have half the code I need - I just don't know what to add to it and where it needs to go...
    Last edited by JonG123; 18 Apr 2010 at 03:52 PM.

  6. #6
    Join Date
    Apr 2010
    Posts
    7
    Plugin Contributions
    0

    Default Re: I want user with company name automatically assigned to specific group

    Can this part be used?

    if ( (ACCOUNT_COMPANY == 'true') && (zen_not_null($company)) ) {


    ADD CODE HERE TO ASSIGN TO A GROUP NAMED 'Trade'

    }

    Close? Miles off? I'm half guessing really so any help would be appreciated.

  7. #7
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: I want user with company name automatically assigned to specific group

    Here's how to have ALL customers join a particular group: http://www.zen-cart.com/forum/showthread.php?t=123132
    You can adapt it to have it use a different group number depending on whether certain fields have been filled in, or whatever.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Apr 2010
    Posts
    7
    Plugin Contributions
    0

    Default Re: I want user with company name automatically assigned to specific group

    Thank you! That works great. I had to make a minor change so here's what I did, in case anyone else is trying to do the same thing:

    First I created two groups - Trade (1) and Standard (2). Trade has 30% off and Standard has 0% off.

    Then I edited /includes/modules/create_account.php

    if ( (ACCOUNT_COMPANY == 'true') && (zen_not_null($company)) ) {

    $grp = 1;

    } else {

    $grp = 2;

    }


    if ($error == true) {

    // hook notifier class

    $zco_notifier->notify('NOTIFY_FAILURE_DURING_CREATE_ACCOUNT');

    } else {

    $sql_data_array = array('customers_firstname' => $firstname,

    'customers_lastname' => $lastname,

    'customers_email_address' => $email_address,

    'customers_nick' => $nick,

    'customers_telephone' => $telephone,

    'customers_fax' => $fax,

    'customers_newsletter' => (int)$newsletter,

    'customers_email_format' => $email_format,


    'customers_group_pricing' => $grp,


    'customers_default_address_id' => 0,

    'customers_password' => zen_encrypt_password($password),

    'customers_authorization' => (int)CUSTOMERS_APPROVAL_AUTHORIZATION

    );

    Not sure if that's the best way to get that working but it does so I hope it helps someone else. Thanks again for the help.

  9. #9
    Join Date
    Mar 2006
    Posts
    63
    Plugin Contributions
    0

    Default Re: I want user with company name automatically assigned to specific group

    This is helpful I have one small question... What if you have a certain company you want to be assigned to a specific group? how would that look in the code?

  10. #10
    Join Date
    Mar 2006
    Posts
    63
    Plugin Contributions
    0

    Default Re: I want user with company name automatically assigned to specific group

    Could you do this??

    if ( (ACCOUNT_COMPANY == 'ACME') && (zen_not_null($company)) ) {

    $grp = 1;

    } else {

    $grp = 2;

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 Group Pricing automatically assigned from email link
    By denliv in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 0
    Last Post: 24 Mar 2014, 11:17 PM
  2. Cross Sell automatically assigned to products
    By divekathster in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 24 Aug 2009, 03:39 PM
  3. New Zen user needs help with setting up specific product
    By jonias in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 10 Feb 2009, 03:23 AM
  4. Paypal RETURN TO shows my real name instead of company name
    By tuanle55 in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 28 Jul 2008, 03:47 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