Results 1 to 3 of 3
  1. #1

    Default Negative discount group on some custommers

    Hello, Im working on a membership design for my site, I made one simple change that works pretty fine:
    I modified functions_prices.php around line 26
    PHP Code:
        if ($specials->RecordCount() > 0) {
    //      if ($product->fields['products_priced_by_attribute'] == 1) {
            
    $special_price = ($specials->fields['specials_new_products_price']); 
    to

    PHP Code:
        if ($specials->RecordCount() > 0) {
    //      if ($product->fields['products_priced_by_attribute'] == 1) {
            
    if ($_SESSION['customer_id']) {$special_price $specials->fields['specials_new_products_price'];}
            else {
    $special_price = (($specials->fields['specials_new_products_price'])*1.05);} 
    that way all custommers that have registration and are logged in can see prices normal and the customers that are not logged will see the prices +5%, also that makes the changes in the cart and on shipping total.

    The problem is here: I want to have an profile (lets name it - orders by phone) from wich I can make order with 5% above the regular price that registed user pay, because this 5% are the income that goes for phone and employe expenses.

    Is there a way to create an group discount -5% (not +5%!) so I can assign it to that profile "orders by phone"?

    I assume that I have to give
    PHP Code:
    $_SESSION['customer_id'] = id (of that profile
    but I cant find the right way to do it.

    Thank you
    My most recent work: magprom.net

  2. #2
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: Negative discount group on some custommers

    Quote Originally Posted by perfumbg View Post
    Hello, Im working on a membership design for my site, I made one simple change that works pretty fine:
    I modified functions_prices.php around line 26
    PHP Code:
        if ($specials->RecordCount() > 0) {
    //      if ($product->fields['products_priced_by_attribute'] == 1) {
            
    $special_price = ($specials->fields['specials_new_products_price']); 
    to

    PHP Code:
        if ($specials->RecordCount() > 0) {
    //      if ($product->fields['products_priced_by_attribute'] == 1) {
            
    if ($_SESSION['customer_id']) {$special_price $specials->fields['specials_new_products_price'];}
            else {
    $special_price = (($specials->fields['specials_new_products_price'])*1.05);} 
    that way all custommers that have registration and are logged in can see prices normal and the customers that are not logged will see the prices +5%, also that makes the changes in the cart and on shipping total.

    The problem is here: I want to have an profile (lets name it - orders by phone) from wich I can make order with 5% above the regular price that registed user pay, because this 5% are the income that goes for phone and employe expenses.

    Is there a way to create an group discount -5% (not +5%!) so I can assign it to that profile "orders by phone"?

    I assume that I have to give
    PHP Code:
    $_SESSION['customer_id'] = id (of that profile
    but I cant find the right way to do it.

    Thank you
    Understand that in part asking for custom code. That said, if you have say a single "order by phone" profile which has its own limits when providing information to call in customers, then something like the below would charge the same 5 percent that is seen by a non-registered/not logged in customer. Additionally, I've added some additional "sanitization" checks to your code:
    Code:
        if ($specials->RecordCount() > 0) {
    //      if ($product->fields['products_priced_by_attribute'] == 1) {
    		if (isset($_SESSION['customer_id']) && is_numeric($_SESSION['customer_id']) && zen_not_null($_SESSION['customer_id']) && (int)$_SESSION['customer_id'] == $_SESSION['customer_id'] && $_SESSION['customer_id'] == X) {$special_price = $specials->fields['specials_new_products_price'] * 1.05;}
    		elseif (isset($_SESSION['customer_id']) && is_numeric($_SESSION['customer_id']) && zen_not_null($_SESSION['customer_id']) && (int)$_SESSION['customer_id'] == $_SESSION['customer_id'] && $_SESSION['customer_id']) {$special_price = $specials->fields['specials_new_products_price'];}
    		else {$special_price = (($specials->fields['specials_new_products_price'])*1.05);}
    Now, if your user is in fact part of a group, then need extra code to identify whether the user is in the desired group(ing). That would be an additional check at the end of the first if test and entered similar as provided. It would replace the session test against X.

    BTW, X is the number for the customers_id that represents your phone order user.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3

    Default Re: Negative discount group on some custommers

    Quote Originally Posted by mc12345678 View Post
    Now, if your user is in fact part of a group, then need extra code to identify whether the user is in the desired group(ing). That would be an additional check at the end of the first if test and entered similar as provided. It would replace the session test against X.

    BTW, X is the number for the customers_id that represents your phone order user.
    Hello, no I dont specialy need that profile to be an part of a group, however I managed to do what I needed and if it will be usefull to somebody I'm posting the code below:

    PHP Code:
            $admincustomer $_SESSION['customer_id'];
        
    $adminarray = array(1,2,3/[B]whatever the customer ID is[/B]/);
        if (
    $specials->RecordCount() > 0) {
    //      if ($product->fields['products_priced_by_attribute'] == 1) {
            
    if (in_array($admincustomer$adminarray)) {$special_price = (($specials->fields['specials_new_products_price'])*1.05);}
                    elseif (
    $_SESSION['customer_id']) {$special_price $specials->fields['specials_new_products_price'];}
            else {
    $special_price = (($specials->fields['specials_new_products_price'])*1.05);} 
    You mentioned "sanitization" do I have to change something else?

    Kind regards and thanks for the help!
    Last edited by perfumbg; 10 Aug 2016 at 07:21 AM.
    My most recent work: magprom.net

 

 

Similar Threads

  1. PayPal viewing discount as negative VAT
    By wdkstudio in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 8 Nov 2011, 08:29 PM
  2. Set max discount for Group Discount + Discount + etc.
    By KEnik in forum Setting Up Specials and SaleMaker
    Replies: 0
    Last Post: 16 Jun 2010, 05:39 PM
  3. Replies: 18
    Last Post: 12 Mar 2010, 06:37 PM
  4. How do I give NEGATIVE discounts using Group Pricing
    By jaxbakers in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 0
    Last Post: 26 Nov 2008, 04:30 PM
  5. Discount Coupon AND Group Discount Tax Problem
    By mrkrinkle in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 11
    Last Post: 5 Apr 2007, 12:16 PM

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