Skip to content
New issue

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

Fix integers being cast to decimal in some particular cases #1192

Closed
digitalpianism opened this issue Sep 7, 2020 · 0 comments · Fixed by #1198
Closed

Fix integers being cast to decimal in some particular cases #1192

digitalpianism opened this issue Sep 7, 2020 · 0 comments · Fixed by #1198

Comments

@digitalpianism
Copy link
Contributor

Preconditions (*)

  1. 20.0.2
  2. Disable Flat Catalog.

Steps to reproduce (*)

  1. Run the following script
<?php

require_once 'app/Mage.php';

Mage::app();

$collection = Mage::getModel('catalog/product')->getCollection()
    ->addAttributeToSelect('tax_class_id')
    ->addAttributeToSort('name');

// toggle this to see the weird result
$collection->addAttributeToSelect('price');

// to make the script faster and lighter
$collection->setPageSize(1);

if ($collection->getSize() > 0) {
    var_dump($collection->getFirstItem()->getData('tax_class_id'));
}

// does not help, the SQL is exactly the same
// echo (string) $collection->getSelect();

Expected result (*)

  1. It should give you the tax class id as an integer, as declared for this attribute type.

Actual result (*)

  1. It will give you the tax class id as a float.

Extra information

I spent a lot of time debugging this issue, you can find a detailed thread about it here: https://magento.stackexchange.com/questions/105244/magento-1-admin-product-grid-column-value-disappear-on-name-search/105421

So I already have a fix for it, will do a PR soon

digitalpianism pushed a commit to digitalpianism/magento-lts that referenced this issue Sep 8, 2020
sreichel pushed a commit that referenced this issue Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants