Search results not showing in dashboard - magento

When my customers search in my searchbox (which uses form.mini.phtml), there results won't show up in my dashboard (Magento 1.7).
Here is my code:
<?php
$catalogSearchHelper = $this->helper('catalogsearch');
?>
<div class="search-form">
<form id="search_mini_form" action="<?php echo $this->getUrl('search/result') ?>" method="get">
<input id="search" type="text" name="query" value="" maxlength="<?php echo $catalogSearchHelper->getMaxQueryLength();?>" />
<button><?php echo $this->__('Search') ?></button>
</form>
<script type="text/javascript">
var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo $this->__('Search Products and Pages...') ?>');
</script>
</div>
<i><?php echo $this->__('Advanced Search'); ?></i>
The results won't show up in my Dashboard, and in the search terms menu under 'Catalog'.
Where should this save action take place?
If i manually add a search term under Catalog -> Search terms, it does show up at 'Latest 5 search terms'.

Check if the setting for popular search terms is enabled under
/admin/system_config/edit/section/catalog -> Search Engine Optimizations
and flush your cache.

Related

Magento 1.7.0.2 Checkout shipping

I have a small problem with jquery that I want to use in my magento one page checkout.
I currently use flat rate for international delivery that is set to 0 because I have a variable costs of shipping.
For this reason I have a jquery email enquiry that sends all contents of the shopping cart in e-mail.
Now what I want to do is: when the customer arrives and selects flat rate delivery option I want to disable the Continue button and enable Email Enquiry button, but that does not work in my checkout. It does in jsfiddle. I think this is due to the fact that shipping methods are in available.phtml and buttons are in different file - shipping_methods.phtml. Any help will be appreciated
Here's my code:
<script type="text/javascript">
//<![CDATA[
var shippingMethod = new ShippingMethod('co-shipping-method-form', "<?php echo $this- >getUrl('checkout/onepage/saveShippingMethod') ?>");
//]]>
</script>
<div id="onepage-checkout-shipping-method-additional-load">
<?php echo $this->getChildHtml('additional') ?>
</div>
<div class="buttons-set" id="shipping-method-buttons-container">
<p class="back-link"><small>« </small><?php echo $this->__('Back') ?></p>
<button id="the_other_button" type="button" title="Email Enquiry" class="button" onclick="javascript:readEmailInfo();"><span><span style="padding: 0 13px;">Email Enquiry</span></span></button>
<button id="the_button" type="button" class="button" onclick="shippingMethod.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
<span id="shipping-method-please-wait" class="please-wait" style="display:none;">
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo
$this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>"
class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
</span>
</div>
</form>
<script>
if ($("#s_method_flatrate_flatrate:checked")){
$('#the_button').hide();
$('#the_other_button').show();
}
</script>
Try this:
<script>
jQuery.noConflict();
if (jQuery("#s_method_flatrate_flatrate").is(":checked")){
jQuery('#the_button').hide();
jQuery('#the_other_button').show();
}
</script>
$ is also used by Magento's default prototype.js, which will conflict with jQuery's $.
You can do that by this:
<script>
$j = jQuery.noConflict();
if ($j("#s_method_flatrate_flatrate").is(":checked"))
{
$j('#the_button').hide();
$j('#the_other_button').show();
}
</script>
By using this you can resolve jQuery Conflict.

Two Search bars on one page in magento

I am working on one website where I want to integrate Magento default search two times on a page. I have two search fields and want to search from two stores. Is that possible ?
I can do that for one store and default Magento also support one store at a time. If someone suggest some hints or guidelines it will be appreciated.
you try the blog file using below code...
<?php
echo $this->getLayout()->createBlock('core/template')->setTemplate('catalogsearch/form.mini.phtml')->toHtml() ?>
?>
You could attempt to change the store view using a querystring parameter in the search action. Replace YOUR_STORE below with the store view code you're wanting to search. This will take you to the search results of the other store.
<form id="search_mini_form" action="/index.php/catalogsearch/result/?___store=YOUR_STORE" method="get">
<div class="form-search">
<label for="search">Search:</label>
<input id="search" type="text" name="q" value="" class="input-text" maxlength="128" autocomplete="off">
<button type="submit" title="Search" class="button"><span><span>Search</span></span></button>
<div id="search_autocomplete" class="search-autocomplete" style="display: none;"></div>
<script type="text/javascript">
//<![CDATA[
var searchForm = new Varien.searchForm('search_mini_form', 'search', 'Search entire store here...');
searchForm.initAutocomplete('/index.php/catalogsearch/ajax/suggest/', 'search_autocomplete');
//]]>
</script>
</div>
</form>
If you wanted to integrate both sets of search results into one search results page then that would require some additional coding.

