how to force magento to use my custom price - php

Hi and thanks for reading,
I'm working on magento EE 1.13, here I added new price fields to product edit page (offer price and deal price) beside the original price and special price fields.
and here the problem come: I need to make magento use deal price or offer price when they are set, I find it complicated and not easy to find.
what I think is maybe I can override addFinalPrice method or override getFinalPrice method, but I'm not sure if it's right, need your help guys in this.
any idea will be appreciated,
thanks in advance.
update: is there any way to save final price in database after saving finishing editing the product?

you need to add observer on event catalog_product_get_final_price. please check my below answer.
Magento : Add Product to cart with custom price

you misunderstood the concept i guess:
the purpose of the getFinalPrice method is to find the price respecting tier price, special price, and the regular price.
If you just want a final price, give the product a regular price and don't use tier_prices, special prices for the product. It is not for saving but for loading...
Update:
"is there any way to save final price in database after saving finishing editing the product?"
You don´t save the final price, the final price is built dynamically. If you want additional prices you need to add a price attribute and use the final price event to check your additional prices and use them - if needed - as final price.

Related

implement configurable product with specific price for every combination of attributes

does anyone know how to achieve this functionality?
We currently have a single product with different colors and sizes and for each combination, there is an specific price for it.
We need something similar to configurable product but instead of adjusting the price based on its attribute, we need to set an specific price for each combination.
We are using magento 1.7
Weve tried using simple configurable plugin
http://www.magentocommerce.com/magento-connect/simple-configurable-products.html
together with the patch
https://github.com/organicinternet/magento-configurable-simple
but failed to make it work.
Is there any other way for magento to achieve this functionality?
Thanks,
Jay
You could just have a single attribute and adjust the prices based on this attribute, instead of having more than one attribute.

Adding discounts to shipping in magento

I was wondering if anyone here has ever added an automatic discount to a shipping method in magento before. FedEx is the only company I ship with, but I have 3 different methods of FedEx. I want to add a discount to 2 of the 3 methods, and display these discounts at the method selection screen automatically at checkout(to make it seem like they are getting a deal with the higher priority shipping I suppose?). I found which file displays the methods, but I don't think this is the file I need:
template/checkout/onepage/shipping_method.phtml
Does anyone know which file these are displayed in so that I can slash out the real price, and add the discounted price bellow it? I suppose I could change the shipping price by just subtracting from the variable price, correct?
I suggest this thread for adding custom discount price but its not related to any of shipping method price calculation, its might helpful, as its helped me well..
http://www.excellencemagentoblog.com/magento-add-fee-discount-order-total

Magento quote_item and tax

I need to add custom attributes to selected products in store. To do so I'm using Model_Price_Observer. I'm using Magento 1.7.
So far I'm able to add custom attribute but calculated price is wrong - tax is missing.
My code is (part):
$quote_item->getProduct()->setIsSuperMode(true);
$quote_item->setOriginalCustomPrice( $customprice );
$quote_item->setCustomPrice( $customprice );
$quote_item->setTaxAmount($taxAmount);
$quote_item->setBaseTaxAmount($taxAmount);
Any ideas what am I doing wrong?
Am I using right trigger?
Tax cannot be added to an item as we do not yet know the customer's location in the world, and therefore cannot reasonably calculate a tax rate. I assume Magento is not saving your new tax information because of this fact. It also seems dangerous to me to add tax manually as it is always calculated on the fly via (sometimes) complex logic.
In the cart, try getting a "quick estimate" by entering in your country and postal code and see if tax is applied to the quote, and maybe try again.

Magento (PHP): Add Product invisble to Cart

I am looking for a way adding a product to cart without display it.
Example:
New customer order -> welcome letter in the cart, but the customer doesnt see it.
The added product cost always 0 €, so it never changed the shopping cart total.
The solution should be changed as few as possible.
Any idea?
Thank you!
(Sorry for my very bad english...)
I would say to change the formulation a bit and add it to the order just before the order is saved. While the quote is being converted into an order (sales_model_service_quote_submit_before is one good event here, but there are others), add the product to the order.
This way, you don't have to hack around trying to hide items in the cart, and the effect is the same.
Two options:
Define a new product type that extends the Virtual product type in Magento, and then use a custom Item Renderer for Checkout and Cart that doesn't output any html. Here's a useful tutorial for that process.
Define a new boolean product attribute called "cart_visibility" or something like that, override DOCROOT\app\design\frontend\base\default\template\checkout\cart\item\default.phtml in your own theme and test for that value before outputting the item's attributes e.g. on line 28:
<?php if($_item->getCartVisibility(){ ?>
Don't forget to close the brace at the end of the file obviously.
if it's 0 then why add it to the cart just add it as a message to cart page by adding it to cart template or injecting your own block to this template

PHP: Buy both and save $50?

OK my client wants to show a buy both feature in the cart, if they have 1 particular item type in the cart they want it to show up for another particular item type so if they buy both they can save $50 off the total. I am trying to wrap my head around what would be the best way to set this up so it couldn't be easily hacked (ie: adding both to the cart then removing one and keeping the discount)
does anyone have some general ideas in theory?
Thanks.
Why not perform the check right before they submit the order? that way, everytime they get to the submit order page, it will check if both items are present.
easy enough - always calculate the final price on the fly based on the current cart contents. The issue you mention seems like it would only be a problem if you were calculating the final price and caching it somehow.
usualy it'd done by creating a new bundle item. It's a bit dirty but works :)
Are they using a system already, or is this a custom job on your part?
Add the discount to the cart and use another table to keep track of the discount's dependencies. Whenever an item is removed from the cart, check to make sure the discount is still valid. If it is, great. If not, remove it and recalculate the cart price.

Categories