X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Percentage Price Modifier to discount other price modifiers? (https://forum.x-cart.com/showthread.php?t=57452)

frgsBC 01-10-2011 07:05 AM

Percentage Price Modifier to discount other price modifiers?
 
Hi,

On certain products my client wants to allow the customer to pay just a 50% deposit at the point of order ( as products can be a few thousand pounds in price).

Now I achieved this using a price modifier option as discussed here

However when a product has other price modifier options at an absolute price, this modifier is not halved in the total price.

For example :

Product X
Base Price - ё1000
Option 1 - +ё200
Deposit Option - -50%

Xcart calculates the total for the above as ё700

(1000 * 0.5)+200 = 700

However In this example I need the total to be ё600
(1000 + 200) *0.5 = 600

Does anybody know how I can achieve this?

frgsBC 01-10-2011 07:50 AM

Re: Percentage Price Modifier to discount other price modifiers?
 
I seem to have worked it out, below is the necessary modifictaion if anybody else needs to do this.

File : include/func/func.cart.php around line 2700

Change from
Code:

  foreach($product_options as $o) {

                            $products_array['options_surcharge'] += (
                                $o['modifier_type'] == '%'
                                    ? ($products_array['price'] * $o['price_modifier'] / 100)
                                    : $o['price_modifier']
                            );
                        }


To this
Code:

foreach($products_array['product_options'] as $o) {
                            if($o['modifier_type'] != '%')
                                $products_array['options_surcharge'] +=$o['price_modifier'];
                           
                        }
       
                        foreach($products_array['product_options'] as $o) {
                            if($o['modifier_type'] == '%')
                            {
                                $products_array['options_surcharge'] += ($products_array['options_surcharge'] * $o['price_modifier']) / 100;
                                $products_array['options_surcharge'] += ($products_array['price'] * $o['price_modifier']) / 100;
                               
                            }
                        }


The change I have made is instead of doing all the modifiers at once, it now does the absolute modifiers first, followed by price modifiers.

minfinger 02-28-2011 06:45 PM

Re: Percentage Price Modifier to discount other price modifiers?
 
How do you work out payment for the remaining 50%?

Since my client is typically lists 1 product available per listing, this becomes a huge problem with the amount of traffic he gets. What I'm getting at is people who put an item (single item) in the cart and then don't complete the order. Often the item doesn't get released from their cart for a period of time. So he usually will list 5 as the quantity until the item is sold and then remove it from availability. Of course the quantity is remove from the product details and customers can only chose 1.

He'd like for the deposit to be taken and then for the item to be removed from inventory while the remaining amount due remains available for the customer to pay.

I find this rather perplexing myself. If an item is $1,000 and the deposit is $100, how do we make sure the customer can get back to pay the remaining $900? Also his deposits expire in 7 days, since his inventory is "live", literally alive, he must sell the item as fast as possible to make a profit.

Oh yeah, thanks for linking my thread. I've since gone a different route.

minfinger 02-28-2011 07:08 PM

Re: Percentage Price Modifier to discount other price modifiers?
 
Vote for my suggestion :D

http://ideas.x-cart.com/forums/32109-x-cart-future-versions/suggestions/1542375-allow-deposits-on-products


All times are GMT -8. The time now is 09:07 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.