1

I don't want to set a min qty, customers should be able to buy many of the same product. But I would like to make it explicitly clear they have added more than qty=1 to their cart.

I've unsuccessfully dug around into enough nooks of the Mage core to believe this is anything trivial. But maybe it is? Anyone have an idea how I might approach this..

Thanks, Kev

2

You can use custom options for this.

Steps:

  1. Log into admin panel and go to Catalog > Manage Products
  2. Select the product which you want to show multiple times in the cart
  3. In the left panel select Custom Options tab
  4. Add a custom option

e.g.

enter image description here

  1. Now the product detail page will be as follows. enter image description here

  2. If you add the same product with different values for this custom field, each product will be added to the cart as a new entry. See the image below. enter image description here

Note: To add the same product as a new entry to the cart, at least one single difference should be among those products. (Otherwise quote always check the newly added product with the parent product.) So by using custom options you can achieve this.

2
  • Its working fine. One question here. How can I add value for the custom option programmatically? – Butterfly Feb 5 '16 at 10:10
  • Ask a different question, So I can explain it there. Hard to provide sample code in comments – Sukeshini Feb 6 '16 at 6:27
5

You could make each item unique by adding a custom product option (just some random number, time added to cart, ...) to differentiate it. This will list them individually since it will run into compareOptions in

app/code/core/Mage/Sales/Model/Quote/Item.php

public function representProduct($product)
{
    $itemProduct = $this->getProduct();
    if (!$product || $itemProduct->getId() != $product->getId()) {
        return false;
    }

    /**
     * Check maybe product is planned to be a child of some quote item - in this case we limit search
     * only within same parent item
     */
    $stickWithinParent = $product->getStickWithinParent();
    if ($stickWithinParent) {
        if ($this->getParentItem() !== $stickWithinParent) {
            return false;
        }
    }

    // Check options
    $itemOptions    = $this->getOptionsByCode();
    $productOptions = $product->getCustomOptions();

    if(!$this->compareOptions($itemOptions, $productOptions)){
        return false;
    }
    if(!$this->compareOptions($productOptions, $itemOptions)){
        return false;
    }
    return true;
}

This answer here has some info on how you could use a product option.

1
  • ahhh! Crafty solution, brother! I'll give this a shot – kevando Jan 31 '14 at 6:37

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.