Forums / Built-in Shipping and Payment Modules / Help finding price calculator files

Help finding price calculator files

Locked

Views: 1,855

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
19 Aug 2008, 9:34 PM
#1
grind avatar

grind

New Zenner

Join Date:
Aug 2008
Posts:
5
Plugin Contributions:
0

Help finding price calculator files

Hi,
I am a PHP developer and I've been recently introduced to Zen Cart (due to work) at first it was very confusing and it still is but I am not as clueless as before. It's really complicated when there are +200 files and you don't know which is which. But I still love the amazing flexibility Zen Cart has.

Anyways, I have a store that sells canvas, and the user uploads his picture, choses a frame and it asks for the printing width and height.

The frames are priced per foot so to get the price of what the user wants I do

Price = (((width*2)/12)Frame_Price) + ((height2)/12)*Frame_Price)) + Canvas_Type_Price

And that gives me the price for the product.

I have edited the function attributes_price($products_id) so it gives me the price based on the attributes (frame/height/width)

Function found in /includes/classes/shopping_cart.php

When I add the product to the cart, the product itself has the correct price, but the subtotal and the top bar have a different price

TOP BAR:
Total Items: 1 Weight: 1lbs Amount: $36.55

and the cart looks something like this:

Canvas One ($95.55)

* Width - 12
* Height - 12
* Frame - Frame 1 ($20 per foot)

Sub-Total: $36.55

How would I make it so the price is constant everywhere? I've had no luck finding the other price calculating functions that give me that price.

Could some one point me in the right direction?

Thanks,

  • Grind
19 Aug 2008, 9:41 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Help finding price calculator files

Really depends upon what line(s) you have hacked??
As whatever you have done is apparently not being passed to the other functions

Zen-Venom Get Bitten

19 Aug 2008, 10:58 PM
#3
grind avatar

grind

New Zenner

Join Date:
Aug 2008
Posts:
5
Plugin Contributions:
0

Re: Help finding price calculator files

As far as I understand

I hacked the function attributes_price() on line 827
File: includes/class/shopping_cart.php

 /**
   * Method to calculate price of attributes for a given item
   *
   * @param mixed the product ID of the item to check
   * @return decimal the pice of the items attributes
   * @global object access to the db object
   */
  function attributes_price($products_id) 
19 Aug 2008, 11:42 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Help finding price calculator files

So did you add this to that file?

Price = (((width*2)/12)*Frame_Price) + ((height*2)/12)*Frame_Price)) + Canvas_Type_Price

Or replace this with it?

function attributes_price($products_id)

Is this available where one can see what you are describing? url?

Zen-Venom Get Bitten

20 Aug 2008, 5:32 PM
#5
grind avatar

grind

New Zenner

Join Date:
Aug 2008
Posts:
5
Plugin Contributions:
0

Re: Help finding price calculator files

Yes and No, I disabled the code inside the function and I replaced it with my own.

I thought modifying it would change all the prices since its a function.

I want to find the other functions that calculate the price.

Thanks