Same product in basket twice with different prices - magento - magento

Is it possible to add the same product to the basket twice or more times with different prices?
I know how to change the price of product when I add it to the basket using an observer and the event checkout_cart_product_add_after. But right now, when I change the price via the quote item in the observer, all products of this type that are already in the basket get the price of the last item of this type that I added…

When you add the product with the changed price add also this to the item and the product:
$data['c_price'] = 'YOUR CUSTOM PRICE HERE';
$product->addCustomOption('c_price', serialize($data));
$item->addOption($product->getCustomOption('c_price'));
This way the new product shouldn't be merged with the previous one, but if you add the product again with the custom price then it will be merged with the one you previously added with a custom price.

Related

use static price at place of original price in Magento

In Magento,I have created an attribute for product price as my_price_attribute.
If cusomer who logged in belongs to perticular group,then I want to show my_price_attribute value at place of original price and use my_price_attribute value to cart else i will have to dislay both prices but use original price to cart.
How can i do this?
Happy, Magento have Provide own feature for your type requirement.
Use Price Group Price ,Here you can set according to customer group

Access stock qty

The code below gets the product id at the store
$products = $this->getRequest()->getParam('super_group');
then I would like to get this product stock qty to add in a condition and choose between two phrases and show it in an ajax pop up.
The first frase is: product added correctly to your shipping cart, and the second one is: the stock qty is lower than you want to buy.
I already tried to use magento collection but it doen't work.
If it's necessary i can add more code.
$product->getStockItem();
You can find additionnal information about updating at : https://stackoverflow.com/a/11140724/2660794

Magento - Sell Products by gram

Hi i want to sell products by gram.
For example i'll define 1g=0.015€.
On the product page the customers should input for example 250g.
Which product-type/configuration matches this requirement at best?
You can just use simple product with as custom option for weight of type text field.
Add some javascript to change the price on product detail page.
For adding to cart, you need an observer.
You have to build an observer that catches the add-to-cart event sales_quote_add_item and then you can do the php-stuff in the observer to get the weight and calculate the price.
You can then change the price of the product with:
$observer->getEvent()->getQuoteItem()->setOriginalCustomPrice([your price])

Custom option adding product price

Currntly, product price adding to custom product, but I need to change some functionality
I dont want to add product price in to custom option. I want to show same price which I have
added fixed price. How can I do that?

how to display few price fields for product in virtuemart

I need to add few price fields on product display in virtuemart, and check box near each price field
For example, when you buy this product, price depends on weight, and you need to select in check box
50ml
75ml
100ml
and near each checkbox, product price input field will be displayed.
How to realise this thing and is there any solution, that already done
Thanks, Ahmed.
You need to setup child (sub) products of your main product. This way you can have the description and images in the parent product and each child product will have an attribute and price associated with it. Have a google on "virtuemart setup child products" or something like that.

Resources