X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   X-Cart offline payment method (https://forum.x-cart.com/showthread.php?t=73681)

rafaelcpalmeida 03-07-2016 01:12 AM

X-Cart offline payment method
 
Hello all,
I'm trying to build an X-Cart 5 module that generates a reference and allows the users to pay offline, it's the most used method in Portugal.

However I can't override X-Cart workflow and override the final page to show the details I want. I've googled a lot and went through the docs but I can't seem to find it.

Does anyone know how to do this?

I've already modified invoice through @ListChild but I need something more "programmatic".

Thanks in advance.

qualiteam 03-09-2016 05:37 AM

Re: X-Cart offline payment method
 
Please provide more information on the desired changes and behavior.

What is a "reference"? Is it a plain text field?
Where and when should it show up during checkout?

rafaelcpalmeida 03-10-2016 12:28 AM

Re: X-Cart offline payment method
 
The payment system we're trying to implement takes 3 values (2 from the configuration form and the total price from the order) and returns 3 values also (1 from the configurations, a reference which is calculated using the value and the final value).

All fields can be strings.

Here's an example of what the module should return:

Entity: 99999
Reference: 999 000 229
Value: 923€

I want this to be displayed in the last step which is, I think, the invoice.

qualiteam 03-13-2016 11:30 PM

Re: X-Cart offline payment method
 
You should look into creating a custom payment method extended from \XLite\Model\Payment\Processor\Offline and use \XLite\Model\Payment\Processor\Check as an example (if you want some data to be entered by customers during checkout).

I believe you should add the extra order fields that will store the data, fill the fields from your offline payment method processor and display the fields in invoices with the help of @ListChild directive.

rafaelcpalmeida 03-15-2016 08:19 AM

Re: X-Cart offline payment method
 
Thanks.

What is the best way to retrieve the settings from the module stored in the database?

qualiteam 03-15-2016 08:47 PM

Re: X-Cart offline payment method
 
Please check this article:
http://kb.x-cart.com/display/XDD/Step+4+-+working+with+settings

rafaelcpalmeida 03-16-2016 06:46 AM

Re: X-Cart offline payment method
 
Is there any chance to get the value of the settings on the PHP side instead of the TPL file?

When I try \XLite\Core\Config::getInstance()-><ID>-><Module>-><variable> returns null

qualiteam 03-16-2016 09:24 PM

Re: X-Cart offline payment method
 
Er... You must get the value in PHP, it won't work in template files :)

If you need the value in a template, you should edit the widget class that is linked with the template and declare there a method retrieving the setting. And then use that method name in the template.

rafaelcpalmeida 03-17-2016 12:34 AM

Re: X-Cart offline payment method
 
But in the link that you sent me you call the
PHP Code:

{getHtmlCode():h

in your TPL file. How can I call it in my processor.php file?

Edit:
I managed to understand you meant. The problem here is: The example you showed me uses \XLite\Core\Config for settings, I'm using \XLite\Model\Payment\Method. How can I access my module settings like this?

qualiteam 03-17-2016 08:38 PM

Re: X-Cart offline payment method
 
You should use \XLite\Model\Payment\Method::getSetting($name) method.

If you have a transaction model in the $transaction variable, you can get the setting from this object as follows:
$transaction->getPaymentMethod()->getSetting($name);

So, basically you need the payment method model to get values of its settings.


All times are GMT -8. The time now is 11:05 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.