2

I am trying to implement a new payment gateway in cs-cart 4

I'm trying to create a new payment method following the instructions at http://kb.cs-cart.com/new-payment. I'm an experienced developer and reasonably familiar with Smarty

This payment method requires a new template to collect specific data, but I cannot find any instructions as to how to go about this. If I create a new blank template in

/design/backend/templates/views/orders/components/payments

for example xxx.tpl, then set the template field in the cscart_payments to hold

views/orders/components/payments/xxx.tpl

The system gives me an error when the new payments method is clicked on. However if I specify the, also empty, cod.tpl template in the field then I get now error, just a blank field.

There appears to be no additional documentation so far as I can see that discusses how to implement this, and I can't spot any other tables that would appear to be relevant.

How do I fix this? And how do I process new data fields?

Cruachan
  • 15,733
  • 5
  • 59
  • 112

2 Answers2

0

* In design/backend/templates/views/payments/components/cc_processors you must create (if necessary) admin layout template. This template required for admin payment methods page.

** In design/themes/(responsive|or_something_else)/templates/views/orders/components/payments you must create customer credit card layout. this is opening in payment page.

please look other gataways.

mysql> select * from cscart_payment_processors;

We must define that templates and payment gateaway.php

| processor_id | processor | processor_script | processor_template | admin_template |

| int(id) | procesor name| payment_gateway.php | must be full path views/orders/components/payments/customer_cc_layout.tpl* | admin_template.tpl **

your gateway.php must be in /app/payments

You said : And how do I process new data fields? but this is not clear. If you use inputs in customer CC layout page, all of them post by cs-cart to your gataway.php

0

I do realize that this is an old question, but I thought another answer could help.

In your question you mentioned the lack of additional documentation. There is now an article in CS-Cart Documentation, which provides instructions on adding a payment processor to CS-Cart via an addon. Payment processors can be added via add-ons since CS-Cart 4.2.4.

A payment processor is a group of several PHP and TPL files and an entry in the payment_processors table.

If you add a payment processor via add-on, your templates should be located in the design/backend/templates/addons/$addon_name/views/payments/components/cc_processors directory. $addon_name should be replaced by the name of your add-on. I suggest using the default my_changes addon that comes with CS-Cart and is meant to store various custom modifications.

The processor_template field of the payment_processors table stores the relative path without the first slash to the TPL file. That TPL file contains the template that appears to a customer who places an order.

If you don't add the template via an add-on, the path must be relative to design/themes/{$theme_name}/templates. For example: views/orders/components/payments/cc.tpl.

If the processor was added by an add-on and requires a custom template, you can specify the path to the template from the add-on template folder. For example, this is the template path for the PayPal add-on: addons/paypal/views/orders/components/payments/paypal_express.tpl.

The article at the beginning provides the information about other fields of the payment_processors table, as well as the structure of the PHP file with the processor script.

You may also want to check how existing payment processors work. For example, you can check out app/addons/paypal.

  • Hi Ivan, welcome to Stack Overflow. I recommend you expand on your answer a bit; links are generally not seen as being full answers and are more appropriate as comments. They often lead to guides that are more general than the user's question, they can end up changing or being broken, and they are perceived as being lazy. – J Brazier Jul 26 '16 at 13:27