I have had the store for years, but never added blog posts, so I am not sure how long this has been broken - it may have been from the very first version.
I am now looking at adding a blog to the store but selected 'new post' just gives a blank screen - the console in chrome shows the following errors.
> JQMIGRATE: Migrate is installed, version 1.4.1
data.min.js?ver=4.2.0:1 Uncaught TypeError: Object(...) is not a function
at Module.308 (data.min.js?ver=4.2.0:1)
at r (data.min.js?ver=4.2.0:1)
at wp.data.0 (data.min.js?ver=4.2.0:1)
at data.min.js?ver=4.2.0:1
post-new.php:2018 Uncaught TypeError: Cannot read property 'use' of undefined
at post-new.php:2018
at post-new.php:2020
The code is so abstracted that I am not sure what it is actually doing - but all the code is in wp-includes/js/dist/
And the bit of code throwing the error looks like this (the second line is highlighted as failing).
var A = {
reducer: Object(f.flowRight)([S("reducerKey"), S("selectorName")])(function() {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : new m.a
, e = arguments.length > 1 ? arguments[1] : void 0;
switch (e.type) {
case "START_RESOLUTION":
case "FINISH_RESOLUTION":
var r = "START_RESOLUTION" === e.type
, n = new m.a(t);
return n.set(e.args, r),
n;
case "INVALIDATE_RESOLUTION":
var o = new m.a(t);
return o.delete(e.args),
o
}
return t
}),
I have tried this in chrome and edge, both get exactly the same result - same error, but a bit less informative in the edge console.
It seems to be a guttenburg/block editor issue, the old classic editor, can be enabled using this plug in
https://wordpress.org/plugins/classic-editor/
Related
I am just using the below code. It was working fine but from today is shows error - "TypeError thrown wc_add_number_precision(): Argument #1 ($value) must be of type float, null given, called in /chroot/home/a23cc473/fdd76f6eaa.nxcli.net/html/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 1955". Here is my code - WC()->cart->add_to_cart( 5 )
Can anyone please advise me why this error is showing
It's related with newest WC core, go and edit wc->includes->wc-core-functions.php row 1918 and replace it with older function:
new (not working) :
function wc_add_number_precision( float $value, bool $round = true ) {
old (working one) :
function wc_add_number_precision( $value, $round = true ) {
It's not best fix, but at least is working.
Hi all I am a bit stumped it seems after the latest update to wordpress this function has stopped working. Any ideas would be gratefully received . . .
First snippet gets the parameter "we" and should then auto fill the form field id #input_2_4 after making some calculations.
`<script>
$.urlParam = function (name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)')
.exec(window.location.href);
return results[1] || 0;
}
var we = parseInt( $.urlParam('we') );
$('#input_2_4').val( '£' + (we * 0.1450).toFixed(2));
</script>`
Everything seems present in the url string including &we=1685 value but field #input_3_4 is now blank.
Link
I'd try it like below to remove any $ issues. Console.log should let you know if the issue is in getting the URL parameters. You may need to look at enqueueing the script as well to make sure it's getting loaded in the proper order.
jQuery.urlParam = function (name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)')
.exec(window.location.href);
console.log(window.location.href)
console.log(results[1] || 0);
return results[1] || 0;
}
var we = parseInt( jQuery.urlParam('we') );
jQuery('#input_2_4').val( '£' + (we * 0.1450).toFixed(2));
I am using wkhtmltopdf version 0.12.2.1 (with patched qt) to render my reactJs app! It worked fine, until I added the react-pdf-js lib to render the pdf generated inside my app. I followed the code described on react-pdf-js documentation (see https://www.npmjs.com/package/react-pdf-js) to make it work.
The pdf is rendered inside my page, and it looks pretty cool indeed. But when I try to run wkhtmltopdf again, to generate a pdf of any page of my app, the following error is returned:
desenv01#desenv01-PC:~$ wkhtmltopdf -O Landscape --print-media-type --debug-javascript http://localhost:3000/report/1 report.pdfLoading pages (1/6)
Warning: undefined:0 ReferenceError: Can't find variable: Float64Array
Warning: http://localhost:3000/assets/js/app.js:46789 SyntaxError: Parse error
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done
Then, I went to my app.js to see what's on line 46789:
set href(href) {
clear.call(this);
parse.call(this, href);
},
get protocol() {
return this._scheme + ':';
},
set protocol(protocol) {
if (this._isInvalid)
return;
parse.call(this, protocol + ':', 'scheme start');
},
The error happens on the line that says parse.call(this, href);, which is part of pdf.combined.js script.
I could not find any solution online so I wondered if there is anyone who might know if I did something wrong or a way to work around it.
Thanks..
I ran into this using wkthmltopdf 12.3 and 12.4 because I have my IDE set to nag me for using var instead of let. The problem is the older Qt engine powering those versions of the program doesn't recognize new-style, ES6 keywords. Not sure if you can down-convert React. Otherwise you can try the bleeding edge versions which use a newer Qt.
I have same problem. I fixed it by modify some code that i think it is new in JS. let keyword (ES5) and template literals (ES6).
generateRandomColor= function () {
let maxVal = 0xFFFFFF; // 16777215
let randomNumber = Math.random() * maxVal;
randomNumber = Math.floor(randomNumber);
randomNumber = randomNumber.toString(16);
let randColor = randomNumber.padStart(6, 0);
return `#${randColor.toUpperCase()}`
}
I modify above code into below
generateRandomColor = function () {
var maxVal = 0xFFFFFF;
var randomNumber = Math.random() * maxVal;
randomNumber = Math.floor(randomNumber);
randomNumber = randomNumber.toString(16);
var randColor = randomNumber.padStart(6, 0);
return "#" + randColor.toUpperCase();
}
I am currently refactoring the javascript portions of a web site, and now I have bundled some scripts together using Browserify. The resulting script is bundled along with other resources using SquishIt. In Debug mode, when SquishIt is not bundling all the scripts together everything seems to work just fine, but when running in Production, and SquishIt bundles everything together I get errors from the Browserify part of my bundle. The error is complaining that r has no length property (see line 18) below. This part of the code is created by Browserify when bundling the scripts.
(function e(t, n, r) {
function s(o, u) {
if (!n[o]) {
if (!t[o]) {
var a = typeof require == "function" && require;
if (!u && a) return a(o, !0);
if (i) return i(o, !0);
var f = new Error("Cannot find module '" + o + "'");
throw f.code = "MODULE_NOT_FOUND", f
}
var l = n[o] = {
exports: {}
};
t[o][0].call(l.exports, function(e) {
var n = t[o][1][e];
return s(n ? n : e)
}, l, l.exports, e, t, n, r)
}
return n[o].exports
}
var i = typeof require == "function" && require;
for (var o = 0; o < r.length; o++) s(r[o]);
return s
})({
I really can't think of anything that using SquishIt to bundle all the scripts would break the logic of the browserified scripts. What could be the cause of this? This gist shows the entire source code, in case that is relevant.
I have not changed anything on the ASP.NET side (in the bundling), and the relevant part of my ´Head.ascx´ looks like this:
Bundle.JavaScript()
.Add(Assets.JavaScript.GetUrl("main.js").ToString())
.Add(Assets.JavaScript.GetUrl("Plugins/raphael-min.js").ToString())
.Add(Assets.JavaScript.GetUrl("Plugins/vector_map.js").ToString())
// more ...
.Render("~/Content/"+Assets.VersionString+"/Scripts/Combined/combined.js")
Have a look at this comment it may help https://github.com/jetheredge/SquishIt/issues/320#issuecomment-139921409
Is there a reason you need to use two different bundling solutions?
I'm looking at an example by substack of using hyperscript, main-loop, and hyperx.
I'd like to recreate this example using hyperscript-helpers to get code similar to Elm. That module says it supports both hyperscript and virtual-hyperscript, so I'm trying virtual-hyperscript.
My code looks like this:
var vdom = require('virtual-dom')
var vh = require('virtual-hyperscript');
var hh = require('hyperscript-helpers')(vh);
var main = require('main-loop')
var div = hh.div;
var span = hh.span;
var h1 = hh.h1;
var loop = main({ times: 0 }, render, vdom)
document.querySelector('#content').appendChild(loop.target)
function render(state) {
return h1('title');
}
And it gives me an error:
Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
What's going wrong? I assume something's not wired up correctly because
console.log(loop.target) //null
If it helps, I can post my html and the browserify build command I'm using
virtual-hyperscript is moved to https://github.com/Matt-Esch/virtual-dom/tree/master/virtual-hyperscript
See README at https://github.com/Raynos/virtual-hyperscript
The virtual-dom/h is just a new version of virtual-hyperscript.