Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Jobs/DownloadMagentoProductImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct($uri, $directory = null)
{
$this->uri = $uri;
$this->directory = $this->directory ?: '/pub/media/catalog/product';
$this->fullUrl = config('magento.base_url') . $this->directory . $this->uri;
$this->fullUrl = config('magento.base_url').$this->directory.$this->uri;
}

/**
Expand All @@ -55,7 +55,7 @@ public function handle()
{
$contents = file_get_contents($this->fullUrl);
$name = substr($this->fullUrl, strrpos($this->fullUrl, '/') + 1);

Storage::put('product/'.$name, $contents);
}
}
6 changes: 3 additions & 3 deletions src/Support/MagentoProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function syncCustomAttributes($attributes, $product)
if ($attribute['attribute_code'] === 'category_ids') {
$this->syncProductCategories($attribute['value'], $product);
}

if ($this->isImageType($attribute['attribute_code'])) {
$this->downloadImage($attribute['value']);
}
Expand All @@ -127,7 +127,7 @@ protected function syncCustomAttributes($attributes, $product)
* Determine if the Custom Attribute type is an image.
*
* @param string $attribute_type
* @return boolean
* @return bool
*/
protected function isImageType($attribute_type)
{
Expand All @@ -137,7 +137,7 @@ protected function isImageType($attribute_type)
'small_image',
];

return ((in_array($attribute_type, $types)));
return in_array($attribute_type, $types);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/Support/MagentoProductsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function test_magento_product_adds_associated_category()
public function test_magento_product_launches_job_to_download_product_image()
{
Queue::fake();

factory(MagentoCategory::class)->create();

$products = [
Expand Down Expand Up @@ -108,7 +108,7 @@ public function test_magento_product_launches_job_to_download_product_image()
public function test_magento_product_does_not_job_on_invalid_image_download()
{
Queue::fake();

factory(MagentoCategory::class)->create();

$products = [
Expand Down Expand Up @@ -145,7 +145,7 @@ public function test_magento_product_does_not_job_on_invalid_image_download()
public function test_magento_product_download_image_is_correctly_constructed()
{
Queue::fake();

factory(MagentoCategory::class)->create();

$products = [
Expand Down