- Posts: 86273
- Thank you received: 14257
Mini cart module modification
14 years 8 months ago #36537
by nicolas
Replied by nicolas on topic Re: Mini cart module modification
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.
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.
14 years 8 months ago #36614
by frama
Replied by frama on topic Re: Mini cart module modification
that's right! i had another regular cart module enabled. Thank you!
Please Log in or Create an account to join the conversation.
12 years 11 months ago - 12 years 11 months ago #129718
by Lexnia
Replied by Lexnia on topic Re: Mini cart module modification
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?
$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: 12 years 11 months ago by Lexnia.
Please Log in or Create an account to join the conversation.
12 years 11 months ago #129802
by Xavier
Replied by Xavier on topic Re: Mini cart module modification
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 ?
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.
Less
More
- Posts: 35
- Thank you received: 0
11 years 10 months ago #182458
by PigeonTech
Replied by PigeonTech on topic Re: Mini cart module modification
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
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?
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
Code:
<?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.
11 years 10 months ago #182521
by nicolas
Replied by nicolas on topic Re: Mini cart module modification
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.
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.
Less
More
- Posts: 35
- Thank you received: 0
11 years 10 months ago #182553
by PigeonTech
Replied by PigeonTech on topic Mini cart module modification
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.
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.
Less
More
- Posts: 35
- Thank you received: 0
11 years 10 months ago #182556
by PigeonTech
Replied by PigeonTech on topic Mini cart module modification
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
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.
Less
More
- Posts: 35
- Thank you received: 0
11 years 10 months ago #182557
by PigeonTech
Replied by PigeonTech on topic Mini cart module modification
Hold The Phone! 
using require_once worked. Just needed to refresh cache.
Many Thanks for your help.
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.
11 years 10 months ago #182577
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Mini cart module modification
Hi,
Right ; "require_once" is quite better to avoid double inclusion of the file
Regards,
Right ; "require_once" is quite better to avoid double inclusion of the file
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: PigeonTech
Please Log in or Create an account to join the conversation.
8 years 1 month ago - 8 years 1 month ago #297668
by raskal
Replied by raskal on topic Re: Mini cart module modification
Hi, i m a little noob... where i have to put this code in i want to show numer item in cart?
Thank You.
Regards
Code:
$class = dacshop::get('class.cart');
$rows = $class->get();
$qty = 0;
if(!empty($rows)){
foreach($rows as $k => $row){
$qty += $row->cart_product_quantity;
}
}
Regards
Last edit: 8 years 1 month ago by Jerome. Reason: [code] tag is nice
Please Log in or Create an account to join the conversation.
8 years 1 month ago #297675
by nicolas
Replied by nicolas on topic Re: Mini cart module modification
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.
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.191 seconds