Totally Zenned
- Join Date:
- Jan 2007
- Location:
- Los Angeles, California, United States
- Posts:
- 10,011
- Plugin Contributions:
- 3
Post #1 by divavocals
Following this post: **"Successfully added to cart" message stack - change position**, I too wanted to display the message stack in a different place on the product info page. Like the OP in that thread I too am looking at implementing changes suggested by Eric Leuenberger. (Simple Google Analytics author)
The old thread may not be clear for everyone stumbling upon it.. Plus the changes suggested are based on Zen Cart v1.3.x code.. So wanted to share what I did to update this to use with Zen Cart v1.5.1..
First go to Configuration > My Store > Display Cart After Adding Product, change the value to "False".
Then find the following in includes/templates/yourtemplate/common/tpl_header.php
<?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']), ENT_COMPAT, CHARSET, TRUE);
}
if (isset($_GET['info_message']) && zen_not_null($_GET['info_message'])) {
echo htmlspecialchars($_GET['info_message'], ENT_COMPAT, CHARSET, TRUE);
} else {
}
?>
Replace with:
<?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']), ENT_COMPAT, CHARSET, TRUE);
}
if (isset($_GET['info_message']) && zen_not_null($_GET['info_message'])) {
echo htmlspecialchars($_GET['info_message'], ENT_COMPAT, CHARSET, TRUE);
} else {
}
}
?>
Then in includes/templates/yourtemplates/templates/tpl_product_info_display.php delete this:
<?php if ($messageStack->size('product_info') > 0) echo $messageStack->output('product_info'); ?>
Then in the same file (includes/templates/yourtemplates/templates/tpl_product_info_display.php), I added this code where I wanted the message alert to appear on the product info page
<?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']), ENT_COMPAT, CHARSET, TRUE);
}
if (isset($_GET['info_message']) && zen_not_null($_GET['info_message'])) {
echo htmlspecialchars($_GET['info_message'], ENT_COMPAT, CHARSET, TRUE);
} else {
}
?>
It appears to work just fine.. Hoping to get input from others if they see anything that isn't kosher here..
My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.