We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This piece, <?php echo $this->getFieldValue('notify_stock_qty')*1 ?>, can cause this error:
<?php echo $this->getFieldValue('notify_stock_qty')*1 ?>
TypeError: Unsupported operand types: string * int in /var/www/app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml:131 Stack trace: #0 /var/www/app/code/core/Mage/Core/Block/Template.php(273): include() #1 /var/www/app/code/core/Mage/Core/Block/Template.php(310): Mage_Core_Block_Template->fetchView() #2 /var/www/app/code/core/Mage/Core/Block/Template.php(323): Mage_Core_Block_Template->renderView() #3 /var/www/app/code/core/Mage/Adminhtml/Block/Template.php(67): Mage_Core_Block_Template->_toHtml() #4 /var/www/app/code/core/Mage/Core/Block/Abstract.php(926): Mage_Adminhtml_Block_Template->_toHtml() #5 /var/www/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php(77): Mage_Core_Block_Abstract->toHtml() #6 /var/www/app/code/core/Mage/Core/Block/Abstract.php(299): Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs->_prepareLayout() #7 /var/www/app/code/core/Mage/Core/Model/Layout.php(474): Mage_Core_Block_Abstract->setLayout() #8 /var/www/app/code/core/Mage/Core/Model/Layout.php(490): Mage_Core_Model_Layout->createBlock() #9 /var/www/app/code/core/Mage/Core/Model/Layout.php(234): Mage_Core_Model_Layout->addBlock() #10 /var/www/app/code/core/Mage/Core/Model/Layout.php(200): Mage_Core_Model_Layout->_generateBlock() #11 /var/www/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->generateBlocks() #12 /var/www/app/code/core/Mage/Core/Controller/Varien/Action.php(345): Mage_Core_Model_Layout->generateBlocks() #13 /var/www/app/code/core/Mage/Core/Controller/Varien/Action.php(256): Mage_Core_Controller_Varien_Action->generateLayoutBlocks() #14 /var/www/app/code/core/Mage/Adminhtml/Controller/Action.php(293): Mage_Core_Controller_Varien_Action->loadLayout() #15 /var/www/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php(218): Mage_Adminhtml_Controller_Action->loadLayout() #16 /var/www/app/code/core/Mage/Core/Controller/Varien/Action.php(421): Mage_Adminhtml_Catalog_ProductController->newAction() #17 /var/www/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(255): Mage_Core_Controller_Varien_Action->dispatch() #18 /var/www/app/code/core/Mage/Core/Controller/Varien/Front.php(181): Mage_Core_Controller_Varien_Router_Standard->match() #19 /var/www/app/code/core/Mage/Core/Model/App.php(358): Mage_Core_Controller_Varien_Front->dispatch() #20 /var/www/app/Mage.php(740): Mage_Core_Model_App->run() #21 /var/www/index.php(56): Mage::run() #22 {main}
because this:
public function getFieldValue($field) { if ($this->getStockItem()) { return $this->getStockItem()->getDataUsingMethod($field); } return Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_ITEM . $field); }
in a rare case, the product doesn't have a stock item (new product), it uses the StoreConfig, and other than this line, it isn't cast to float there:
public function getNotifyStockQty() { if ($this->getUseConfigNotifyStockQty()) { return (float) Mage::getStoreConfig(self::XML_PATH_NOTIFY_STOCK_QTY); } return (float) $this->getData('notify_stock_qty'); }
@sreichel your Opinion on the Fix? Just adding (float) to the templates?
(float)
The text was updated successfully, but these errors were encountered:
How about value="<?php echo (float)$this->getFieldValue('notify_stock_qty') ?>"?
value="<?php echo (float)$this->getFieldValue('notify_stock_qty') ?>"
Sorry, something went wrong.
All admin system configurations for Mage_CatalogInventory_Model_Stock_Item::XML_PATH_ITEM . $field should return a float value. Not?
Mage_CatalogInventory_Model_Stock_Item::XML_PATH_ITEM . $field
We not use Mage::getStoreConfigAsFloat()?
Mage::getStoreConfigAsFloat()
Edit: your public function getNotifyStockQty() seems outdated, it should already use Mage::getStoreConfigAsFloat()?!?
public function getNotifyStockQty()
3rd-party code may use getFieldValue() to return non-float from custom settings.
getFieldValue()
No branches or pull requests
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
This piece,
<?php echo $this->getFieldValue('notify_stock_qty')*1 ?>
, can cause this error:because this:
in a rare case, the product doesn't have a stock item (new product),
it uses the StoreConfig, and other than this line, it isn't cast to float there:
@sreichel your Opinion on the Fix? Just adding
(float)
to the templates?The text was updated successfully, but these errors were encountered: