Hi i’m developing a eCommerce site in Magento for jewellery business and its based on a “weight”, not the price because gold rate is changing in day by day or more then 3 times in a day.So it is not possible to change the product price every time according to gold rate. Then, how to manage the prices on this scenario?
Example case: Today I have added a 18K gold ring of 10gm to my site and right now gold rate is Rs30,000 per 10gm, so today price of this ring is Rs30,000 but, Next day the rate will be changed (Rs32,000 per 10gm) then, my product price must be changed from Rs30,000 to Rs32,000.
This is not possible to update the price of all products every time.
I am using Magento platform. Please, Share your idea regarding this situation.
To make this simple, you should work on a 2 ways solutions.
In the frontend, do not show price ($_product->getPrice()) but just show the real price according to weight.
Example if you have price/grm stored in the backend use $product->getWeight * Mage::getStoreConfig('mycompany/gold/dayprice').
That way price will be shown dynamically in the product page or list page.
Now you should use an Observer on the add to cart event to change the price to the good one.
This way, don't matter what price is set on the product because showing and adding will use the formulae.
Related
I have a woocommerce shop with the woocommerce booking system. At my website, you can book meal deliveries based on time slots. I used the booking system because some meals are available some days. And, you can book meals on multiple days in one order.
My problem is that I want to apply a fixed shipping cost (3,5euros) based on deliveries/time slots. I can’t group meals of the same delivery in one order.
My question is : is there a way to make a php script to calculate shipping cost based on delivery time slots?
My current cart page and what i need
currently, i use this calculation method on woocommerce settings : 3,5 * [qty]
The problem in my case is that don't want to charge multiple times for the same delivery.
Thank you!
For the products in a cake shop, the cakes can get ordered for different order dates (order attribute) within the same order.
The stock should only be considered, if the cakes are ordered for the next day. For orders further in the future, the stock is irrelevant.
So I want to modify the cart that in get_cart_item_quantities() the item quantities get only grouped for cakes ordered for the next day.
So far, I managed to write a plugin extending the original cart and overriding get_cart_item_quantities()and add_to_cart().
But with the recent update, the plugin is no longer working due to new class hierarchies.
So I'm looking for a solution with standard filters and actions which is more update proof.
Can anyone help?
Here's more information on what I want to achieve:
The cakes can be ordered as a whole cake (12 or 16 pieces) – which is the main product – or as a variation of a quarter cake (3 or 4 pieces).
The shop keeper wants to manage the stock in number of pieces for the whole cake, not with the variations as well.
Moreover, the cakes can be ordered for next day delivery or sometime in the further future.
ONLY if the cake gets ordered for the next day, the stock should get checked.
Let's say there is 12 pieces of a cake in stock.
One customer buys a whole cake (12 pieces in this case) for tomorrow and a quarter for sometime next week.
When adding this to the cart, the cart should contain:
amount 1 of the whole cake for tomorrow
amount 1 of the quarter cake for sometime later
I add the delivery date in woocommerce_add_cart_item_data.
Internally, WC_Product::has_enough_stock() should check the stock only for the items ordered for tomorrow and in the actual number of pieces, in this case 12 for the whole cake for tomorrow (even though the amount in the cart is 1)
So far, I implemented the number of pieces by overriding WC_Cart::get_cart_item_quantities() and adding a custom filter.
And by overriding WC_Cart::add_to_cart() to modify has_enough_stock().
During checkout, I reduce the stock amount by the correct number of pieces by filtering woocommerce_order_item_quantity.
But of course, with the plugin solution I need to update the plugin with almost every update of WooCommerce.
The possibilities I see at the moment:
As WC_Product::has_enough_stock() is not applying any filters itself, I could filter woocommerce_product_variation_get_stock_quantity and return the actual quantity if the delivery date is relevant and return a fake number like 9999 in all other cases.
Like this, stock management should workg during add to cart, in the cart and during checkout when relevant.
What do you think?
I need to find a way to create Negative product prices in Magento.
We use Magento both as Online shop and POS and in POS we sometimes need
to give a certain discount that simply can't be accomplished with coupons or shopping cart rules.
I did some googling but nothing turned out. Does anybody know how I could create this?
Example:
1 x Apple iPhone 6 - € 699,99
1 x Discount with subscription from provider X - € -100
Total : € 599,99
Thanks in advance!
Why can't you use coupons?
Another possible way to go with is a configureable product option. You need to setup this for each product, however. An option can have a negative price, in your case -100€. You can include an description as text on invoices, but it won't show you "599.99-100.00 = 499.99" but just "499.99" as row total price.
I'm using Ubercart in Drupal for a simple web store. I'm having trouble calculating a product discount based on the total number of all products in the cart. For example, I'm easily able to define discounts for if a user buys more than one of the same product, using the uc_custom_price module. But I want to give the discount if they buy more than one of any product. If they buy item 1 for 10 dollars and then add item 2 for 10 dollars, then I want both items to now cost 8 dollars.
Hopefully this makes sense. I searched the forums and googled for a couple of hours, but I just can't get this to work correctly. Thanks for your help.
Check Rules + Ubercart module. Or write custom code on order creation
I was wondering, has anyone ever created a discount system with PHP for ecommerce? i.e: Before discount the price is $100, after the discount the price becomes $85, and the $100 was stroked.
For changing text to be crossed out, use the <STRIKE> tag (Like this). The rest just involves multiplying current price by 1.00 - discount/100.0, or subtracting current_price * discount/100.0.
You can also use css (text-decoration:line-through;). Css is probably a better choice, really.
For example, a 15% discount means taking the price and multiplying by (1-15/100), which means price * 0.85.
It's quite a short description, but I think you can create a table in your DB with associated to the item ID the discount percentage you want to apply...
Than on the aplication side you can fetch from the DB the original price, print it and after this the new price calculated easily by the original price and the discount percentage.
It's very easy :)