Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

X-Cart offline payment method

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 03-07-2016, 01:12 AM
 
rafaelcpalmeida rafaelcpalmeida is offline
 

Member
  
Join Date: Feb 2016
Posts: 12
 

Default 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.
__________________
X-Cart 5.2.13
Reply With Quote
  #2  
Old 03-09-2016, 05:37 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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?
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #3  
Old 03-10-2016, 12:28 AM
 
rafaelcpalmeida rafaelcpalmeida is offline
 

Member
  
Join Date: Feb 2016
Posts: 12
 

Default 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.
__________________
X-Cart 5.2.13
Reply With Quote
  #4  
Old 03-13-2016, 11:30 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
rafaelcpalmeida (03-15-2016)
  #5  
Old 03-15-2016, 08:19 AM
 
rafaelcpalmeida rafaelcpalmeida is offline
 

Member
  
Join Date: Feb 2016
Posts: 12
 

Default Re: X-Cart offline payment method

Thanks.

What is the best way to retrieve the settings from the module stored in the database?
__________________
X-Cart 5.2.13
Reply With Quote
  #6  
Old 03-15-2016, 08:47 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: X-Cart offline payment method

Please check this article:
http://kb.x-cart.com/display/XDD/Step+4+-+working+with+settings
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #7  
Old 03-16-2016, 06:46 AM
 
rafaelcpalmeida rafaelcpalmeida is offline
 

Member
  
Join Date: Feb 2016
Posts: 12
 

Default 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
__________________
X-Cart 5.2.13
Reply With Quote
  #8  
Old 03-16-2016, 09:24 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #9  
Old 03-17-2016, 12:34 AM
 
rafaelcpalmeida rafaelcpalmeida is offline
 

Member
  
Join Date: Feb 2016
Posts: 12
 

Default 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?
__________________
X-Cart 5.2.13
Reply With Quote
  #10  
Old 03-17-2016, 08:38 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:23 PM.

   

 
X-Cart forums © 2001-2020