Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

function writing


iperez_genius

Recommended Posts

Posted

I am trying to overwrite the cart total with a another value that i have generated.

 

on the shopping_cart.php page the little box on the right hand side showing the total being bought and the subtotal at the bottom of the cart is based on the following function

 

function show_total() {

$this->calculate();

 

return $this->total;

}

 

this function is called $cart->show_total()

 

I wrote my own function to over write this total with any value and this is my function

 

function set_total($value)

{

$this->total = $value;

}

 

and i am caqlling it with the same shopping_cart.php file

with $cart->set_total(200);

 

now my function doesn't work and i am wondering if anyone can explain why...or how to implement it

 

 

Ilan

Posted

The $this is used to reference something in a class. So you have to add your function to that class for it to be understood correctly. Try adding it to the includes/classes/shopping_cart.php file and see if that helps.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...