Hikashop cart integration with T3/bootstrap

  • Posts: 22
  • Thank you received: 0
9 years 3 weeks ago #218608

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.0
-- PHP version -- : 5.3.28
-- Browser(s) name and version -- : Chrome

Hi there,

Apologies if something similar to this has been posted before, i've searched around but cant seem to find an answer.

I'm trying to use the t3/bootstrap off canvas sidebar to display the mini cart, which is working correctly, but i would like to have the sidebar open when something is added to the cart, rather than the hikashop popup.

If anyone could point me in the right direction, or even point out what files i should be looking at to trigger the offcanvas sidebar that would be great.

Many thanks, Oli

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

  • Posts: 13201
  • Thank you received: 2322
9 years 3 weeks ago #218617

Hi,

Not sure but I think that the sidebar open and close is done via Javascript.
So some javascript code could be added to the page in order to open the sidebar (so see with the template provider how to do that) when the "add to cart" button is pressed.

With jQuery that could be something like that:

jQuery('.hikashop_cart_button').click(function(){
    // open the canvas sidebar
});
This code is very generic and will be call every time the customer click on an add to cart button.
That can be more specific by calling a JS function in a plugin based on the function "onBeforeCartUpdate()".

This require Javascript knowledges and in the second case PHP too.
Here is the developer documentation for the plugin part:
www.hikashop.com/support/support/documen...r-documentation.html

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

  • Posts: 22
  • Thank you received: 0
9 years 3 weeks ago #218720

Hi Xavier,

Thanks for that, I cannot seem to find the onBeforeCartUpdate() function in any of the hikashop files, it is called in \administrator\components\com_hikashop\helpers\cart.php, but i cannot find the actual function.

I would have thought it would be located near onAfterCartUpdate() in hikashopuser.php but it doesnt seem to be there.

Thanks, Oli

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

  • Posts: 13201
  • Thank you received: 2322
9 years 3 weeks ago #218721

Hi,

The best will be to create a new plugin and use this function in the plugin directly.

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

  • Posts: 22
  • Thank you received: 0
9 years 3 weeks ago #218866

Hi Xavier,

Thanks for your help with this, its most appreciated.

In the end i solved the problem by placing the following code in to the off canvas loader.
By using 2 Attributes i was able to display the cart only when the actual "add to cart" button is pressed, ignoring the proceed to checkout buttons etc.

	$document = JFactory::getDocument();
$document->addScriptDeclaration('
jQuery(document).ready(function(){
    jQuery("[class*=hikashop_cart_input_button][name=add]").click(function(){
	jQuery("[class*=off-canvas-toggle]").trigger("tap");
    });
});
');

Cheers, Oli

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

Time to create page: 0.070 seconds
Powered by Kunena Forum