public function getPaymentForm() { $form = new Form('payment_form', 'payment_form', '/Store/Payment'); $paypalHost = 'https://' . $this->hostName . '/cgi-bin/webscr'; $form->updateAttributes(array('action' => $paypalHost)); $form->updateAttributes(array('onSubmit' => "return checkBeforePayment()")); $tid = @$_SESSION['ECommTID']; if ($tid) { $transaction = Transaction::getTransactionBasedOnTID($tid); $sessionId = $transaction->getSession(); $session = Session::getActiveSession($sessionId); $cartItems = CartItem::getAll($sessionId); //$form->setConstants( array ( 'cmd' => '_cart' ) ); $form->setConstants(array('cmd' => '_xclick')); $form->addElement('hidden', 'cmd'); $form->setConstants(array('upload' => 1)); $form->addElement('hidden', 'upload'); //Set the ID of the transaction for this order $form->setConstants(array('custom' => $tid)); $form->addElement('hidden', 'custom'); $form->setConstants(array('currency_code' => SiteConfig::get("EComm::Currency"))); $form->addElement('hidden', 'currency_code'); $form->setConstants(array('business' => $this->accountEmail)); $form->addElement('hidden', 'business'); $form->setConstants(array('return' => "http://" . $_SERVER['HTTP_HOST'] . "/Store/IPN/&action=OrderComplete&tid={$tid}")); $form->addElement('hidden', 'return'); $cartDetails = Module_EComm::getCartDetails($sessionId, $cartItems); $form->setConstants(array('amount' => $cartDetails["subTotal"])); $form->addElement('hidden', 'amount'); $form->setConstants(array('shipping' => $cartDetails["shipping"])); $form->addElement('hidden', 'shipping'); $form->setConstants(array('tax' => $cartDetails["tax"])); $form->addElement('hidden', 'tax'); } $form->addElement('image', 'cart_submit', 'https://www.paypal.com/en_US/i/btn/x-click-but23.gif'); return $form->display(); }