#StackBounty: #magento2 #configurable-product #simple-product #grouped-products #downloadable Product shippable and/or downloadable. Wh…

Bounty: 50

The problem:

I have to sell products which are downloadable but they can be shippable as well as CD or USB Key. Thus, customer can choose if download the product or receive it on DVD or USB Key.

What’s the best option to handle this situation in Magento 2?


What I did:

Till now, using Magento 1, I was selling the product in just 2 options: downloadable or shippable on CD. In order to do this I created 3 products: 1 simple product (for CD), 1 downloadable product (for download), and 1 grouped product (to group those 2 products). However, this is very inconvenient because every time I have to insert a new product I have to insert 3 separated products and now that I want to give the USB key option, I should insert 4 separated products.

I tried to use a configurable product in order to create them but since I’m using a custom Attribute Set with many required fields, the child products created from this process inherit the parent Attribute Set and they force me to compile all those fields. I also tried to change it once the child products have been created but I got I mess…

What I was thinking:

I was thinking about alternatives… something like creating just 1 downloadable product for every products and then creating just 1 simple product for CD shipping and another for USB Key shipping for all products so the customer who wants shipping buys 2 products: the downloadable product and the simple product for CD shipping for example. But, in my opinion, this is not an elegante way to handle this situation.

Do you have a better idea?


Get this bounty!!!

#StackBounty: #product #configurable-product #layered-navigation Magento 2.4: show variant images of configurable product based on filter

Bounty: 100

i have configurable product on listing page with swatches enabled .

Configurable product has images swatches – Red , Green, Blue.

Not when i applied Color – filter as Red still images on Listing page -it still shows default configurable product image, instead it should show Red one image of one of Variant Product with Red image.

enter image description here


Get this bounty!!!

#StackBounty: #configurable-product #magento2.4 #object-manager magento 2.4 issue creating configurable product programmatically

Bounty: 100

i am using the below code to create a configurable product from product sku (from attributes color and size), it is working fine when all associated products have both attributes – color and size

Issue comes one Attribute is not there in all associated product.

For eg

Case 1: works fine

SKU 1 : Size – L and Color – Red

SKU 2 : Size -M and Color – Black

Case 2: Add to cart not working as both associated product have one attribute Color missing as both associated product

SKU 1 : Size – L

SKU 2 : Size -M

Case 3: Add to cart not working as both associated product have one attribute Size missing as both associated product

SKU 1 : Color – Red

SKU 2 : Color – Black

Also i get the below error in the admin when I try to edit the configurable product in CASE 2 and CASE 3

Notice: Undefined offset: 0 in /usr/share/nginx/zodiac/html/vendor/magento/module-configurable-product/Model/Product/Type/VariationMatrix.php on line 49
Exception in /usr/share/nginx/zodiac/html/vendor/magento/framework/App/ErrorHandler.php:61

Code as below :

    $product = $objectManager->create('MagentoCatalogModelProduct');
    $product->setTypeId('configurable') 
            ->setStatus(1) // 1 = enabled, 2 = disabled
            ->setAttributeSetId(4) // 4 = default
            ->setName('Configurable test product')
            ->setSku('config')
            ->setPrice(0)
            ->setTaxClassId(2) // 0 = None, 2 = Default product tax class
            ->setCategoryIds(array(2)) // 2 = Default category
            ->setDescription('test description')
            ->setShortDescription('test short description')
            ->setUrlKey('configurable-test-product')
            ->setWebsiteIds(array(1)) // 1 = Default Website ID
            ->setStoreId(0) // 0 = Default store ID
            ->setVisibility(4); // 4 = Catalog & Search
                    
    $product_resource = $product->getResource();
    $color_attribute = $product_resource->getAttribute('color');
    $size_attribute = $product_resource->getAttribute('size');
    $color_attribute_id = $color_attribute->getId();
    $size_attribute_id = $size_attribute->getId();
    $configurable_attributes = array('color', 'size'); // put here all configurable attributes you need and get their attribute IDs like I showed above
    $product->getTypeInstance()->setUsedProductAttributeIds(array($color_attribute_id, $size_attribute_id), $product); // assign attributes to configurable product
    
    $configurable_attributes_data = $product->getTypeInstance()->getConfigurableAttributesAsArray($product);
    $product->setCanSaveConfigurableAttributes(true);
    $product->setConfigurableAttributesData($configurable_attributes_data);
    
    $child_product_skus = array('SKU1','SKU2');
    $child_ids = array();
    foreach ($child_product_skus as $child_product) {
        echo "<br>".$child_product;
        $child_ids[] = $objectManager->get('MagentoCatalogModelProduct')->getIdBySku($child_product);
    }
    print_r($child_ids);
    $product->setAssociatedProductIds($child_ids);
    $product->save();


Get this bounty!!!

#StackBounty: #magento2 #configurable-product #configurable-price Override configurable prices (or load via AJAX)

Bounty: 50

So I have an AJAX price loader, which works fine for simple products. However for configurable products and the simple options, I do not get the override working.

I have a javascript that can set the new/correct price in the spConfig after the page is loaded.
Example

$('#product_addtocart_form').data('mageConfigurable').options.spConfig.optionPrices[699].basePrice = {amount: 23};

The price is correctly show, but the select box is still an incorrect price. How can I re-render the select boxes?


Get this bounty!!!

#StackBounty: #magento2 #magento2.3 #configurable-product #simple-product #multi-source-inventory Should Providers be Multi-Sources or …

Bounty: 50

I have a store where

  1. showing catalog from my vendors I don’t have actual inventory
  2. end-customer is not aware of my vendors (so it is not multi-vendor store)
  3. currently, I am using the configurable product for all product info and simple-product(configration) that is linked to the configurable and has (cost, qty, price, and vendorID)
  4. configrations are auto-selected based on cost so the customer does not select which product from which vendor because he is not aware of my vendors

Today I found this (multi-source-inventory-in-magento-2.3)
https://www.mageplaza.com/kb/multi-source-inventory-in-magento-2.html

and now I am confused did I did the wrong implementation?
I read about it but I am still confused

  • how MSI handles different costs from different sources?

  • how to handle different selling prices?


Get this bounty!!!