I have a problem with Option tab on Add/Edit product. The problem is that when I installed the extension Autocomplete No More and when I choose Option it throws this error
Fatal error: Uncaught Error: Call to a member function getOptionData() on null in /../ocartdata/storage/modification/admin/controller/catalog/option.php:437
in option.php line 437 is
$option_data = $this->model_extension_catalog_autocomplete_no_more->getOptionData($this->request->post['option_id']);
And full function is this one
public function getOptionData() {
if (isset($this->request->post['option_id'])) {
$this->load->language('catalog/option');
$this->load->model('catalog/autocomplete_no_more');
$this->load->model('tool/image');
$option_data = $this->model_extension_catalog_autocomplete_no_more->getOptionData($this->request->post['option_id']);
$this->response->setOutput(json_encode($option_data));
}
}
Is anyone has an idea why this throws null?
Issue:
You are trying to call a method of an Object
$this->model_extension_catalog_autocomplete_no_more
with the extension in the object name.
but then you are loading the model without the extension in the path:
$this->load->model('catalog/autocomplete_no_more')
So obviously the Error signals that you have not yet defined this object
Call to a member function getOptionData() on null
Solution:
Fix it by adding extension to the path:
$this->load->model('extension/catalog/autocomplete_no_more')
or remove if from the object name:
$this->model_catalog_autocomplete_no_more
Related
I just got done setting up karma-jasmine in my solution. On the initial test run, I get an error:
Error during loading: Uncaught TypeError: $(...).tooltip is not a
function in src.js
tooltip being a function from bootstrap.js. This library is being pulled into my .asp file along with my src.js file being tested. Is there a way to let karma-jasmine know that this function does indeed exist?
I have the following pdfMake code block in my ionic app:
pdfMake.createPdf(docDefinition).getBase64(function (encodedString) {
pdfEncoded = encodedString;
console.log(pdfEncoded);
this.sendValue(pdfEncoded);
}
The error I am getting is:
Cannot read property 'sendValue' of undefined.
What do I need to do to call the sendValue() function? I am able to console.log the value of pdfEncoded but unable to pass the value to a function. Can someone let me know what I am doing wrong.
Thank you,
A
One reason of the error maybe because the keyword 'this' might be undefined inside your function(block). Check for that and see if the error is because of that and if it is try this :
let $this = this
And then inside your function use it as:
$this.sendValue(pdfEncoded);
I want to set up the Linea Pro to charge the phone if the phone's battery gets low and I'm having a tough time mainly because all the examples are shown in objective-C still and not in Swift.
The manual says:
#param enabled TRUE to enable charging, FALSE to disable/stop it
#param error pointer to NSError object, where error information is stored in case function fails. You can pass nil if you don't want that information
#return TRUE if function succeeded, FALSE otherwise
*/
and the code provided is the following:
-(BOOL)setCharging:(BOOL)enabled error:(NSError **)error;
So in Swift I first tried this:
self.scanner.setCharging = true
but that gives me the following error:
Cannot assign to property: 'setCharging' is a method
So I tried this:
self.scanner.setCharging(true)
which gives me this error:
Call can throw, but it is not marked with 'try' and the error is not handled
Interesting because apparently I have to build it in a function called "setCharging" I think, but I have no idea what and how it wants me to set up the try and catch to, and quite frankly where am I opposed to get this information from?
I think it should be along these lines or something, but I'm not clear on the specifics :
func setCharging(_ enabled: Bool) throws -> Bool {
do {
try
//something goes here I'm not sure what
} catch {
//and then maybe something here on that to do with error
print("some error")
}
}
The answer was provided to me by the manufacturer. It is unnecessary to create a function with the same name as the API, APIs can be called anywhere in the code with the exception of handling error. So in this case I just have this directly in my code not in a function and it just works. (Since I have my scanner.connect code inside a viewWillAppear block, the code to start charging was too early to be called in there, so I placed it inside of a viewDidAppear block).
The following is the code:
do{
try self.scanner.setCharging(true)
}catch let error as NSError{
NSLog("Operation \(error as Error)")
}
for the automated generation of pdfs from the page content I want to use the renderWith function within onAfterWrite in the Page Class (later with DOMPDF the PDF will be generated from the returned HTML):
public function onAfterWrite() {
parent::onAfterWrite();
$this->renderPdf();
}
public function renderPdf() {
return $this->renderWith(array('Pdf'));
}
There is always this Error returned when saving the Page: None of these templates can be found in theme 'mytheme': Pdf.ss
The Template exists for sure and calling the Function renderPdf via a Template works perfectly. This is a bit weird. (ss 3.1.1)
many thanks,
florian
EDIT: maybe it is related to 3.1, I just tested in 3.0.5. without any issues. In a clean 3.1.2 install I was able to reproduce the error.
Where is your template located exactly?
Have you tried to put it under the 'templates' folder, and not under 'Layout' or 'Includes'?
In your case, I would try to move that file here:
/themes/mytheme/templates/Pdf.ss
As you are calling for a standalone template (so not alongside 'Page' for example), the .ss file should be accessible as a 'root' template, as opposed to a layout template.
I created a Joomla 2.5 custom component and load data to grid on administrator side. All data loaded and adding and editing work well. But deleting is not working. It gives following error.
Fatal error: Call to a member function delete() on a non-object in
C:\wamp\www\Joomla\libraries\joomla\application\component\controlleradmin.php on line 131
In view class I used JToolBarHelper for delete action as follows.
JToolBarHelper::deleteList('', 'regions.delete', 'JTOOLBAR_DELETE');
I had this problem myself, and I've just figured it out. Look into your file corresponding to admin/controllers/helloworlds.php, there should be this line:
public function getModel($name = 'HelloWorld', $prefix = 'HelloWorldModel')
The first param's default value is the name of a single item (in your case, probably Region) and the second one contains the name of the component. So it should be:
public function getModel($name = 'Region', $prefix = 'NameOfYourComponentModel')
I hope this helps also in your case. In the HelloWorld example, they use HelloWorld all over the code, both as the name of the component and the main view, so it's sometimes hard to distinguish which one is what.