Magento how update product price in cart - magento

I want to update the product price depend on different sizes selected and quantity entered for the size (I am using the custom options for different sizes).
for example:
I have one product with two different size options
size 1: S
size 2: M
where size 2 have cost with $2 extra. so if the product price is $14 and user select this size then this will charge user extra $2 for each M size quantity entered.
Another example:
Small size quantity: 5
Medium size quantity: 1
Then the product price will be
5 * 14 = $70
1 * 16 = $16
Total price: $86
But according to magento this effect overall price:
6 * 16 = $96
so the product cost is $96 instead of $86.

Which types do the products have? Configurable products should exist of a set Simple products which are or are not visible individually.
Since the configurable products is just a shell to keep it all together you can still alter the prices of the individual products.
For more info on configurable products, attributes and simple products check: http://www.magentocommerce.com/knowledge-base/entry/tutorial-creating-a-configurable-product/
Good luck!

Related

How to apply shopping cart rule for single product?

we want a discount to be applied when user add to cart 10 M size t-shirts, 10 L size t-shirts and 5 XL size t-shirts (same product) - so total quantity is 25. & we want to give discount only for the product whose quality is 25 or greater?
You can try to create "Shopping Cart Price Rule" with condition on "Quantity in Cart". Does it help you?

How do I set up multiple shopping cart price rules for discount bands in Magento?

I need to apply multiple discounts like this:
When the order total is less than £50: No discount
When the order total is more than £50 but less than £100: £5 off
When the order total is more than £100 but less than £250: £10 off
When the order total is more than £250 but less than £500: £25 off
When the order total is more than £500: £50 off
I’ve tried so many different combinations but I cannot seem to get these rules to work. Please can someone give me instructions on how to set this up?
I am not sure if you have seen that post: Shopping Cart Price Rules.
So the basic idea is:
1) That you go have to specify in the tab "Conditions" the Cart Attribute Subtotal to the price that you want.Or greater than, equal or less..
2) On the tab Actions just add "Fixed amount of discount" and you are set.
For your example:
1) "Conditions" the Cart Attribute Subtotal equal or greater than 50
and again Subtotal equals or less than 100
2) On tab actio : Choose "Fixed amount of discount" and on Discount Amount put 10.
Hope it helps.
You have to create four rules as follows
Go to magento admin > Promotions >
1) First rule
If ALL of these conditions are TRUE :
• Subtotal greater than 50
• Subtotal less than 100
Actions tab
Discount Amount * 5
2) Second rule
If ALL of these conditions are TRUE :
• Subtotal greater than 100
• Subtotal less than 250
• Actions tab
Discount Amount * 10
3) Third Rule
If ALL of these conditions are TRUE :
• Subtotal greater than 250
• Subtotal less than 500
Discount Amount * 25
4) Fourth Rule
If ALL of these conditions are TRUE :
• Subtotal greater than 500
Discount Amount * 50
1) Select status active
2) Select proper website
3) Select Customer groups
4) No specific coupon
5) Proper from date and to date
for more reference
http://www.magentocommerce.com/knowledge-base/entry/what-are-shopping-cart-price-rules-and-how-do-i-use-them

custom options price calculation

How does custom options price calculation work for a fixed and percent price?
I want to change percent calculation functionality from base price to total price.
Currently it's calculating price from base price.
How to change this from base price to total price?
For example:
base price = $10
custom option1 = $10
custom option2 = 10%
default Magento calculation:
Total price = Base price + selected custom option1 + selected custom option.
Total price = $10+$10+ 10% of $10(baseprice) = $21.
But we need this Total price after selecting the custom option:
Total price = $10+$10 = $20.
Total price after select custom option2
Total price = $20 + (10% of Total price)
Total price = $20 + (10% of $20).
Total price = $20 + $2 = $22.
I need to calculate the percentage from the total price, not from the base price. Please advise.
This is done in
Mage_Catalog_Model_Product_Type_Price::_applyOptionsPrice
If this applies only to special products, you might want to create an own product type with a customer price handler.

Modify Magento Subtotal Calculation: Tier prices

I am using Tier Prices and have a set price for quantities that fall between 1 and 4 and a per item price for anything over 4.
I want to modify my cart to have a set price for items where Qty >= 1 && Qty <=4
How do I do that?
Here is the item i testing this with: http://stjamestutorials.com/ppptransportation/index.php/mayfield-falls-tours-negril-jamaica-tours.html
Try and create an observer for this event:
catalog_product_get_final_price
which is found in the class :
app\code\core\Mage\Catalog\Model\Product\Type\Price.php
The event comes with the product and the qty, so you can write your logic and then set your custom price in the final_price attribute of the product.

is it possible to get only the associated product count from shopping cart?

I am working on a Ajax cart for my website. I am trying to validate Configurable products for the stock availability. Please consider below case
Cotton shirt (Product ID : 421 - Configurable Product)
Size : L (Product ID : 425 - Simple product)
Size : M (Product ID : 436 - Simple product)
User should select at least one size to add product to the cart.
When i added this product with "Size L" twice and added this product with "Size M" once.
And when i print the item ids in shopping cart, it shows only the id of Configurable product (421).
How do i get ids of Simple product which are really being added to the cart?
You will need to check if the product in the cart is configurable, then if it is you can get the information stored in the product options to work out the simple product that was actually added. The below code should help a bit:
if($product['product_type']=='configurable'){
$options = unserialize($product['product_options']);
$simpleProduct = Mage::getModel('catalog/product')->loadByAttribute('sku',$options['simple_sku']);
}

Resources