Coupon code doesn't visible in cart. Please help ASAP!


  • Default avatar
    Alenis83    
     4 years ago
    0

    Hello!

    I need your help. I have asked this question in VirtueMart forum too, but i didn't get any replies.

    I have to create coupon codes on my site, there is AwoCoupon installed beside VirtueMart 1.1.5. The guy, who created the site said, he has disabled (commented out) this function in one of the php files, but I couldn't find it. "Enable coupons" in VirtueMart configuration page is checked. I have updated AwoCoupon too, but it didn't solved the problem either.

    Thanks for your replies!
  • Your avatar
    seyi    
     4 years ago
    0

    Hello,

    There are 2 places you can look:

    www/administrator/components/com_virtuemart/html/basket.php, towards the very end of the file, you should see the template "common/couponField.tpl.php"

    and

    www/components/com_virtuemart/themes/[default]/templates/common/couponField.tpl.php, this contains the code to display the coupon code field. [default] is your virtuemart theme.
  • Default avatar
    Alenis83    
     4 years ago
    0

    Hello!

    Thanks for your fast reply!

    I have found that, the "Input Field for the Coupon Code" part of basket.php was commented out before, but the comments has been removed since, so i don't understand why it isn't working...

    I have checked the couponField.tpl.php too, but i didn't find any comments, or something like that... btw i don't know the php much :)
  • Your avatar
    seyi    
     4 years ago
    0

    can you post the section of code from basket.php with the couponfield code?
  • Default avatar
    Alenis83    
     4 years ago
    0

    Did you mean this one?

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

    yes, that code looks fine. How about the contents of couponField.tpl.php?

    Also while in the file, put in an exit statement. So somewhere after <\?php and before ?> on a new line enter the code
    <?php
    exit;
    ?>


    then refresh the front page. If half the page does not die to the point you cannot continue, that file is not being called.
  • Default avatar
    Alenis83    
     4 years ago
    0

    Which one do you mean? The couponField.tpl.php?

    This is the content of my couponField.tpl.php:

    mm_showMyFileName( __FILE__ );

    ?>

    <table width="100%">
        <tr class="sectiontableentry1">
            <td width="100%">
    <?php
    if (@$_SESSION['invalid_coupon'] == true) {
        echo 
    "<strong>" $VM_LANG->_('PHPSHOP_COUPON_CODE_INVALID') . "</strong>
    "
    ;
    }
    if( !empty(
    $GLOBALS['coupon_error']) ) {
        echo 
    vmGet($GLOBALS'coupon_error''')."
    "
    ;
    }
    // If you have a coupon code, please enter it here:
    echo $VM_LANG->_('PHPSHOP_COUPON_ENTER_HERE') . '
    '
    ;
    ?>  
            <form action="<?php echo $mm_action_url basename$_SERVER['PHP_SELF']) ?>" method="post" onsubmit="return checkCouponField(this);">
                <input type="text" name="coupon_code" id="coupon_code" width="10" maxlength="30" class="inputbox" />
                <input type="hidden" name="Itemid" value="<?php echo @intval($_REQUEST['Itemid'])?>" />
                <input type="hidden" name="do_coupon" value="yes" />
                <input type="hidden" name="option" value="<?php echo $option ?>" />
                <input type="hidden" name="page" value="<?php echo $page ?>" />
                <input type="submit" value="<?php echo $VM_LANG->_('PHPSHOP_COUPON_SUBMIT_BUTTON'?>" class="button" />
            </form>        
            </td>
        </tr>
    </table>
    <script type="text/javascript">
    function checkCouponField(form) {
        if(form.coupon_code.value == '') {
            new Effect.Highlight('coupon_code');
            return false;
        }
        return true;
    }
    </script>
  • Your avatar
    seyi    
     4 years ago
    0

    that looks fine.

    Now in this same file, couponField.tpl.php enter an exit statement, so at the top you have something that looks like this:

    <?php
    mm_showMyFileName
    __FILE__ );
    exit;
    ?>


    Then go to the front end of your cart and try it out. If execution is not stopped then this file is not being called. At that point, look at other themes if you have any in your virtuemart folder.
  • Default avatar
    Alenis83    
     4 years ago
    0

    Thank you.

    I did it, and the site worked perfectly. I don't have any other themes in this folder.
    So, what does it mean, the file isn't called? What can I do?
  • Your avatar
    seyi    
     4 years ago
    0

    maybe your basket.php is not being called either. You can easily test this by adding the exit; command at the top of the file, after <\?php on a new line.

    Are you using some type of one page checkout?
  • Default avatar
    Alenis83    
     4 years ago
    0

    You are right, the basket.php isn't called too.

    I don't know what is one page checkout. We have some modifications in our php files, eg. tax counting, etc, but those are working since years, so it is not in connection with this problem.
  • Your avatar
    seyi    
     4 years ago
    0

    Virtuemart allows overrides, I dont know if you can override a html file, but its worth a shot. look here for basket.php:
    www/components/com_virtuemart/themes/[your_theme_name]/user_class/basket.php

    If its there then that is probably what is being called and you should check for the coupon field at the bottom of the file.

    A one page checkout allows the customer to check out all on one page. these type of extensions generally need modification to your virtuemart files. An example product, would be Rupostel One page checkout.
  • Default avatar
    Alenis83    
     4 years ago
    0

    I don't have that directory, maybe because, I use Joomla 1.5.22 and VirtueMart 1.1.5
  • Your avatar
    seyi    
     4 years ago
    0

    Yes, the overrides are for virtuemart 1.1.x. If you do not see the directory then there are no overrides. I do not know, you would need to figure out what is being called in place of html/basket.php
  • Default avatar
    Alenis83    
     4 years ago
    0

    It looks like I can't solve the problem this way, so I will restore some old backups, or something like that.

    Anyway, Many thanks for your help! :)
  • Your avatar
    seyi    
     4 years ago
    0

    You are welcome.

    One other note. basket.php is called from html/checkout.index.php. You should check that file to see if it is called. It shoudl be, if in your non sef urls when checking out it shows index.php?option=com_virtuemart&page=checkout.index.... If basket.php is not within it then it should show the alternative.

    Another reason its not working is you may be looking at the wrong set of files???
  • Default avatar
    Alenis83    
     4 years ago
    0

    The files are the same, I download it from the server everytime. But maybe I'm doing it wrong, because I'm new in Joomla... :)

    I figured out another way to solve the problem. But that is 100%, the problem is inside /administrator/components/com_virtuemart