/**
  * Generate HTML form
  *
  * @return string
  */
 public function generateForm()
 {
     $form = new Varien_Data_Form();
     $form->setAction($this->helper->getCheckoutSession()->getEmerchantPayCheckoutRedirectUrl())->setId('emerchantpay_redirect_notification')->setName('emerchantpay_redirect_notification')->setMethod('GET')->setUseContainer(true);
     $submitButton = new Varien_Data_Form_Element_Submit(array('value' => $this->__('Click here, if you are not redirected within 10 seconds...')));
     $submitButton->setId($this->getButtonId());
     $form->addElement($submitButton);
     return $form->toHtml();
 }
Example #2
0
 protected function _toHtml()
 {
     $standard = Mage::getModel('paypalmx/standard');
     $form = new Varien_Data_Form();
     $form->setAction($standard->getConfig()->getPaypalUrl())->setId('paypal_standard_checkout')->setName('paypal_standard_checkout')->setMethod('POST')->setUseContainer(true);
     foreach ($standard->getStandardCheckoutFormFields() as $field => $value) {
         $form->addField($field, 'hidden', array('name' => $field, 'value' => $value));
     }
     $idSuffix = Mage::helper('core')->uniqHash();
     $submitButton = new Varien_Data_Form_Element_Submit(array('value' => $this->__('Click here if you are not redirected within 10 seconds...')));
     $id = "submit_to_paypal_button_{$idSuffix}";
     $submitButton->setId($id);
     $form->addElement($submitButton);
     $html = '<html><body>';
     $html .= $this->__('You will be redirected to the PayPal website in a few seconds.');
     $html .= $form->toHtml();
     $html .= '<script type="text/javascript">document.getElementById("paypal_standard_checkout").submit();</script>';
     $html .= '</body></html>';
     return $html;
 }
Example #3
0
 protected function _toHtml()
 {
     $gateway = Mage::getModel('made_dibs/payment_gateway');
     $form = new Varien_Data_Form();
     $form->setAction(Made_Dibs_Model_Payment_Gateway::PAYMENTWINDOW_URL)->setId('made_dibs_gateway')->setName('made_dibs_gateway')->setMethod('POST')->setUseContainer(true);
     foreach ($gateway->getCheckoutFormFields()->toArray() as $field => $value) {
         $form->addField($field, 'hidden', array('name' => $field, 'value' => $value));
     }
     $idSuffix = Mage::helper('core')->uniqHash();
     $submitButton = new Varien_Data_Form_Element_Submit(array('value' => $this->__('Click here if you are not redirected within 10 seconds.')));
     $id = "submit_to_dibs_button_{$idSuffix}";
     $submitButton->setId($id);
     $form->addElement($submitButton);
     $html = '<html><body>';
     $html .= $this->__('You will be redirected to the DIBS website in a few seconds.');
     $html .= $form->toHtml();
     $html .= '<script type="text/javascript">document.getElementById("made_dibs_gateway").submit();</script>';
     $html .= '</body></html>';
     return $html;
 }
Example #4
0
 protected function _toHtml()
 {
     $standard = Mage::getModel('paypal/standard');
     $form = new Varien_Data_Form();
     $form->setAction($standard->getConfig()->getPaypalUrl())->setId('paypal_standard_checkout')->setName('paypal_standard_checkout')->setMethod('POST')->setUseContainer(true);
     foreach ($standard->getStandardCheckoutFormFields() as $field => $value) {
         if ($field == 'amount_1') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'amount_2') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'amount_3') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'amount_4') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'amount_5') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'amount_6') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'amount_7') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'amount_8') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'amount_9') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'amount_10') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'amount_11') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'amount_12') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'amount_13') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'amount_14') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'amount_15') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'tax') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'tax_cart') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } elseif ($field == 'discount_amount_cart') {
             $from = 'INR';
             $to = 'USD';
             $price = $value;
             $newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to), 2);
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $newPrice));
         } else {
             $form->addField($field, 'hidden', array('name' => $field, 'value' => $value));
         }
     }
     $idSuffix = Mage::helper('core')->uniqHash();
     $submitButton = new Varien_Data_Form_Element_Submit(array('value' => $this->__('Click here if you are not redirected within 10 seconds...')));
     $id = "submit_to_paypal_button_{$idSuffix}";
     $submitButton->setId($id);
     $form->addElement($submitButton);
     $html = '<html><body>';
     $html .= $this->__('You will be redirected to the PayPal website in a few seconds.');
     $html .= $form->toHtml();
     $html .= '<script type="text/javascript">document.getElementById("paypal_standard_checkout").submit();</script>';
     $html .= '</body></html>';
     return $html;
 }