View Single Post
  #4  
Old 11-08-2012, 06:24 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Product Modifier Math (help)

Well my suggestion then is to not use product options for this, instead I think it may be simpler to add your own charge, and pass that through the cart. It's not going to be easy, have to take it step by step.

The first step is to create the trigger, the checkbox on the product page in the admin that tells us that this product is intended to receive this extra charge. It could be a checkbox, or and input, and you could decide to use extra fields (though I would just code my own).

Here is a video tutorial for adding the custom variable: http://www.youtube.com/watch?v=-7ESOW0pKU4

Here is how to use extra fields : http://www.youtube.com/watch?v=dRGRWkotqvM

After you have a checkbox or an input field on the product page, and are passing those variables through to the customer side, then we can create a special checkbox for Custom on the product page. Once you get there let me know, and I will guide you through the next steps, adding the product to the cart with the extra price assigned, then tacking on the charge.

Actually the more I think about it, the code to do this is going to be quite tricky. The basic problem is going to be that XC multiplies the price by the quantity in the cart process. We will have to either show the price as a separate line item under the product, or count the quantity of items and divide the charge between them. Either way we need the special variable no matter what.

That has me thinking about another way to handle this. Perhaps we can quantify the price increase, and control it based on quantity.

Scenario: 150 minimum pen order. Custom option is selected modifies the price to be + $0.17 (150 * $0.17 = $25.50) Then we set a wholesale discount for 200 pens of $0.05, effectively lowering the price per pen to $0.12 Lots of silly math this way. And the wholesale discounts would still apply, even without the customization option. Oh well, guess its got to be the hard way.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote