I would like to be able to show the current total weight of my customers' basket on every page.
The easiest way I can think of to do this would be to extend the functionality of the MiniCart plugin (more information from a previous thread) . Ofcourse I open to other suggestions, but this is just me thinking out loud.
Within this function I am thinking its easiest to store the weight of each product and store within the cookie to then be totalled up by javascript. But firstly I need to know how to return the weight of a particular item.
Within the code I can see;
I can not see a simular function to return the weight of an item within Cart.pm so I presume this function is within another class. Does anyone know the if/how I can return this value from another object?
Please be patient with me as I do not know Perl (but come from basic programming background).
As a point of reference, this is the current MiniCart function within Cart.pm (slightly edited from orginal);
Thanks again for everyone's time & effort.
The easiest way I can think of to do this would be to extend the functionality of the MiniCart plugin (more information from a previous thread) . Ofcourse I open to other suggestions, but this is just me thinking out loud.
Within this function I am thinking its easiest to store the weight of each product and store within the cookie to then be totalled up by javascript. But firstly I need to know how to return the weight of a particular item.
Within the code I can see;
Code:
my @Prices = $Self->GetCartItemPrice($pCartItem);
Please be patient with me as I do not know Perl (but come from basic programming background).
As a point of reference, this is the current MiniCart function within Cart.pm (slightly edited from orginal);
Code:
sub miniCart
{
use HTML::Entities ();
my $Self = shift;
my $defaultCur="£"; # currency symbol to include
my $cartStr="ss=" . $::g_sSearchScript . "cur=" . $defaultCur;
my $pCartItem;
foreach $pCartItem (@{$Self->{_CartList}})
{
my ($Status, $Message, $pProduct) = GetProduct($pCartItem->{'PRODUCT_REFERENCE'}, $pCartItem->{'SID'});
if ($Status == $::FAILURE)
{
return ($Status, $Message, []);
}
elsif ($Status == $::NOTFOUND)
{
next;
}
my @Prices = $Self->GetCartItemPrice($pCartItem);
$cartStr=$cartStr . "&!" . $pCartItem->{'QUANTITY'} . "x" . HTML::Entities::encode($pCartItem->{'PRODUCT_REFERENCE'}) . ">" . HTML::Entities::encode($pProduct->{'NAME'}) . ">" . $Prices[2]/100;
}
return $cartStr;
}
Comment