📢 Meta Panel Script
File: linuxfront-v2-logistics/inc/panels/meta.php
This panel injects a small JavaScript snippet into every page to handle the Canadian Customer Quote popup. It listens for clicks on Canadian “Quote & Ship” links and spawns a modal dialog with an embedded iframe for users to choose between a Domestic Canadian or Cross-Border shipment.
Overview
This script enhances the user experience for Canadian-based customers by presenting a modal dialog when they initiate a quote. Rather than navigating directly to the quote wizard, Canadian users first choose whether they want a domestic or cross-border shipment.
⚙️ Dependencies
- jQuery (≥ 1.8) for DOM manipulation and event handling
- jQuery UI for the
dialogwidget - An HTML container
<div id="canadian_popup">present in the footer panel
🔍 Key Elements
| Selector | Role |
|---|---|
#canadian_popup |
Hidden <div> that becomes the modal dialog |
.startquoteclass |
Links that trigger the Canadian quote popup |
iframe#modalIframeId |
Dynamically injected container for external page |
🚀 Functionality
- Hide the Popup Container
On document ready, the#canadian_popupelement is hidden to keep it out of view until needed. - Delegate Clicks to
.startquoteclass
Uses jQuery’slive('click', …)(deprecated in newer jQuery) to catch clicks on any link with.startquoteclass. - Configure the Dialog
- Reads the
relattribute (e.g."ltl") from the clicked link to determine the shipment type - Sets the dialog’s title to
"Domestic Canadian / Cross Boarder, US/CN " - Temporarily displays
"loading."text, then injects an<iframe>filling the dialog area - Points the iframe’s
srctocanadian_customer_popup.php?type=+ the shipment type - Opens a modal, resizable dialog sized 525×350 pixels
- Reads the
<script type="text/javascript"><!--
$(document).ready(function() {
$("#canadian_popup").hide();
$(".startquoteclass").live('click', function() {
var type = $(this).attr("rel");
$("#canadian_popup")
.attr("title", "Domestic Canadian / Cross Boarder, US/CN ")
.html("loading.")
.html('<iframe id="modalIframeId" width="100%" height="100%" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto"></iframe>');
$("#modalIframeId").attr("src", "<?=SITE_PATH?>canadian_customer_popup.php?type=" + type);
$("#canadian_popup").dialog({
modal: true,
height: 350,
width: 525,
resizable: true
});
});
});
--></script>
🔗 Related Files
| File | Purpose |
|---|---|
inc/panels/footer.php |
Declares <div id="canadian_popup"> container for the dialog |
inc/panels/top_nav.php |
Renders the “Quote & Ship” link with class="startquoteclass" for Canadian customers |
canadian_customer_popup.php |
Loaded in the iframe; presents radio options and “Proceed” button |
canadian_customer_popup_meta.php |
Styles & logic for the popup content (radio selection & redirect) |
canadian_customer_popup_top.php |
Secures the popup page and reads the type query parameter |
🛠️ Dialog Flowchart
flowchart LR
A[User clicks .startquoteclass] --> B[Capture click event]
B --> C[Read rel attribute as `type`]
C --> D[Hide & prepare #canadian_popup]
D --> E[Inject iframe into popup]
E --> F[Set iframe src = "…/canadian_customer_popup.php?type="+type]
F --> G[Open jQuery UI Dialog (#canadian_popup)]
✨ Summary
- Purpose: Guide Canadian customers through a two-step quoting process.
- Behavior: Intercepts link clicks, loads an embedded selection UI, and opens a modal dialog.
- Extensibility: Can be adapted for other country-specific flows by replicating this pattern.
By centralizing this logic in the Meta Panel, the application cleanly separates presentation (HTML in the footer) from interactive behavior (this script), ensuring maintainability and a consistent user experience.