Category: Web developers

 

Woocommerce integration with Quickbook, error Amount calculation incorrect in the request

On the process of pushing the orders from WP to QBK, your plugin is calculating the amount by quantity in the order?

We disable the option on Woocommerce; “Round tax at subtotal level, instead of rounding per line”
Round tax at subtotal level, instead of rounding per line

a) Error on WP on the plugin WooCommerce Sync for QuickBooks Online – by MyWorks Software


Error:6070: [Amount calculation incorrect in the request., Amount is not equal to UnitPrice * Qty. Supplied value:54.475] 

The SQL query on Mysql could like this


select
p.order_id,
p.order_item_id,
p.order_item_name,
p.order_item_type,
max( CASE WHEN pm.meta_key = '_product_id' and p.order_item_id = pm.order_item_id THEN pm.meta_value END ) as productID,
max( CASE WHEN pm.meta_key = '_qty' and p.order_item_id = pm.order_item_id THEN pm.meta_value END ) as Qty,
max( CASE WHEN pm.meta_key = '_variation_id' and p.order_item_id = pm.order_item_id THEN pm.meta_value END ) as variationID,
max( CASE WHEN pm.meta_key = '_line_total' and p.order_item_id = pm.order_item_id THEN pm.meta_value END ) as lineTotal,
max( CASE WHEN pm.meta_key = '_line_subtotal_tax' and p.order_item_id = pm.order_item_id THEN pm.meta_value END ) as subTotalTax,
max( CASE WHEN pm.meta_key = '_line_tax' and p.order_item_id = pm.order_item_id THEN pm.meta_value END ) as Tax,
max( CASE WHEN pm.meta_key = '_tax_class' and p.order_item_id = pm.order_item_id THEN pm.meta_value END ) as taxClass,
max( CASE WHEN pm.meta_key = '_line_subtotal' and p.order_item_id = pm.order_item_id THEN pm.meta_value END ) as subtotal
from
wp_woocommerce_order_items as p,
wp_woocommerce_order_itemmeta as pm
 where order_item_type = 'line_item' and
 p.order_item_id = pm.order_item_id  and p.order_id='8459'
 group by
p.order_item_id

This select could display a result like on the next picture:

Manual solution of Amount is not equal to UnitPrice * Qty:
To edit the line item in the order, by simply changed the order to Pending Payment, which allowed to edit the value in the line item on WP.
After that tried to push this particular order to QuickBook.

It seems your WooCommerce is storing numbers in more than 2 places after the decimal which is fairly abnormal. We do indeed use the amount + qty fields as we sync the order into QuickBooks, to ensure that these numbers match between QuickBooks and WooCommerce, however, QuickBooks isn’t allowing the additional digits after 2 numbers after the decimal.

Solution for another common error 60000

Error:6000: [A business validation error has occurred while processing your request, Business Validation Error: Were sorry, QuickBooks encountered an error while calculating tax. Try reselecting the tax rate or reentering the product/service item and saving the form again.]

On Woocommerce or any other e-commerce app, the customer must defined the way. You can no set a customer A -Emily Beauty shop a Not tax, and for the customer you configured to pay 20% tax on Quickbook.

Defender WordPress Security, Malware Detection, and Firewall to block access to wp-includes: Internal error

Defender WordPress Security, Malware Detection, and Firewall to block access to wp-includes to avoid an internal error 500.

After installed a WP plugin called Defender and configured, we found out that it provoking access denied to wp-includes:


The script from “https://yourdomain.com/wp-includes/js/thickbox/thickbox.js?ver=3.1-20121105” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
plugins.php
The script from “https://yourdomain.com/wp-includes/js/dist/a11y.min.js?ver=2.5.1” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
plugins.php
The script from “https://yourdomain.com/wp-includes/js/wp-sanitize.min.js?ver=5.3.2” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
plugins.php
The script from “https://yourdomain.com/wp-includes/js/wp-auth-check.min.js?ver=5.3.2” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
plugins.php
The script from “https://yourdomain.com/wp-includes/js/jquery/ui/widget.min.js?ver=1.11.4” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
plugins.php
The script from “https://yourdomain.com/wp-includes/js/heartbeat.min.js?ver=5.3.2” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
plugins.php
The script from “https://yourdomain.com/wp-includes/js/jquery/ui/mouse.min.js?ver=1.11.4” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
plugins.php
The script from “https://yourdomain.com/wp-includes/js/jquery/ui/core.min.js?ver=1.11.4” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
plugins.php
The script from “https://yourdomain.com/wp-includes/js/jquery/ui/draggable.min.js?ver=1.11.4” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
plugins.php
The script from “https://yourdomain.com/wp-includes/js/jquery/ui/slider.min.js?ver=1.11.4” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
plugins.php
The script from “https://yourdomain.com/wp-includes/js/jquery/jquery.ui.touch-punch.js?ver=0.2.2” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
plugins.php
The script from “https://yourdomain.com/wp-includes/js/backbone.min.js?ver=1.4.0” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
plugins.php
The script from “https://yourdomain.com/wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=7.4.4” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.

