small refactor on checks if downloadable product
This commit is contained in:
parent
35fa80e91f
commit
9fd5ff7f47
|
|
@ -118,15 +118,16 @@ class Cart extends Model implements CartContract
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if cart have downloadable items
|
||||
* Checks if cart has downloadable items
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function haveDownloadableItems()
|
||||
{
|
||||
foreach ($this->items as $item) {
|
||||
if ($item->type == 'downloadable')
|
||||
if (stristr($item->type,'downloadable') !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class DownloadableLinkPurchasedRepository extends Repository
|
|||
*/
|
||||
public function saveLinks($orderItem)
|
||||
{
|
||||
if (! $this->isDownloadableProduct($orderItem)) {
|
||||
if (! $this->isValidDownloadableProduct($orderItem)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ class DownloadableLinkPurchasedRepository extends Repository
|
|||
* @param mixed $orderItem Webkul\Sales\Models\OrderItem;
|
||||
* @return bool
|
||||
*/
|
||||
private function isDownloadableProduct($orderItem) : bool {
|
||||
private function isValidDownloadableProduct($orderItem) : bool {
|
||||
if (stristr($orderItem->type,'downloadable') !== false && isset($orderItem->additional['links'])) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue