How to put maximum discount restriction in magento? - magento-1.9

I have a requirement, suppose 50% is the discount given but the maximum discount that can be availed on cart is Rs/100 only.
How to implement this thing in magento?

Related

Update one SQL value in a table after changing a value from another table

So I have a table categories with the following columns:
Id, Category, Vat, Tax
And a products tables with the following columns:
Id, idCategory, Code, Product, Stock, buyingPrice, sellingPrice, Sales
When creating a new product the value of a product is entered and the buyingPrice is calculated by adding the Vat and Tax from the categories table to the value.
The sellingPrice is then calculated by a percentage markup of the buying price.
I now want to be able to automatically update the buyingPrice of all products if the Vat or Tax is changed.
I have tried creating a trigger but I am currently unable to work it out. I'm not sure if it's because the original value is not saved or if I am doing it all wrong. I have never created a trigger before so any push in the right direction would be appreciated.
I think Strawberry has a great comment here; you should store the VAT and tax separately and apply them to the base price that you store, rather than storing it as a final selling price that includes VAT or tax.
In your scenario, what happens if the VAT is reduced by 0.5%? Your trigger can be modified to properly account for newly inserted items, but how will you go back and correct existing ones? In the US, an item can be exempt from sales tax (if the purchaser is a certain type of non-profit organization or other exempt business, or in certain states during a sales-tax holiday). Again, in the US, sales tax calculations regarding putting an item on sale can be complicated. I'm not making the assumption that your situation will require dealing with those situations, but it seems like it would benefit you to not need to recalculate every item in your database if any of these were to apply.
If you really insist on this, I'd personally rather use a view to calculate the price on the fly rather than using a trigger to calculate it on insertion, but that's just me. Again, I'd ultimately prefer to handle this in the application logic.

How to obtain the discounted price for Listing?

I'm trying to obtain the Listing price via the Etsy API. But I stuck in a problem with discounted prices.
There is a listing that I'm trying to obtain: https://www.etsy.com/listing/679432133/turkish-kilim-geometric-kilim-handmade. It's original price is $590 and discounted price is $236.
The problem is that I get only the original price via open API: https://openapi.etsy.com/v2/listings/679432133/?api_key=MY_KEY&fields=price, but I need to obtain the discounted one.
I'm reading the documentation already for the past three years but it looks like it's impossible via API.
Any help?
Unfortunately, getting the discounted price is not available when getting listings via the API. Mainly because the discounted price is not an attribute of the Listing itself. Rather, the discounted price is usually derived from applying any number of coupons/sales/promotions from within your shop.
For example, if you have listing A at $100. Then run a 50% off sale for any quantity purchased... then the discount price is $50. Then if you edit the sale to require a purchase quantity of 2 or more... then the price is back to $100. And if you offer a coupon for a specific item for 10% off, now the price is $90.
All of this is just to illustrate how the discounted price for a listing is not really a direct attribute of the listing alone... but rather is a "derived" price.
If you want to know the discounted price, then the closest thing that I can think of is that you would have to use the API to add the listing to a cart. That will return the contents of the Cart that does have a field named "discount_amount" that will let you detect any line item discounts applied to the cart. From there you could subtract the "discount_amount" from the "total" to try and calculate the discount price.
At best, however, this would be an approximation of the discount price you are looking for.

Magento discount price round up issue

Facing very annoying Magento pricing issue, I have a product with price $634 and promotion rule set to 35% discount. After discount price should show $612.10 but Magento skipping 0.10 it round up to $612 (it skips only 0.10, it works fine in other cases i.e $612.25, $612.95 etc) any help?

ACCESS - calculating prices

I have one table in my access DB which contains a list of all devices that has been sold to our customer. We have only one customer and only one type of device. The table contains details like name, serial, warranty detail of device. Now we need to calculate the price for invoice purpose. The thing is that the price should be calculated depending on amount of sold devices and also we don't want to hard code the price instead we would like to use a separate table whit different category of prices and calculating the price based on this table, because of the prices changing frequently and so we should modify the price value only in one table.
We have 3 category of price : if customer bought 100 device then the unit price is 15$ else if 200 devices the unit price would be 10$ else if 300 then price for unit would be 5$. So based on these rules we will need to calculate the price.
So I'm looking for the right approach that would be for this problem.
This is a very open-ended question and is impossible to definitively answer without more information about the architecture of the database.
There are 3 different ways I usually perform a calculation inside my Access databases.
perform a calculation inside a query. For simple things.
perform a calculation inside a module function, that is called by a query. For complicated things.
perform a calculation inside a module vba subroutine, that is called by a button OnClick Event. For extremely complicated things.
You could do a cross join as long as you have a range wide enough to account for all possibilities (i.e. some ridiculous upper boundary like 9999999). Otherwise a subquery would work with the same WHERE clause:
SELECT Prices.Price
FROM Prices
WHERE (Prices.MinQuantity <= Invoice.Quantity) AND
(Prices.MaxQuantity >= Invoice.Quantity)
As Gustav and V-ball point out there are many ways to set this up depending on your needs.

How do I set up a database schema for a shopping cart with promotions/discounts?

I'd like to set up some sort of schema that will allow me to implement sales/promotions on products, but can be a bit dynamic.
By that I mean: having sales that are not all of a specific type.
For example:
All items 30% off.
Items in a specific category 10% off.
Using a discount code "DISC20" is 20% off your final price.
Free shipping until a certain date
I've seen a lot of posts about discount codes, or x percent off. That's all well and good, but what if I want to have both of those as an option. And the free shipping one throws a wrench into things. Perhaps the answer is obvious, but I'm stuck.
Any help is more than welcome :)
Thank you!
To be honest, there is not general solution to this, but following would give you some idea about DB schema.
This is not exact solution but general understanding, but the thing is you have a product table in which there is prodId, categoryID, promoID, prodName, Desc, price etc..another table Category which has list of categories and another table called Promotions where you define your promotions i.e. productId, categoryID, promocode, discount.
Now when user checks out you make use of promotion table and figure out what promotion to apply and what not.
Feel free to look into opensource shopping cart that you can customize according to your need http://www.slideshare.net/boneyp/most-popular-open-source-ecommerce-shopping-carts-top-20