1

We have a third party software to configure single products to one final product. The final product should be bought via magento. We don't want to import each single product into Magento and the final product is different with each customization.

Is it generally possible to add the final product with descriptions to the magento shopping cart, checkout and save this as an order without having the concrete product in the database?

Example: Create a dummy product in Magento, with the Number: 10001, but the price and the description is saved within each order.

In the Database:

100001 - Customized Dummy Product - No Price - No Description

In the Order:

Order 1

Number: 100001 - Name: My Product - Price: $99,00 - Description: Single Product 1, Single Product 2

Order 2

Number: 100001 - Name: My Product 2 - Price: $199,00 - Description: Single Product 2, Single Product 5

  • How is the information of the final product transferred into Magento when the customer wants to order it? – 7ochem Feb 25 '15 at 15:56
2

Try the following -:

$cart = Mage::getSingleton('checkout/cart');
$product = Mage::getModel('catalog/product');
$product->setTypeId('simple');
$product->setTaxClassId(1);
$product->setSku('SKU_ID');
$product->setName('NAME');
$product->setShortDescription("SHORT_DESC");
$product->setDescription("DESC");
$product->setPrice("129.95");

$cart->addProduct(
    $product, 
    array(
        'qty' => 1,
        'price' => 129.95
    ));

// save the cart
$cart->save();

// very straightforward, set the cart as updated
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
| improve this answer | |
1

Yes this is possible, but a lot of work.

During the checkout all informations come from the products, this means you have to change the logic in the checkout, emails, etc. which echoes the description and stuff.

Depending on how much products you have to import, I would think about doing it NOT this way. But if your logic is complex, it might be worth the work.

| improve this answer | |
1

I have done this before on a project. You need to set this kind of data when creating the sales quote item. You could do this upon some add to cart event:

The $product should be your 'dummy' product. The quote should be a sales quote object for instance from checkout session: $quote = Mage::getSingleton('checkout/session')->getQuote()

$qty = 1; // or what it needs to be
$customPrice = 10.00; // or what it needs to be

try {
    $result = $quote->addProduct($product, $qty);
} catch (Exception $e) {
    $result = $e->getMessage();
}
if (is_string($result)) {
    throw new Mage_Core_Exception($result, null, (isset($e) ? $e : null));
}
/* @var $result Mage_Sales_Model_Quote_Item */

$result->setName('Custom Name')
    ->setDescription('custom description')
    ->setCustomPrice($customPrice)
    ->setOriginalCustomPrice($customPrice)
    ->setCalculationPrice($customPrice);

If you would convert this quote into an order, then all of this information will be converted correctly and will be saved with the order.

| improve this answer | |

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.