Opencart Integration on Localhost

Request for general support related to Logic Invoice.
buzzz
Posts: 3
Joined: Mon Aug 28, 2017 3:11 am

Re: Opencart Integration on Localhost

Post by buzzz » Mon Aug 28, 2017 4:05 am

Hello Esmond,

I've been trying to get the integration between opencart and logic invoice up for about over a day, but I seem to be messing up in some way that I can't seem to track. :(

I'm trying to follow by the directions that I've been reading the whole day, but I bet I'm missing something. Your help in this regard would be greatly appreciated.

An error is logged in Opencart pertaining to the activity, whenever i try to sync orders using the cron link:
http://[my-domain.com]/index.php?route=module/logic_invoice/orders&token=123

Opencart Error Log:
2017-08-27 20:58:45 - LOGIC INVOICE [Login] ::
2017-08-27 20:58:45 - LOGIC INVOICE DEBUG ORDERS :: EXPORTED 10 orders with 0 successful, 0 ignored and 0 failed.


No errors logged in Logic Invoice

Just like nicknick above, this is what I have tried already:
- I tried using the API with the key and secret that had been generated on the cron, System User account on my LogicInvoice install.
- I went ahead and regenerated the keys at LogicInvoice and used those in the Opencart Logic Invoice Integration module.

I tried a little troubleshooting on my own as well. Here are the details:
I added 2 lines of var_dump in the file opencart/catalog/model/module/logic_invoice.php
Modified the function login()

just after the curl execution and json decoding...
"$response = curl_exec($curl);

$data = json_decode($response, true);"

... I tried to var_dump both the variables:
var_dump($response); // this returns bool(false)

var_dump($data); // this returns NULL

The login portion is failing miserably, and I'm clueless why. Since, I'm using the latest integration module, that means I'm already up to date on the code changes. that were previously required in
logicinvoice/application/model/api/api.php (I've verified the name of the function to be "login" and the required code to be the same as well in the file as in your previously shared git link (https://github.com/Equotix/Logic-Invoic ... 750240ffbf).

I've been pulling my hair over this all day. Your guidance will be much appreciated.


Environment Details:
PHP Version 7.0.22
Mysql Version - 10.1.26-MariaDB

Opencart - 2.2.0.0
Logic Invoice - 1.2.0
Logic Invoice Integration - 2.0.2

Note: LogicInvoice is installed under the Opencart folder in my environment. For e.g.:
Opencart Site URL: http://[my-domain.com]
LogicInvoice Site URL: http://[my-domain.com]/lci
Hopefully that isn't causing any issues.

PS: Thanks for taking the time to read this and sorry for the long message. :D

User avatar
Esmond
Site Admin
Posts: 283
Joined: Tue Sep 15, 2015 3:08 pm
Location: Singapore
Contact:

Re: Opencart Integration on Localhost

Post by Esmond » Mon Aug 28, 2017 7:55 am

As both Logic Invoice and OpenCart is on localhost, have you checked to ensure HTTP Loopback is disabled? That may be the issue for some users, which was why the login failed.

buzzz
Posts: 3
Joined: Mon Aug 28, 2017 3:11 am

Re: Opencart Integration on Localhost

Post by buzzz » Mon Aug 28, 2017 3:59 pm

Thanks for the reply Esmond. I had previously enabled the HTTP Loopback since I wasn't getting any errors in opencart and logic invoice, and no records were being synched when it was disabled. On enabling it opencart started showing errors in its logs.

I've disabled the HTTP Loopback option again after your reply.
The link that I get for the cron, when I disable HTTP Loopback is:
curl -s -o /dev/null "http://[my-domain.com]/index.php?route=module/logic_invoice&token=123"
(where [my-domain.com] is a substituted name for my live domain here)

If I try to run the link "http://[my-domain.com]/index.php?route=module/logic_invoice&token=123" directly from my browser, i get a blank white screen. Both the Opencart error log and the Logic Invoice error log show no errors being logged either.

If it helps, I'm running a windows-based dedicated server for the site. Running the command directly from the browser should work too, right? If it runs fine, I can simply setup a cron to run the link based on some schedule. However, my epic noobness is making me fail miserably.

Opencart and Logic Invoice are both setup on a live domain that I've set up. Although, if the localhost logic also holds by means of both sites being hosted on the same server, then yes - both sites are on the same server as well.

Thanks again for helping me through this. I really hope I get this working with your help by the end of the day. :)

User avatar
Esmond
Site Admin
Posts: 283
Joined: Tue Sep 15, 2015 3:08 pm
Location: Singapore
Contact:

Re: Opencart Integration on Localhost

Post by Esmond » Tue Aug 29, 2017 9:44 am

Running the website on the same server should be fine.

When you run http://[my-domain.com]/index.php?route=module/logic_invoice&token=123, do you get any logs in your OpenCart error logs when debug mode is turned on?

You should likely get some information in the logs. If that doesn't work, do drop me a PM with the login details. I can have a look at the issue for you.

buzzz
Posts: 3
Joined: Mon Aug 28, 2017 3:11 am

Re: Opencart Integration on Localhost

Post by buzzz » Wed Aug 30, 2017 12:45 pm

I've been testing with debug mode on, but haven't been getting any errors in the error log after turning off http loopback, and running that url.
I have dropped a PM your way with the login details. :)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests