Call to a member function get_cart_subtotal() on a non-object in config-woocommerce/config.php on line 790 - plugins

I'm trying to login into my WordPress Admin panel, and am getting the following error:
Call to a member function get_cart_subtotal() on a non-object in /home/spicom/public_html/adwinang.com/wp-content/themes/enfold/config-woocommerce/config.php on line 790
This is my code at line 790:
$cart_subtotal = $woocommerce->cart->get_cart_subtotal();

It sounds like you haven't called global $woocommerce;, before trying to access the $woocommerce object.
A better way would be to use WC():
$cart_subtotal = WC()->cart->get_cart_subtotal();
Alternatively, it's possible the WooCommerce hasn't even been installed and activated...make sure to do that, if it's a theme dependency.

I had a very similar message.
[25-Sep-2018 10:24:08 UTC] PHP Fatal error: Uncaught Error:
Call to a member function get_cart_subtotal() on null in
themes\storefront\inc\woocommerce\storefront-woocommerce-template-functions.php:80
It was due to me having the following in my wp-config.php file.
define( 'DOING_CRON', false );
I'd added this line while attempting to run something from the command line with W3 Total Cache activated. I didn't realise that it would completely ruin WooCommerce and didn't notice the side effect until attempting to view the site in my browser.

Related

Exception - Call to undefined function course_overviewfiles_options()

I am using a Moodle(3.2.2 the newest one) site created by php7.0 and mysql5.7,but when i try to add a new course as administrator, an error called :Exception - Call to undefined function course_overviewfiles_options(). What can i do to fix it?
I did 'Purge all caches' from Development,so the problem above disappeared,but
when users login, another error occurred: Exception - Call to undefined function core_login_get_return_url().
I did 'Purge all caches'again, the problem no.2 disappeared and the no.1 occurred again.
did you include the correct library resource file?
require_once($CFG->libdir. '/coursecatlib.php'); (I think)
HTH

Called to undefined method laravel backpack

I installed the backpack-demo package and was able to register a new user.
Now when I want to add a new permission role or something else that needs to insert a new record into the DB i got the following error message:
"BadMethodCallException in Builder.php line 2450:
Call to undefined method Illuminate\Database\Query\Builder::getCastedAttributes()"
Any idea how to solve?
thx,
m
Sounds like an error that has already been fixed. A composer update should fix it for you.

Meteor error in trying to use collections

I am currently pulling data from collections in the MongoDB but there are 2 in particular that will not work either giving me the following error:
Exception from sub Assets id i574gxNDc9RdHERNn TypeError: Cannot call method 'find' of undefined
Or:
TypeError: Cannot call method 'attachSchema' of undefined
Or:
Object # has no method 'attachSchema'
depending on how I configure it. Does anyone have an idea of what I am doing wrong. I am using the same code for the ones that work as well as the ones that are throwing errors.
The collection looks like this:
Assets = Collections.Assets = Meteor.Assets;
Querying in server/publish.js:
Meteor.publish("Assets", function (){
return Meteor.Assets.find({});
});
Changing it to:
new Mongo.Collection('Assets');
Gives error:
Exception from sub Assets id ZgzZyNYPmMr5gtFGn TypeError: Cannot call method 'find' of undefined
Running the following from the command line in the top (root) directory of the project might fix this (it helped me):
meteor add aldeed:collection2

sails.js : using dust in sails 0.10.5

I am trying to migrate a project from 0.9.9 to 0.10.5
We were using dust templating engine in our porject instead of the default ejs engine.
Contents of config/views.js file
module.exports.views = {
engine: 'dust',
layout: 'layout'
};
In my controller, I was able to render this view like this
res.view('layout', obj);
However, in sails 0.10.5, when I lift sails, first of all I get this warning
warn: Sails' built-in layout support only works with the `ejs` view engine.
warn: You're using `dust`.
warn: Ignoring `sails.config.views.layout`...
And then when I try to render the view as I was doing earlier, I get following error:
error: Sending 500 ("Server Error") response:
Error: ENOENT, open '/.dust'
{ [Error: ENOENT, open '/.dust'] errno: 34, code: 'ENOENT', path: '/.dust' }
Any idea what is the correct way of doing this in 0.10.5 ?
The layout property does not apply to dust (just ejs). Set layout to false to get the warning to go away. You want to use Dust's built-in support for partials and blocks anyways.
Using res.view('layout', obj); means that you expect a file called views/layout.dust to exist. Prior to 0.10, sails was including the layout property from config/views.js as part of the path.
So my best guess is that your res.view() call is actually being invoked with an empty string as the first parameter, and it wasn't breaking because you were trying to render something called layout. I'd check your invocation to make sure that you're calling res.view() with an instantiated variable.

Trouble with upload component - Cakephp 2.0

I was trying to incorporate file upload to my project but whenever I access the a function in the controller it gives me these warnings:
Warning (2): call_user_func_array(): First argument is expected to be a valid callback, 'UploadComponent::initialize' was given [CORE/Cake/Utility/ObjectCollection.php, line 110]
Warning (2): call_user_func_array() [http://php.net/function.call-user-func-array]: First argument is expected to be a valid callback, 'UploadComponent::beforeRender' was given [CORE/Cake/Utility/ObjectCollection.php, line 110]
Warning (2): call_user_func_array() [http://php.net/function.call-user-func-array]: First argument is expected to be a valid callback, 'UploadComponent::shutdown' was given [CORE/Cake/Utility/ObjectCollection.php, line 110]
The upload component that I added works fine for my cake 1.3 version.
please help
Solved it, by modifying the Component.
In cake php 2.0 all components must extend Component; failing to do this will trigger an exception.
For example:
class UploadComponent extends Component {
}