Code: Select all
<?php
//$total = 120;
$sum = (100-$total);
if ($total >= 100) {
echo "Your are eligable for FREE SHIPPING"; }
else {
echo "To be eligable for free shipping you need to buy for ".$sum." more";
}
?>
Code: Select all
<?php
//$total = 120;
$sum = (100-$total);
if ($total >= 100) {
echo "Your are eligable for FREE SHIPPING"; }
else {
echo "To be eligable for free shipping you need to buy for ".$sum." more";
}
?>
Code: Select all
$this->cart->getTotal();
//or
$this->cart->getSubTotal();
These show me the following errors:DigitCart wrote: ↑Sat Nov 11, 2017 12:42 pmHi,
try this:Code: Select all
$this->cart->getTotal(); //or $this->cart->getSubTotal();
Code: Select all
$data['cart_total'] = $this->cart->getTotal();
Code: Select all
<?php echo $cart_total; ?>
It works Thank you once again.DigitCart wrote: ↑Sat Nov 11, 2017 4:16 pmYes,
You must use them in controller.
controller:view:Code: Select all
$data['cart_total'] = $this->cart->getTotal();
Code: Select all
<?php echo $cart_total; ?>
Regards,
Nightwing
Access to my Free Extensions: https://www.opencart.com/index.php?rout ... =nightwing
Code: Select all
$order_total = $this->cart->getTotal();
Code: Select all
<?php
$total = $this->cart->getTotal();
if ($total > 100) {
echo "Your are eligable for FREE SHIPPING";
}
else {
echo "To be eligable for free shipping you need to buy for ".$sum." more";
}
?>
For further assistance with Opencart Development you can reach me at
asktofaizan@gmail.com | https://asktofaizan.com |
Whoever may find this page, the above advice is completely wrong!
Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.
I guess you are new to oc or may be more as student, obviously above code should me inside of the controller was just giving them idea how it will workOSWorX wrote: ↑Sun May 16, 2021 3:58 pmWhoever may find this page, the above advice is completely wrong!
Whenever you have to define or set variables, do it inside the controller, assign a variable and use that later in the view!
That's simply what and why it is called MVC > Model View Controller.
Never mix php code with html in your templates - is an old (and outdated) technique used in the bginning of the 20th century.
For further assistance with Opencart Development you can reach me at
asktofaizan@gmail.com | https://asktofaizan.com |
It seems you are a funny guy.faizanyasn wrote: ↑Sun May 23, 2021 11:05 pmI guess you are new to oc or may be more as student, obviously above code should me inside of the controller was just giving them idea how it will workOSWorX wrote: ↑Sun May 16, 2021 3:58 pmWhoever may find this page, the above advice is completely wrong!
Whenever you have to define or set variables, do it inside the controller, assign a variable and use that later in the view!
That's simply what and why it is called MVC > Model View Controller.
Never mix php code with html in your templates - is an old (and outdated) technique used in the bginning of the 20th century.
Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.
Users browsing this forum: No registered users and 42 guests