0

I have a downloadable product in a grouped product and after placing the order for the downloadable product from the grouped product display it doesn't show up in My Downloadable Products (it does if I order the downloadable product by searching for it and placing the order from its own display (not from within the grouped product).

It seems that the main thing we're seeing is that there are no records inserted for downloadable_link_purchased and downloadable_link_purchased_item.

The quote_item_option record for info_buy_request is different when adding to the cart as well as there being an additional record for the grouped_product_type in that table also.

I'm not finding any other questions related to this so I'm also wondering if this is working for anyone else.

I appreciate any comments or suggestions or notes on success or failure from anyone else who can test this! Thank you!

Magento CLI version 2.1.2

EDIT: (and thanks for the welcome!)

I'd like to add the steps to test this to see if anyone could share whether it is my issue or existing code:

1) Set up a downloadable product

2) Set up a grouped product

3) Add downloadable product to grouped product

4) Search / Go to downloadable product display and order it (works and shows in downloadable files list)

5) Go to grouped product and order the downloadable product (orders but does not show in downloadable files list)

1
  • Welcome to Magento Stack Exchange :)
    – Jackson
    Oct 26 '16 at 1:27
0

I think this is bug from Magento. I have done something but I don't know if that would be a proper solution though it seems to work.

Make a Plugin:

on etc/di.xml add:

<type name="Magento\Quote\Model\Quote\Item\ToOrderItem">
        <plugin name="append_downloadable_data_to_order" type="Company\GroupedProduct\Plugin\QuoteItem"/>
    </type>

and iside the foler Plugin I have:

namespace Company\GroupedProduct\Plugin;

use Closure;

class QuoteItem
{
    /**
     *
     *
     * @param \Magento\Quote\Model\Quote\Item\ToOrderItem $subject
     * @param callable $proceed
     * @param \Magento\Quote\Model\Quote\Item\AbstractItem $item
     * @param array $additional
     * @return \Magento\Sales\Model\Order\Item
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     */
    public function aroundConvert(
        \Magento\Quote\Model\Quote\Item\ToOrderItem $subject,
        Closure $proceed,
        \Magento\Quote\Model\Quote\Item\AbstractItem $item,
        $additional = []
    ) {
        /** @var $orderItem \Magento\Sales\Model\Order\Item */
        $orderItem = $proceed($item, $additional);
        $isDonwloadable = $orderItem->getProductOptionByCode('is_downloadable');
        if ($isDonwloadable) {
            $orderItem->setProductType('downloadable');
        }
        return $orderItem;
    }
}

From my understanding when magento is using convert from quote to make it order it changes the product_type from downloadable to grouped. Magento is adding the links to proper tables using an observer which is inside the downloadable module. Inside there they have a check for product type and that's where it fails. Hope it makes sense

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.