Any idea how to place 'success message stack' from the header to underneath product price in product info page just like the attached image shown below?
Any idea how to place 'success message stack' from the header to underneath product price in product info page just like the attached image shown below?
I'd like to do this too, anyone know how? I believe the main area is in tpl_header.php
And then there is this in tpl_product_info_display.phpCode:<?php // Display all header alerts via messageStack: if ($messageStack->size('header') > 0) { echo $messageStack->output('header'); } if (isset($_GET['error_message']) && zen_not_null($_GET['error_message'])) { echo htmlspecialchars(urldecode($_GET['error_message'])); } if (isset($_GET['info_message']) && zen_not_null($_GET['info_message'])) { echo htmlspecialchars($_GET['info_message']); } else { } ?>
So if I put the top code from the header into the info page where I want it, the message will display there, but how do I stop it from also displaying at the top of the page?Code:<?php if ($messageStack->size('product_info') > 0) echo $messageStack->output('product_info'); ?>
Can anyone help? lol thanx ;)
HunnyBee Design - ZC 1.3.9h ~ Digiscrap Forum
"A man's manners are a mirror in which he shows his portrait." ~ Johann Wolfgang von Goethe
would be interested too.![]()
Live and learn... the Zen way.
Ok, here what I did.
Find: includes/templates/*yourtemplate*/common/tpl_header.php
Cut out this code:
Then open: includes/templates/*yourtemplates*/templates/tpl_product_info_display.phpPHP Code:<?php
// Display all header alerts via messageStack:
if ($messageStack->size('header') > 0) {
echo $messageStack->output('header');
}
if (isset($_GET['error_message']) && zen_not_null($_GET['error_message'])) {
echo htmlspecialchars(urldecode($_GET['error_message']));
}
if (isset($_GET['info_message']) && zen_not_null($_GET['info_message'])) {
echo htmlspecialchars($_GET['info_message']);
} else {
}
?>
Paste the above code to anywhere, for example after
<!--eof Reviews button and count -->
Edit CSS to your likely,
.messageStackSuccess {
background-color:red;
color:#000;
}
Then try to add your product to the cart and see how it goes.![]()
Thanks for sharing, Miles! I've been searching for a nifty ajax-like mod or suchbut just couldn't find one. This will work for me! Thanks! :)
Keep in mind that MOVING that from the header file into the product-info file specifically will prevent ALL other pages EVERYWHERE on your site from ever seeing any alert messages intended to be shown. And, COPYING instead it will cause duplicates on your product-info page.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donations always welcome: www.zen-cart.com/donate
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Is it possible to put an if statement into the header -
if this is the product info page then don't display
- so that we can have a custom placement of the "product added" alert, and other alerts won't be affected?
I'm just thinking out loud - will try experimenting with this in the next couple of days.
How do we display this and or turn it off. where is the button in the admin again?
Thank you, Sincerely, MagicMan
I added an if statement to the includes/templates/YOUR_TEMPLATE/common/tpl_header.php file as so:
<!--bof Add to Cart Alert-->
<?php
if ($current_page_base == 'product_info'){
//do nothing
} else {
// Display all header alerts via messageStack:
if ($messageStack->size('header') > 0) {
echo $messageStack->output('header');
}
if (isset($_GET['error_message']) && zen_not_null($_GET['error_message'])) {
echo htmlspecialchars(urldecode($_GET['error_message']));
}
if (isset($_GET['info_message']) && zen_not_null($_GET['info_message'])) {
echo htmlspecialchars($_GET['info_message']);
} else {
}
}
?>
<!--eof Add to Cart Alert-->
This prevents the header alert from showing up on the product_info pages, but allows other alerts to show correctly. This is important if your product listing pages have an "add to cart" button that doesn't redirect them to the product page - the "add to cart" alert will show up properly.
I also moved the alert to the bottom of the header - just before the final </div>. This brings the alert closer to the eye level and more obvious.
Did you still move the alert to your product info page and added that if statement or just added that if statement?
Bookmarks