Is it possible to have a code used a set number of times without users logging in ?


  • Default avatar
    scraggs    
     14 years ago
    0

    Hi
    is it possible to have a code be used say 10 times by users to my site, but I don't require buyers to log in, it appears to only work if customers are logged in.
  • Your avatar
    seyi    
     14 years ago
    0

    If set as a coupon, no, since it is uses per user, so you would need to know which user is using what.
    If set as gift certificate, then yes, you can set the total number ot times a coupon can be used total.
  • Default avatar
    scraggs    
     14 years ago
    0

    Many thanks for that, works a treat
  • Default avatar
    dsrpmedia    
     14 years ago
    0

    Hi,

    I love this component, have been waiting literally YEARS for someone to get this right.

    I see the logic in having to have the user login before they can use the usage-limited codes, however, for new users, the place where you enter the coupon comes BEFORE the place where you register, so the potential for confusion & lost sales is great.

    Do you know of a way to remove the 'add coupon' field until later in the process?

    (i.e. after the user completes the register part of the process, or logs in)

    or else making the coupon field visible to 'registered only?

    any help would be greatly appreciated

  • Your avatar
    seyi    
     14 years ago
    0

    No worries, here is the hack:

    in www/administrator/components/com_virtuemart/html/basket.php

    around line 318 (pretty much the last line of code) you should see this
    <?php
    $basket_html 
    .= $tpl->fetch'common/couponField.tpl.php' );
    ?>



    change it to this:
    <?php
    if(!empty($auth['user_id'])) {
        
    $basket_html .= $tpl->fetch'common/couponField.tpl.php' );
    }
    ?>


    Now the coupon component will only show up either after the user registers or after shipping address has has been put in (if you set virtuemart up so customers do not have to register)
  • Default avatar
    dsrpmedia    
     14 years ago
    0

    Thank you so much for this...

    I `ve been using VM for 3 years now & have fought with the coupon system the whole time.
    Today I finally won ;)
  • Default avatar
    spotya    
     14 years ago
    0

    Hello, thank you for providing this solution, it is exactly what I am looking for... however after copying the fix you suggested, I get the following error:

    Parse error: syntax error, unexpected T_IF in /users/multimediabible.com/htdocs/spotya1/administrator/components/com_virtuemart/html/basket.php on line 318

    Now, I am not a php code writer, so I have no idea what I did wrong. I tried to put the file back to it's original code and that did not work either...

    Can you provide some assistance please? This is currently what my code looks like:

    /* Input Field for the Coupon Code */
    if( PSHOP_COUPONS_ENABLE=='1'
    && !@$_SESSION['coupon_redeemed']
    //&& ($page == "shop.cart" )); }
    {
    if(!empty($auth['user_id'])) {
        $basket_html .= $tpl->fetch( 'common/couponField.tpl.php' );
    }

    ?>


    Can someone please help me with this error?
    Thank you!
  • Your avatar
    seyi    
     14 years ago
    0

    Hi, you are missing a closed parenthesis of the if statement and also a closing bracket in the code:

    change
    <?php
    /* Input Field for the Coupon Code */
    if( PSHOP_COUPONS_ENABLE=='1'
    && !@$_SESSION['coupon_redeemed']
    //&& ($page == "shop.cart" )); }
    {
    if(!empty(
    $auth['user_id'])) {
        
    $basket_html .= $tpl->fetch'common/couponField.tpl.php' );
    }
    ?>


    to

    <?php
    /* Input Field for the Coupon Code */
    if( PSHOP_COUPONS_ENABLE=='1'
    && !@$_SESSION['coupon_redeemed']
    //&& ($page == "shop.cart" )); }
    ) {
        if(!empty(
    $auth['user_id'])) {
            
    $basket_html .= $tpl->fetch'common/couponField.tpl.php' );
        }
    }
    ?>


    You might have that last bracket and just didnt include it in the code you pasted. If it still doesnt work, delete the last "}". Hope it helps.
  • Default avatar
    spotya    
     14 years ago
    0

    Thought I would share... the code works as you already know... In my case, with respect to your reply above, I actually needed a third "}" at the end before the ?> tag... so it reads:

        if(!empty($auth['user_id'])) {
            $basket_html .= $tpl->fetch( 'common/couponField.tpl.php' );
        }
    }
    }


    anyway, hope that helps other non programmers with this fix... thanks for the help.
  • Default avatar
    paypal4    
     14 years ago
    0

    Hi,

    I implemented this change, so only logged in users now see the field.
    That's great!

    But how can I also remove the field in the cart?

    I want the field ONLY be visible at the page where the customer chooses a payment method.

    Any help?

    Thank you,
    Maurice

  • Your avatar
    seyi    
     14 years ago
    0

    you will need to delete the couponfield.tpl from the basket.html file, since you no longer want it attached to the basket. then within www/administrator/components/com_virtuemart/html/checkout.index.php, you should add it back in there.

    so somewhere after the title gets echoed out
    <?php
    if( in_array('CHECK_OUT_GET_SHIPPING_ADDR'$checkout_steps[$current_stage]) ) {
        
    /* Input Field for the Coupon Code */
        
    if( PSHOP_COUPONS_ENABLE=='1'
            
    && !@$_SESSION['coupon_redeemed']
            
    //&& ($page == "shop.cart" )
        
    ) {
            
    $basket_html .= $tpl->fetch'common/couponField.tpl.php' );
        }
    }
    ?>


    where CHECK_OUT_GET_SHIPPING_ADDR is the page you want it to show up on.
  • Default avatar
    erik92    
     13 years ago
    0

    Hello Seyi,

    I tried the above fix albeit I wanted the coupon to show only on the payment method page like so. I need folks to have picked a shipper before I'd like them to be able to use a coupon. I inserted this code right below the first echo of $browse_html on the checkout.index.php page. I did delete the reference out of the basket.php file.

    No luck. Am I missing something?

    <?php
            
    if( in_array('CHECK_OUT_GET_PAYMENT_METHOD'$checkout_steps[$current_stage]) ) {
        
    /* Input Field for the Coupon Code */
        
    if( PSHOP_COUPONS_ENABLE=='1'
            
    && !@$_SESSION['coupon_redeemed']
            
    //&& ($page == "shop.cart" )
        
    ) {
            
    $basket_html .= $tpl->fetch'common/couponField.tpl.php' );
        }
    }
    ?>
  • Your avatar
    seyi    
     13 years ago
    0

    What is the error you are getting?

    Try changing CHECK_OUT_GET_PAYMENT_METHOD to CHECK_OUT_GET_SHIPPING_ADDR
  • Default avatar
    erik92    
     13 years ago
    0

    Seyi,

    I'd actually given that a try earlier. Either way there is never an error the coupon field just never shows. Not any where in the checkout series at least.

    Would the if statement as it's written just never be testing as true?

    Thanks for helping out on this!
  • Your avatar
    seyi    
     13 years ago
    0

    You can try 2 things, echo out the value of the current step and put an exit statement within the if loop to see if it is actually run. So something like this:

    <?php
    echo '<pre>'.print_r($checkout_steps[$current_stage],1).'</pre>';
    if( 
    in_array('CHECK_OUT_GET_PAYMENT_METHOD'$checkout_steps[$current_stage]) ) {
        
    /* Input Field for the Coupon Code */
        
    if( PSHOP_COUPONS_ENABLE=='1'
        
    && !@$_SESSION['coupon_redeemed']
        
    //&& ($page == "shop.cart" )
        
    ) {
    exit(
    'im displaying the basket');
            
    $basket_html .= $tpl->fetch'common/couponField.tpl.php' );
        }
    }
    ?>
  • Default avatar
    erik92    
     13 years ago
    0

    To any others wanting the coupon code to appear only during the Payment Method page. Here is what I did to the basket.html file. I'd previously used a hack to make sure only logged in users were seeing the coupon field, I further narrowed that down so that the coupon field was only displayed on the Payment page. I was never able to get this to work modifying the checkout.index.php file.

    Thanks Seyi for pointing me in the right direction.


    <?php
        
    /* Input Field for the Coupon Code */
        /*if( PSHOP_COUPONS_ENABLE=='1'
            && !@$_SESSION['coupon_redeemed']
            //&& ($page == "shop.cart" )
        ) {
        if(!empty($auth['user_id'])) {
            $basket_html .= $tpl->fetch( 'common/couponField.tpl.php' );
            }
        }*/
        
        
    if( in_array('CHECK_OUT_GET_PAYMENT_METHOD'$checkout_steps[$current_stage]) ) {
        
    /* Input Field for the Coupon Code */
        
    if( PSHOP_COUPONS_ENABLE=='1'
        
    && !@$_SESSION['coupon_redeemed']
        
    //&& ($page == "shop.cart" )
        
    ) {
            
    $basket_html .= $tpl->fetch'common/couponField.tpl.php' );
        }
    }
    ?>
  • Default avatar
    MeanGreen7    
     12 years ago
    0

    Ok I commented out the said line in basket.html file and added the said code for the checkout.index.php file as referenced below:

    echo '
    '.print_r($checkout_steps[$current_stage],1).'
    ';
    if( in_array('CHECK_OUT_GET_PAYMENT_METHOD', $checkout_steps[$current_stage]) ) {
    /* Input Field for the Coupon Code */
    if( PSHOP_COUPONS_ENABLE=='1'
    && !@$_SESSION['coupon_redeemed']
    //&& ($page == "shop.cart" )
    ) {
    $basket_html .= $tpl->fetch( 'common/couponField.tpl.php' );
    }

    if($paypalActive)
    {
    // Paypal API / Express
    echo '';
    }
    }

    Now I am getting this error:

    Array
    (
    [0] => CHECK_OUT_GET_PAYMENT_METHOD
    )

    Fatal error: Call to a member function fetch() on a non-object in /home/artattac/public_html/administrator/components/com_virtuemart/html/checkout.index.php on line 155

    Can you explain as to where the code issue is and how to fix it, I think I am really close, like right almost there. More than likely right under my nose, but I cant figure it out.
  • Your avatar
    seyi    
     12 years ago
    0

    try changing
    <?php
        $basket_html 
    .= $tpl->fetch'common/couponField.tpl.php' );
    ?>


    to
    <?php
        $basket_html 
    .= $theme->fetch'common/couponField.tpl.php' );
    ?>
  • Default avatar
    MeanGreen7    
     12 years ago
    0

    Ok I changed it and this is the error I got,

    Array
    (
    [0] => CHECK_OUT_GET_PAYMENT_METHOD
    )

    Fatal error: Call to a member function fetch() on a non-object in /home/artattac/public_html/administrator/components/com_virtuemart/html/checkout.index.php on line 155


    Here is the code from the checkout.index.php file:

       $Itemid = $sess->getShopItemid();

        /* Decide, which Checkout Step is the next one 
        * $checkout_this_step controls the step thru the checkout process
        * we have the following steps

        * -CHECK_OUT_GET_SHIPPING_ADDR
        * let the user choose a shipto address

        * -CHECK_OUT_GET_SHIPPING_METHOD
        * let the user choose a shipto metho for the ship to address

        * -CHECK_OUT_GET_PAYMENT_METHOD
        * let the user choose a payment method

        * -CHECK_OUT_GET_FINAL_CONFIRMATION
        * shows a total summary including all payments, taxes, fees etc. and let the user confirm
        */
        if( $auth['user_id'] > 0 ) {
            $show_basket = true;
        } else {
            $show_basket = false;
        }
        $current_stage = ps_checkout::get_current_stage();
        $checkout_steps = ps_checkout::get_checkout_steps();

    }
    echo '<pre>'.print_r($checkout_steps[$current_stage],1).'</pre>';
    if( in_array('CHECK_OUT_GET_PAYMENT_METHOD', $checkout_steps[$current_stage]) ) {
    /* Input Field for the Coupon Code */
        if( PSHOP_COUPONS_ENABLE=='1'
            && !@$_SESSION['coupon_redeemed']
            //&& ($page == "shop.cart" )
        ) {
            $basket_html .= $theme->fetch( 'common/couponField.tpl.php' );
        }

        if($paypalActive)
        {
            // Paypal API / Express
            echo '<script type="text/javascript">window.addEvent("domready", function() {
            $$(\'label\').each( function(el) { if(el.htmlFor == "'.ps_paypal_api::getPaymentMethodName().'") { el.innerHTML = "Credit Card";} });
            });</script>';
        }

  • Your avatar
    seyi    
     12 years ago
    0

    what is on line 155? It might be helpful to have the full contents of checkout.index.php as I am not sure where the problem is from this code.
  • Default avatar
    MeanGreen7    
     12 years ago
    0

    <?php
    if( !defined'_VALID_MOS' ) && !defined'_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); 
    /**
    *
    * @version $Id: checkout.index.php 2529 2010-09-05 15:48:16Z zanardi $
    * @package VirtueMart
    * @subpackage html
    * @copyright Copyright (C) 2004-2010 VirtueMart Dev Team - All rights reserved.
    * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
    * VirtueMart is free software. This version may have been modified pursuant
    * to the GNU General Public License, and as distributed it includes or
    * is derivative of works licensed under the GNU General Public License or
    * other free or open source software licenses.
    * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
    *
    * http://virtuemart.net
    */
    mm_showMyFileName__FILE__ );

    require_once( 
    CLASSPATH "ps_checkout.php" );

    global 
    $mainframe$vmLogger$vars;

    // PayPal API / Express

    if( file_exists(CLASSPATH 'payment/ps_paypal_api.php'))
    {
        
    $lang jfactory::getLanguage();
        
    $name$lang->getBackwardLang();
        if( 
    file_exists(CLASSPATH ."payment/paypal_api/languages/lang.".$name.".php"))
            include(
    CLASSPATH ."payment/paypal_api/languages/lang.".$name.".php");
        else
            include(
    CLASSPATH ."payment/paypal_api/languages/lang.english.php");
        
        if( 
    file_exists(CLASSPATH "payment/ps_paypal_api.cfg.php"))
        {        
            include_once( 
    CLASSPATH "payment/ps_paypal_api.cfg.php");
        }
        require_once( 
    CLASSPATH 'payment/ps_paypal_api.php');
        
    $paypalActive ps_paypal_api::isActive();
        
    $ppex_checkout_details=ps_paypal_api::ppex_getCheckoutDetails();
    }
    else
    {
        
    $paypalActive false;
    }

    $paypal_express_checkout vmGet($_REQUEST'ppex',null);
    $paypal_express_checkout_payment vmGet($_REQUEST'payment_method_ppex'null);
    $paypal_express_checkout_cancel vmGet($_REQUEST'ppex_cancel',null);
    if(
    $paypal_express_checkout_cancel) {
        
    //$GLOBALS['vmLogger']->warning( 'PayPal Zahlung abgebrochen!' );
        
    require_once( CLASSPATH 'payment/ps_paypal_api.php');
        
    ps_paypal_api::destroyPaypalSession();
        
    $payment_method_id$_GET['payment_method_id'] = $_REQUEST['payment_method_id'] = 0;
        if( !empty(
    $_GET['ship_to_info_id']) && !empty( $_GET['shipping_rate_id'] ) ) {
            
    $_POST['checkout_this_step'][] = 'CHECK_OUT_GET_SHIPPING_ADDR';
            
    $_REQUEST['checkout_last_step'] = 2;
        }
    }

    if(
    $paypal_express_checkout) {
        
    // Check for token and redirect to PayPal to get one, if not available yet
        
    $_SESSION['ppex_token'] = $ppex_token=ps_paypal_api::gettoken(1);
    }
    else if(
    $paypal_express_checkout_payment === "2")
    {
        
    // Check for token at payment select screen and redirect to PayPal to get one, if not available yet
        
    $_SESSION['ppex_token'] = $ppex_token=ps_paypal_api::gettoken(2);
    }

    $paypal_express_checkout vmGet($_REQUEST'ppex_gecd',null);

    if(isset(
    $_SESSION['ppex_userdata']) && is_array($_SESSION['ppex_userdata']) && isset($_SESSION['ppex_token']) && $paypalActive) {

        if(!isset(
    $auth['user_id']) || $auth['user_id'] <= 0)
        {
            
    ps_paypal_api::ppex_userLogin($auth);
        }

        
    ps_paypal_api::checkAddress($auth);
        
        
    $ship_to_info_id vmGet$_REQUEST'ship_to_info_id');
        
    $shipping_rate_id urldecode(vmGet$_REQUEST"shipping_rate_id"null ));
        
        
    $paypal_api_payment_method_id $payment_method_id ps_paypal_api::getPaymentMethodId();
        
        
    $_REQUEST['payment_method_id'] = $payment_method_id;
        
        
    $Itemid $sess->getShopItemid();
        if( 
    $auth['user_id'] > ) {
            
    $show_basket true;
        } else {
            
    $show_basket false;
        }
        
        
    $current_stage ps_checkout::get_current_stage();
        
    $checkout_steps ps_checkout::get_checkout_steps();
        
    /*if ($shipping_rate_id && $ship_to_info_id && $payment_method_id && !isset($_GET['checkout_stage'])) {
            $current_stage=count($checkout_steps);
        } elseif( $ship_to_info_id && $payment_method_id && empty($shipping_rate_id) && isset( $_GET['checkout_last_step'] ) && !isset($_GET['checkout_stage'])) {
            $_POST['checkout_this_step'] = $checkout_steps[$current_stage];
            $current_stage++;
        }*/

        
    if(isset($_SESSION['ppex_userdata']['payer_id']))
        {
            
    ps_paypal_api::checkOutStatus($auth$checkout_steps$current_stage$ship_to_info_id$paypal_express_checkout);
        }
    } else {
        
    $ship_to_info_id vmGet$_REQUEST'ship_to_info_id');
        
    $shipping_rate_id urldecode(vmGet$_REQUEST"shipping_rate_id"null ));
        
    $payment_method_id vmGet$_REQUEST'payment_method_id');
        
        if( 
    file_exists(CLASSPATH "payment/ps_paypal_api.cfg.php")) {
            include_once( 
    CLASSPATH "payment/ps_paypal_api.cfg.php");
            require_once( 
    CLASSPATH 'payment/ps_paypal_api.php');
            
    $paypal_api_payment_method_id ps_paypal_api::getPaymentMethodId('ps_paypal_api');
        }
        
        
    $Itemid $sess->getShopItemid();

        
    /* Decide, which Checkout Step is the next one 
        * $checkout_this_step controls the step thru the checkout process
        * we have the following steps

        * -CHECK_OUT_GET_SHIPPING_ADDR
        * let the user choose a shipto address

        * -CHECK_OUT_GET_SHIPPING_METHOD
        * let the user choose a shipto metho for the ship to address

        * -CHECK_OUT_GET_PAYMENT_METHOD
        * let the user choose a payment method

        * -CHECK_OUT_GET_FINAL_CONFIRMATION
        * shows a total summary including all payments, taxes, fees etc. and let the user confirm
        */
        
    if( $auth['user_id'] > ) {
            
    $show_basket true;
        } else {
            
    $show_basket false;
        }
        
    $current_stage ps_checkout::get_current_stage();
        
    $checkout_steps ps_checkout::get_checkout_steps();

    }
    echo 
    '<pre>'.print_r($checkout_steps[$current_stage],1).'</pre>';
    if( 
    in_array('CHECK_OUT_GET_PAYMENT_METHOD'$checkout_steps[$current_stage]) ) {
    /* Input Field for the Coupon Code */
        
    if( PSHOP_COUPONS_ENABLE=='1'
            
    && !@$_SESSION['coupon_redeemed']
            
    //&& ($page == "shop.cart" )
        
    ) {
            
    $basket_html .= $theme->fetch'common/couponField.tpl.php' );
        }

        if(
    $paypalActive)
        {
            
    // Paypal API / Express
            
    echo '<script type="text/javascript">window.addEvent("domready", function() {
            $$(\'label\').each( function(el) { if(el.htmlFor == "'
    .ps_paypal_api::getPaymentMethodName().'") { el.innerHTML = "Credit Card";} });
            });</script>'
    ;
        }
    }

    if( 
    in_array('CHECK_OUT_GET_FINAL_CONFIRMATION'$checkout_steps[$current_stage]) ) {
        
    $next_page 'checkout.thankyou';
        if( 
    sizeof($checkout_steps[$current_stage]) > ) {
            include_once( 
    PAGEPATH 'basket.php' );
        } else {
            include_once( 
    PAGEPATH 'ro_basket.php' );
        }
    } else {
        
    $next_page 'checkout.index';    
        include_once( 
    PAGEPATH 'basket.php' );
    }

    // Get the zone quantity after it has been calculated in the basket 
    $zone_qty vmGet$vars'zone_qty');

    //Check for express checkout from paypal
    if(isset($_SESSION['ppex_userdata']) && is_array($_SESSION['ppex_userdata']) && isset($_SESSION['ppex_token']) && $paypalActive
    {
        
    //If the $paypal_express_checkout is equal to 2
        //Then we just came from paypal express which originated from 
        //The payment selection screen
        
    if((int)$paypal_express_checkout == 2)
        {
            if(
    in_array('CHECK_OUT_GET_FINAL_CONFIRMATION'$checkout_steps[$current_stage]))
            {
                if(
    $perm->is_registered_customer($auth['user_id']))
                {
                    
                     
    //Create our array like the form
                    //Just in case so we don't mess anything up when
                    //doing ps_checkout->process()
                    
    $checkoutData = Array('option' => 'com_virtuemart',
                                          
    'Itemid' => $Itemid,
                                          
    'user_id' => (int)$auth['user_id'],
                                          
    'page' => 'checkout.thankyou',
                                          
    'func' => 'checkoutProcess',
                                          
    'zone_qty' => $zone_qty,
                                          
    'ship_to_info_id' => $ship_to_info_id,
                                          
    'shipping_rate_id' => urlencode($shipping_rate_id),
                                          
    'ship_method_id' => $shipping_rate_id,
                                          
    'payment_method_id' => $payment_method_id,
                                          
    'checkout_last_step' => '4',
                                          
    'checkout_this_step' => array('CHECK_OUT_GET_FINAL_CONFIRMATION'));
                    
                    
                    
    //Make sure to set the request variables before creating a new ps_checkout();
                    //Just in case
                    
    $_REQUEST['shipping_rate_id'] = urlencode($shipping_rate_id);
                    
    $_REQUEST['ship_method_id'] = $shipping_rate_id;
                    
    $_REQUEST['user_id'] = (int)$auth['user_id'];
                    
    $_REQUEST['zone_qty'] = $zone_qty;
                    
    $_REQUEST['ship_to_info_id'] = $ship_to_info_id;
                    
    $_REQUEST['payment_method_id'] = $payment_method_id;
                    
                    
    //Set our $_SESSION variable for DoExpressCheckout
                    //So we know which way we came from
                    
    $_SESSION['ppex_cart_ecm'] = '1';
                    
                    
    $checkout = new ps_checkout();
                    
    //Try to process the order
                    //On Success redirect to checkout.thankyou
                    
    if($checkout->process($checkoutData))
                    {
                        
    vmRedirect$sess->url'index.php?page=checkout.thankyou&order_id='.$checkoutData['order_id'], falsefalse ) );
                    }
                }
                else
                {
                    
    $vmLogger->err(@$nvp_common_015);
                }
            }
        }
    }

    $theme = new $GLOBALS['VM_THEMECLASS']();

    $theme->set_vars// Import these values into the template files
        
    array( 'zone_qty' => $zone_qty,
                
    'ship_to_info_id' => $ship_to_info_id,
                
    'shipping_rate_id' => $shipping_rate_id,
                
    'current_stage' => $current_stage,
                
    'payment_method_id' => $payment_method_id,
                
    'weight_total' => $weight_total,
                
    'Itemid' => $Itemid
                
    )
        );
        
    if (
    $cart["idx"] > 0) {
        
        echo 
    '<h3>'$VM_LANG->_('PHPSHOP_CHECKOUT_TITLE') .'</h3>';
        
        if (!
    defined('_MIN_POV_REACHED')) {
            echo 
    $basket_html;
            
    ?>
            <div align="center">
                <script type="text/javascript">alert('<?php echo $VM_LANG->_('PHPSHOP_CHECKOUT_ERR_MIN_POV',false?>');</script>
                <strong><?php echo $VM_LANG->_('PHPSHOP_CHECKOUT_ERR_MIN_POV'?></strong>

                <strong><?php echo $VM_LANG->_('PHPSHOP_CHECKOUT_ERR_MIN_POV2') . " ".$CURRENCY_DISPLAY->getFullValue($_SESSION['minimum_pov']) ?></strong>
            </div><?php
            
    return;
        }
        
        
    // We have something in the Card so move on
        
    if ($perm->is_registered_customer($auth['user_id'])) { // user is logged in and a registered customer
        
        
    $basket_html .= '<form action="'$sess->urlSECUREURL."index.php?page=".$next_page."&checkout_last_step=".$current_stage) .'" method="post" name="adminForm">  
            <input type="hidden" name="option" value="com_virtuemart" />
            <input type="hidden" name="Itemid" value="'
    $Itemid .'" />
            <input type="hidden" name="user_id" value="'
    $auth['user_id'] .'" />
            <input type="hidden" name="page" value="'
    $next_page .'" />
            <input type="hidden" name="func" value="checkoutProcess" />
            <input type="hidden" name="zone_qty" value="'
    $zone_qty .'" />
            <input type="hidden" name="ship_to_info_id" value="'
    $ship_to_info_id .'" />
            <input type="hidden" name="shipping_rate_id" value="'
    urlencode($shipping_rate_id) .'" />
            <input type="hidden" name="payment_method_id" value="'
    $payment_method_id .'" />
            <input type="hidden" name="checkout_last_step" value="'
    $current_stage .'" />';
            
            
    $theme->set'basket_html'$basket_html );
            
            
    // CHECK_OUT_GET_SHIPPING_ADDR
            // Lets the user pick or add an alternative Shipping Address
            
    if( in_array('CHECK_OUT_GET_SHIPPING_ADDR'$checkout_steps[$current_stage]) ) {
                echo 
    '<a name="CHECK_OUT_GET_SHIPPING_ADDR"></a>';
                echo 
    $theme->fetch'checkout/get_shipping_address.tpl.php');
                
    $theme->set('basket_html''');
            }
            
    // CHECK_OUT_GET_SHIPPING_METHOD
            // Let the user pick a shipping method
            
    if( in_array('CHECK_OUT_GET_SHIPPING_METHOD'$checkout_steps[$current_stage]) ) {   
                echo 
    '<a name="CHECK_OUT_GET_SHIPPING_METHOD"></a>';
                echo 
    $theme->fetch'checkout/get_shipping_method.tpl.php');
                
    $theme->set('basket_html''');
            }
            
            
    // -CHECK_OUT_GET_PAYMENT_METHOD
            // let the user choose a payment method
            
    if( in_array('CHECK_OUT_GET_PAYMENT_METHOD'$checkout_steps[$current_stage]) ) {   
                echo 
    '<a name="CHECK_OUT_GET_PAYMENT_METHOD"></a>';
                    
                    if(!empty( 
    $paypal_api_payment_method_id ) && $paypalActive)
                    {
                        echo 
    $theme->fetch('checkout/get_payment_method_paypal_ex.tpl.php');
                    }
                    else
                    {
                        echo 
    $theme->fetch'checkout/get_payment_method.tpl.php');
                    }
                    
                
    $theme->set('basket_html''');
            } 
            
    // -CHECK_OUT_GET_FINAL_CONFIRMATION
            // shows a total summary including all payments, taxes, fees etc. 
            
    if( in_array('CHECK_OUT_GET_FINAL_CONFIRMATION'$checkout_steps[$current_stage]) ) {   
                echo 
    '<a name="CHECK_OUT_GET_FINAL_CONFIRMATION"></a>';
                
    // Now let the user confirm
                
    echo $theme->fetch'checkout/get_final_confirmation.tpl.php');
                
    $theme->set('basket_html''');
            }
            
    ?>
        
    <?php 
            
    foreach( $checkout_steps[$current_stage] as $this_step ) {    
                echo 
    '<input type="hidden" name="checkout_this_step[]" value="'.$this_step.'" />';
            }
            
             
    // Set Dynamic Page Title: "Checkout: Step x of x"
            
    $ii 0;
            for( 
    $i 1$i 5$i++ ) {
                if( isset( 
    $checkout_steps[$i] ) ) {
                    
    $ii += 1;
                    if( 
    in_array($this_step$checkout_steps[$i] ) ) {
                        
    $mainframe->setPageTitlesprintf$VM_LANG->_('VM_CHECKOUT_TITLE_TAG'), $iicount($checkout_steps) ));
                        break;
                    }
                }
            }
            
            if( !
    in_array('CHECK_OUT_GET_FINAL_CONFIRMATION'$checkout_steps[$current_stage]) ) {
                 
    ?>
                    <div align="center">
                    <input type="submit" class="button" name="formSubmit" value="<?php echo $VM_LANG->_('PHPSHOP_CHECKOUT_NEXT');?> >>" />
                    </div>
                <?php 
            
    }
            
    // Close the Checkout Form, which was opened in the first checkout template using the variable $basket_html
            
    echo '</form>';

             if( !
    in_array('CHECK_OUT_GET_FINAL_CONFIRMATION'$checkout_steps[$current_stage]) ) {
                    echo 
    "<script type=\"text/javascript\"><!--
                        function submit_order( form ) { return true; }
                        --></script>"
    ;
                }
            }
            
            else {
                
              if (!empty(
    $auth['user_id'])) {
                
    // USER IS LOGGED IN, BUT NO REGISTERED CUSTOMER
                // WE NEED SOME ADDITIONAL INFORMATION HERE,
                // SO REDIRECT HIM TO shop/shopper_add
                  
    $vmLogger->info$VM_LANG->_('PHPSHOP_NO_CUSTOMER',false) );
          
                include(
    PAGEPATH'checkout_register_form.php');
              }
          
              else { 
                  
    // user is not logged in
                
    echo $theme->fetch'checkout/login_registration.tpl.php' );
              }
        }
    }
    else {
        
    vmRedirect$sess->url'index.php?page=shop.cart'falsefalse ) );
    }
  • Your avatar
    seyi    
     12 years ago
    0

    I see now, your $theme is not yet defined. Try this, change line 155
    <?php
        $basket_html 
    .= $theme->fetch'common/couponField.tpl.php' );
    ?>


    to
    <?php
        $theme 
    = new $GLOBALS['VM_THEMECLASS']();
        
    $basket_html .= $theme->fetch'common/couponField.tpl.php' );
    ?>
  • Default avatar
    MeanGreen7    
     12 years ago
    0

    Still showing the error or code on the front end. I don't think it is an error per say, it is just showing up on the front end on this page in the checkout process:

    Array
    (
    [0] => CHECK_OUT_GET_SHIPPING_METHOD
    )


    Also Coupon Code Field is not showing on the Confirm Order page of checkout or anywhere for that matter. Do you think it is because I commented the section mentioned in the above posts in the basket.php file?

    Thank you for being patient with me and helping me on this. You can check the site at www.artattackgreetings.com to see what I see through out the checkout.

    MG7
  • Your avatar
    seyi    
     12 years ago
    0

    Ok, that is just an echo of your current checkout status (for debugging).

    You can remove that by removing this line
    <?php
    echo '<pre>'.print_r($checkout_steps[$current_stage],1).'</pre>';
    ?>


    The solution you implemented is for the coupon code field showing up on the payment method page. If you did not remove the debug statement, when it shows:

    Array
    (
    [0] => CHECK_OUT_GET_PAYMENT_METHOD
    )

    On the page, you should see the coupon code field. If you are never seeing 'CHECK_OUT_GET_PAYMENT_METHOD', then the coupon code field will not appear.

    Also make sure you have coupons enabled within Virtuemart configuration.
  • Default avatar
    MeanGreen7    
     12 years ago
    0

    Hey Seyi,

    That worked on the,
    "Array
    (
    [0] => CHECK_OUT_GET_PAYMENT_METHOD
    )".

    I do have Coupon Code enabled in Virtue Mart, but it is still not showing on the Confirm Order page, before it cycles to PayPal. I am logged in as a customer. I think we are almost there?

    MG7