Closed ghost closed 3 years ago
@bartoszkubicki, Bundle product type is getting changed to simple as soon as we add the attachments, Also if any options are added they are getting disappeared.
can you please have a look on this..
@pinjar I will look at this soon. Thank you for reporting this!
@bartoszkubicki , Thank you so much!! Please let me know if you can also replicate the issue, if not I will update the screenshots.
@bartoszkubicki, did you get time to check this bug?
@pinjar I have tested it today and I can't reproduce this issue. Maybe you have other modules, that influence saving flow of product.
@bartoszkubicki , Yes product is saving there is no issue in that, but the Bundle options are removed once we add the attachments. I have used it in fresh magento 2.3.4 as well as in 2.4. Also when attachments are added Bundle product type changed to simple. Have you tried this scenario?
I have created bundle product with options, then save it, then added attachments, then save it again. All is working fine. Product has both bundle options and attachments.
@bartoszkubicki , Please have a look at this screencast video. I have only installed this module in fresh magento 2.3.4.
https://www.awesomescreenshot.com/video/2648344?key=9f31570b8464bcc52c287ecc58ad2feb
Please try to reproduce the same steps from your end once. Thank you.
Hello @pinjar, I have created a bundle product that is working on in default Magento. I think the issue is in your product attachment extension which is added in your Magento. Please check it after removing that extension.
Thanks
@kandarp-bhatt , Yes its issue in product attachment extension, I am looking for a fix for that. Default magento there is no issue, its working as expected. I reported the issue with attachment extension.
@pinjar I can reproduce on 2.3. I will look at that probably this weekend. If you have a fix already, you can post it as PR
@bartoszkubicki , Sorry I haven't found any fix for it. I tried few suggestions but no luck, please update here when you get the fix for this. This helps a lot!!
Thanks
Hello @pinjar,
We have reviewed the extension and came to know that the extension is built based on the reference of the downloadable product module and that's why it is converting bundle products to simple while saving.
We have done a temporary fix for the extension issue.
For that, you need to create two files.
1) app/code/LizardMedia/ProductAttachment/etc/adminhtml/events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="catalog_product_save_before">
<observer name="lizardmedia_catalog_product_save_before" instance="LizardMedia\ProductAttachment\Observer\ProductSaveBefore"/>
</event>
</config>
2) app/code/LizardMedia/ProductAttachment/Observer/ProductSaveBefore.php
<?php
namespace LizardMedia\ProductAttachment\Observer;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\NewRelicReporting\Model\Config;
/**
* Class ProductSaveBefore
*/
class ProductSaveBefore implements ObserverInterface
{
/**
* @var \Magento\Framework\App\RequestInterface
*/
protected $request;
/**
* @param \Magento\Framework\App\RequestInterface $request
*/
public function __construct(
\Magento\Framework\App\RequestInterface $request
) {
$this->request = $request;
}
/**
* Set product type before product save
*
* @param Observer $observer
* @return void
*/
public function execute(Observer $observer)
{
$product = $observer->getEvent()->getProduct();
$type = $this->request->getParam('type');
if(!empty($type) && in_array($type, $this->getProductType())) {
$product->setTypeId($type);
}
}
private function getProductType()
{
return ['bundle', 'grouped'];
}
}
After that clear cache and check.
Thanks.
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.