1- Solution check inside the folder wp-includes for .htaccess file that is added by WP defender, you delete this file and try configure again o modify this file here is an example:


deny from allallow from allallow from all
## WP Defender - Protect PHP Executed ##

Order allow,deny
Deny from all


Allow from all


Allow from all

## WP Defender - End ##

Disable, reset or remove from mysql the 2 factor authentication wpmudev, Defender

Disable, reset or remove mysql 2 factor authentication wpmudev, Defender the plugin installed on WordPress

After active this option: “You are required to setup two-factor authentication to use this site.”

Follow the procedure
1. Install the Verification app
2. Scan the barcode
3. Enter passcode
Enter the 6 digit passcode that is shown on your device into the input field below and hit “Verify”.
But for any reason it was working to verify the code.
The option you are
1- Delete the plugin via ftp or file manger, but unfortunately that will not solve the issue because the configuration will remain on the database.
2- This option is best solution, access to your database search the wp_options(it depends the extension of your, but name should end _options) search for wd_2auth_setting:

SELECT * FROM `wp_options` WHERE `option_name` LIKE ‘%wd_2auth_settings%’

Configuration of wd_2auth_settings:


a:12:{s:7:"enabled";s:1:"1";s:9:"lostPhone";b:1;s:9:"forceAuth";b:0;s:13:"forceAuthMess";s:69:"You are required to setup two-factor authentication to use this site.";s:9:"userRoles";a:0:{}s:14:"forceAuthRoles";a:0:{}s:13:"customGraphic";i:0;s:16:"customGraphicURL";s:94:"https://smarttechno.co.uk/wp-content/plugins/defender-security/assets/img/2factor-disabled.svg";s:10:"isConflict";a:0:{}s:13:"email_subject";s:0:"";s:12:"email_sender";s:0:"";s:10:"email_body";s:0:"";}

Yes delete everything, that will remove 2 factor authentication or you only change s:7:”enabled” by s:7:”disabled”;

Here is modified content:


a:12:{s:7:"disabled";s:1:"1";s:9:"lostPhone";b:1;s:9:"forceAuth";b:0;s:13:"forceAuthMess";s:69:"You are required to setup two-factor authentication to use this site.";s:9:"userRoles";a:0:{}s:14:"forceAuthRoles";a:0:{}s:13:"customGraphic";i:0;s:16:"customGraphicURL";s:94:"https://smarttechno.co.uk/wp-content/plugins/defender-security/assets/img/2factor-disabled.svg";s:10:"isConflict";a:0:{}s:13:"email_subject";s:0:"";s:12:"email_sender";s:0:"";s:10:"email_body";s:0:"";}


When you will update your dashboard, you should now is not active:

ow to reset Two Factor Auth settings using

WP, the date vs get the date in loop

Why the the_date function on WordPress won’t display some dates?

In the loop to display posts on your blog the  function the_date probably won’t display all the dates, but the get_the_date will do.

Why the_date is not working but get_the_date is working?

The_date(), will not display  the same date if another post has the same date, but get_the_date will display, so we recommend to the get_the_date()


 echo get_the_date();

Solution for WP duplicator installation: This site can’t be reached dup-installer/main.installer.php is unreachable.

Solution for WP duplicator installation: This site can’t be reached dup-installer/main.installer.php is unreachable.

Step one: If you have access to CP, navigate to where you are trying to install using the WP Duplicator, dup-installer/error_log: inside the log file:


