I've been trying to get the coupon block from the cart to show up on a custom cms page:
{{block type="core/template" title="Coupon" template="checkout/cart/coupon.phtml"}}
The Coupomn Block is displayed, but submitting a coupon code does not seem to work? I was expecting it to direct me to the cart and let me know that the code has been used.
Alternatively I have tried adding the block to the template/checkout/cart/noItems.phtml page using this code:
<div class="couponpop"><?php echo $this->getLayout()->createBlock("core/template")->setTemplate("checkout/cart/coupon.phtml")->toHtml();?></div>
and trying to have it pop up in fancybox2 on pageload, but again, submitting a working coupon code does not seem to apply any discounts if in a fancybox2 modal or in the page content.
Any help would be greatly appreciated.
--- EDIT:
I've tried Amit Bera's suggestion below, however this gives me a 302 error on the POST form-action.
Here is the content of my noItems.phtml file:
<div class="page-title">
<h1><?php echo $this->__('Shopping Cart is Empty') ?></h1>
</div>
<div class="cart-empty">
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<?php echo $this->getChildHtml('checkout_cart_empty_widget'); ?>
<p><?php echo $this->__('You have no items in your shopping cart.') ?></p>
<p><?php echo $this->__('Click <a href="%s">here</a> to continue shopping.', $this->getContinueShoppingUrl()) ?></p>
<div class="couponpop"><?php echo $this->getLayout()->createBlock("checkout/cart_coupon")->setTemplate("checkout/cart/coupon.phtml")->toHtml();?></div>
<?php echo $this->getChildHtml('shopping.cart.table.after'); ?>
</div>
and here is what the console is telling me:
--- EDIT 2:
As Amit rightly pointed out, this is not allowed by the magento system and even with a bit of core function hacking i couldn't get a coupon code to work without already having a product in your cart.