/** * Returns true if the product is available * ALMOST THE SAME AS THE PARENT, EXCEPT WE DON'T CHECK FOR PRICE * * @param IsotopeProductCollection|\Isotope\Model\ProductCollection $objCollection * * @return bool */ public function isAvailableForCollection(IsotopeProductCollection $objCollection) { if ($objCollection->isLocked()) { return true; } if (BE_USER_LOGGED_IN !== true && !$this->isPublished()) { return false; } // Show to guests only if ($this->arrData['guests'] && $objCollection->member > 0 && BE_USER_LOGGED_IN !== true && !$this->arrData['protected']) { return false; } // Protected product if (BE_USER_LOGGED_IN !== true && $this->arrData['protected']) { if ($objCollection->member == 0) { return false; } $groups = deserialize($this->arrData['groups']); $memberGroups = deserialize($objCollection->getRelated('member')->groups); if (!is_array($groups) || empty($groups) || !is_array($memberGroups) || empty($memberGroups) || !count(array_intersect($groups, $memberGroups))) { return false; } } // Check that the product is in any page of the current site if (count(\Isotope\Frontend::getPagesInCurrentRoot($this->getCategories(), $objCollection->getRelated('member'))) == 0) { return false; } // Check if "advanced price" is available //if (null === $this->getPrice($objCollection) && (in_array('price', $this->getAttributes()) || $this->hasVariantPrices())) { // return false; //} return true; }
/** * Process payment on checkout page. * @param IsotopeProductCollection The order being places * @param Module The checkout module instance * @return mixed */ public function processPayment(IsotopeProductCollection $objOrder, \Module $objModule) { if ($objOrder->isLocked()) { return true; } return false; }
/** * Process payment on checkout page. * @param IsotopeProductCollection The order being places * @param Module The checkout module instance * @return mixed */ public function processPayment(IsotopeProductCollection $objOrder, \Module $objModule) { // If the order has already been placed through postsale if ($objOrder->isLocked()) { return true; } // In processPayment, the parameters are always in GET $this->psp_http_method = 'GET'; return $this->processPostsale($objOrder); }
/** * Returns true if the product is available * * @param IsotopeProductCollection|\Isotope\Model\ProductCollection $objCollection * * @return bool */ public function isAvailableForCollection(IsotopeProductCollection $objCollection) { if ($objCollection->isLocked()) { return true; } if (isset($GLOBALS['ISO_HOOKS']['productIsAvailable']) && is_array($GLOBALS['ISO_HOOKS']['productIsAvailable'])) { foreach ($GLOBALS['ISO_HOOKS']['productIsAvailable'] as $callback) { $objCallback = \System::importStatic($callback[0]); $available = $objCallback->{$callback}[1]($this, $objCollection); // If return value is boolean then we accept it as result if (true === $available || false === $available) { return $available; } } } if (BE_USER_LOGGED_IN !== true && !$this->isPublished()) { return false; } // Show to guests only if ($this->arrData['guests'] && $objCollection->member > 0 && BE_USER_LOGGED_IN !== true && !$this->arrData['protected']) { return false; } // Protected product if (BE_USER_LOGGED_IN !== true && $this->arrData['protected']) { if ($objCollection->member == 0) { return false; } $groups = deserialize($this->arrData['groups']); $memberGroups = deserialize($objCollection->getRelated('member')->groups); if (!is_array($groups) || empty($groups) || !is_array($memberGroups) || empty($memberGroups) || !count(array_intersect($groups, $memberGroups))) { return false; } } // Check that the product is in any page of the current site if (count(\Isotope\Frontend::getPagesInCurrentRoot($this->getCategories(), $objCollection->getRelated('member'))) == 0) { return false; } // Check if "advanced price" is available if (null === $this->getPrice($objCollection) && (in_array('price', $this->getAttributes()) || $this->hasVariantPrices())) { return false; } return true; }