How to create an unsubscribe page in magento

I would like to create a direct unsubscribe page in magento, I found this instruction to follow but the steps 1 and 2 are not clear As I'm not a professional.
Can someone please help me clarify these two steps. Where to create the "unsubscribe.phtml" page? How to add the just created block in it?
Thank you in advance.
1. Create a phtml page say “unsubscribe.phtml” containing the code to create the unsubscribe form.
<?php $newsletterObj = new Mage_Newsletter_Block_Subscribe(); ?>
<div class="newsletter-unsubscribe">
<div class="newsletter-unsubscribe-title"><?php echo $this->__('Submit your email id to unsubscribe newsletter') ?></div>
<form action="<?php echo $newsletterObj->getUnsubscribeFormActionUrl() ?>” method="post" id="newsletter-validate-detail">
<div class="block-content">
<div class="input-box">
<input type="text" name="email" id="newsletter" title="<?php echo $this->__('Sign up for our newsletter') ?>” class="input-text required-entry validate-email” value="<?php echo $this->__('Enter Your Email Here') ?>” onfocus="if(this.value==’<?php echo $this->__('Enter Your Email Here') ?>’)this.value=’’;” onblur="if(this.value==’’)this.value=’<?php echo $this->__('Enter Your Email Here') ?>’;”
/>
</div>
<div class="actions">
<button type="submit" title="<?php echo $this->__('Submit') ?>” class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
</div>
</div>
</form>
<script type="text/javascript\">
//<![CDATA[
var newsletterSubscriberFormDetail = new VarienForm(’newsletter-validate-detail’);
//]]>
</script>
</div>
2) Create a CMS page. Add the just created block in it. So that your CMS page will contain that form.
3) Now in page \app\design\frontend\base\default\template\newsletter\subscribe.phtml add the code to add a link of the cms page.
<div class="unsubscribe">
<?php echo $this->__('Unsubscribe') ?>
</div>
4) In page \app\code\core\Mage\Newsletter\Block\Subscribe.php add a function to create the form action url which is called in the “unsubscribe.phtml”.
public function getUnsubscribeFormActionUrl()
{
return $this->getUrl(’newsletter/subscriber/unsubscribecus’, array(’_secure’ => true));
}
5) Now in \app\code\core\Mage\Newsletter\controllers\SubscriberController.php page add new action for unsubscribe process.
/**
* Unsubscribe newsletter from frontend
*/
public function unsubscribecusAction()
{
$email = $this->getRequest()->getParam(’email’);
$subsModel = Mage::getModel(’newsletter/subscriber’);
$subscriber = $subsModel->loadByEmail($email);
$id = (int) $subsModel->getId();
$code = (string) $subsModel->getCode();
if ($id && $code) {
$session = Mage::getSingleton(’core/session’);
try {
Mage::getModel(’newsletter/subscriber’)->load($id)
->setCheckCode($code)
->unsubscribe();
$session->addSuccess($this->__(’You have been unsubscribed.’));
}
catch (Mage_Core_Exception $e) {
$session->addException($e, $e->getMessage());
}
catch (Exception $e) {
$session->addException($e, $this->__(’There was a problem with the un-subscription.’));
}
}
$this->_redirectReferer();
}
Since a can't leave a comment and this question isn't marked as solved yet, i'll assume you still need an answer.
I would suggest placing the unsubscribe.phtml file in /template/newsletter/
For step 2 you can use this code
{{block type="core/template" template="newsletter/unsubscribe.phtml"}}
so the page will contain your form.
If you already figured out how to do this, please post an answer to your own question further on.
Would it be an idea to add an unsubscribe button next to the subscribe button (or allow for a variable in the block call that sets it to yes/no display) - this way you capture both

phpBB sessions do not carry from page to page

