Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
A simple means of disabling the discount / coupon code ………
 
tempus fugit
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2008-03-09
UK
 

It would be nice, at times when there are no valid discount coupons issued or available, to be able to simply deselect the coupon entry code from displaying on the cart page.

People see that there might be the possibility of some discount, worry that they’re missing something, go Googling for codes, call our office etc.

It would be great if we could just switch its visibility on and off from system/config as & when required.

Thanks for all you have provided ...................... it works for me!!!!!!!! grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
sixtyonedesign
Jr. Member
 
Total Posts:  17
Joined:  2008-08-11
 

hi, what was the solution for this? how do you disable coupons?

 
Magento Community Magento Community
Magento Community
Magento Community
 
tempus fugit
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2008-03-09
UK
 

As far as I know nothing has changed to enable you to deselect coupons.
We edited the code to comment it out as a temporary fix.
Somebody did it for me, so I couldn’t actually tell you where to find the relevant code.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mckilty
Jr. Member
 
Total Posts:  21
Joined:  2008-04-20
 

The file I went into to disable the discount coupon was: App --> design --> frontend --> default --> my theme --> template --> checkout --> cart --> coupon.phtml

all I did was comment the file contents and reload the file.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lenlucas
Jr. Member
 
Total Posts:  13
Joined:  2008-10-10
 

A slightly better way to do this would be to comment out the following code in /app/design/frontend/yourtheme/default/layout/checkout.xml

<!--            <block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/> -->
<!--            <
block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/> -->

You can edit XML layout files in this way to remove sections you don’t want.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Chad P. Statham
Jr. Member
 
Total Posts:  7
Joined:  2008-12-13
 
lenlucas - 12 December 2008 06:48 AM

A slightly better way to do this would be to comment out the following code in /app/design/frontend/yourtheme/default/layout/checkout.xml

<!--            <block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/> -->
<!--            <
block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/> -->

You can edit XML layout files in this way to remove sections you don’t want.

Is it neccessary to comment out both these lines for disabling teh coupon code or is the second block being commented out for another reason?
Thanks, Chad

 
Magento Community Magento Community
Magento Community
Magento Community
 
till
Member
 
Total Posts:  58
Joined:  2007-12-17
 

I couldn’t get it to work, so I did the following:

In coupon.phtml the first two lines look like this:

<?php
/**//tempend ?>

I replaced it with:

<?php
return;
/**//tempend ?>

