Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Vip Customer Rate Topic   - - - - -

 
  • mumbomedia
  • Senior Member
  • Members
  • Join Date: 13-Jan 17
  • 211 posts

Posted 28 August 2020 - 10:20 PM #1

We're looking to have VIP customers.
For example, any customer that has spend over a total of 1000,- becomes a  VIP or Special member or whatever.

They will be put in a diffrent group, get diffrent newsletters, special discounts.

I think we have to use usergroups for this. Anyone has an idea what the best way to do would be

 



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12038 posts

Posted 29 August 2020 - 06:02 PM #2

Add a decimal field to the users table for purchase_total of decimal(12,2)

Use a change_order_status hook and look  at the value of the order.  Add that to the purchase_total and save it to the users table.  then check if the user is already in the group, if not, add them.

define('my_special_group', your_group_id);
define('my_special_amount', 1000);
function fn_my_changes_change_order_status($status_to, $status_from, $order_info) {
  $user_id = $order_info['user_id'];
  if( empty($user_id) )
    return;
 
  $purchase_total = db_get_field("SELECT purchase_total FROM ?:users WHERE user_id=?i", $user_id);
  db_query("UPDATE ?:users SET purchase_total=?d WHERE user_id=?i", $purchase_total += $order_info['subtotal'], $user_id);
 
  if( !in_array(my_special_group, $_SESSION['auth']['usergroup_ids']) && $purchase_total > my_special_amount )
    fn_change_usergroup_status('F', $user_id, my_special_group);
}

 

UNTESTED


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21726 posts

Posted 31 August 2020 - 06:05 AM #3

Please pay attention to our addon

 

https://www.ecom-lab...ram-add-on.html


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)