[21-Nov-2019 20:38:52 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function json_encode() in .../public_html/dup-installer/classes/utilities/class.u.notices.manager.php:86

From this error, Json is not installed or activate on you CP. If you have access to CP or ask the hosting’s company to activate Json on the PHP configuration:

On Json will be activate try to install again:

Note: On the log error you should find the reason why the installation of duplicator is not working.

nginx/1.10.3 (Ubuntu) server error 502 Bad Gateway, solution

nginx/1.10.3 (Ubuntu) server error 502 Bad Gateway, solution

Nginx won’t work after rebooting the server

First at all, check the configuration of Nginx, by typing nginx -t


ubuntu@ip-127-0-0-1:/$ nginx -t
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2019/10/17 07:45:33 [warn] 2671#2671: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
2019/10/17 07:45:33 [emerg] 2671#2671: open() "/run/nginx.pid" failed (13: Permission denied)

And double check the nginx configuration…in case http://127.0.0.1:1337 is where sails js should be running, the solution is load sails js


	# Add index.php to the list if you are using PHP
	index index.html index.htm index.nginx-debian.html;

	server_name www.ukgoodbye.co.uk;
	

	location / {
                #rewrite ^/ukgoodbye(.*) $1 break;
                #add_header "Access-Control-Allow-Origin" "*, *";
                proxy_pass http://127.0.0.1:1355;
        }
        location /ukgoodbye-services/ {
                rewrite ^/ukgoodbye-services(.*) $1 break;
                #add_header "Access-Control-Allow-Origin" "*, *";
                proxy_pass http://127.0.0.1:1337;
        }



mongodb won’t start after rebooting the server

mongodb won’t start after rebooting the server

Mongodb, Sails, angular and Nginx were running smoothly after rebooting system, that was on Ubuntu on AWS amazon.
1- Mongodb, trying to run mongo, here is the


ubuntu@ip-172-0-0-1:~$ mongo
MongoDB shell version v3.4.9
connecting to: mongodb://127.0.0.1:27017
2019-10-17T07:20:34.919+0000 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2019-10-17T07:20:34.919+0000 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed

Mongo won’t work unless you delete the mongod.lock, on
a) On windows it could be c:\data\db\monogod.lock
b) On Ubuntu(linux) is located on /var/lib/mongodb, you can check the path of mongo on file configuration mongod.conf:


...
# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
#  engine:
  mmapv1:
    smallFiles: true
#  wiredTiger:
.... 

So to delete mongod.lock


ubuntu@ip-127-0-0-1:/var/lib/mongodb$ rm mongod.lock
rm: remove write-protected regular empty file 'mongod.lock'? 

After deleting the mongod.lock, mongo should be able to work again, you start it by
ubuntu@ip-127-0-0-1:/var/lib/mongodb$ service mongod start

How to recover an Google Analytics Tracking Code, when you changed the website without it?

How to recover an Google Analytics Tracking Code, when you changed the website without it?

Google cached the website to view web pages cached in Google Search Results
Use the https://webcache.googleusercontent.com/search?q=cache:your-domain-url

Example:
1- https://webcache.googleusercontent.com/search?q=cache:https://ukgoodbye.co.uk

2- Step 2, Right click, and select “View source page” and search for Google tracking code on cached page.
Example it should look like:


 

.....
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-79894830-1');
....

Now check if the Google Analytic and the site can be crawl by the robots
You can use third parties website as http://www.gachecker.com/, to Check your entire site for missing Google Analytics or Google AdWords code with one click

Http error, uploading SVG on WP, solution

Http error, uploading SVG, solution

To upload SVG on backend on WordPress, you should  install a plugin to do so like SVG support by

1- Download and install the plugin

SVG Support plugin

2- Now, you should be able to upload SVG files.  If you are able to upload other types files like PNG, JPG but not SVG that could be the case your hosting provider do not allow to so like on Godady,

Access Denied – GoDaddy Website Firewall
If you are the site owner (or you manage this site), please whitelist your IP or if you think this block is an error please open a support ticket and make sure to include the block details (displayed in the box below), so we can assist you in troubleshooting the issue.
for information check on the next picture:

Access Denied Godady

 

WordPress, why ACF won’t appear on menu my WP dashboard?

WordPress, why ACF won’t appear on menu my WP dashboard?

There are many reasons Advanced Custom Fields, doesn’t appear in dashboard menu. The custom fields menu item can be hidden like on the next example:
Check on the wp-content/theme/your-active-theme/functions.php



....
add_filter('acf/settings/show_admin', '__return_false');
....

 

By removing this line the ACF should appear back to the dashboard.
"Custom Fields" doesn't appear in dashboard menu

 

 

 

 

You can try to  access to ACF menu, by type you browser

http://your-domain/wp-admin/edit.php?post_type=acf-field-group,