(This forum adds “//tempend ?>” whatever to the end of my code, please ignore!)

 
Magento Community Magento Community
Magento Community
Magento Community
 
MarkUpACreek
Jr. Member
 
Total Posts:  12
Joined:  2009-03-25
 
Chad P. Statham - 22 December 2008 06:14 PM

lenlucas - 12 December 2008 06:48 AM
A slightly better way to do this would be to comment out the following code in /app/design/frontend/yourtheme/default/layout/checkout.xml

<!--            <block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/> -->
<!--            <
block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/> -->

You can edit XML layout files in this way to remove sections you don’t want.

Is it neccessary to comment out both these lines for disabling teh coupon code or is the second block being commented out for another reason?
Thanks, Chad

Worked for me but I had to refresh cache. Using ver. 1.3.2.1.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kevin Von
Member
 
Total Posts:  31
Joined:  2008-07-22
 
lenlucas - 12 December 2008 06:48 AM

A slightly better way to do this would be to comment out the following code in /app/design/frontend/yourtheme/default/layout/checkout.xml

<!--            <block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/> -->
<!--            <
block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/> -->

You can edit XML layout files in this way to remove sections you don’t want.

Thanks.This is useful for me.And now it works for me.

 
Magento Community Magento Community
Magento Community
Magento Community
 
gspablo
Jr. Member
 
Total Posts:  21
Joined:  2010-06-16
 

How I can enable the coupon discount for appear in the cart page??

I yhink the problem is in cart.phtml

<div class="col-2">
<?php echo $this->getChildHtml('coupon') ?>
<?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
</div>

Because shipping is working but coupon s not working

 
Magento Community Magento Community
Magento Community
Magento Community
 
Workwell
Member
 
Avatar
Total Posts:  63
Joined:  2010-05-05
London
 

Strangely enough I have found myself looking for a solution to this issue, my sites have been vastly modified with extensions and somewhere along the way my coupon code option has disappeared from the checkout page. Much to my annoyance!

I have trawled for hours (more like days) looking into the reasons and examining the file structure to no avail. in total I have six sites suffering the CC absence and one that is not.

Unfortunately the unaffected site was a clean install of 1.4.1.1 whereas the other sites were upgrades from 1.4 and 1.4.0.1, so I also suspect that the magento code itself maybe at fault.

Using the unaffected site for comparison I have replaced ALL the core code and relevant files to see if this cleared the fault. Alas no. The most notable difference is that I am not using J2Ts Reward Points on the unaffected site but there doesn\’t appear to be any reason for a conflict (however I will be asking J2T this very question). cart.phtml and coupon.phtml are correct!

Using firefly I can see that the unaffected site yields the following code:

<div class=\"col-2\">
<form method=\"post\" action=\"http://www.charitiesaccounting.com/index.php/checkout/cart/couponPost/\" id=\"discount-coupon-form\">
<div class=\"discount\">
<h2 translate=\"[{shown:\’Discount Codes\’,translated:\’Discount Codes\’,original:\’Discount Codes\’,location:\’Heading level 2\’,scope:\’Mage_Checkout\’}]\” class=\"translate-inline\">Discount Codes</h2>
<div class=\"discount-form\">
<label for=\"coupon_code\" translate=\"[{shown:\’Enter your coupon code if you have one.\’,translated:\’Enter your coupon code if you have one.\’,original:\’Enter your coupon code if you have one.\’,location:\’Label for an input element.\’,scope:\’Mage_Checkout\’}]\” class=\"translate-inline\">Enter your coupon code if you have one.</label>
<input type=\"hidden\" value=\"0\" id=\"remove-coupone\" name=\"remove\">
<div class=\"input-box\">
<input value=\"\" name=\"coupon_code\" id=\"coupon_code\" class=\"input-text\" gtbfieldid=\"3\">
</div>
<div class=\"buttons-set\">
<button translate=\"[{shown:\’Apply Coupon\’,translated:\’Apply Coupon\’,original:\’Apply Coupon\’,location:\’Tag attribute (ALT, TITLE, etc.)\’,scope:\’Mage_Checkout\’},{shown:\’Apply Coupon\’,translated:\’Apply Coupon\’,original:\’Apply Coupon\’,location:\’Tag attribute (ALT, TITLE, etc.)\’,scope:\’Mage_Checkout\’},{shown:\’Apply Coupon\’,translated:\’Apply Coupon\’,original:\’Apply Coupon\’,location:\’Push button\’,scope:\’Mage_Checkout\’}]\” value=\"Apply Coupon\” onclick=\"discountForm.submit(false)\" class=\"button translate-inline\” title=\"Apply Coupon\” type=\"button\"><span><span>Apply Coupon</span></span></button>
</div>
</div>
</div>
</form>
<script type=\"text/javascript\">
//<![CDATA[
var discountForm = new VarienForm(\’discount-coupon-form\’);
discountForm.submit = function (isRemove) {
if (isRemove) {
$(\’coupon_code\’).removeClassName(\’required-entry\’);
$(\’remove-coupone\’).value = \"1\";
} else {
$(\’coupon_code\’).addClassName(\’required-entry\’);
$(\’remove-coupone\’).value = \"0\";
}
return VarienForm.prototype.submit.bind(discountForm)();
}
//]]>
</script>

Where as the missing CC checkout page displays the following:

<div class=\"col-2\">
<div class=\"discount-codes box\">
<div class=\"shipping\">
<h2>Estimate Shipping and Tax</h2>
<div class=\"shipping-form\">
etc....

Quite obviously there is a huge chunk of code not being called under the col-2 tag which has me completely baffled. I would imagine the shipping script (which is called in) is in the same form.js as the discount script?

Usually I manage to figure out solutions over time but this one has me foxed, any solutions, tests or ideas would be most helpful and by the way… cheap airsoft guns are available at http://www.uk-bbguns.com, good quality fishing equipment is available here http://www.carphunter.co.uk and some lovely knives and swords are available here http://www.hunters-knives.co.uk <<Shameless>>

The hunting continues…

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sunburst WebConsult
Jr. Member
 
Total Posts:  19
Joined:  2009-05-13
 

Ok… so what was the fix to get the discount coupon box showing again?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Workwell
Member
 
Avatar
Total Posts:  63
Joined:  2010-05-05
London
 

Don’t know, it looks like Javascript is not being implemented, which suggests an absence or conflict.

Possible causes Fooman Speedster (but I don’t think so) or js files being compressed into one file.

Pain in the backside!!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Workwell
Member
 
Avatar
Total Posts:  63
Joined:  2010-05-05
London
 
Sunburst WebConsult - 27 November 2010 05:25 AM

Ok… so what was the fix to get the discount coupon box showing again?

Put the coupon.phtml code in to shipping.phtml to display coupon box, it worked for me.

Problem seems to be with coupon.phtml not being picked up from cart.

Anyone!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
frano9
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2010-01-21
Manchester
 

To make it a bit cleaner. Make an extension to which you add just an etc/system.xml with the following content :

<config>
    <
sections>
        <
sales>
            <
groups>
                <
discounts translate="label">
                    <
label>Manage Discount Codes</label>
                    <
frontend_type>text</frontend_type>
                    <
sort_order>110</sort_order>
                    <
show_in_default>1</show_in_default>
                    <
show_in_website>1</show_in_website>
                    <
show_in_store>1</show_in_store>
                    <
fields>
                        <
show_frontend translate="label">
                            <
label>Show in Frontend</label>
                                                    <
frontend_type>select</frontend_type>
                          <
source_model>adminhtml/system_config_source_yesno</source_model>
                                                    <
sort_order>5</sort_order>
                                                    <
show_in_default>1</show_in_default>
                                                    <
show_in_website>1</show_in_website>
                                                    <
show_in_store>0</show_in_store>
                        </
show_frontend>                                     
                    </
fields>
                </
discounts>
            </
groups>
        </
sales>
    </
sections>
  </
config>

At the top of app/design/frontend/default/[YOUR_THEME]/template/checkout/cart

$show = (int)Mage::getStoreConfig('sales/discounts/show_frontend');
if(!
$show) return;

This way you have an option in your backend to show/hide it. System > Configuration > Sales > Sales > Manage Discount Codes

 
Magento Community Magento Community
Magento Community
Magento Community
 
Lance Monotone
Member
 
Avatar
Total Posts:  63
Joined:  2008-04-16
North Adams, MA. 01247
 
frano9 - 01 March 2011 08:51 AM

To make it a bit cleaner. Make an extension to which you add just an etc/system.xml with the following content :

Hi, I’m trying this solution and I guess I’m not putting the XML in the right place.  What is the complete path for the ‘etc/system.xml’ file that you mentioned? And maybe I need to delete the cache (which I did) or clear some other setting?

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2