Mini cart module modification

  • Posts: 149
  • Thank you received: 0
  • Hikashop Business
7 years 9 months ago #12498

hello,

i use the following template demo.gavick.com/joomla15/nov2010/index.php

there is a module position with name "cart" on this template but it can only be used with K2 and VM.

i use the latest version o essential version, when i use the module position for the hikashop mini cart it doesnt work properly.

here is the code in the template that i have to change

<?php if($this->countModules('cart')) : ?>
    <div id="gk-cart-btn">
        <h2><?php echo JText::_('GK_SHOP_CART'); ?></h2>
        <div id="gk-items">[ <strong>...</strong> ] <?php echo JText::_('GK_ITEMS'); ?></div>
        <a href="index.php?page=checkout.index&amp;option=com_virtuemart&amp;Itemid=178&amp;redirected=1&amp;Itemid=9999" class="button"><?php echo JText::_('GK_GO_TO_CHECKOUT'); ?></a>
    </div>
    <div id="gk-cart">
        <jdoc:include type="modules" name="cart" style="none" />
    </div>
    <?php endif; ?>



what i have to do have in that position with the same style the Hikashop mini cart module?


i am trying to do something like the code below this but i cant get the virable for the hikashop items
<?php if($this->countModules('cart')) : ?>
    <div id="gk-cart-btn">
        <h2><?php echo JText::_('GK_SHOP_CART'); ?></h2>
        <div id="gk-items">[ <strong>...</strong> ] <?php echo JText::sprintf('TOTAL_IN_CART_X'); ?></div>
        <a href="index.php?option=com_hikashop&ctrl=checkout&Itemid=180" class="button"><?php echo JText::_('GK_GO_TO_CHECKOUT'); ?></a>
    </div>
    <div id="gk-cart">
        <jdoc:include type="modules" name="cart" style="none" />
    </div>
    <?php endif; ?>



thank you

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

  • Posts: 64484
  • Thank you received: 9313
  • MODERATOR
7 years 9 months ago #12500

What code do you have for VM for the <strong>...</strong> (the number of items) ?

In HikaShop, the number of items is calculated during the display of the module.

What I would do is just keep the code below in your template:
<div id="gk-cart">
<jdoc:include type="modules" name="cart" style="none" />
</div>

and then modify the HTML code of the file cart of the view product in order to look like the VM one of that template.

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

  • Posts: 149
  • Thank you received: 0
  • Hikashop Business
7 years 9 months ago #12505

i try that but it doesnt works propably is a template issue.


in the code for numbers of items is " echo JText::_('GK_ITEMS'); " i try to replace it with " JText::sprintf('TOTAL_IN_CART_X')" , but no luck.

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

  • Posts: 64484
  • Thank you received: 9313
  • MODERATOR
7 years 9 months ago #12507

Of course. The number of items is calculated during the display of the module.
JText::sprintf('TOTAL_IN_CART_X') just displays a translation string. If you don't feed the number of items variable to it, it won't work and for that you have to load the whole cart and process it. That's why I said that the other solution should be easier.

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

  • Posts: 149
  • Thank you received: 0
  • Hikashop Business
7 years 9 months ago #12509

but unfortunetly is not working the easy solution, it has to work, its template issue obviously.

i will try to find out was going on .

thank you nicolas..

you can post the difficult solution if its easy for you :)

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

  • Posts: 64484
  • Thank you received: 9313
  • MODERATOR
7 years 9 months ago #12516

Without the template on our end, we can't test anything so we can't provide any precise solution but just give guidelines.

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

  • Posts: 256
  • Thank you received: 2
  • Hikashop Business
7 years 9 months ago #13313

I don't want to hijack a discussion but my question is pertinent I believe to the current issue. I am creating a new template to use with hikashop. I have a bar at the top of the page where I would like to simply indicate the number of items the user has in their cart (among other information). I'd like to avoid using a module, and just insert a script into to index.php file of the template. Could you suggest how best to access this data if possible?

Thanks

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

  • Posts: 64484
  • Thank you received: 9313
  • MODERATOR
7 years 9 months ago #13328

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

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

  • Posts: 256
  • Thank you received: 2
  • Hikashop Business
7 years 9 months ago #13351

Thanks Nicolas for the solution. Just made a small change to avoid error msg when $rows is empty

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

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

  • Posts: 14
  • Thank you received: 0
7 years 7 hours ago #36142

Hi,

I would like to have these three things:

# of items
Total ammount
Checkout Button

E.g.

Items: 1
Total: $15
Checkout

I am trying hard from minicart but i cant get it. Is this possible weather from minicart or from custom code on template index.php?

thanks

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

  • Posts: 64484
  • Thank you received: 9313
  • MODERATOR
6 years 11 months ago #36184

Hi,

The mini cart already displays the number of items and the total.
That that be activated by turning on the "mini cart" option of the hikashop cart module.
For a link to the checkout, you can easily add it in the file "cart" of the view "product" via the menu Display->Views with some HTML like that:
<a href="URL_OF_YOUR_CHECKOUT">Checkout</a>

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

  • Posts: 14
  • Thank you received: 0
6 years 11 months ago #36297

i did used the minicart, but when i add a product, it shows me full cart. when i navigate away from this product than i see only total ammount.

seems kind of bug!!!

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

  • Posts: 64484
  • Thank you received: 9313
  • MODERATOR
6 years 11 months ago #36332

It shows you the full cart ?
Maybe you have some kind of caching issue ?
Could you make sure that the cache in the joomla configuration and in the joomla system cache plugin are both turned off.
Then,if that still doesn't change anything, could you give the URL of your page so that we can see that?

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

  • Posts: 14
  • Thank you received: 0
6 years 11 months ago #36351

www.gotech.al/test this is the url. i can give you administrator access if you want.
(in the left you have the shop categories in order to add products to the cart. top-right is the cart)

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

  • Posts: 64484
  • Thank you received: 9313
  • MODERATOR
6 years 11 months ago #36399

Could you do a screenshot of your cart module's hikashop options screen ?

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

  • Posts: 14
  • Thank you received: 0
6 years 11 months ago #36422



have i attached correctly??

Attachments:

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

  • Posts: 14
  • Thank you received: 0
6 years 11 months ago #36424



this is the screen after i navigate away

Attachments:

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

  • Posts: 64484
  • Thank you received: 9313
  • MODERATOR
6 years 11 months ago #36456

No, I'm talking about a screenshot of the options of the cart module, not the front end of your shop.

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

  • Posts: 14
  • Thank you received: 0
6 years 11 months ago #36480



i am talking about different behaviors for same settings!

Attachments:

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

  • Posts: 14
  • Thank you received: 0
6 years 11 months ago #36483

i found out something that may help. When i click add to cart, i see the pop up asking pay now or turn to the shop. when i say pay now, the page is going to different url and during this process the page is refreshed and minicart is displayed correctly. when i say turn to the shop page is not refreshed and i see big cart.

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

Time to create page: 0.129 seconds
Powered by Kunena Forum