Skip to content

Commit

Permalink
Implements compliance for virtual quote (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbouchotoyst authored and mehdichaouch committed Jun 11, 2018
1 parent 4b5003d commit d86e781
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/code/community/Oyst/OneClick/Model/Catalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class Oyst_OneClick_Model_Catalog extends Mage_Core_Model_Abstract
Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE,
Mage_Catalog_Model_Product_Type::TYPE_GROUPED,
//Mage_Catalog_Model_Product_Type::TYPE_BUNDLE,
//Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL,
//Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE,
Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL,
Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE,
);

/**
Expand Down
18 changes: 13 additions & 5 deletions app/code/community/Oyst/OneClick/Model/OneClick/ApiWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ private function getOneClickOrderParams($dataFormated)
{
$orderParams = new OneClickOrderParams();
$orderParams->setManageQuantity($this->getConfig('allow_quantity_change'));
$this->loadSelfQuote($dataFormated);
$orderParams->setIsMaterialized(!$this->quote->isVirtual());

if ($delay = Mage::getStoreConfig('oyst/oneclick/order_delay')) {
$orderParams->setDelay($delay);
Expand Down Expand Up @@ -222,11 +224,7 @@ public function getCartItems(&$dataFormated)
$products = array();

/** @var Mage_Sales_Model_Quote quote */
if (!isset($this->quote)
|| $this->quote->getId() != $dataFormated['quoteId']
) {
$this->quote = Mage::getModel('sales/quote')->load($dataFormated['quoteId']);
}
$this->loadSelfQuote( $dataFormated);

/** @var Mage_Sales_Model_Quote $items */
$items = $this->quote->getAllVisibleItems();
Expand Down Expand Up @@ -329,4 +327,14 @@ public function isOystOrderStatusValid($oystOrderId)

return true;
}

protected function loadSelfQuote($dataFormated)
{
if (!isset($this->quote)
|| $this->quote->getId() != $dataFormated['quoteId']) {
$this->quote = Mage::getModel('sales/quote')->load($dataFormated['quoteId']);
}

return $this;
}
}

0 comments on commit d86e781

Please sign in to comment.