Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 25
  1. #11
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default Re: Free Shipping Options (freeoptions) and Rewards

    I've been cracking my head open trying to figure out a way around this and every time I get either a blank page.

    PHP Code:
    <?php
    if (!IS_ADMIN_FLAG) { 
        global 
    $order$db;
          if ((
    $order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0)) { 
      
        echo 
    '<div style="border: 3px solid #777777; padding: 10px 0;"><p style="text-align: center;"><strong>Your order no longer qualifies for Free Shipping.</strong></p>
        <p style="text-align: center;"><strong>The total for your order is below the minimum qualifying for Free Shipping.</strong></p>
        <p style="text-align: center;"><strong>Please head back to the - <a href="index.php?main_page=shopping_cart">SHOPPING BAG</a> - to increase the quantity of products in your bag, add more products or select 
        a different shipping option.</strong></p>'

        echo
    '<span id="opc-order-confirm"></span>'
        
        } elseif {  ((
    $order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0) && ($_SESSION['cot_gv'] !=0)) { 
         echo 
    '<div class="buttonRow">' TEXT_CONTINUE_CHECKOUT_PROCEDURE '</div>';
         echo 
    '<div class="buttonRow confirm-order">' zen_image_submit(BUTTON_IMAGE_CONFIRM_ORDERBUTTON_CONTINUE_CHECKOUT_CONFIRMATION_ALT'name="btn_submit" id="btn_submit"') . '</div>';
     
      } else {
    ?>
    What am I not getting right?... Could someone help me figure this out?...

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

    Default Re: Free Shipping Options (freeoptions) and Rewards

    Quote Originally Posted by mvstudio View Post
    I've been cracking my head open trying to figure out a way around this and every time I get either a blank page.

    PHP Code:
    <?php
    if (!IS_ADMIN_FLAG) { 
        global 
    $order$db;
          if ((
    $order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0)) { 
      
        echo 
    '<div style="border: 3px solid #777777; padding: 10px 0;"><p style="text-align: center;"><strong>Your order no longer qualifies for Free Shipping.</strong></p>
        <p style="text-align: center;"><strong>The total for your order is below the minimum qualifying for Free Shipping.</strong></p>
        <p style="text-align: center;"><strong>Please head back to the - <a href="index.php?main_page=shopping_cart">SHOPPING BAG</a> - to increase the quantity of products in your bag, add more products or select 
        a different shipping option.</strong></p>'

        echo
    '<span id="opc-order-confirm"></span>'
        
        } elseif {  ((
    $order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0) && ($_SESSION['cot_gv'] !=0)) { 
         echo 
    '<div class="buttonRow">' TEXT_CONTINUE_CHECKOUT_PROCEDURE '</div>';
         echo 
    '<div class="buttonRow confirm-order">' zen_image_submit(BUTTON_IMAGE_CONFIRM_ORDERBUTTON_CONTINUE_CHECKOUT_CONFIRMATION_ALT'name="btn_submit" id="btn_submit"') . '</div>';
     
      } else {
    ?>
    What am I not getting right?... Could someone help me figure this out?...
    If you get a blank page, there should be a nifty myDebug log file in your logs folder waiting to identify what is wrong with the code... The information contained therein will be the best source of help. Now, I do see an issue with the code above:
    Code:
    elseif {  (($order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0) && ($_SESSION['cot_gv'] !=0)) {
    should be more like:
    Code:
    elseif  (($order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0) && ($_SESSION['cot_gv'] !=0)) {
    though there may be other issues within there or elsewhere... But that extra left curly brace with no "if criteria" will certainly cause an issue.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #13
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default Re: Free Shipping Options (freeoptions) and Rewards

    Quote Originally Posted by mc12345678 View Post
    If you get a blank page, there should be a nifty myDebug log file in your logs folder waiting to identify what is wrong with the code... The information contained therein will be the best source of help. Now, I do see an issue with the code above:
    Code:
    elseif {  (($order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0) && ($_SESSION['cot_gv'] !=0)) {
    should be more like:
    Code:
    elseif  (($order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0) && ($_SESSION['cot_gv'] !=0)) {
    though there may be other issues within there or elsewhere... But that extra left curly brace with no "if criteria" will certainly cause an issue.
    Thank you!!!!

    I'm finally not getting the blank page, but the code doesn't work, so I now need to figure out how to insert the proper gv statement, for which I still have no clue.

  4. #14
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default Re: Free Shipping Options (freeoptions) and Rewards

    This is driving me bananas, and for sure is something simple, I just don't know enough to figure it out. Could anyone throw me a clue please?...

  5. #15
    Join Date
    Jul 2012
    Posts
    16,710
    Plugin Contributions
    17

    Default Re: Free Shipping Options (freeoptions) and Rewards

    could you be more specific about "doesn't work"? I didn't even really look at what the code is expected to do, but instead the syntax of it because its just a snippet of the whole. Further this area of code in the bigger picture has/does not have certain data available depending on what page is being viewed and other things.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #16
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default Re: Free Shipping Options (freeoptions) and Rewards

    Quote Originally Posted by mc12345678 View Post
    could you be more specific about "doesn't work"? I didn't even really look at what the code is expected to do, but instead the syntax of it because its just a snippet of the whole. Further this area of code in the bigger picture has/does not have certain data available depending on what page is being viewed and other things.
    Sorry! I forgot to add what doesn't work.

    What I'm trying to accomplish is turning off, so to speak the ability for customers to place the order if certain conditions aren't met. The code is placed in the tpl_checkout_confirmation_default.php page right above the place order button.

    The original code, which I came up with worked... up to a point. Basically this checks if free options total minimum is met based on the total of the order, and if it's not met, then trigger a message instructing the customer his/her order no longer qualifies for free shipping.

    ORIGINAL CODE
    PHP Code:
    <?php
    if (!IS_ADMIN_FLAG) { 
        global 
    $order$db;
          if ((
    $order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0)) { 
      
        echo 
    'MESSAGE TO BE DISPLAYED';  
        
      } else {
    ?>
    The reason for this is because free shipping option is calculated on sub-total nor total, so customers were applying discounts lowering the minimum for free shipping and still getting free shipping. Not ideal.

    But, the problem I have with this piece of code, is that customers paying with gift certificates, which is technically cash, are still unable to checkout, as the total of the order is actually lowered triggering the message the order no longer qualifies for free shipping.

    So I thought adding an elseif statement that if the above happens and gift certificates are used to pay for the order, then the message isn't triggered and customer can still checkout and get free shipping. However the way I wrote it, doesn't seem to accomplish anything at all.

    MODIFIED CODE THAT DOESN'T WORK AS INTENDED
    PHP Code:
    <?php
    if (!IS_ADMIN_FLAG) { 
        global 
    $order$db;
          if ((
    $order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0)) { 
      
        echo 
    'MESSAGE_ORDER_NO_LONGER_QUALIFIES_FOR_FREE_SHIPPING';  

    } elseif ((
    $order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0) && ($_SESSION['cot_gv'] !=0)) { 
         echo 
    '<div class="buttonRow">' TEXT_CONTINUE_CHECKOUT_PROCEDURE '</div>';
         echo 
    '<div class="buttonRow confirm-order">' zen_image_submit(BUTTON_IMAGE_CONFIRM_ORDERBUTTON_CONTINUE_CHECKOUT_CONFIRMATION_ALT'name="btn_submit" id="btn_submit"') . '</div>';
        
      } else {
    ?>
    The part I need help with is the elseif statement on the code above to let customers checkout if the order which qualified for free shipping to begin with is also paid with gift certificate.

    Sorry for the long explanation.

    Thank you for helping me out!

  7. #17
    Join Date
    Jul 2012
    Posts
    16,710
    Plugin Contributions
    17

    Default Re: Free Shipping Options (freeoptions) and Rewards

    No, the detail was very helpful.

    Now to see how I can explain how to address the issue, why the desired results are not being seen, what was not quite being considered correctly.

    So, it seems the issue is that there are conditions at which the "standard" process doesn't give the desired results. Lets just consider the cases where the cart total was above the minimum desired, but some extra feature drove the total below the desired amount.

    The desire is to allow the situations where ones own money is being used, but to stop the situations where the store is "giving" money.

    The two conditions identified right now for that to happen are gift certificates (one's own money) and coupons (the store's money). Both of these cause the total to go below the threshold.

    Ok, on the same page right?

    Well, thing is, that logic needs to be considered in addressing the handling of the new situation.

    Now there are at least two ways that come to mind on how to address it. I have a preference, but it also can depend on how complicated the follow-on action is.

    So, the first and my preferred at the moment, is to keep your existing initial evaluation: if the price is lower than it should be, enter this area of evaluation.

    Now check why it is low, if it is because of a gift certificate, then continue in a positive direction, allowing the customer to checkout and bypass any "stop" code. The action to otherwise occur is the stop code and message. I leave the coding logic to whatever you choose, but generally speaking the easier it is to read, the easier it is to follow/modify in the future.

    The other alternative is to continue with these multiple ifs/elseifs... in the situation described above, because both situations cause the total to be too low, then the action that is to be allowed, should be evaluated first. If the value is low because a gift certificate hasn't been used, then the next thing to consider is if the value is low at all and if so, to stop execution.

    Note, that this logic is also dependent on only one or the other being used... for example, what is the handling if the total is low because both a gift certificate *AND* a coupon was used?

    Reviewing that on an if statement may be a lot of work. Afterall, its not necessarily a check that a gift certificate was used at all, but even if one or more gift certificates were used, do their total used value plus the current total equal or exceed the lower limit?

    Anyways, what I'm getting at is with the new criteria attempted to be used and based on what drives the problem, the first if is always true when using a gift certificate or coupon and therefore the elseif is never reached. Swapping the order of the checks would at least allow evaluation of the gift certificate aspect such that if it isn't the cause the next check is executed which would identify that it is low and then execute.

    Alternatively, as in my first example (preferred), the final value is low, now within that area, further evaluation can be done to determine why it is low and if it is ok to be low, carry on if not then "stop".
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #18
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default Re: Free Shipping Options (freeoptions) and Rewards

    Quote Originally Posted by mc12345678 View Post
    No, the detail was very helpful.

    Now to see how I can explain how to address the issue, why the desired results are not being seen, what was not quite being considered correctly.

    So, it seems the issue is that there are conditions at which the "standard" process doesn't give the desired results. Lets just consider the cases where the cart total was above the minimum desired, but some extra feature drove the total below the desired amount.

    The desire is to allow the situations where ones own money is being used, but to stop the situations where the store is "giving" money.

    The two conditions identified right now for that to happen are gift certificates (one's own money) and coupons (the store's money). Both of these cause the total to go below the threshold.

    Ok, on the same page right?

    Well, thing is, that logic needs to be considered in addressing the handling of the new situation.

    Now there are at least two ways that come to mind on how to address it. I have a preference, but it also can depend on how complicated the follow-on action is.

    So, the first and my preferred at the moment, is to keep your existing initial evaluation: if the price is lower than it should be, enter this area of evaluation.

    Now check why it is low, if it is because of a gift certificate, then continue in a positive direction, allowing the customer to checkout and bypass any "stop" code. The action to otherwise occur is the stop code and message. I leave the coding logic to whatever you choose, but generally speaking the easier it is to read, the easier it is to follow/modify in the future.

    The other alternative is to continue with these multiple ifs/elseifs... in the situation described above, because both situations cause the total to be too low, then the action that is to be allowed, should be evaluated first. If the value is low because a gift certificate hasn't been used, then the next thing to consider is if the value is low at all and if so, to stop execution.

    Note, that this logic is also dependent on only one or the other being used... for example, what is the handling if the total is low because both a gift certificate *AND* a coupon was used?

    Reviewing that on an if statement may be a lot of work. Afterall, its not necessarily a check that a gift certificate was used at all, but even if one or more gift certificates were used, do their total used value plus the current total equal or exceed the lower limit?

    Anyways, what I'm getting at is with the new criteria attempted to be used and based on what drives the problem, the first if is always true when using a gift certificate or coupon and therefore the elseif is never reached. Swapping the order of the checks would at least allow evaluation of the gift certificate aspect such that if it isn't the cause the next check is executed which would identify that it is low and then execute.

    Alternatively, as in my first example (preferred), the final value is low, now within that area, further evaluation can be done to determine why it is low and if it is ok to be low, carry on if not then "stop".
    Thank you so much!! It never occurred to me flipping the statements would even make a difference, and I'm happy to report it works!!

    If customer pays with GV the button is displayed. If customer uses reward points or coupons that lower the amount the buttons aren't displayed and the message to add more items, change quantities to reach the minimum threshold for free shipping or selecting a different shipping option is triggered.

    However in running the tests I stumbled on a new occurrence I hadn't considered before. What if the customer uses both? A coupon or reward points (customers can't use both in my store, is either one or the other) which lower the total amount, and customer pays with a GV, and my code failed.

    I offer free shipping on orders over $99.99
    Customer has $100.75 in the cart.
    Discount coupon or reward points in the amount of $5 lowering the total to below the minimum required for free shipping to $95.75.
    Customer can still checkout even though minimum order for free shipping hasn't been met.

    Not a clue how to tackle this one

  9. #19
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default Re: Free Shipping Options (freeoptions) and Rewards

    I thought changing the order of the ot_gv might make the code work, but somehow it doesn't. Regardless of where the ot_gv sits, above or below order total nothing changes.

    So I figured my logic isn't quite there.

    I'm thinking there should more considerations for this to run smoothly. Assuming the only 2 variables that lower the order total are coupons or reward points (one or the other never together) then:

    1) Customer's order total is below minimum for FS, no coupons or reward points, therefore cannot checkout with or without GV.
    2) Customer's order total is below minimum for FS including coupons or reward points therefore cannot checkout with or without GV.
    3) Customer's order total is above minimum for FS therefore can checkout with or without GV.

    For scenario 1 the code works BUT if GV present, the checkout process continues, which shouldn't happen.
    For scenario 2 the code works BUT if GV present, the checkout process continues, which shouldn't happen.
    For scenario 3 the code works just fine in the presence of GV or not.


    This is the code I have so far.
    PHP Code:
    <!-- bof disable checkout button from displaying 1 of 2 -->
     <?php
    if (!IS_ADMIN_FLAG) { 
        global 
    $order$db;
          if ((
    $order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0) && ($_SESSION['cot_gv'] !=0)) {

         echo 
    '<div class="buttonRow">' TEXT_CONTINUE_CHECKOUT_PROCEDURE '</div>';
         echo 
    '<div class="buttonRow confirm-order">' zen_image_submit(BUTTON_IMAGE_CONFIRM_ORDERBUTTON_CONTINUE_CHECKOUT_CONFIRMATION_ALT'name="btn_submit" id="btn_submit"') . '</div>';
         

    } elseif ((
    $order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0)) { 
        echo 
    'MESSAGE';  
        
      } else {
    ?> 
    <!-- eof disable checkout button from displaying 1 of 2 -->

    I can't wrap my head around the logic to make it work with the different scenarios. Is it that the cot_gv statement is incorrect and that's why it doesn't work with all the scenarios or that I need more elseif statements to take into account all the combinations?...

    I tried all these combinations and it seems I broke the page. Regardless of what's in the shopping bag it doesn't work.
    PHP Code:
          if (($order->info['total'] < MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0) && ($_SESSION['cot_gv'] !=0)) {
    echo 
    'MESSAGE';

          } elseif ((
    $order->info['total'] = MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0) && ($_SESSION['cot_gv'] !=0)) {
    echo 
    'MESSAGE';

          } elseif ((
    $order->info['total'] > MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) && (substr_count($_SESSION['shipping']['id'], 'freeoptions') !=0) && ($_SESSION['cot_gv'] !=0)) {
    echo 
    'MESSAGE'

  10. #20
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default Re: Free Shipping Options (freeoptions) and Rewards

    Could anyone give me a clue on how to approach this? I really am stuck as I don't know much php. Any help is appreciated.

 

 
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Free Shipping Options freeoptions
    By jmberman in forum General Questions
    Replies: 5
    Last Post: 7 Jul 2018, 07:15 PM
  2. Rewards Points Module and rewards by friends (MLM)
    By DArnaez in forum General Questions
    Replies: 1
    Last Post: 15 Dec 2012, 07:25 PM
  3. v138a Force to show free shipping icon w/ freeoptions on
    By prettyodd in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 14 Dec 2012, 12:09 PM
  4. exclude a product or category from Free Shipping freeoptions
    By gotlogos in forum Built-in Shipping and Payment Modules
    Replies: 18
    Last Post: 14 Feb 2012, 01:05 AM
  5. Rewards Points Module and rewards by friends (MLM)
    By minshop.no in forum General Questions
    Replies: 0
    Last Post: 9 Sep 2008, 11:03 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