Joomla/VirtueMart setup instructions

» Go to "Payment Modules"

The setup process for Joomla/VirtueMart modules is currently a manual process. As further versions of VirtueMart are released this may become more automated. Please note that this module is still classified as a BETA module therefore will require testing before making it LIVE. Any problems or queries with this module should be submitted to us here.

Instructions for setup is as follows:

  1. Unzip the contents of the VirtueMart payment module somewhere accessable.
  2. Copy px_paymex.php and ps_paymex.cfg.php to the joomla/administrator/components/com_virtuemart/classes/payment/ directory.
  3. Copy pxnotify.php to the joomla/administrator/components/com_virtuemart/ directory.
  4. Copy checkout.result2.php to the joomla/administrator/components/com_virtuemart/html/ directory.
  5. Log in to the Joomla administration panel
  6. Click on Components/VirtueMart
  7. Click "Store" on the left Administration panel
  8. Click "Add Payment method"
  9. Enter the following details:
    Option NameValue
    Active?Ticked
    Payment Method NamePaymex
    CodePMX
    Payment Class Nameps_paymex
    Payment method typeHTML-Form based
  10. Click Save
  11. Click "List Payment Methods" in the menu
  12. Click the "Paymex" payment method in the list shown
  13. Click Configuration
  14. Enter the Paymex configuration details:
    Configuation OptionDescription
    Test Mode?Recommended to set this to Yes until you go LIVE
    Business IdSet this to the business id provided to you by Paymex
    Order Status for successful transactionsGenerally set to "Confirmed"
    Order Status for pending paymentsGenerally set to "Pending"
    Order Status for failed transactionsGenerally set to "Cancelled"
  15. Under the Payment Extra Info section copy and paste the following code:
    
    <?php
    $db1 = new ps_DB();
    $q = "SELECT country_2_code FROM #__vm_country" .
         " WHERE country_3_code='".$user->country."'".
         " ORDER BY country_2_code ASC";
    $db1->query($q);
    
    $url = "https://secure.paymex.co.nz/Process.aspx";
    $tax_total = $db->f("order_tax") + $db->f("order_shipping_tax");
    $discount_total = $db->f("coupon_discount") + $db->f("order_discount");
    
    $state = $dbbt->f('state');
    if ($state == '-')
       $state = 'n/a';
    
    $post_variables = Array(
    "business" => PAYMEX_BUSINESS,
    "item_name" => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": ". $db->f("order_id"),
    "ex_order_id" => $db->f("order_id"),
    "ex_invoice" => $db->f("order_number"),
    "retail_ref" => $db->f("order_number"),
    "client_ref" => $db->f("order_number"),
    "amount" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),
    "shipping" => sprintf("%.2f", $db->f("order_shipping")),
    "currency_code" => $_SESSION['vendor_currency'],
    
    "first_name" => $dbbt->f('first_name'),
    "last_name" => $dbbt->f('last_name'),
    "address1" => $dbbt->f('address_1'),
    "address2" => $dbbt->f('address_2'),
    "postcode" => $dbbt->f('zip'),
    "city" => $dbbt->f('city'),
    "suburb" => $state,
    "country" => $db1->f('country_2_code'),
    "email" => $dbbt->f('user_email'),
    "phone" => $dbbt->f('phone_1'),
    
    "hide_extra" => "1",
    "cc_only" => "1",
    
    "return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result2" . 
                "&order_id=".$db->f("order_id"),
    "notify_url" => SECUREURL ."administrator/components/com_virtuemart/pxnotify.php",
    "notify_type" => "post",
    "return_cancel" => SECUREURL ."index.php",
    
    "test_mode" => PAYMEX_TESTMODE
    );
    if( $page == "checkout.thankyou" ) {
       $query_string = "?";
       foreach( $post_variables as $name => $value ) {
          $query_string .= $name. "=" . urlencode($value) ."&";
       }
       vmRedirect( $url . $query_string );
    } 
    else 
    {
       echo '<form action="'.$url.'" method="post" target="_blank">';
       echo '<input type="image" name="submit" '.
            'src="https://secure.paymex.co.nz/images/btn_paynow.gif"'.
            ' border="0" ' .
            'alt="Click here to pay securely by credit card with Paymex" />';
    
       foreach( $post_variables as $name => $value ) {
          echo '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
       }
       echo '</form>';
    
    }
    ?>
    
    
  16. Click Save.
  17. You have now set up Paymex as a payment method for Joomla/VirtueMart
  18. Please note that this module is still classified as a BETA module therefore will require testing before making it LIVE. Any problems or queries with this module should be submitted to us here.

    Print Print this page
    Email Email this page
    Contact Contact Paymex
    Knowledge Base Home Knowledge Base Home

    Search Knowledge Base: