If statement within UDT and Cart Module

General project discussion. NOT for help questions.
Post Reply
chawkins24
New Member
New Member
Posts: 9
Joined: Wed Jun 17, 2009 2:35 pm

If statement within UDT and Cart Module

Post by chawkins24 »

I am currently trying to use an IF statement (contained within a UDT) to determine the shipping cost of items based on the total value within the Shopping Cart (Cart Module).

I have tried placing the PHP code of the UDT inline within the shopping cart template but it seems the Cart module doesn't like IF Else statements and does not run the script.

The code used is below:

Cart template

{$carttotal|number_format:2}

User Defined Tag which should carry the variable and execute the If statement

echo "cart cost =  " . $cartshipping;

if ($cartshipping Less than £10';
} elseif  ($cartshipping Less than £15';
} elseif  ($cartshipping Less than £20';
} elseif  ($cartshipping Less than £25';
} else {
echo 'Free Shipping';
}



The problem is that the variable can be echoed via the statement within the Cart, but from here the variable is not transferring to the UDT. I have tried using session variables, actually I have quite successfully used session variables within the very cart I am having these problems with in order to enable a basic PHP + function to auto increment a number to create a PayPal form input.

If anyone could help with this it would be very greatly appreciated.
Post Reply

Return to “General Discussion”