+ Reply to Thread
Results 1 to 7 of 7

Thread: Applying a Group Discount to Product Options

  1. #1
    Client
    Join Date
    Aug 2010
    Posts
    8
    Squirrelcart version
    v3.2.1

    Applying a Group Discount to Product Options

    I havn't been able to find anything on this so perhaps someone out there an help. I would like a apply a discount to the product options associated with my products when customers login with certain group membership. How is this done?

  2. #2
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,719
    Squirrelcart version
    v3.3.7
    We don't have a feature to discount product options.

  3. #3
    Client
    Join Date
    Aug 2010
    Posts
    8
    Squirrelcart version
    v3.2.1
    Is it possible to write some code to do this? I'm just looking for a way to apply a blanket xx% discount to the options when the customer has a group membership.

  4. #4
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,719
    Squirrelcart version
    v3.3.7
    This may work - use at your own risk.

    1. Backup your files
    2. Open squirrelcart/functions/storefront/common/catalog_viewing/sc_product.func.php in an editor
    3. Find this line (around line #333):
    PHP Code:
                    // only continue w. this option if choices where found
                    
    if (is_array($choices)) { 
    4. After that, add this:
    PHP Code:
    foreach($choices as $key => $choice) {
        if (
    $choices[$key]['Price'] && security_level('Group Name')) $choices[$key]['Price'] *= .75;

    5. Change the Group Name to the name of your group
    6. Change the .75 to the percent of the original price they are paying. With it set to .75, they are getting 25% off.
    7. Save the file
    8. Cross your fingers

  5. #5
    Client
    Join Date
    Aug 2010
    Posts
    8
    Squirrelcart version
    v3.2.1
    Thanks for the code. This worked out great and can also be used for multiple group memberships at various discounts. The only issue I found was a minor formating problem on the product display page... the discounted options display with a floating decimal on this page. However, all formating is correct when added to the cart.

  6. #6
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,719
    Squirrelcart version
    v3.3.7
    Try changing this:
    PHP Code:
    foreach($choices as $key => $choice) {
        if (
    $choices[$key]['Price'] && security_level('Group Name')) $choices[$key]['Price'] *= .75;

    To this:
    PHP Code:
    foreach($choices as $key => $choice) {
        if (
    $choices[$key]['Price'] && security_level('Group Name')) $choices[$key]['Price'] = number_format($choices[$key]['Price'] * .75,2);


  7. #7
    Client
    Join Date
    Aug 2010
    Posts
    8
    Squirrelcart version
    v3.2.1
    That worked great... this is an excellent fix for anyone who wants to discount product options!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts