How to add a new dropdown-value to a Magento SEO-list? - magento

I am using Magento 1.7.0.2 and I want to set a different value for the meta-robots-tag for several products. Therefore I go to Catalog > Article > Meta Information > And select a value from the dropdown "Robots Meta Tag"
Now comes the problem. I just have 4 selectable values in this dropdown, like this:
<select id="seo_meta_robots" name="product[seo_meta_robots]" class=" select">
<option value="0">Don't change</option>
<option value="1">NOINDEX, NOFOLLOW</option>
<option value="2">NOINDEX, FOLLOW</option>
<option value="3" selected="selected">INDEX, NOFOLLOW</option>
</select>
And I'd need a 5th one, labeled "index,follow" - how/where would I need to add that?
Thanks

The easier way would be to copy this file app/code/core/Mage/Adminhtml/Model/System/Config/Source/Design/Robots.php into app/code/local/Mage/Adminhtml/Model/System/Config/Source/Design/Robots.php and add the option there:
public function toOptionArray()
{
return array(
array('value'=>'INDEX,FOLLOW', 'label'=>'INDEX, FOLLOW'),
array('value'=>'NOINDEX,FOLLOW', 'label'=>'NOINDEX, FOLLOW'),
array('value'=>'INDEX,NOFOLLOW', 'label'=>'INDEX, NOFOLLOW'),
array('value'=>'NOINDEX,NOFOLLOW', 'label'=>'NOINDEX, NOFOLLOW'),
array('value'=>'INDEX,FOLLOW', 'label'=>'INDEX, FOLLOW'),
);
}
However, the best practise would be creating a Magento Extension and overriding this model to add the option. Since it's a one line code change it probably doesn't worth the effort though, but bear in mind that you might need to maintain changes on this file if you ever upgrade Magento (it's unlikely that this file will be changed).
I hope it helps!

Related

How to add image in dropdown in angularjs

I am working on dropdown with image in angularjs, i tried many solution but havent get any success.
My combo data is coming in json format with three elements id , image and value.
These dropdown numbers are also dynamic as per number of rows are there in model.
Please share the solution for that.
Thanks you.
Please Try this it will work out,
<select ng-model="choice">
<option ng-repeat="item in itemsList" data-image="{{item.url}}">{{item.label}}</option>
<select>
<select ng-model="image_chosen">
<option ng-repeat="data in list" data-image="{{data.url}}" value="{{data.id}}">{{data.value}}</option>
<option value="">Choose a option</option>
</select>
Checkout a example at angularjs select option with custom format value
Hope it helps.
Write like this in option tag
ng-repeat="obj in xxxxComboData" data-image="{{obj.image}}"

Check product has more than one option in dropdown Magento

HI i need something unusual , i want like
if my product has more than one option value
than it should show in dropdown
otherwise if it has only one option value
than i need to show without dropdown or as a text only.
Please suggest me how can i do this.
like like if
<select name="select_box" id="select_box">
<option value="one">1</option>
<option value="tow">2</option>
<option value="three">3</option>
<option value="three">4</option>
<option value="three">5</option>
<option value="three">6</option>
</select>
the dropdown has more than one opton than i need to show the above dropdown and if the
<select name="select_box" id="select_box">
<option value="one">optionname only</option>
</select>
dropdown has one option than i need to show optionname only as a text.This will not be a require field.
3-4 files are included in this process.
You can see that by enabling "Template path hints" from admin->settings->advanced->developer.
anyway check these files
if its a dropdown the you can change in this file (Remember do changes in your theme not in base)
frontend/base/default/template/catalog/product/view/options/type/select.phtml
Another files in this process(check xml)
frontend/base/default/template/catalog/product/view/options/wrapper.phtml
frontend/base/default/template/catalog/product/view/options/js.phtml
frontend/base/default/template/catalog/product/view/options.phtml
Another way:
Goto
App/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php
here find getValuesHtml() and check the code and edit as per your need
(DO NOT EDIT CORE FILES ALWAYS OVERRIDE FOR EDITING PURPOSE)

Selecting a drop-down option using Selenium IDE

I'm new to Selenium and having a difficult time selecting options from a drop down list (trying to select the second option).
Here is the HTML that I'm working with:
<div id="applicationReasonTypeIDContainer" class="appfield">
<label id="applicationReasonTypeIDLabel" for="applicationReasonTypeID">Application Reason</label>
<select name="appstart_international1:applicationReasonTypeID" id="applicationReasonTypeID" class="AppStart dropdown required" title="Application reason">
<option value="0"> </option>
<option value="1">New Application</option>
<option value="2">Additional location</option>
<option value="3">Owner change</option>
I'm using XPath checker to find the XPath, and it's giving me this but it doesn't work when I try and click or select command
id('applicationReasonTypeID_listbox')/x:li[2]
What should the proper Target be for finding an option like this using XPath?
Thanks Kindly!
If you know the text that will be in the field this is how I do it:
new Select(driver.findElement(By.id("applicationReasonTypeID"))).selectByVisibleText("New Application");
Hope that might help.
edit to add correct id and text from code provided.
What's wrong with either of the following?
new SelectElement(driver.FindElement(By.Id("CustomerDropDown"))).SelectByText("Nationwide");
new SelectElement(driver.FindElement(By.Id("CustomerDropDown"))).SelectByIndex(1);
I actually figured out the problem - it's an issue with Kendo UI not supporting drop-downs properly. Basically the workaround is the click the drop-down arrow, then use sendKeys and point to the same Target as the drop-down with the value being whatever item you want from the list, then clicking the drop-down again. This worked for me, hopefully it helps somebody else!

Creating a Published drop down in Joomla

<field
name="published"
type="list"
label="JSTATUS"
description="JFIELD_PUBLISHED_DESC"
class="inputbox"
filter="intval"
size="1"
default="1"
>
<option value="1">
JPUBLISHED</option>
<option value="0">
JUNPUBLISHED</option>
<option value="-2">
JTRASHED</option>
</field>
I've created a Joomla dropdown in my form.xml file of a custom component to choose the published status of the item. I've taken this code unashamedly from the Joomla com_content component (and copied and pasted it into my own form.xml file. However when its rendered in the edit.php file (as shown below) you can see that the item is being set as unpublished. Despite the code above clearly setting the default as 1 which should correspond to published. Any good ideas as to why/how to fix this. I can easily change the drop down back from unpublished to published - and it works fine doing that. But its just annoying and a bug I'd like to fix. Any ideas?
Try to take a look if there is any override through your code, since this was taken by the com_content component, it won't set to default until all the mandatory fields are set, double check if any JS script or PHP function interrupts your field's normal behavior.
Another thought of mine is that maybe there is a problem with the translations, so take a close look to the translation files.
Are you using a table / model approach like com_content does? if so, when the record doesn't exist, its fields will be set to default (as read from database, so int fields will default to 0).
You can either
set the right defaults in the database,
check their values in the model,
change JPUBLISHED to 0 and JUNPUBLISHED to 517
although the latter looks really ugly.

How to remove initial empty value for a dropdown attribute in Magento?

I'm using Magento version 1.5.1.0. I added an attribute with the following options selected in the Properties tab:
Catalog input type for store owner: dropdown
Unique value: no
Values required: no
I then went to the Manage Label/Options tab and added 3 different options, selecting the first option as a default. I added it to an attribute set, and when I go to enter a product, I see the dropdown, but with an empty option value prepended to it:
<select>
<option selected="selected"></option>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
When I save the product, the empty option still remains selected. How do I remove that empty option and make Option 1 the default for all of my existing products without resorting to using JS or editing any files whatsoever?
I think this can help.
When you call getAllOptions you need to pass false.
->getAllOptions(false)
Magento attribute dropdown with first empty value
<select name="history[status]" class="select" id="history_status">
<option value="pending" selected="selected">Pending</option>
<option value="canceled">Canceled</option>
<option value="processing">Processing</option>
</select>
Try using the SELECT tag rather than option for this block. Here above I have an example taken from a Magento store. Your:
<option selected="selected></option>
Is exactly that. An option, rather than defining a select box.

Resources