Include the Hikashop helper.php

  • Posts: 231
  • Thank you received: 4
  • Hikaserial Standard
4 years 4 months ago #321729

-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.9.19

Hello,
My client is currently using a series of MetaMod modules to display various free shipping options dependent on various settings.

I'm updating the site to the latest versions etc and trying to port this older code. However I cannot seem to get the cart values currently for this code to function fully:

$maxv = 50;
$minv = 30;
$spendmoretotal = $cart->total->prices[0]->price_value_with_tax;
echo $spendmoretotal;
if ($spendmoretotal > $minv && $spendmoretotal < $maxv) {
    $total2 = $maxv - $spendmoretotal;
    $formattedNum = number_format($total2, 2);
echo '<p style="text-align:left;">Spend another £'.$formattedNum.' to get free shipping</p>';
   }

// BAR
$scale = 1.0;
// Get Percentage out of 100
$percent = ($spendmoretotal * 100) / $maxv;

echo '<div class="percentbar" style="width:'.round(100 * $scale).'%;"><div style="width:'.round($percent * $scale).'%;"></div></div>';

My issue appears to be the $cart->total->prices[0]->price_value_with_tax piece. Looking at the older version fo the code it had an include to load a helper.php file from Hikashop. However even when I try this older include code nothing is being displayed.

What is the correct code now to include the helper.php files that would give me the $cart variables?

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
4 years 4 months ago #321746

Hello,

If what you want is to load the user current cart, the solution can be to use that kind of code :

$cartClass = hikashop_get('class.cart');
$cart = $cartClass->loadFullCart(true);

Kind regards,
Mohamed.

Please Log in or Create an account to join the conversation.

  • Posts: 231
  • Thank you received: 4
  • Hikaserial Standard
4 years 4 months ago #321781

Mohamed,
Thats greta, it now works and I get the values and variables I need.

Thanks so much!

Please Log in or Create an account to join the conversation.

Time to create page: 0.067 seconds
Powered by Kunena Forum