Skip to content

Commit

Permalink
check product enabled and visible
Browse files Browse the repository at this point in the history
  • Loading branch information
bnayalivne committed Jan 2, 2017
1 parent f541e7f commit f76cdd7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions Model/Api/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
use Magento\SalesRule\Model\CouponFactory;
use Magento\SalesRule\Helper\Coupon;
use Magento\Framework\Exception\LocalizedException;
use Magento\Catalog\Model\Product\Attribute\Source\Status;
use Magento\Catalog\Model\Product\Visibility;

class Data implements DataInterface
{
Expand Down Expand Up @@ -424,6 +426,16 @@ public function getProducts(
}
}

//product_exists
$visibility = array_key_exists('visibility', $mappedArray) ? $mappedArray['visibility'] : 1;
$status = array_key_exists('status', $mappedArray) ? $mappedArray['status'] : 1;

$active = true;
if($status == Status::STATUS_DISABLED || $visibility == Visibility::VISIBILITY_NOT_VISIBLE){
$active = false;
}
$prod['product_exists'] = $active;

$prod['image'] = $this->getImage($row);
$prod['images'] = $this->getMediaGalleryImages($row);

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lib-libxml": "*"
},
"type": "magento2-module",
"version": "2.1.5",
"version": "2.1.6",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Remarkety_Mgconnector" setup_version="2.1.5">
<module name="Remarkety_Mgconnector" setup_version="2.1.6">
</module>
</config>

0 comments on commit f76cdd7

Please sign in to comment.