How to show the set amount with currency for free shipping in header? And the set amount change if customer change currencies in Navbar.
I have added the text message and I need to show the set amount with currency in the red rectangle.
Show set amount for free shipping in Header
Show set amount for free shipping in Header
You do not have the required permissions to view the files attached to this post.
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Show set amount for free shipping in Header
Code: Select all
MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVERRe: Show set amount for free shipping in Header
@ecartz Now the amount for free shipping is showing but without currency. I would like to show with currency and convert the amount to whatever currency is selected.
The code that I used as below:
Main File: /includes/modules/content/header/cm_header_mond_ups.php
Template File: /includes/modules/content/header/templates/tpl_cm_header_mond_ups.php
Languages File: /includes/languages/english/modules/content/header/cm_header_mond_ups.php
The code that I used as below:
Main File: /includes/modules/content/header/cm_header_mond_ups.php
Code: Select all
class cm_header_mond_ups extends abstract_executable_module {
const CONFIG_KEY_BASE = 'MODULE_CONTENT_HEADER_MOND_UPS_';
public function __construct() {
parent::__construct(__FILE__);
}
public function execute() {
$tpl_data = [ 'group' => $this->group, 'file' => __FILE__ ];
include 'includes/modules/content/cm_template.php';
}
protected function get_parameters() {
return [
'MODULE_CONTENT_HEADER_MOND_UPS_STATUS' => [
'title' => 'Enable Header UPS Free Shipping Banner Module',
'value' => 'True',
'desc' => 'Do you want to enable the UPS Free Shipping Banner content module?',
'set_func' => "Config::select_one(['True', 'False'], ",
],
'MODULE_CONTENT_HEADER_MOND_UPS_CONTENT_WIDTH' => [
'title' => 'Content Width',
'value' => '4',
'desc' => 'What width container should the content be shown in?',
'set_func' => "Config::select_one(['12', '11', '10', '9', '8', '7', '6', '5', '4', '3', '2', '1'], ",
],
'MODULE_CONTENT_HEADER_MOND_UPS_FREE_SHIPPING_OVER' => [
'title' => 'Free Shipping For Orders Over',
'value' => '50',
'desc' => 'Provide free shipping for orders over the set amount.',
'use_func' => 'currencies->format',
],
'MODULE_CONTENT_HEADER_MOND_UPS_SORT_ORDER' => [
'title' => 'Sort Order',
'value' => '20',
'desc' => 'Sort order of display. Lowest is displayed first.',
],
];
}
}Code: Select all
<div class="col-md-12 col-lg-6 col-xl-<?= (int)MODULE_CONTENT_HEADER_MOND_UPS_CONTENT_WIDTH ?> cm-header-ups" style="margin-bottom:8px; text-align:center;">
<text style="display:inline-block; vertical-align:middle; text-align:center"><?=MODULE_CONTENT_HEADER_MOND_UPS_TEXT?>
<?=MODULE_CONTENT_HEADER_MOND_UPS_FREE_SHIPPING_OVER?></text>
</div>Code: Select all
define('MODULE_CONTENT_HEADER_MOND_UPS_TITLE', 'Mond UPS Free Shipping Banner');
define('MODULE_CONTENT_HEADER_MOND_UPS_DESCRIPTION', 'Adds UPS Free Shipping Banner into the Header Area of your site.');
define('MODULE_CONTENT_HEADER_MOND_UPS_TEXT', '<b>FREE SHIPPING! </b><br>UPS Express on orders over');-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Show set amount for free shipping in Header
Code: Select all
const MODULE_CONTENT_HEADER_MOND_UPS_TEXT = '<b>FREE SHIPPING! </b><br>UPS Express on orders over %s';Code: Select all
<text style="display:inline-block; vertical-align:middle; text-align:center"><?=
sprintf(MODULE_CONTENT_HEADER_MOND_UPS_TEXT, Guarantor::ensure_global('currencies')->format(MODULE_CONTENT_HEADER_MOND_UPS_FREE_SHIPPING_OVER))
?></text>