I need to call in checkout/confirm.tpl file a custom function that i've made in controller/product.php
what's the best way to make this?
i've tried this, but doesn't work:
$productController = $this->load->model('product/product');
$productController->customFunction();
yes i find the right answer finally!!! sorry for last bad answer
class ControllerCommonHome extends Controller {
public function index() {
return $this->load->controller('product/ready');
}
}
$productController = $this->load->model('product/product');
controller()
in class Loader
- which is not (luckily)So let's say your controller is CatalogProductController
and the method you want to invoke is custom()
- in this case accessing this URL
http://yourstore.com/index.php?route=catalog/product/custom
you will make sure that the custom()
method of CatalogProductController
is invoked/accessed.
You can access such URL in many ways - as a cURL request, as a link's href or via AJAX request, to name some. In a PHP scope even file_get_contents()
or similar approach will work.
(*) By shouldn't I mean that it is (unfortunately) possible in OpenCart but such abuse is against MVC architecture.
$this->load->controller('sale/box',$yourData);
To call ShipmentDate()
function of box Controller
$this->load->controller('sale/box/ShipmentDate',$yourData);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With