-
-
Notifications
You must be signed in to change notification settings - Fork 436
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
Removed 2 unneeded function calls. Local var is already there. #1373
Removed 2 unneeded function calls. Local var is already there. #1373
Conversation
Hi @woutersamaey @colinmollenhour @tmotyl @sreichel I think we've to rollback this change. It appears to change and break some basic behavior of Magento on which several modules and functionalities depend on. This gets clear when you compare the two data sources It's quite a habit of some developers to rely on the SKU containing always the simple SKU (also if you have the quote/order item of a configurable product). Here some example stackexchange question from the community: https://magento.stackexchange.com/questions/19372/get-id-of-simple-product-of-any-configurable-product-on-cart-phtml-magento/126318 One of my customers was complaining about wrong weights and SKUs (and for some reason also wrong MPNs) on their invoices. After rolling back your changes everything was back to normal again. |
Here's the code snippet that supports @hannes011: /**
* Retrieve product model object associated with item
*
* @return Mage_Catalog_Model_Product
*/
public function getProduct()
{
$product = $this->_getData('product');
if ($product === null && $this->getProductId()) {
$product = Mage::getModel('catalog/product')
->setStoreId($this->getQuote()->getStoreId())
->load($this->getProductId());
$this->setProduct($product);
}
/**
* Reset product final price because it related to custom options
*/
$product->setFinalPrice(null);
if (is_array($this->_optionsByCode)) {
$product->setCustomOptions($this->_optionsByCode);
}
return $product;
} That is called twice. May be a patch like this: public function setProduct($product)
{
if ($this->getQuote()) {
$product->setStoreId($this->getQuote()->getStoreId());
$product->setCustomerGroupId($this->getQuote()->getCustomerGroupId());
}
$product = $this->setData('product', $product)->getProduct();
$this
->setProductId($product->getId())
->setProductType($product->getTypeId())
->setSku($product->getSku())
->setName($product->getName())
->setWeight($product->getWeight())
->setTaxClassId($product->getTaxClassId())
->setBaseCost($product->getCost())
->setIsRecurring($product->getIsRecurring());
... |
@hannes011 does the proposed solution from @kiatng fix the issue in your case? |
@colinmollenhour Cheers, Hannes |
Can you please provide a PR (just rollback for now)? (I only testet with simple products ... :/ I'd prefer rollback asap too, impovements can be (re-)done later.) |
OpenMage#1373)" This reverts commit 2fe9658.
Our customers also have issues with this change. I fixed this also by reverting back those lines and came here to mention the problem. A quick release of a fixed version would be preferable I guess, because this is corrupting order data while in this state. |
@AlterWeb how did you revert this exact change? (Sorry not too familiar with git) |
@seansan The most easy way is to copy app/code/core/Mage/Sales/Model/Quote/Item.php to app/code/local/Mage/Sales/Model/Quote/Item.php. This way the core file stays intact but Magento is using the local version. In the local file you then change Don't forget to remove this local copy after you update OpenMage to a newer version where this issue is resolved (it looks like it will be fixed in 19.4.11 when it will be released). |
After reading how many issues created this commit a famous phrase is coming in my mind: if it ain't broke, don't fix it! |
Removed 2 unneeded function calls. Local var is already there.