Jump to content

Help with WordPress Simple Paypal Shopping Cart Item Count script


Recommended Posts

Hi,

 

I'm hoping someone could help me please.

 

I am building a site and have installed the Simple Paypal Shopping Cart plugin to sell some products. The only problem with it is that it doesn't have any way of letting the customer know that the item has been successfully added to their basket.

 

I did a search and found the following script and instructions:

 

Adding the following code to my “wp_shopping_cart.php” file

 


function simple_cart_total()
{
foreach ((array) $_SESSION['simpleCart'] as $item)
{
$total += $item['price'] * $item['quantity'];
$item_total_shipping += $item['shipping'] * $item['quantity'];
}
$grand_total = $total + $item_total_shipping;
return $grand_total;
}

 

and then calling the function <?php echo simple_cart_total(); ?> in the header.

 

While this works and I can get it to input £30 or £45 etc, this amount also includes shipping (P&P) so I would prefer not to have to use this method.

 

What I really was looking for was a way to show the number of items added to the basket rather than showing the actual value in money. Is there any way to alter the above script to provide this function?

 

I don't know anything about php I'm afraid so I wouldn't know where to start. See attached screenshot to see how it works at the moment.

 

Failing this is there any way to at least add the 2 decimal places after the value so it shows as £30.00 or £45.00?

 

I hope someone can help.

 

Kind regards

Margaret

 

[attachment deleted by admin]

Hi,

 

I apologise if my first post was too much to ask (it more than likely was).

 

I am more than happy to go along with the shopping value as it is now but I would like to be able to convert it to add 2 decimal points.

 

The code is:<?php echo simple_cart_total(); ?>

 

Can anyone please suggest a way to add 2 decimal points after the total (i.e., £5 to £5.00). I tried searching but  couldn't really find a solution - the nearest I came to it was it was outputting £5 as £50.00, in other words it was adding a nought before the decimal point as well as the 2 noughts after.

 

The default setting at the moment is 0 and I prefixed it with the £ in html so the output doesn't have to include the pound sign.

 

I hope someone can help me with this one.

 

Thanks Margaret

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.