Magento--The state is activated by default when adding new products, inventory status is in stock by default

Source: Internet
Author: User
Tags php foreach

State is activated by default when adding new products

Open file/app/code/core/mage/catalog/model/product/status.php, comment out "Please select"

[PHP]View Plaincopy
  1. /**
  2. * Retrieve option array with empty value
  3. *
  4. * @return Array
  5. */
  6. static public Function getalloptions ()
  7. {
  8. $res = Array (
  9. /*
  10. Array
  11. ' Value ' = ',
  12. ' Label ' = mage::helper (' catalog ')->__ ('------')
  13. )*/
  14. );
  15. foreach (Self::getoptionarray () as $index = = $value) {
  16. $res [] = Array (
  17. ' Value ' = $index,
  18. ' Label ' = $value
  19. );
  20. }
  21. return $res;
  22. }

Inventory status is in stock by default

Open file/app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml, and then

[PHP]View Plaincopy
  1. <select id= "inventory_stock_availability" name= "<?php Echo $this->getfieldsuffix ()? >[stock_data][is_in _stock] "class=" select "<?php echo $_readonly;? >>
  2. <?php foreach ($this->getstockoption () as $option):?>
  3. <?php $_selected = ($option [' value '] = = $this->getfieldvalue (' Is_in_stock '))? ' selected= ' selected "': '?>
  4. <option value= "<?php echo $option [' value ']?> <?php echo $_selected? >><?php echo $option [' label '] ?></option>
  5. <?php Endforeach;?>
  6. </select>

In the ' selected= ' selected ': '

Replace with ': ' selected= ' selected '

Magento--The state is activated by default when adding new products, inventory status is in stock by default

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.