Permalink
Browse files

Altered the voucher validation to use sub-total rather than total

  • Loading branch information...
1 parent 37e4ea3 commit 325d801e44b35b40338aefc17edc69859bacbe69 @pierswarmers committed Dec 5, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/form/rtShopPaymentForm.class.php
@@ -35,7 +35,8 @@ public function setup()
$options = array('required' => false);
$options['model'] = 'rtShopVoucher';
$options['column'] = 'code';
- $options['query'] = Doctrine::getTable('rtShopVoucher')->getValidityQuery($this->getRtShopCartManager()->getTotalCharge());
+ $options['query'] = Doctrine::getTable('rtShopVoucher')->getValidityQuery($this->getRtShopCartManager()->getSubTotal());
+
$this->setValidator('voucher_code', new sfValidatorDoctrineChoice($options, array('invalid' => 'Couldn\'t find a valid voucher for that code.')));
$this->widgetSchema->setNameFormat('rt_shop_order_voucher[%s]');
@@ -49,6 +50,9 @@ public function getRtShopOrder()
return $this->getRtShopCartManager()->getOrder();
}
+ /**
+ * @return rtShopCartManager
+ */
public function getRtShopCartManager()
{
return $this->_rt_shop_cart_manager;

0 comments on commit 325d801

Please sign in to comment.