- Code: Select all
function process_button() {
global $_POST, $products, $cart;
$this->$products = $_SESSION['cart']->get_products(); // I am not sure if this is the right syntax, I want to check $_SESSION['cart'] and call get_products() function, to retrieve the list of products in the shopping cart.
for ($i=0, $n=sizeof($this->$products); $i<$n; $i++) {
$this->$productsImage = (IMAGE_SHOPPING_CART_STATUS == 1 ? zen_image(DIR_WS_IMAGES . $this->$products[$i]['image'], $this->$products[$i]['name'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT) : ''); // This checks the cart status and retrieves the image location using the function zen_image
$this->$quantityField = zen_draw_input_field('cart_quantity[]', $this->$products[$i]['quantity'], 'size="4"');// quantity in cart
$this->$productsPrice = $this->$currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($this->$products[$i]['tax_class_id']), $this->$products[$i]['quantity']) . ($this->$products[$i]['onetime_charges'] != 0 ? '<br />' . $this->$currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($this->$products[$i]['tax_class_id']), 1) : ''); // This checks for additional charges and taxes
$this->$productsPriceEach = $this->$currencies->display_price($this->$products[$i]['final_price'], zen_get_tax_rate($this->$products[$i]['tax_class_id']), 1) . ($this->$products[$i]['onetime_charges'] != 0 ? '<br />' . $this->$currencies->display_price($this->$products[$i]['onetime_charges'], zen_get_tax_rate($this->$products[$i]['tax_class_id']), 1) : '');// Calculates the individual product final price
// function continues ...
}
Now I am getting error
Fatal error: Call to a member function get_products() on a non-object in ... line 92
Line 92 corresponds to
- Code: Select all
$products = $_SESSION['cart']->get_products();