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

Fixed getQuote() returns null in quote item and quote address objects. #3355

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

kiatng
Copy link
Contributor

@kiatng kiatng commented Jun 27, 2023

Description (*)

Example:

$quoteItem = Mage::getModel('sales/quote_item')->load($itemId);
$quote = $quoteItem->getQuote(); // null value but it should not be!

@github-actions github-actions bot added the Component: Sales Relates to Mage_Sales label Jun 27, 2023
@fballiano fballiano merged commit c830ba5 into OpenMage:main Jun 27, 2023
15 checks passed
@pquerner
Copy link
Contributor

Mh, maybe sometimes you dont want the object appended automatically. Shouldnt you be able to chose this?

@kiatng kiatng deleted the fix_getQuote_is_null branch June 28, 2023 01:13
@kiatng
Copy link
Contributor Author

kiatng commented Jun 28, 2023

Mh, maybe sometimes you dont want the object appended automatically. Shouldnt you be able to chose this?

There is a setQuote() right above it:

public function setQuote(Mage_Sales_Model_Quote $quote)
{
$this->_quote = $quote;
if ($this->getQuoteId() != $quote->getId()) {
$this->setQuoteId($quote->getId());
}
return $this;
}
/**
* Retrieve quote object
*
* @return Mage_Sales_Model_Quote
*/
public function getQuote()
{
if (is_null($this->_quote)) {
$this->_quote = Mage::getModel('sales/quote')->load($this->getQuoteId());
}
return $this->_quote;
}

@pquerner
Copy link
Contributor

Thanks! I thought this would auto-append it at load-times. My bad. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Sales Relates to Mage_Sales
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants