- Posts: 14
- Thank you received: 0
Discount in cart based on custom fields
- insitevision
-
Topic Author
- Offline
Less
More
10 years 4 months ago #241819
by insitevision
Discount in cart based on custom fields was created by insitevision
-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.5.1
-- PHP version -- : 7.0.6
-- Browser(s) name and version -- : Firefox 46.0.1
Hi,
A little intoduction:
A client is selling pvc floors. The price for a product is a price per m2. However a package contains for instance 3.62 m2 and he only sells full packages.
I made a custom field for priceperm2, a custom field for packegecontents and a custom field so a client can fill in the surface for which he needs a floor.
On the product page there is a input field where a customer can enter the surface of m2 he needs (for instance 12 m2) and than the amount of packages (3.62 m2 per package) is calculated, so in the cart there will be 4 packages (= 14.48 m2)
This is working fine but now he wants to advertise with the slogan "Every 5th m is for free". So, in the example above (when surface = 12, price per m2 = 42.95 and package price = 155.48 there should be a (calculated) discount of: ((floor)surface/5 * priceperm2))
My question:
How can I implement this so that in the cart there is a (per product) calculated discount that is substracted from the total price as in the attached (photoshopped image)?
Kind regards,
Eric Beernink
-- Joomla version -- : 3.5.1
-- PHP version -- : 7.0.6
-- Browser(s) name and version -- : Firefox 46.0.1
Hi,
A little intoduction:
A client is selling pvc floors. The price for a product is a price per m2. However a package contains for instance 3.62 m2 and he only sells full packages.
I made a custom field for priceperm2, a custom field for packegecontents and a custom field so a client can fill in the surface for which he needs a floor.
On the product page there is a input field where a customer can enter the surface of m2 he needs (for instance 12 m2) and than the amount of packages (3.62 m2 per package) is calculated, so in the cart there will be 4 packages (= 14.48 m2)
This is working fine but now he wants to advertise with the slogan "Every 5th m is for free". So, in the example above (when surface = 12, price per m2 = 42.95 and package price = 155.48 there should be a (calculated) discount of: ((floor)surface/5 * priceperm2))
My question:
How can I implement this so that in the cart there is a (per product) calculated discount that is substracted from the total price as in the attached (photoshopped image)?
Kind regards,
Eric Beernink
Please Log in or Create an account to join the conversation.
10 years 4 months ago #241820
by nicolas
Replied by nicolas on topic Discount in cart based on custom fields
Hi,
There is no system to something exactly like that.
Sure, you could edit the file "cart" of the view "checkout" to add such display, but all the totals would have to be recalculated everywhere.
I would rather recommend to use the additional system which allows you to add extra rows between the sub total and the shipping fee rows everywhere with the system automatically recalculating the total based on what you give in the plugin.
That's close to the display you want and it will be a long term solution.
Here is a example plugin which uses this system: www.hikashop.com/forum/taxes/873285-fix-tax-import.html#190511
There is no system to something exactly like that.
Sure, you could edit the file "cart" of the view "checkout" to add such display, but all the totals would have to be recalculated everywhere.
I would rather recommend to use the additional system which allows you to add extra rows between the sub total and the shipping fee rows everywhere with the system automatically recalculating the total based on what you give in the plugin.
That's close to the display you want and it will be a long term solution.
Here is a example plugin which uses this system: www.hikashop.com/forum/taxes/873285-fix-tax-import.html#190511
Please Log in or Create an account to join the conversation.
Time to create page: 0.173 seconds