How to hide/remove search field in Magento - 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.

Related

How to update an image in the get_template_directory_uri()?

I need to update the header image on the front page of our website. I found the code in the Theme Editor for the header.php. The current image link is there but I can't find the template directory to add the new image to be able to swap them out. How would I go about finding the template directory to add in / update the image?
Old Photo: /images/woolpower-home-bg.jpg
New Photo: https://woolpowerus.com/wp-content/uploads/2021/09/Header-Kollag-2021.jpg
<?php if (is_front_page()): ?>
<header class="home-banner jarallax">
<img class="jarallax-img" src="<?php echo get_template_directory_uri(); ?>/images/woolpower-home-bg.jpg" alt="woolpower" title="woolpower">
<div class="control-content">
<div class="container">
<div class="box-content">
<h1>Why Woolpower?</h1>
<p> Because we manufacture underwear and reinforcement garments all the way from yarn to finished product in Ă–stersund, Sweden. We are a company that takes responsibility for people, animals and nature. The clothes are sewn to last and adapted to extreme weather conditions. But at the same time, they should keep you warm in your everyday life. </p>
</div>
</div>
</div>
</header>
Could I use -
<img src="<?php echo get_template_directory_uri(); ?
>/uploads/2012/09/Header-Kollag-2021.jpg" />
It looks like get_template_directory_uri is returning https://woolpowerus.com/wp-content/themes/targetmarket so src="<?php echo get_template_directory_uri(); ?>/uploads/2012/09/Header-Kollag-2021.jpg" would point to the wrong location.
You could re-upload the image under the theme's folder or use src="https://woolpowerus.com/wp-content/uploads/2021/09/Header-Kollag-2021.jpg"

Magento error TypeError: element is null in prototype.js after upgrade

I'm having trouble with a Magento error and I've tried fixing it for hours now, but somehow I just can't figure it out.
My clients shop was running on Magento 1.4.1.1 and he wanted me to upgrade it to the most recent 1.9.2.2 (Community Edition). All worked out pretty well and the template looks as it should, but the checkout process just won't work and I really don't know why.
Everytime I put something in the cart and go to checkout, it brings me to the page where I can select to register or login or continue as guest. I choose continue as guest and click "next", but absolutely nothing happens.
The Firefox console is showing me the following error:
TypeError: element is null in prototype.js:1931
I've checked the .js file and can see at which point it uses an empty element, which is this:
hide: function(element) {
element = $(element);
element.style.display = 'none';
return element;
So basically it tries to hide an object, which is null. The trouble is: I have no idea which file or causes the error and how to debug it. I've read multiple posts and I could only find one fitting post, which said there might be a closing tag missing for a head section somewhere. But there's just tons of files and I don't know where to look.
If anyone had a similar problem or knows where the issue might be, please share to help me resolve this.
Thanks for the help!
EDIT:
I've used firebug and was able to see what creates the error.
Seems that there is a problem in my opcheckout.js. But that's a magento file which was not altered in any way and is in the skin/base/ folder.
The only thing I can think of is that they changed something there from v. 1.4.1.1 to 1.9.2.2 and I don't see it.
Here's the code from the opcheckout.js:
setMethod: function(){
if ($('login:guest') && $('login:guest').checked) {
this.method = 'guest';
var request = new Ajax.Request(
this.saveMethodUrl,
{method: 'post', onFailure: this.ajaxFailure.bind(this), parameters: {method:'guest'}}
);
Element.hide('register-customer-password');
this.gotoSection('billing', true);
}
The error is created by "Element.hide('register-customer-password');".
Here's the code from my theme's billing.phtml where the div is located:
<li class="fields" id="register-customer-password">
<div class="field">
<label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
<div class="input-box">
<input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
</div>
</div>
<div class="field">
<label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
<div class="input-box">
<input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
</div>
</div>
</li>
So in my eyes the element it tries to hide is there, I don't get why it says Element is null...
Any ideas?
Just test for the element's existence first, which will prevent an 'undefined' or 'null' error from being thrown:
if($(element)){
element = $(element);
element.style.display = 'none';
return element;
}
$(element) is the equivalent of document.getElementById('' + element + '')

Search results not showing in dashboard

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.

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.

Magento Newsletter Signup Source

I'm currently integrating Mailchimp with Magento, using Ebizmarts MageMonkey module, for an e-commerce store. The data I need to send to Mailchimp is first & last name, email, and signup source/location e.g header, footer, checkout, etc...I have successfully been able to get first name, last name, and email, but cannot figure out how to get signup source/location.
I've done a lot of research for a way to get the signup source/location when a user opts in to our newsletter. I haven't be successful in finding anything other than how to move the newsletter block to a different location on the page.
So my question is, When a customer or guest signs up for our newsletter is there a way to get the location where they signed up, e.g header, footer, checkout, etc...
Any help is greatly appreciated. Thanks.
The newsletter signup template is in:
app/design/frontend/base/default/customer/form/register.phtml
Specifically it's the following lines:
<li class="control">
<div class="input-box">
<input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign up for Newsletter') ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
</div>
<label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
<?php /* Extensions placeholder */ ?>
<?php echo $this->getChildHtml('customer.form.register.newsletter')?>
</li>
Additionally the layout for this page can be found in:
customer.xml
Under the layout handle:
<customer_account_create translate="label">
The lines that define this block:
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
<block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
<label>Form Fields Before</label>
</block>

Resources