Mini cart module modification

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
12 years 10 months ago #36537

That would indicate that you have several instances of the hikashop cart module.
Go in your joomla modules manager and look for the cart modules. Make sure that you have only one instance (delete the others) and make sure that the one left has the mini cart activated.

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

  • Posts: 14
  • Thank you received: 0
12 years 10 months ago #36614

that's right! i had another regular cart module enabled. Thank you!

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

  • Posts: 52
  • Thank you received: 2
11 years 1 month ago #129718

Hi, I am trying to display the minicart at the top of the page within the header div by including the following within the header div on the index.php file, but it's not working:

$class = hikashop::get('class.cart');
$rows = $class->get();
$qty = 0;
foreach($rows as $k => $row){
$qty += $row->cart_product_quantity;
}
echo $qty;

Do I have to include a php echo value before it? Please help?

Last edit: 11 years 1 month ago by Lexnia.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 4 weeks ago #129802

Hi,

First of all, you have to enable the Joomla debug mode, and set the error reporting to "maximum" in order to see the returned errors. Then we already have a module "cart" and in it's options you can set that you want to use it as a mini cart.
So you have to add a module position in your template file to display that module.

Else the code seems to be correct, do you have a cart for the current session ? Some articles in it ?

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

  • Posts: 35
  • Thank you received: 0
9 years 11 months ago #182458

Hi,
I'm running Hikashop v2.2.0 on Joomla 3.3.6. Site url is diywetroom.pigeontech.co.uk

I'm using a chunk of code taken from this thread to display the number of cart items in a div

<?php
$class = hikashop::get('class.cart');
$rows = $class->get();
$qty = 0;
if(!empty($rows)){
foreach($rows as $k =>$row){
$qty += $row->cart_product_quantity;
}
} 
echo $qty; 
?>

I'm using sourcerer so I can put the code direct into a Joomla module. Everything word fine until I think the browser cache cleared and now the hikashop class fails to be called giving error:

Fatal error: Class 'hikashop' not found in /home/dwrftp/diywetroom.pigeontech.co.uk/tests/cart_items.php on line 3

line 3 on my code is: $class = hikashop::get('class.cart');

Any ideas? I wondered if it might be the order in which the class is called?

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
9 years 11 months ago #182521

Hi,

If you're running that code on a place where HikaShop is not (yet) loaded, you'll get that error as that code requires HikaShop's main helper to be loaded.
You can load it manually by simply adding a line like this before:
<?php require('/path/to/the/root/of/your/website/administrator/components/com_hikashop/helpers/helper.php'); ?>

Of course, /path/to/the/root/of/your/website is to be changed by the path to the root folder of your website.

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

  • Posts: 35
  • Thank you received: 0
9 years 11 months ago #182553

Thanks,

But now I get a different error when I access the store:

Fatal error: Cannot redeclare hikashop_getDate() (previously declared in /home/dwrftp/diywetroom.pigeontech.co.uk/administrator/components/com_hikashop/helpers/helper.php:65) in /home/dwrftp/diywetroom.pigeontech.co.uk/administrator/components/com_hikashop/helpers/helper.php on line 83

Guessing I need to disable a line of code but not sure which.

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

  • Posts: 35
  • Thank you received: 0
9 years 11 months ago #182556

Tried using require_once but get the following error:

Parse error: syntax error, unexpected ''); ' (T_CONSTANT_ENCAPSED_STRING) in /home/dwrftp/diywetroom.pigeontech.co.uk/tests/cart_items.php on line 5

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

  • Posts: 35
  • Thank you received: 0
9 years 11 months ago #182557

Hold The Phone! B)

using require_once worked. Just needed to refresh cache.

Many Thanks for your help.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 11 months ago #182577

Hi,

Right ; "require_once" is quite better to avoid double inclusion of the file :)

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: PigeonTech

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

  • Posts: 16
  • Thank you received: 0
6 years 2 months ago #297668

Hi, i m a little noob... where i have to put this code in i want to show numer item in cart?

$class = dacshop::get('class.cart');
$rows = $class->get();
$qty = 0;
if(!empty($rows)){
  foreach($rows as $k => $row){
    $qty += $row->cart_product_quantity;
  }
}
Thank You.
Regards

Last edit: 6 years 2 months ago by Jerome. Reason: [code] tag is nice

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
6 years 2 months ago #297675

Hi,

There is no need for any code change anymore.
Just turn off the display options you don't want in the settings of the cart module via the Joomla modules manager and you'll be able to get only the quantity.

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

Time to create page: 0.113 seconds
Powered by Kunena Forum