How to add an attribute or attribute sets on homepage magento. 1.9.0 - magento-1.9

I want to add a custom search on frontend(magento). So i want to add 2 or 3 attributes on frontend to make a custom/advanced search. I have tried to add catalosearch/advanced to frontend but the attributes are not showing as dropdown menu like product page.
Thanks :)

First make the attribute to be searcheable from admin. Catalog->attribute->manage attributes. Enable used in quick search and used in advanced search.
Then get all the searcheable attribute by this
$attributes = array();
foreach ($this->getSearchableAttributes() as $_attribute):
$attributes[$_attribute->getAttributeCode()] = $_attribute;
endforeach;
Show the attribute by this $attributes['attribute_code'];

You simply need to click on manage properties and check the frontend properties of that particular attribute. You just need to change the following :
Visible on Product View Page on Front-end - Yes
Makes the attribute searchable

Related

using href or routerlink with #

I'm fairly new to changing paths / position of page so I would like a little help on this.
Say, when a button is clicked, I want to scroll down to another portion of the page. (where id of that section is 'xyz') however, I'm using an entirely different component to access that section.
If I were to use href, I can easily do : href="/app/appid#xyz"
however, if appid is a variable retrieved from the ts file, how can I insert it into my href?
It's easier to to use [routerlink]="['app', appid]" but how can I insert the "#xyz" into my string?
Or is there a completely separate and easier functionality I can use?
Thank you
Add the frament attribute:
<a [routerLink]="['app', appid] fragment="xyz">Link</a>
https://angular.io/api/router/RouterLink

How to prevent default title setting on Vue Component?

I am using Vue Material Design Icons ref, and they automatically have a title attribute set - by default it is a human readable form of the icon's name, e.g. Plus Icon. Because this is being imported directly from the Node Package, I don't want to mess with the components themselves. I also know that I could write some custom JS to fix it, but I don't really want to do that.
Is there a standard way to disable the title attribute during component registration or in some other fashion that doesn't add a performance cost or require any patchwork code?
note: I'm also using Webpack if this can be done that way.
From the link you've provided, that icon component provides a prop where you can set the title to whatever you wish if you don't want to use the default.
Props
title - This changes the hover tooltip as well as the title shown to screen readers. By default, those values are a "human readable"
conversion of the icon names; for example chevron-down-icon becomes
"Chevron down icon".
Example:
<android-icon title="this is an icon!" />

How to make a angucomplete-alt tag 'required' in a form

I am using angucomplete-alt in many places of my web application (in forms), but i cant make the autocomplete fields as a 'required' field, even thought i've used the 'field-required' attribute.
angucomplete-alt#sectorSuggested(field-required= true,placeholder='Search sectors', local-data='sectors', selected-object='onSectorSelected', search-fields='Sector', pause='300', minlength='1', title-field='Sector',input-class="form-control form-control-small", name='sector')
how do i make it required field, please help :)
Going off of the documentation and examples I can see here, it looks like the attribute should be
field-required="true"
In the above example, his element looks like this:
<div angucomplete-alt="" id="ex8" placeholder="Search countries" pause="100" selected-object="countrySelected8" local-data="countries" search-fields="name" title-field="name" minlength="1" input-class="form-control form-control-small" match-class="highlight" field-required="true" class="ng-isolate-scope">
Additionally, if you have many required fields, his documentation states:
Set custom class name for required. Unique class names need to be set
when you have multiple directives to validate
You can do this, using the field-required-class attribute.
Taken from here
you can use field-required = "true"
and it should work fine.

tabs when editing node in admin - using Seven theme

I am using the Seven theme and wondered if there was anything that can be done about he vertical tabs at the bottom to either hide the ones my user does not need or make them look a bit nicer.
To change which tabs show up for which roles, use the Override Node Options module: https://www.drupal.org/project/override_node_options
To change the look, you could create a custom module that adds CSS and/or JS in hook_init(). Another way to change the look would be to make a subtheme of Seven, set that as your admin theme, and then add your CSS / JS in the new theme.
You can manipulate which ones appear by proper use of hook_form_alter.
For that, you will need to create a small module, implement the hook, and then hide any element you want by setting $element['#access'] = false;
As an example, assuming you are interested in the node form for content type dummy_type:
In mymodule.module:
<?php
function mymodule_form_alter(&$form, $form_state,$form_id) {
if($form_id=='dummy_type_node_form') {
$form['additional_settings']['#access'] = false;
}
}
The above snippet will hide all the core vertical tabs. You can pick the specific ones you want by playing around a bit.
In that case you need to create role and assign permission
Step 1 : Create new role go to following path
Administration » People » Permissions
Here add new role e.g. content manager.
Step 2 : Click on edit permission as newly created role.
Here assign role as per your requirement.

Rails 3 - How to set different id (html attribute) in nested form attributes

I'm developing a rails 3.0.9 app, I'm using "accept nested attributes
for" to add dynamically new "child" items to its "parentW. the thing is
every child has the same id (html attribute), and I need every child with its own id,
because I need to make some jquery functions to work with them.
Is there a way to achieve this?
Tanks for your help
Adding an new element to a Nested Form was handled brilliantly in a Railscast. In it, Ryan uses javascript to replace the ID attribute with something more meaningful.
Hope this helps.