I have a website (located in the root directory) with a forum located in ./forum/
I have successfully integrated phpBB's sessions into the index of my website using the following codes:
In my index page before <html>:
<?php include_once("include/phpbb.php");
// check for logout request
$cp = $_GET['cp'];
// is it a logout? then kill the session!
if ($cp == "logout") {
$user->session_kill();
$user->session_begin();
echo "Successfully Logged Out.";
}
?>
phpbb.php:
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
?>
Displaying the information - this is in header.php which is included in my index:
<?php
// Page login notice
if ($user->data['user_id'] == ANONYMOUS)
{
?>
<img src="forum/images/avatars/gallery/noavatar.png" style="float:left; width:72px; height:72px;">
<div class="login">
<form method="POST" action="forum/ucp.php?mode=login">
<ul><li><span>Username:</span> <input class="loginfield" type="text" name="username" size="20"></li>
<li><span>Password:</span> <input class="loginfield" type="password" name="password" size="20"></li>
<li>Remember Me? <input type="checkbox" name="autologin"> Register</li>
<li><input type="submit" value="Login" name="login"></li>
</ul>
<input type="hidden" name="redirect" value="../index2.php">
</form>
</div>
<?php
} else { ?>
<img src="forum/images/avatars/gallery/<?php echo $user->data['user_avatar']; ?>" style="float:left; width:72px; height:72px;">
<div class="login">
Welcome back, <?php echo $user->data['username_clean']; ?><br>
You have <?php echo $user->data['user_unread_privmsg']; ?> new messages<br>
Log Out
</div>
<?php } ?>
I can successfully log in on the index using the form I created, but if I then click to another page (i.e. about.php) I am asked to log in again. This happens for every page. This also happens if I click over to the phpbb forum.
Is there any way to make it so I can log in on any page, and not have the session restart when browsing other pages?
Thank you for any help!
Check the cookie path in your board configuration in the phpBB ACP. phpBB by default tries to create restrictive cookies with the board root specified as the cookie path.
If the cookie path is /forum/, sessions won't persist in /.

How to hide/remove search field in Magento

The store is running in: Magento ver. 1.4.1.1
Because the search is not working, we're wanting to hide the search bar until I have time to look into the problem. I've searched everywhere. I keep seeing people editing catalogsearch.xml but I don't even know where to find that.
To me it looks like the search field is contained in a content block (under or above the left navvy) which also has contact information. But I don't even know where that content block is.
==== EDIT ====
(Since I can't answer my OWN post for another 5 hours, here's the answer below:)
Found it:
Location: app > design > frontend > default > calshrm > template > catalogsearch > form.mini.phtml
Just removed the code and stored the removed section as a .txt file in the same directory.
Code removed:
<form id="search_mini_form" action="<?php echo $this->helper('catalogsearch')->getResultUrl() ?>" method="get">
<div class="dfsboxleft">
<label for="search"><!--?php echo $this->__('Search:') ?--></label>
<button type="submit" title="<?php echo $this->__('Search') ?>" class="dfsbutton">
<span>
<span><!--?php echo $this->__('Search') ?--></span>
</span>
</button>
</div>
<div class="dfsbox">
<input id="search" type="text" name="<?php echo $this->helper('catalogsearch')->getQueryParamName() ?>"
value="<?php echo $this->helper('catalogsearch')->getEscapedQueryText() ?>" class="dfsinput" />
<div id="search_autocomplete" class="search-autocomplete"></div>
<script type="text/javascript">
//<![CDATA[
var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo $this->__('Product Search') ?>');
searchForm.initAutocomplete('<?php echo $this->helper('catalogsearch')->getSuggestUrl() ?>', 'search_autocomplete');
//]]>
</script>
</div>
</form>
I'm assuming form.mini is something different than what is normal, in which case you may have to look for the file mentioned above, which I'm not sure where that one is.
Go to app/design/frontend/[your interface]/[your theme]/template/page/html/header.phtml and remove:
getChildHtml('topSearch') ?>
You can also disable the module in System->Configuration->Advanced->Disable Modules Output :: Mage_CatalogSearch.
You can hide the search with the layout xml. You can use local.xml in
app/design/frontend/yourpackage/default/layout/local.xml
Put this in to hide the search:
<layout>
<default>
<reference name="header">
<remove name="top.search" />
</reference>
</default> </layout>
With the local.xml file you have a central point in your theme to change the layout.
I'm using chrome (right clicking on the serch box, and clicking inspect element) to look at the code. You could hide the input id "search" with a name "q" using jquery. It should be more simple than finding the blocks in xml.
It's not really the best solution, since refreshing the page may show it for a second (depending on the speed of the site), but it should be temporary and you're better off spending the time fixing the search IMO.

Resources