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! :)
Sweet! Nice post. I now understand better how to move things around.![]()
Thank you, Sincerely, MagicMan
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.
To some degree, yes. But what you're all trying to do is mimic ajax-like behavior, and many do that very badly. The biggest problem I see with people doing that is they bypass the shopping-cart page but never provide a *clear* easy-to-find link to see the actual cart contents and/or begin checkout. Huge mistake IMO.
Nevertheless, if you're trying to deal specifically with positioning the "product added" alert, it would be a whole lot easier to set it to use its own messageStack class in the shopping-cart class and then echo only that particular messageStack class in the middle of your product 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.
I can't speak for anyone else, but the reason I want this change is that my site is set to stay on the product info page after adding an item to the cart, and the green "added successfully" notice in the header is not really obvious, so it sometimes seems that nothing has happened when you add the item. By placing the notification within the product description, near the "add to cart button" they've just clicked, there's no confusion about what has just happened.
Bookmarks