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?
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?
We don't have a feature to discount product options.
Thanks,
Jamie
PHP shopping cart software - Squirrelcart
Please rate or review us!![]()
Hotscripts ● PHP Resource Index
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.
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):
4. After that, add this:PHP Code:// only continue w. this option if choices where found
if (is_array($choices)) {
5. Change the Group Name to the name of your groupPHP Code:foreach($choices as $key => $choice) {
if ($choices[$key]['Price'] && security_level('Group Name')) $choices[$key]['Price'] *= .75;
}
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
Thanks,
Jamie
PHP shopping cart software - Squirrelcart
Please rate or review us!![]()
Hotscripts ● PHP Resource Index
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.
Try changing this:
To this:PHP Code:foreach($choices as $key => $choice) {
if ($choices[$key]['Price'] && security_level('Group Name')) $choices[$key]['Price'] *= .75;
}
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);
}
Thanks,
Jamie
PHP shopping cart software - Squirrelcart
Please rate or review us!![]()
Hotscripts ● PHP Resource Index
That worked great... this is an excellent fix for anyone who wants to discount product options!
There are currently 1 users browsing this thread. (0 members and 1 guests)