lizardmedia / product-attachments-magento2 Goto Github PK
View Code? Open in Web Editor NEWMagento2 module for adding downloadable product attachments
License: MIT License
Magento2 module for adding downloadable product attachments
License: MIT License
Hello, I can't install this module on a PHP 8.0/8.1 system using composer; is this something you're planning to do? PHP 7.4 won't stay supported much longer.
Magento: 2.4.1
PHP: 7.3
Module: 1.3.5
Docroot in /pub/
Whenever I download an attached file it will dump a copy of that file in the magento root folder first before allowing the download. In my case the DOCroot is /pub/ but still the files to download end up with a copy in the magento root (where the vendor folder resides). The file dumped is totally inaccessible from the browser so it does not make much sense to put it there. It does not matter if downloaded from frontend or backend, there is always a copy. The download itself works fine though.
Download paths look like this:
Admin
https://www.example.com/admin/downloadable/attachment_file/preview/id/146
Frontend:
https://www.example.com/downloadable/download/attachment/id/102/
PHP Parse error: syntax error, unexpected '?' in /app/code/LizardMedia/ProductAttachment/Model/AttachmentRepository.php on line 244
It seem that backend url is changed to backend_name from env.php
in our case its backend + downloadable
so if i visit site/backend i get 404 but when i visit site/backend/downloadable i get admin login page.
all sections are affected by that backend/downloadable/cache/index
any idea on how to fix this ?
Hello,
Is the module compatible with Magento EE ?
We are encountering an error on a Magento EE Cloud instance: product with attached files is the wrong one (you just need to change the product_id in the product_attachments table to fix) and it may be caused by differences between CE & EE: https://magento.stackexchange.com/questions/139081/magento-2-what-is-the-difference-between-the-row-id-and-entity-id-in-the-enti
When I try to save a product with an existing attachment I get this error:
Item (LizardMedia\ProductAttachment\Model\Attachment) with the same ID "195" already exists.
I cleaned all lizardmedia* tables to be sure everything is from scratch. I also removed all files in pub\media\downloadable\files\attachment.
Then I uploaded a PDF to an existing product which worked fine. But editing this product afterwards failed with the mentioned error.
Hello,
how can i use this module from an external script in php?
Thank you
Step to reproduce the issue :
I am getting below error while deleting the attachment.
Fatal error: Uncaught TypeError: Return value of LizardMedia\ProductAttachment\Model\AttachmentRepository::updateAttachment() must be of the type integer, string returned in /app/code/LizardMedia/ProductAttachment/Model/AttachmentRepository.php:466 Stack trace: #0 /app/code/LizardMedia/ProductAttachment/Model/AttachmentRepository.php(325): LizardMedia\ProductAttachment\Model\AttachmentRepository->updateAttachment(Object(Model\Sample\Model\Catalog\Product\Interceptor), Object(LizardMedia\ProductAttachment\Model\Attachment), true) #1 /app/code/LizardMedia/ProductAttachment/Model/Attachment/UpdateHandler.php(55): LizardMedia\ProductAttachment\Model\AttachmentRepository->save('TestProduct002', Object(LizardMedia\ProductAttachment\Model\Attachment), true) #2 /vendor/magento/framework/EntityManager/Operation/Update/UpdateExtensions.php(49): LizardMedia\ProductAttachment\Model\Attachment\UpdateHandler->execute(Object(Model\Sample\Model\Ca in /app/code/LizardMedia/ProductAttachment/Model/AttachmentRepository.php on line 466
Hi,
When I try to change from product information page (admin) the name of Tab from "Attachments" to other for example "Extra Files" still the tab shows up as "Attachments".
Any idea why? by the way, when I replace the name of the file or change the file attached all working , only the issue on Tab name that stuck on "Attachments"
Have following error:
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught TypeError: Return value of LizardMedia\\ProductAttachment\\Model\\Attachment::getTitle() must be of the type string, null returned in /home/pplazam2/domains/plafondplaza.nl/public_html/app/code/LizardMedia/ProductAttachment/Model/Attachment.php:167\nStack trace:\n#0 /home/pplazam2/domains/plafondplaza.nl/public_html/app/code/LizardMedia/ProductAttachment/Model/AttachmentRepository.php(273): LizardMedia\\ProductAttachment\\Model\\Attachment->getTitle()\n#1 /home/pplazam2/domains/plafondplaza.nl/public_html/app/code/LizardMedia/ProductAttachment/Model/AttachmentRepository.php(258): LizardMedia\\ProductAttachment\\Model\\AttachmentRepository->setBasicFields(Object(LizardMedia\\ProductAttachment\\Model\\Attachment), Object(LizardMedia\\ProductAttachment\\Model\\Attachment))\n#2 /home/pplazam2/domains/plafondplaza.nl/public_html/app/code/LizardMedia/ProductAttachment/Model/AttachmentRepository.php(223): LizardMedia\\ProductAttachment\\Model\\AttachmentRepository->buildAttachment(Object(Lizard...\n', referer: https://plafondplaza.nl/backend/catalog/product/edit/id/543/key/4a319c0dfcd151b03113021bd5b00cbe0a052d9eae9acc4db8379ba8ee716676/
after this error, was able to save product without any problems.. seem it has something to do with store values ( if you have attachment at store level and not default store )
Hello,
first of all .. thx for the great extension!
I had the problem that sometimes titles are inserted multiple times.
Here you check the "id" field instead of "attachment_id". Would be nice if you can fix this.
Regards
Marcus
Is it possible to configure Attachments Tab position on product page? Maybe I would like to move the Tab to 2nd or even last position.
Step to reproduce :
Explaination :
Solution to avoid the problem:
Along with refactor support for php 7.2 should be provided.
Hi,
We get this error, and now i'm wondering if this is correct
Because the error log say this will return a array
return $product->getProductAttachments();
And here it is a array
PHP Fatal error: Uncaught TypeError: Return value of LizardMedia\ProductAttachment\Model\AttachmentRepository::getAttachments() must be an instance of LizardMedia\ProductAttachment\Model\ResourceModel\Attachment\Collection or null, array returned in /...../vendor/lizardmedia/module-product-attachments/Model/AttachmentRepository.php:239
Stack trace:
#0 ...../vendor/lizardmedia/module-product-attachments/Model/AttachmentRepository.php(214): LizardMedia\ProductAttachment\Model\AttachmentRepository->getAttachments(Object(Magento\Catalog\Model\Product\Interceptor))
#1 /...../vendor/lizardmedia/module-product-attachments/Model/Attachment/UpdateHandler.php(49): LizardMedia\ProductAttachment\Model\AttachmentRepository->getAttachmentsByProduct(Object(Magento\Catalog\Model\Product\Interceptor))
#2 /var/domains/ in ...../vendor/lizardmedia/module-product-attachments/Model/AttachmentRepository.php on line 239
Hello,
I installed the plugin but when I attach a file I get an error in the webpage:
"A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later."
and no file is attached.
Francesco
Create any Bundle product with one or more bundle options then save the product.
Now add the Attachments then re save the product, now all the options created for the bundle product getting disappeared and the product type changes to simple product.
Hello,
I´m trying your extension in my project but when I try to run the product edit form, it displays this message"Session ID is not used as URL parameter anymore.", the problem is apparently in Attachments.php in the line where it calls this method:
'url' => $this->urlBuilder->addSessionParam()->getUrl(
'downloadable/attachment_file/upload',
[Attachment::ATTACHMENT_TYPE => 'attachments', '_secure' => true]
)
under the method: $attachmentUploader['arguments']['data']['config']
So far I´ve just installed the extension via composer on a clean magento install
I´m quite new to magento, and I don´t understand what the problem is, Could you please help me?
Thanks in advance.
Wouldn't it be better to not show "Attachments" tab at all if there are none? I tried it in my store and it shows within all products but says "no attachments"...
I have the same issue #34 on WAMP environnement. I know that Magento is not recommended on Windows.
I think there's a problem with the DIRECTORY_SEPARATOR ( "/" on Linux, " \ " on Windows).
On the file vendor\lizardmedia\module-product-attachments\Ui\DataProvider\Product\Form\Modifier\Attachments.php at line 106 :
$attachmentsPath = Composite::CHILDREN_PATH . DIRECTORY_SEPARATOR . Composite::CONTAINER_ATTACHMENTS;
give me "product_attachment/children\container_attachments" instead of "product_attachment\children\container_attachments"
If I do the change, the form appear on admin panel but it doesn't work (the file is uploaded but stay in /tmp directory, no entry on database).
I think there're others issues due to this problem like in this file : lizardmedia\module-product-attachments\Model\Attachment.php
Line 109 : return 'downloadable/tmp/attachment';
Line 117 : return 'downloadable/files/attachment';
I did not succeed to use the plugin on WAMP but I don't think that's a big deal to do it.
Anyways, thank you for your good work !
Hi, I would like to add same option from front end, we have module that add the product, any option to add same option and store it in the DB?
feel free to contact me [email protected]
When I try to update to Magento 2.4 (running PHP 7.4) composer fails with this error message: "lizardmedia/module-product-attachments 1.3.5 requires php ~7.1.0|~7.2.0|~7.3.0 -> your PHP version (7.4.8) does not satisfy that requirement."
Can you update the module?
Possibility to upload Storeview level Attachments is really required.
Is this implemented?
Hi,
I have spotted one bugs linked to the Magento API and blocking updates of products.
{ "product": { "price": 5.27 } }
Fatal Error: 'Uncaught TypeError: Return value of LizardMedia\ProductAttachment\Model\AttachmentRepository::getAttachments() must be an instance of LizardMedia\ProductAttachment\Model\ResourceModel\Attachment\Collection or null, array returned in /home/magento/fm-medical/app/code/LizardMedia/ProductAttachment/Model/AttachmentRepository.php:255
@bartoszkubicki Hello Bartosz, today I installed Magento 2.3.3 on a clean OS, first I tried installing your extensions version 1.3.2 with no luck and then I triend with version 1.3.4, and I
m getting the same issue, I can see the Attachments section on admin panel but it has no content, I checked logs and console, it doesnt trigger any error Same issue with Magento 2.3.5 as I mentioned before. Hope you can help me out. P.D. I dived into the code and I don
t see anything under the fieldset section of the attachments module. I dontt know if there
s anything else I could check, I`m using windows server 2012, xampp and chrome.
Thanks a lot!
PDF added in admin side successfully and also in end user front end its showing under attachments but when I click on file name to download its redirecting to http:// base-url /downloadable/download/attachment/id/1/ and then redirecting to product page but No pdf attachment downloaded.
Hello,
when I try to download the file I attached, I get this error:
"Sorry, there was an error getting requested content."
Francesco
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.