-2

When I open cart admin panel, I get an error:

Fatal error: Call to a member function calculate() on a non-object in /home/u371067346/public_html/catalog/controller/module/featured.php on line 38

Code in featured.php where error existed:

if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
    $price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
    $price = false;
}

On my local copy open cart working fine.

6

1 Answer 1

0

This is because in admin side there is no object created for the tax class (also not necessary), But in the catalog, we need to calculate tax so the object of the class Tax created and added to the registry. To know more clearly, have a look at index.php file of both catalog and admin folder. You will find $registry->set('tax', new Tax($registry)); in the index.php file of the front-end but not in the index.php file of the admin panel.

3
  • and how can i fix this?
    – Klaod
    Commented Dec 29, 2015 at 7:32
  • Have a you tried to do like $this->currency->format($option['price'] + ($this->config->get('config_tax') ? $product['tax'] : 0), $order_info['currency_code'], $order_info['currency_value']); Commented Dec 29, 2015 at 8:38
  • It is not the solution. I mean to say try like this one. Add tax by checking if config_tax is enabled. This is just an example and as a reference. Take any idea from it. Commented Dec 30, 2015 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.