Skip to content

Commit

Permalink
Set v1.0.8. Removed doesProductHaveImage method. Deleted validation f…
Browse files Browse the repository at this point in the history
…or Image. Removed Encrypted integration_api_password.
  • Loading branch information
Returnless committed Mar 12, 2021
1 parent 7a55eea commit 7bb6348
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 47 deletions.
54 changes: 10 additions & 44 deletions Model/Api/OrderInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,62 +267,28 @@ protected function getProductById($id)
return $product;
}

/**
* @param $product
* @return mixed
*/
public function doesProductHaveImage($product)
{
$image = false;

if (!$product || !$product->getId()) {
return $image;
}

$image = $product->getImage();

if (empty($image) || $image == 'no_selection') {
$image = $product->getSmallImage();
}

if (empty($image) || $image == 'no_selection') {
$image = $product->getThumbnail();
}

return (empty($image) || $image == 'no_selection') ? false : true;
}

/**
* @param $product
* @return bool
*/
public function getImageByProduct1($product)
{
$image = false;

$productHasImage = $this->doesProductHaveImage($product);

if ($productHasImage) {
$mediaGalleryImages = $product->getMediaGalleryImages();

$image = $mediaGalleryImages->getFirstItem()->getUrl();
}
$mediaGalleryImages = $product->getMediaGalleryImages();
$image = $mediaGalleryImages->getFirstItem()->getUrl();

return $image;
}

/**
* @param $product
* @return bool|string
*/
public function getImageByProduct($product)
{
$image = false;

$productHasImage = $this->doesProductHaveImage($product);

if ($productHasImage) {
$image = $this->image
->init($product, 'product_page_image_large')
->setImageFile($product->getImage())
->getUrl();
}
$image = $this->image
->init($product, 'product_page_image_large')
->setImageFile($product->getImage())
->getUrl();

return $image;
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"OSL-3.0",
"AFL-3.0"
],
"version": "1.0.7"
"version": "1.0.8"
}
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<returnless_connector>
<general>
<enabled>1</enabled>
<integration_api_password backend_model="Magento\Config\Model\Config\Backend\Encrypted" ><![CDATA[0:3:GYPxbV49zVR1PoaSzMfZ36rYjrnGQIrSrKI066/AQMlTRoiL7Xzdaoqp99CQpWqwxzkhj1DHrh4eJR0v]]></integration_api_password>
<integration_api_password backend_model="Magento\Config\Model\Config\Backend\Encrypted" />
</general>
</returnless_connector>
</default>
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?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="Returnless_Connector" setup_version="1.0.7">
<module name="Returnless_Connector" setup_version="1.0.8">
<sequence>
<module name="Magento_Sales"/>
</sequence>
Expand Down

0 comments on commit 7bb6348

Please sign in to comment.